A little messy, but this should get the Back/Forward buttons working again for browse...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 14 May 2009 15:46:10 +0000 (15:46 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 14 May 2009 15:46:10 +0000 (15:46 +0000)
Here's the problem in a nutshell:  <browser> behaves differently if loaded from chrome:// versus https?://

In particular, the webNavigation for a browser does not work if the <browser> is coming from http, so Back & Forward buttons will not work.

There's been churn trying to work around this, and past differences between remote/chrome browsers.  The use of chrome browser is preventing us from making the top-level menu system (menu.js) remote xul where it would be easier to deploy changes and local customizations. remote xul where it would be easier to deploy changes and local customizations.

urls.XUL_BROWSER --> chrome/content/util/browser.xul is a wrapper for chrome-based <browser>
urls.XUL_REMOTE_BROWSER --> chrome/content/util/rbrowser.xul is a wrapper for non chrome-based <browser>
chrome/content/util/browser.js is the javascript in common between the two

Since menu.js is currently chrome, we need to use XUL_BROWSER.

Since menu.js is chrome, it doesn't magically know the remote server we're connecting to.  So URL's passed to XUL_BROWSER need to be wrapped or decorated with obj.url_prefix(), which looks up the hostname given during the login sequence.

Does this make sense? :)

git-svn-id: svn://svn.open-ils.org/ILS/trunk@13161 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/main/menu.js

index c50e9d1..4ee57bd 100644 (file)
@@ -67,9 +67,9 @@ main.menu.prototype = {
             label = offlineStrings.getString(labelKey);
 
             // URL
-            var loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape(urls.EG_WEB_BASE + '/conify/global/' + path);
+            var loc = urls.XUL_BROWSER + '?url=' + window.escape( obj.url_prefix(urls.EG_WEB_BASE) + '/conify/global/' + path);
             if(old_school)
-                loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape(urls.CONIFY + '/' + path + '.html');
+                loc = urls.XUL_BROWSER + '?url=' + window.escape( obj.url_prefix(urls.CONIFY) + '/' + path + '.html');
 
             obj.set_tab( 
                 loc, 
@@ -85,7 +85,7 @@ main.menu.prototype = {
             label = offlineStrings.getString(labelKey);
 
             // URL
-            var loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape(urls.XUL_LOCAL_ADMIN_BASE + '/' + path);
+            var loc = urls.XUL_BROWSER + '?url=' + window.escape( obj.url_prefix(urls.XUL_LOCAL_ADMIN_BASE) + '/' + path);
             if(addSes) loc += window.escape('?ses=' + ses());
 
             obj.set_tab( 
@@ -335,7 +335,7 @@ main.menu.prototype = {
                                                                                if (param_count++ == 0) url += '?'; else url += '&';
                                                                                url += i + '=' + window.escape(p[i]);
                                                                        }
-                                                                       var loc = obj.url_prefix( urls.XUL_REMOTE_BROWSER ) + '?url=' + window.escape( url );
+                                                                       var loc = obj.url_prefix( urls.XUL_BROWSER ) + '?url=' + window.escape( obj.url_prefix(url) );
                                                                        obj.new_tab(
                                                                                loc, 
                                                                                {}, 
@@ -351,8 +351,8 @@ main.menu.prototype = {
                                                                }
 
                                        obj.data.stash_retrieve();
-                                       var loc = obj.url_prefix( urls.XUL_REMOTE_BROWSER ) 
-                                               + '?url=' + window.escape( urls.XUL_PATRON_EDIT + '?ses=' + window.escape( ses() ) );
+                                       var loc = obj.url_prefix( urls.XUL_BROWSER ) 
+                                               + '?url=' + window.escape( obj.url_prefix(urls.XUL_PATRON_EDIT) + '?ses=' + window.escape( ses() ) );
                                        obj.set_tab(
                                                loc, 
                                                {}, 
@@ -406,7 +406,7 @@ main.menu.prototype = {
                                ['oncommand'],
                                function() { 
                                        obj.data.stash_retrieve();
-                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape(
+                                       var loc = urls.XUL_BROWSER + '?url=' + window.escape(
                                                obj.url_prefix(urls.XUL_HOLD_PULL_LIST) + '?ses='+window.escape(ses())
                                        );
                                        obj.set_tab( loc, {'tab_name' : offlineStrings.getString('menu.cmd_browse_hold_pull_list.tab')}, { 'show_print_button' : true } );
@@ -432,8 +432,8 @@ main.menu.prototype = {
                                ['oncommand'],
                                function() { 
                                        //obj.set_tab(obj.url_prefix(urls.XUL_LOCAL_ADMIN)+'?ses='+window.escape(ses())+'&session='+window.escape(ses()),{},{});
-                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape(
-                                               urls.XUL_LOCAL_ADMIN+'?ses='+window.escape(ses())+'&session='+window.escape(ses())
+                                       var loc = urls.XUL_BROWSER + '?url=' + window.escape(
+                        obj.url_prefix( urls.XUL_LOCAL_ADMIN+'?ses='+window.escape(ses())+'&session='+window.escape(ses()) )
                                        );
                                        obj.set_tab( 
                                                loc, 
@@ -455,8 +455,8 @@ main.menu.prototype = {
                        'cmd_open_vandelay' : [
                                ['oncommand'],
                                function() { 
-                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + 
-                        window.escape(urls.EG_WEB_BASE + '/vandelay/vandelay');
+                                       var loc = urls.XUL_BROWSER + '?url=' + 
+                        window.escape( obj.url_prefix(urls.EG_WEB_BASE) + '/vandelay/vandelay');
                                        obj.set_tab( 
                                                loc, 
                                                {'tab_name' : offlineStrings.getString('menu.cmd_open_vandelay.tab'), 'browser' : false }, 
@@ -468,7 +468,7 @@ main.menu.prototype = {
                        'cmd_local_admin_reports' : [
                                ['oncommand'],
                                function() { 
-                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape(urls.XUL_REPORTS + '?ses=' + ses());
+                                       var loc = urls.XUL_BROWSER + '?url=' + window.escape( obj.url_prefix(urls.XUL_REPORTS) + '?ses=' + ses());
                                        obj.set_tab( 
                                                loc, 
                                                {'tab_name' : offlineStrings.getString('menu.cmd_local_admin_reports.tab'), 'browser' : false }, 
@@ -816,8 +816,8 @@ main.menu.prototype = {
                        'cmd_public_opac' : [
                                ['oncommand'],
                                function() {
-                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape(
-                                               urls.remote
+                                       var loc = urls.XUL_BROWSER + '?url=' + window.escape(
+                                               obj.url_prefix(urls.remote)
                                        );
                                        obj.set_tab( 
                                                loc,