[open-ils-commits] r17329 - in branches/rel_2_0/Open-ILS: web/opac/locale/en-US xul/staff_client/chrome/content/main xul/staff_client/defaults/preferences (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Aug 24 14:21:22 EDT 2010


Author: phasefx
Date: 2010-08-24 14:21:18 -0400 (Tue, 24 Aug 2010)
New Revision: 17329

Modified:
   branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd
   branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/main/menu.js
   branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
   branches/rel_2_0/Open-ILS/xul/staff_client/defaults/preferences/prefs.js
Log:
rip the join tab feature out of 2.0; it's still experimental and doesn't work well with the embedded OPAC

Modified: branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-08-24 18:05:16 UTC (rev 17328)
+++ branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-08-24 18:21:18 UTC (rev 17329)
@@ -992,10 +992,6 @@
 <!ENTITY staff.main.menu.file.new.label "New Window">
 <!ENTITY staff.main.menu.file.new_tab.accesskey "T">
 <!ENTITY staff.main.menu.file.new_tab.label "New Tab">
-<!ENTITY staff.main.menu.file.join_tabs_horizontal.accesskey "J">
-<!ENTITY staff.main.menu.file.join_tabs_horizontal.label "Join Tabs (Horizontal)">
-<!ENTITY staff.main.menu.file.join_tabs_vertical.accesskey "V">
-<!ENTITY staff.main.menu.file.join_tabs_vertical.label "Join Tabs (Vertical)">
 <!ENTITY staff.main.menu.file.open.key "O">
 <!ENTITY staff.main.menu.file.open.label "Open Session">
 <!ENTITY staff.main.menu.file.save.key "S">

Modified: branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/main/menu.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2010-08-24 18:05:16 UTC (rev 17328)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2010-08-24 18:21:18 UTC (rev 17329)
@@ -34,11 +34,6 @@
             tabs.childNodes[i].setAttribute('accesskey','');
         }
     }
-
-    if (xulG.pref.getBoolPref('open-ils.enable_join_tabs')) {
-        document.getElementById('join_tabs_menuitem_vertical').hidden = false;
-        document.getElementById('join_tabs_menuitem_horizontal').hidden = false;
-    }
 }
 
 main.menu.prototype = {
@@ -161,14 +156,6 @@
                 ['oncommand'],
                 function() { obj.new_tab(null,{'focus':true},null); }
             ],
-            'cmd_join_tabs_vertical' : [
-                ['oncommand'],
-                function() { obj.join_tabs({'orient':'vertical'}); }
-            ],
-            'cmd_join_tabs_horizontal' : [
-                ['oncommand'],
-                function() { obj.join_tabs({'orient':'horizontal'}); }
-            ],
             'cmd_close_tab' : [
                 ['oncommand'],
                 function() { obj.close_tab(); }
@@ -1323,11 +1310,6 @@
         }
     },
 
-    // We keep a reference to content_params fed to tabs, so if we manipulate the DOM (say, via join_tabs),
-    // we can re-inject the content_params into the content if needed.  We have to watch out for memory leaks
-    // doing this.
-    'preserved_content_params' : {},
-
     'close_all_tabs' : function() {
         var obj = this;
         try {
@@ -1339,8 +1321,8 @@
         }
     },
 
-    'close_tab' : function (specific_idx) {
-        var idx = specific_idx || this.controller.view.tabs.selectedIndex;
+    'close_tab' : function () {
+        var idx = this.controller.view.tabs.selectedIndex;
         var tab = this.controller.view.tabs.childNodes[idx];
         var panel = this.controller.view.panels.childNodes[ idx ];
         while ( panel.lastChild ) panel.removeChild( panel.lastChild );
@@ -1389,66 +1371,6 @@
         }
     },
 
-    'join_tabs' : function(params) {
-        try {
-            if (!params) { params = {}; }
-            if (!params.orient) { params.orient = 'horizontal'; }
-
-            var left_idx = params.specific_idx || this.controller.view.tabs.selectedIndex;
-            var left_tab = this.controller.view.tabs.childNodes[left_idx];
-            var left_panel = this.controller.view.panels.childNodes[ left_idx ];
-
-            // Find next not-hidden tab
-            var right_idx;
-            for (var i = left_idx + 1; i<this.controller.view.tabs.childNodes.length; i++) {
-                var tab = this.controller.view.tabs.childNodes[i];
-                if (!tab.hidden && !right_idx) {
-                    right_idx = i;
-                }
-            }
-            if (!right_idx) { return; }
-
-            // Grab the content
-            var right_tab = this.controller.view.tabs.childNodes[right_idx];
-            var right_panel = this.controller.view.panels.childNodes[ right_idx ];
-
-            var left_content = left_panel.removeChild( left_panel.firstChild );
-            var right_content = right_panel.removeChild( right_panel.firstChild );
-
-            // Create a wrapper and shuffle the content
-            var box = params.orient == 'vertical' ? document.createElement('vbox') : document.createElement('hbox');
-            box.setAttribute('flex',1);
-            left_panel.appendChild(box);
-            box.appendChild(left_content);
-            var splitter = document.createElement('splitter');
-            splitter.appendChild( document.createElement('grippy') );
-            box.appendChild(splitter);
-            box.appendChild(right_content);
-
-            right_tab.hidden = true;
-            // FIXME: if we really want to combine labels for joined tabs, need to handle the cases where the content dynamically set their tab 
-            // labels with xulG.set_tab_name
-            left_tab.setAttribute('unadornedlabel', left_tab.getAttribute('unadornedlabel') + ' / ' + right_tab.getAttribute('unadornedlabel'));
-            left_tab.setAttribute('label', left_tab.getAttribute('label') + ' / ' + right_tab.getAttribute('unadornedlabel'));
-
-            // Re-apply content params, etc.
-            var left_params = this.preserved_content_params[ left_idx ];
-            var right_params = this.preserved_content_params[ right_idx ];
-            this.preserved_content_params[ left_idx ] = function() {
-                try {
-                    left_params();
-                    right_params();
-                } catch(E) {
-                    alert('Error re-applying content params after join_tabs');
-                }
-            };
-            this.preserved_content_params[ left_idx ]();
-
-        } catch(E) {
-            alert('Error in menu.js with join_tabs(): ' + E);
-        }
-    },
-
     'find_free_tab' : function() {
         var last_not_hidden = -1;
         for (var i = 0; i<this.controller.view.tabs.childNodes.length; i++) {
@@ -1618,8 +1540,19 @@
             if (params.src) { help_btn.setAttribute('src', params.src); }
         }
     },
-    'augment_content_params' : function(idx,tab,params,content_params) {
+    'set_tab' : function(url,params,content_params) {
         var obj = this;
+        if (!url) url = '/xul/server/';
+        if (!url.match(/:\/\//) && !url.match(/^data:/)) url = urls.remote + url;
+        if (!params) params = {};
+        if (!content_params) content_params = {};
+        var idx = this.controller.view.tabs.selectedIndex;
+        if (params && typeof params.index != 'undefined') idx = params.index;
+        var tab = this.controller.view.tabs.childNodes[ idx ];
+        if (params.focus) tab.focus();
+        var panel = this.controller.view.panels.childNodes[ idx ];
+        while ( panel.lastChild ) panel.removeChild( panel.lastChild );
+
         content_params.new_tab = function(a,b,c) { return obj.new_tab(a,b,c); };
         content_params.set_tab = function(a,b,c) { return obj.set_tab(a,b,c); };
         content_params.close_tab = function() { return obj.close_tab(); };
@@ -1628,7 +1561,7 @@
         content_params.volume_item_creator = function(a) { return obj.volume_item_creator(a); };
         content_params.get_new_session = function(a) { return obj.get_new_session(a); };
         content_params.holdings_maintenance_tab = function(a,b,c) { return obj.holdings_maintenance_tab(a,b,c); };
-        content_params.set_tab_name = function(name) { tab.setAttribute('unadornedlabel',name); tab.setAttribute('label',(idx + 1) + ' ' + name); };
+        content_params.set_tab_name = function(name) { tab.setAttribute('label',(idx + 1) + ' ' + name); };
         content_params.set_help_context = function(params) { return obj.set_help_context(params); };
         content_params.open_chrome_window = function(a,b,c) { return xulG.window.open(a,b,c); };
         content_params.url_prefix = function(url) { return obj.url_prefix(url); };
@@ -1640,24 +1573,6 @@
         };
         content_params.chrome_xulG = xulG;
         content_params._data = xulG._data;
-
-        return content_params;
-    },
-    'set_tab' : function(url,params,content_params) {
-        var obj = this;
-        if (!url) url = '/xul/server/';
-        if (!url.match(/:\/\//) && !url.match(/^data:/)) url = urls.remote + url;
-        if (!params) params = {};
-        if (!content_params) content_params = {};
-        var idx = this.controller.view.tabs.selectedIndex;
-        if (obj.preserved_content_params[idx]) { delete obj.preserved_content_params[ idx ]; }
-        if (params && typeof params.index != 'undefined') idx = params.index;
-        var tab = this.controller.view.tabs.childNodes[ idx ];
-        if (params.focus) tab.focus();
-        var panel = this.controller.view.panels.childNodes[ idx ];
-        while ( panel.lastChild ) panel.removeChild( panel.lastChild );
-
-        content_params = obj.augment_content_params(idx,tab,params,content_params);
         if (params && params.tab_name) content_params.set_tab_name( params.tab_name );
         
         var frame;
@@ -1684,9 +1599,6 @@
                             'passthru_content_params' : content_params,
                         }
                     );
-                    obj.preserved_content_params[ idx ] = function() {
-                        b.passthru_content_params = content_params;
-                    }
                 } catch(E) {
                     alert(E);
                 }
@@ -1696,40 +1608,37 @@
                 panel.appendChild(frame);
                 dump('creating iframe with src = ' + url + '\n');
                 frame.setAttribute('src',url);
-                obj.preserved_content_params[ idx ] = function() {
-                    try {
-                        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-                        var cw = frame.contentWindow;
-                        if (typeof cw.wrappedJSObject != 'undefined') cw = cw.wrappedJSObject;
-                        cw.IAMXUL = true;
-                        cw.xulG = content_params;
-                        cw.addEventListener(
-                            'load',
-                            function() {
-                                try {
-                                    if (typeof cw.help_context_set_locally == 'undefined') {
-                                        var help_params = {
-                                            'protocol' : cw.location.protocol,
-                                            'hostname' : cw.location.hostname,
-                                            'port' : cw.location.port,
-                                            'pathname' : cw.location.pathname,
-                                            'src' : ''
-                                        };
-                                        obj.set_help_context(help_params);
-                                    } else if (typeof cw.default_focus == 'function') {
-                                        cw.default_focus();
-                                    }
-                                } catch(E) {
-                                    obj.error.sdump('D_ERROR', 'main.menu, set_tab, onload: ' + E);
+                try {
+                    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                    var cw = frame.contentWindow;
+                    if (typeof cw.wrappedJSObject != 'undefined') cw = cw.wrappedJSObject;
+                    cw.IAMXUL = true;
+                    cw.xulG = content_params;
+                    cw.addEventListener(
+                        'load',
+                        function() {
+                            try {
+                                if (typeof cw.help_context_set_locally == 'undefined') {
+                                    var help_params = {
+                                        'protocol' : cw.location.protocol,
+                                        'hostname' : cw.location.hostname,
+                                        'port' : cw.location.port,
+                                        'pathname' : cw.location.pathname,
+                                        'src' : ''
+                                    };
+                                    obj.set_help_context(help_params);
+                                } else if (typeof cw.default_focus == 'function') {
+                                    cw.default_focus();
                                 }
-                            },
-                            false
-                        );
-                    } catch(E) {
-                        this.error.sdump('D_ERROR', 'main.menu: ' + E);
-                    }
-                };
-                obj.preserved_content_params[ idx ]();
+                            } catch(E) {
+                                obj.error.sdump('D_ERROR', 'main.menu, set_tab, onload: ' + E);
+                            }
+                        },
+                        false
+                    );
+                } catch(E) {
+                    this.error.sdump('D_ERROR', 'main.menu: ' + E);
+                }
             }
         } catch(E) {
             this.error.sdump('D_ERROR', 'main.menu:2: ' + E);

Modified: branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul	2010-08-24 18:05:16 UTC (rev 17328)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul	2010-08-24 18:21:18 UTC (rev 17329)
@@ -13,8 +13,6 @@
     <command id="cmd_new_tab" key="new-tab-key" />
     <command id="cmd_close_tab" key="close-tab-key" />
     <command id="cmd_close_all_tabs" key="close-all-tabs-key" />
-    <command id="cmd_join_tabs_vertical" label="&staff.main.menu.file.join_tabs_vertical.label;" accesskey="&staff.main.menu.file.join_tabs_vertical.accesskey;" />
-    <command id="cmd_join_tabs_horizontal" label="&staff.main.menu.file.join_tabs_horizontal.label;" accesskey="&staff.main.menu.file.join_tabs_horizontal.accesskey;" />
     <command id="cmd_shutdown" />
 
     <command id="cmd_edit_copy_buckets" />
@@ -196,8 +194,6 @@
     <menupopup id="main.menu.file.popup">
         <menuitem label="&staff.main.menu.file.new.label;" accesskey="&staff.main.menu.file.new.accesskey;" key="new-window-key" command="cmd_new_window"/>
         <menuitem label="&staff.main.menu.file.new_tab.label;" accesskey="&staff.main.menu.file.new_tab.accesskey;" key="new-tab-key" command="cmd_new_tab"/>
-        <menuitem id="join_tabs_menuitem_horizontal" hidden="true" command="cmd_join_tabs_horizontal"/>
-        <menuitem id="join_tabs_menuitem_vertical" hidden="true" command="cmd_join_tabs_vertical"/>
         <menuseparator />
         <menuitem label="&staff.main.menu.file.close_tab.label;" accesskey="&staff.main.menu.file.close_tab.accesskey;" oldaccesskey="&staff.main.menu.file.close_tab.key;" key="close-tab-key" command="cmd_close_tab"/>
         <menuitem label="&staff.main.menu.tabs.close;" accesskey="&staff.main.menu.tabs.close.accesskey;" key="close-all-tabs-key" command="cmd_close_all_tabs"/>

Modified: branches/rel_2_0/Open-ILS/xul/staff_client/defaults/preferences/prefs.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/defaults/preferences/prefs.js	2010-08-24 18:05:16 UTC (rev 17328)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/defaults/preferences/prefs.js	2010-08-24 18:21:18 UTC (rev 17329)
@@ -6,9 +6,6 @@
 pref("open-ils.write_in_user_chrome_directory", true);
 pref("open-ils.disable_accesskeys_on_tabs", false);
 
-// Toggles for experimental features that may later become org unit settings
-pref("open-ils.enable_join_tabs", true);
-
 // We'll use this one to help brand some build information into the client, and rely on subversion keywords
 pref("open-ils.repository.headURL","$HeadURL$");
 pref("open-ils.repository.author","$Author$");



More information about the open-ils-commits mailing list