tweaks to window titlebars collab/phasefx/tab_name_in_title_bar
authorJason Etheridge <jason@esilibrary.com>
Wed, 20 Jun 2012 19:40:27 +0000 (15:40 -0400)
committerJason Etheridge <jason@esilibrary.com>
Tue, 25 Sep 2012 17:30:37 +0000 (13:30 -0400)
In the login window, fixes the bug preventing the client version from displaying
in the titlebar.

On main menu windows, append the active tab name to the window titlebar.

Minor bug: Admin->Operator Change will wipe out the tab name in the titlebar

But I can live with that :)  Also, we may want to move
util.network.reset_titlebars and util.network.set_user_status from network.js to
menu.js

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Open-ILS/xul/staff_client/chrome/content/main/menu.js

index 55a3682..37b7f15 100644 (file)
@@ -1951,6 +1951,7 @@ main.menu.prototype = {
                         if (typeof cw.default_focus == 'function') {
                             cw.default_focus();
                         }
+                        obj.set_titlebar( tab.label );
                     }
                 } catch(E) {
                     obj.error.sdump('D_ERROR','init_tab_focus_handler: ' + js2JSON(E));
@@ -2253,6 +2254,19 @@ commands:
             if (params.src) { help_btn.setAttribute('src', params.src); }
         }
     },
+    'set_titlebar' : function(name) {
+        try {
+            var obj = this;
+            JSAN.use('util.network');
+            var net = new util.network();
+            net.reset_titlebars( obj.data );
+            if (name) {
+                window.document.title = window.document.title + ' : ' + name;
+            }
+        } catch(E) {
+            alert(E+'\n');
+        }
+    },
 
     'tab_semaphores' : {},
 
@@ -2325,7 +2339,11 @@ commands:
         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.label = tab.curindex + ' ' + name; tab.origlabel = name; };
+        content_params.set_tab_name = function(name) {
+            tab.label = tab.curindex + ' ' + name;
+            tab.origlabel = name;
+            obj.set_titlebar(tab.label);
+        };
         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,secure) { return obj.url_prefix(url,secure); };
@@ -2413,6 +2431,7 @@ commands:
                                 } else if (typeof cw.default_focus == 'function') {
                                     cw.default_focus();
                                 }
+                                obj.set_titlebar( tab.label );
                             } catch(E) {
                                 obj.error.sdump('D_ERROR', 'main.menu, set_tab, onload: ' + E);
                             }