From fd8e714e6c8d818ec2dba030ea84ee99ec7f1158 Mon Sep 17 00:00:00 2001 From: phasefx Date: Thu, 3 Feb 2011 23:40:50 +0000 Subject: [PATCH] make the browser Reload button aware of tab locking for unsaved data git-svn-id: svn://svn.open-ils.org/ILS/trunk@19377 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../staff_client/chrome/content/util/browser.js | 24 ++++++++++++++++++++-- .../chrome/locale/en-US/offline.properties | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/util/browser.js b/Open-ILS/xul/staff_client/chrome/content/util/browser.js index a2d2a354e7..41ff0d2c6a 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/browser.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/browser.js @@ -12,6 +12,8 @@ util.browser = function (params) { util.browser.prototype = { + 'lock_reload' : false, // as opposed to lock 'n load :) + 'init' : function( params ) { try { @@ -124,6 +126,14 @@ util.browser.prototype = { ['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 @@ util.browser.prototype = { 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); }; } diff --git a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties index 2ccd17d495..6a125de544 100644 --- a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties +++ b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties @@ -280,6 +280,7 @@ menu.tab7.accesskey=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? -- 2.11.0