[open-ils-commits] r19011 - in trunk/Open-ILS/xul/staff_client/chrome/content: OpenILS main (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Dec 17 11:41:48 EST 2010
Author: phasefx
Date: 2010-12-17 11:41:45 -0500 (Fri, 17 Dec 2010)
New Revision: 19011
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:
use just one close handler for menu.js; small tweak to support that, and some debug output
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-17 15:19:12 UTC (rev 19010)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js 2010-12-17 16:41:45 UTC (rev 19011)
@@ -5,17 +5,28 @@
data.stash_retrieve();
if (typeof data.unsaved_data == 'undefined') { data.unsaved_data = 0; }
data.unsaved_data++;
+ window.oils_lock++;
data.stash('unsaved_data');
+ dump('incrementing window.oils_lock\n');
+ dump(location.href + ' window.oils_lock == ' + window.oils_lock + '\n');
+ dump('incrementing data.unsaved_data\n');
+ dump('data.unsaved_data == ' + data.unsaved_data + '\n');
}
function oils_unsaved_data_P(count) {
if (!count) { count = 1; }
+ dump('decrementing window.oils_lock by ' + count + '\n');
+ window.oils_lock -= count;
+ if (window.oils_lock < 0) { window.oils_lock = 0; }
+ dump(location.href + ' window.oils_lock == ' + window.oils_lock + '\n');
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; }
+ dump('decrementing data.unsaved_data by ' + count + '\n');
data.unsaved_data -= count;
if (data.unsaved_data < 0) { data.unsaved_data = 0; }
data.stash('unsaved_data');
+ dump('data.unsaved_data == ' + data.unsaved_data + '\n');
}
function oils_lock_page(params) {
@@ -26,7 +37,6 @@
return window.oils_lock;
}
}
- window.oils_lock++;
if (typeof xulG != 'undefined') {
if (typeof xulG.unlock_tab == 'function') {
dump('\twith xulG.lock_tab\n');
@@ -44,8 +54,6 @@
function oils_unlock_page(params) {
dump('oils_unlock_page\n');
- window.oils_lock--;
- if (window.oils_lock < 0) { window.oils_lock = 0; }
if (typeof xulG != 'undefined') {
if (typeof xulG.unlock_tab == 'function') {
dump('\twith xulG.unlock_tab\n');
@@ -62,6 +70,7 @@
}
window.oils_lock = 0;
+ dump(location.href + ' init window.oils_lock == ' + window.oils_lock + '\n');
window.addEventListener(
'close',
function(ev) {
@@ -85,6 +94,7 @@
oils_unsaved_data_P( window.oils_lock );
}
window.oils_lock = 0;
+ dump(location.href + ' forcing window.oils_lock == ' + window.oils_lock + '\n');
// 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-17 15:19:12 UTC (rev 19010)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js 2010-12-17 16:41:45 UTC (rev 19011)
@@ -119,37 +119,6 @@
);
}
- 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;
- }
- }
-
- for (var id in obj.tab_semaphores) {
- if (obj.tab_semaphores[id] > 0) {
- oils_unsaved_data_P( obj.tab_semaphores[id] );
- }
- }
-
- return true;
-
- },
- false
- );
-
var cmd_map = {
'cmd_broken' : [
['oncommand'],
@@ -1321,6 +1290,7 @@
if (window.confirm(confirm_string)) {
obj.data.unsaved_data = 0; // just in case the program doesn't close somehow
obj.data.stash('unsaved_data');
+ dump('forcing data.unsaved_data == ' + obj.data.unsaved_data + '\n');
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var windowManager = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService();
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
More information about the open-ils-commits
mailing list