[Erp5-report] r11026 - /erp5/trunk/utils/erp5admin/content/erp5admin/erp5admin.js

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Oct 31 21:06:35 CET 2006


Author: bartek
Date: Tue Oct 31 21:06:32 2006
New Revision: 11026

URL: http://svn.erp5.org?rev=11026&view=rev
Log:
added option to ignore the first part of path if it does not start with erp5 (to solve problems in virtual hosting sites)

Modified:
    erp5/trunk/utils/erp5admin/content/erp5admin/erp5admin.js

Modified: erp5/trunk/utils/erp5admin/content/erp5admin/erp5admin.js
URL: http://svn.erp5.org/erp5/trunk/utils/erp5admin/content/erp5admin/erp5admin.js?rev=11026&r1=11025&r2=11026&view=diff
==============================================================================
--- erp5/trunk/utils/erp5admin/content/erp5admin/erp5admin.js (original)
+++ erp5/trunk/utils/erp5admin/content/erp5admin/erp5admin.js Tue Oct 31 21:06:32 2006
@@ -96,8 +96,20 @@
     if(gotonewtab==undefined) gotonewtab=false;
     loc=window.content.document.location;
     path=loc.pathname;
+    var forceprefix = navigator.preference("erp5.erp5admin.force_erp5_prefix");
+    // this is to be able to handle well sites which use virtual hosting, so 
+    // the url does not have site part
+    // if you use erp5admin normally, it breaks for example if you start from my.host.name/view
+    // so you can make it use the first part of path only if it starts with erp5
+    if (forceprefix == undefined) {
+        forceprefix=false;
+    }
     p=path.split('/');
-    newpath=p[1]+'/'+tool+'/'+tab;
+    sitepath=p[1];
+    newpath=tool+'/'+tab;
+    if(forceprefix==false || sitepath.substring(0,4)=='erp5'){
+        newpath=p[1]+'/'+newpath;
+    }
     newurl=loc.href.replace(path,'/'+newpath);
     br=getBrowser();
     if(newtab){




More information about the Erp5-report mailing list