[open-ils-commits] r18926 - in trunk/Open-ILS/xul/staff_client/chrome: content/main locale/en-US (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Dec 7 11:58:13 EST 2010
Author: phasefx
Date: 2010-12-07 11:58:10 -0500 (Tue, 07 Dec 2010)
New Revision: 18926
Modified:
trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js
trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
Log:
confirm window closure if tabs within the window are locked
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js 2010-12-07 16:58:06 UTC (rev 18925)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js 2010-12-07 16:58:10 UTC (rev 18926)
@@ -119,6 +119,31 @@
);
}
+ window.addEventListener(
+ 'close',
+ function(ev) {
+
+ var unsaved_data = false;
+ for (var id in obj.tab_semaphores) {
+ if (obj.tab_semaphores[id] > 0) {
+ unsaved_data = true;
+ }
+ }
+
+ if (unsaved_data) {
+ var confirmation = window.confirm(offlineStrings.getString('menu.close_window.unsaved_data_warning'));
+ if (!confirmation) {
+ ev.preventDefault();
+ return false;
+ }
+ }
+
+ return true;
+
+ },
+ false
+ );
+
var cmd_map = {
'cmd_broken' : [
['oncommand'],
@@ -128,7 +153,10 @@
/* File Menu */
'cmd_close_window' : [
['oncommand'],
- function() { window.close(); }
+ function() {
+ JSAN.use('util.widgets');
+ util.widgets.dispatch('close',window);
+ }
],
'cmd_new_window' : [
['oncommand'],
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 2010-12-07 16:58:06 UTC (rev 18925)
+++ trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties 2010-12-07 16:58:10 UTC (rev 18926)
@@ -282,3 +282,4 @@
menu.tab10.accesskey=0
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