From: phasefx Date: Tue, 29 Jun 2010 18:20:02 +0000 (+0000) Subject: File->Join Tabs experiment. Can disable through prefs.js, and I may make disabled... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0376e2f123b84ea311c44acded2e8614e297245e;p=evergreen%2Fbjwebb.git File->Join Tabs experiment. Can disable through prefs.js, and I may make disabled the default before we branch trunk depending how things play out. One current limitation is that the interfaces thus joined get reloaded as a consequence of their respective DOM nodes being relocated, so tab joining is most useful to setup prior to retrieving information you'd like to view side by side. I haven't found an easy way around this, though we could roll our own tab browser (bleh) or come up with a generic way for interfaces to save their state. Tab labels are also imperfect, given that interfaces are able to dynamically modify the tab label and can clobber each other if sharing a tab git-svn-id: svn://svn.open-ils.org/ILS/trunk@16830 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 365f92e4c..f8ec360f5 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -961,6 +961,10 @@ + + + + diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index ff628cea4..9c9282f4e 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -35,6 +35,11 @@ main.menu = function () { 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 = { @@ -157,6 +162,14 @@ main.menu.prototype = { ['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(); } @@ -1277,6 +1290,11 @@ main.menu.prototype = { } }, + // 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 { @@ -1288,8 +1306,8 @@ main.menu.prototype = { } }, - 'close_tab' : function () { - var idx = this.controller.view.tabs.selectedIndex; + 'close_tab' : function (specific_idx) { + var idx = specific_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 ); @@ -1338,6 +1356,66 @@ main.menu.prototype = { } }, + '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 + + @@ -188,6 +190,8 @@ +