[open-ils-commits] r18929 - in trunk/Open-ILS/xul/staff_client: chrome/content/OpenILS server/cat (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Dec 7 11:58:27 EST 2010
Author: phasefx
Date: 2010-12-07 11:58:24 -0500 (Tue, 07 Dec 2010)
New Revision: 18929
Modified:
trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.js
trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.xul
Log:
Wire up the Item Attribute Editor with oils_lock_page. Some tweaks needed to global_util.js for util.widgets.dispatch('close',window) to work.
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-07 16:58:17 UTC (rev 18928)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js 2010-12-07 16:58:24 UTC (rev 18929)
@@ -1,6 +1,7 @@
function $(id) { return document.getElementById(id); }
function oils_lock_page(params) {
+ dump('oils_lock_page\n');
if (!params) { params = {}; }
if (window.oils_lock) {
if (!params.allow_multiple_locks) {
@@ -17,6 +18,7 @@
}
function oils_unlock_page(params) {
+ dump('oils_unlock_page\n');
window.oils_lock = false;
if (typeof xulG != 'undefined') {
if (typeof xulG.unlock_tab == 'function') {
@@ -29,7 +31,8 @@
window.addEventListener(
'close',
function(ev) {
-
+ try {
+ dump('oils_lock_page/oils_unlock_page onclose handler\n');
if (window.oils_lock) {
var confirmation = window.confirm($('offlineStrings').getString('menu.close_window.unsaved_data_warning'));
if (!confirmation) {
@@ -45,7 +48,22 @@
}
}
+ // Dispatching the window close event doesn't always close the window, even though the event does happen
+ setTimeout(
+ function() {
+ try {
+ window.close();
+ } catch(E) {
+ dump('Error inside global_util.js, onclose handler, setTimeout window.close KLUDGE: ' + E + '\n');
+ }
+ }, 0
+ );
+
return true;
+ } catch(E) {
+ dump('Error inside global_util.js, onclose handler: ' + E + '\n');
+ return true;
+ }
},
false
);
Modified: trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.js 2010-12-07 16:58:17 UTC (rev 18928)
+++ trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.js 2010-12-07 16:58:24 UTC (rev 18929)
@@ -388,6 +388,7 @@
g.summarize( g.copies );
g.render();
g.check_for_unmet_required_fields();
+ oils_unlock_page();
}
/******************************************************************************************************/
@@ -414,6 +415,8 @@
alert(E);
}
}
+
+ oils_lock_page();
}
/******************************************************************************************************/
@@ -447,6 +450,8 @@
g.error.standard_unexpected_error_alert('apply_stat_cat',E);
}
}
+
+ oils_lock_page();
}
/******************************************************************************************************/
@@ -480,6 +485,8 @@
g.error.standard_unexpected_error_alert('apply_stat_cat',E);
}
}
+
+ oils_lock_page();
}
/******************************************************************************************************/
@@ -1262,6 +1269,8 @@
g.stash_and_close = function() {
try {
+ oils_unlock_page();
+
if (g.handle_update) {
try {
var r = g.network.request(
@@ -1281,9 +1290,10 @@
//g.data.stash('temp_copies');
xulG.copies = g.copies;
update_modal_xulG(xulG);
- window.close();
+ JSAN.use('util.widgets');
+ util.widgets.dispatch('close',window);
} catch(E) {
- g.error.standard_unexpected_error_alert('stash and close',E);
+ alert('Error in copy_editor.js, g.stash_and_close(): '+E);
}
}
Modified: trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.xul 2010-12-07 16:58:17 UTC (rev 18928)
+++ trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.xul 2010-12-07 16:58:24 UTC (rev 18929)
@@ -89,7 +89,7 @@
<spacer flex="1"/>
<button id="copy_notes" label="&staff.cat.copy_editor.copy_notes.label;" accesskey="&staff.cat.copy_editor.copy_notes.accesskey;" oncommand="g.copy_notes();"/>
<button id="save" label="&staff.cat.copy_editor.save.label;" hidden="true" accesskey="&staff.cat.copy_editor.save.accesskey;" oncommand="g.stash_and_close();"/>
- <button id="cancel" label="&staff.cat.copy_editor.cancel.label;" accesskey="&staff.cat.copy_editor.cancel.accesskey;" oncommand="window.close();"/>
+ <button id="cancel" label="&staff.cat.copy_editor.cancel.label;" accesskey="&staff.cat.copy_editor.cancel.accesskey;" oncommand="JSAN.use('util.widgets'); util.widgets.dispatch('close',window);"/>
</hbox>
<spacer/>
More information about the open-ils-commits
mailing list