[open-ils-commits] r19377 - in trunk/Open-ILS/xul/staff_client/chrome: content/util locale/en-US (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Feb 3 18:40:57 EST 2011


Author: phasefx
Date: 2011-02-03 18:40:50 -0500 (Thu, 03 Feb 2011)
New Revision: 19377

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.js
   trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
Log:
make the browser Reload button aware of tab locking for unsaved data


Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.js	2011-02-03 23:31:55 UTC (rev 19376)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.js	2011-02-03 23:40:50 UTC (rev 19377)
@@ -12,6 +12,8 @@
 
 util.browser.prototype = {
 
+    'lock_reload' : false, // as opposed to lock 'n load :)
+
     'init' : function( params ) {
 
         try {
@@ -124,6 +126,14 @@
                             ['command'],
                             function() {
                                 try {
+                                    if (obj.lock_reload) {
+                                        if (window.confirm( $('offlineStrings').getString('browser.reload.unsaved_data_warning') )) {
+                                            obj.lock_reload = false;
+                                            window.xulG.unlock_tab();
+                                        } else {
+                                            return;
+                                        }
+                                    }
                                     netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                                     var n = obj.getWebNavigation();
                                     n.reload( Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE );
@@ -258,8 +268,18 @@
             if (!cw.xulG.set_tab) { cw.xulG.set_tab = function(a,b,c) { return window.xulG.set_tab(a,b,c); }; }
             if (!cw.xulG.new_tab) { cw.xulG.new_tab = function(a,b,c) { return window.xulG.new_tab(a,b,c); }; }
             if (!cw.xulG.close_tab) { cw.xulG.close_tab = function(a) { return window.xulG.close_tab(a); }; }
-            if (!cw.xulG.lock_tab) { cw.xulG.lock_tab = function() { return window.xulG.lock_tab(); }; }
-            if (!cw.xulG.unlock_tab) { cw.xulG.unlock_tab = function() { return window.xulG.unlock_tab(); }; }
+            if (!cw.xulG.lock_tab) {
+                cw.xulG.lock_tab = function() {
+                    obj.lock_reload = true;
+                    return window.xulG.lock_tab();
+                };
+            }
+            if (!cw.xulG.unlock_tab) {
+                cw.xulG.unlock_tab = function() {
+                    obj.lock_reload = false;
+                    return window.xulG.unlock_tab();
+                };
+            }
             if (!cw.xulG.inspect_tab) { cw.xulG.inspect_tab = function() { return window.xulG.inspect_tab(); }; }
             if (!cw.xulG.new_patron_tab) { cw.xulG.new_patron_tab = function(a,b) { return window.xulG.new_patron_tab(a,b); }; }
             if (!cw.xulG.set_patron_tab) { cw.xulG.set_patron_tab = function(a,b) { return window.xulG.set_patron_tab(a,b); }; }

Modified: trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2011-02-03 23:31:55 UTC (rev 19376)
+++ trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2011-02-03 23:40:50 UTC (rev 19377)
@@ -280,6 +280,7 @@
 menu.tab8.accesskey=8
 menu.tab9.accesskey=9
 menu.tab10.accesskey=0
+browser.reload.unsaved_data_warning=This page may have unsaved data. Reload it anyway?
 menu.close_tab.unsaved_data_warning=This tab may have unsaved data. Close it anyway?
 menu.replace_tab.unsaved_data_warning=This tab may have unsaved data. Replace it anyway?
 menu.close_window.unsaved_data_warning=This window may have unsaved data. Close it anyway?



More information about the open-ils-commits mailing list