[open-ils-commits] r18943 - in trunk/Open-ILS/xul/staff_client/chrome/content: OpenILS main (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Dec 9 06:09:14 EST 2010
Author: phasefx
Date: 2010-12-09 06:09:08 -0500 (Thu, 09 Dec 2010)
New Revision: 18943
Modified:
trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js
Log:
make sure forced closures of locked tabs and windows are correctly changing data.unsaved_data
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js 2010-12-09 11:09:06 UTC (rev 18942)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js 2010-12-09 11:09:08 UTC (rev 18943)
@@ -8,11 +8,12 @@
data.stash('unsaved_data');
}
- function oils_unsaved_data_P() {
+ function oils_unsaved_data_P(count) {
+ if (!count) { count = 1; }
JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
data.stash_retrieve();
if (typeof data.unsaved_data == 'undefined') { data.unsaved_data = 0; }
- data.unsaved_data--;
+ data.unsaved_data -= count;
if (data.unsaved_data < 0) { data.unsaved_data = 0; }
data.stash('unsaved_data');
}
@@ -68,12 +69,16 @@
}
}
- window.oils_lock = 0;
if (typeof xulG != 'undefined') {
if (typeof xulG.unlock_tab == 'function') {
xulG.unlock_tab();
+ } else {
+ oils_unsaved_data_P( window.oils_lock );
}
+ } else {
+ oils_unsaved_data_P( window.oils_lock );
}
+ window.oils_lock = 0;
// Dispatching the window close event doesn't always close the window, even though the event does happen
setTimeout(
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-09 11:09:06 UTC (rev 18942)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js 2010-12-09 11:09:08 UTC (rev 18943)
@@ -140,7 +140,7 @@
for (var id in obj.tab_semaphores) {
if (obj.tab_semaphores[id] > 0) {
- oils_unsaved_data_P();
+ oils_unsaved_data_P( obj.tab_semaphores[id] );
}
}
@@ -1386,7 +1386,7 @@
if (this.tab_semaphores[id] > 0) {
var confirmation = window.confirm(offlineStrings.getString('menu.close_tab.unsaved_data_warning'));
if (!confirmation) { return; }
- oils_unsaved_data_P();
+ oils_unsaved_data_P( this.tab_semaphores[id] );
}
delete this.tab_semaphores[id];
}
@@ -1662,7 +1662,7 @@
if (obj.tab_semaphores[id] > 0) {
var confirmation = window.confirm(offlineStrings.getString('menu.replace_tab.unsaved_data_warning'));
if (!confirmation) { return; }
- oils_unsaved_data_P();
+ oils_unsaved_data_P( obj.tab_semaphores[id] );
}
delete obj.tab_semaphores[id];
}
More information about the open-ils-commits
mailing list