From 96c535159a337690cee2e41ed69fdd7e522ec385 Mon Sep 17 00:00:00 2001 From: phasefx Date: Thu, 9 Dec 2010 11:09:11 +0000 Subject: [PATCH] unsaved data warning for MARC editor. some debug output for oils_lock_page() git-svn-id: svn://svn.open-ils.org/ILS/trunk@18944 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/ui/default/acq/common/li_table.js | 4 +- Open-ILS/web/js/ui/default/cat/authority/list.js | 4 +- Open-ILS/web/js/ui/default/vandelay/vandelay.js | 4 +- Open-ILS/web/opac/skin/craftsman/js/rdetail.js | 4 +- Open-ILS/web/opac/skin/default/js/rdetail.js | 4 +- .../chrome/content/OpenILS/global_util.js | 6 + .../xul/staff_client/chrome/content/cat/opac.js | 4 +- .../xul/staff_client/server/cat/bibs_abreast.js | 4 +- Open-ILS/xul/staff_client/server/cat/marc_new.xul | 4 +- Open-ILS/xul/staff_client/server/cat/marcedit.js | 2 + Open-ILS/xul/staff_client/server/cat/marcedit.xul | 136 ++++++++++----------- Open-ILS/xul/staff_client/server/cat/z3950.js | 4 +- 12 files changed, 103 insertions(+), 77 deletions(-) diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js index 42fca003e..bbaf04856 100644 --- a/Open-ILS/web/js/ui/default/acq/common/li_table.js +++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js @@ -2331,7 +2331,9 @@ function AcqLiTable() { } ); }, - } + }, + 'lock_tab' : typeof xulG != 'undefined' ? (typeof xulG['lock_tab'] != 'undefined' ? xulG.lock_tab : undefined) : undefined, + 'unlock_tab' : typeof xulG != 'undefined' ? (typeof xulG['unlock_tab'] != 'undefined' ? xulG.unlock_tab : undefined) : undefined }; } diff --git a/Open-ILS/web/js/ui/default/cat/authority/list.js b/Open-ILS/web/js/ui/default/cat/authority/list.js index 43d451182..6948e8404 100644 --- a/Open-ILS/web/js/ui/default/cat/authority/list.js +++ b/Open-ILS/web/js/ui/default/cat/authority/list.js @@ -159,7 +159,9 @@ function loadMarcEditor(pcrud, rec) { alert("Record was saved"); win.close(); } - } + }, + 'lock_tab' : typeof xulG != 'undefined' ? (typeof xulG['lock_tab'] != 'undefined' ? xulG.lock_tab : undefined) : undefined, + 'unlock_tab' : typeof xulG != 'undefined' ? (typeof xulG['unlock_tab'] != 'undefined' ? xulG.unlock_tab : undefined) : undefined }; } diff --git a/Open-ILS/web/js/ui/default/vandelay/vandelay.js b/Open-ILS/web/js/ui/default/vandelay/vandelay.js index 4a74f2917..ed8c1531b 100644 --- a/Open-ILS/web/js/ui/default/vandelay/vandelay.js +++ b/Open-ILS/web/js/ui/default/vandelay/vandelay.js @@ -1087,7 +1087,9 @@ function vlOpenMarcEditWindow(rec, postReloadHTMLHandler) { } ); }, - } + }, + 'lock_tab' : typeof xulG != 'undefined' ? (typeof xulG['lock_tab'] != 'undefined' ? xulG.lock_tab : undefined) : undefined, + 'unlock_tab' : typeof xulG != 'undefined' ? (typeof xulG['unlock_tab'] != 'undefined' ? xulG.unlock_tab : undefined) : undefined }; } diff --git a/Open-ILS/web/opac/skin/craftsman/js/rdetail.js b/Open-ILS/web/opac/skin/craftsman/js/rdetail.js index d7da5c6b2..025851b90 100644 --- a/Open-ILS/web/opac/skin/craftsman/js/rdetail.js +++ b/Open-ILS/web/opac/skin/craftsman/js/rdetail.js @@ -246,7 +246,9 @@ function OpenMarcEditWindow(pcrud, rec) { rec.ischanged(true); pcrud.update(rec); } - } + }, + 'lock_tab' : typeof xulG != 'undefined' ? (typeof xulG['lock_tab'] != 'undefined' ? xulG.lock_tab : undefined) : undefined, + 'unlock_tab' : typeof xulG != 'undefined' ? (typeof xulG['unlock_tab'] != 'undefined' ? xulG.unlock_tab : undefined) : undefined }; } diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index f5c49352f..14bd7278c 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -274,7 +274,9 @@ function OpenMarcEditWindow(pcrud, rec) { rec.ischanged(true); pcrud.update(rec); } - } + }, + 'lock_tab' : typeof xulG != 'undefined' ? (typeof xulG['lock_tab'] != 'undefined' ? xulG.lock_tab : undefined) : undefined, + 'unlock_tab' : typeof xulG != 'undefined' ? (typeof xulG['unlock_tab'] != 'undefined' ? xulG.unlock_tab : undefined) : undefined }; } diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js index 9b8363d29..e68c9da29 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js @@ -29,11 +29,14 @@ window.oils_lock++; if (typeof xulG != 'undefined') { if (typeof xulG.unlock_tab == 'function') { + dump('\twith xulG.lock_tab\n'); xulG.lock_tab(); } else { + dump('\twithout xulG.lock_tab\n'); oils_unsaved_data_V(); } } else { + dump('\twithout xulG.lock_tab\n'); oils_unsaved_data_V(); } return window.oils_lock; @@ -45,11 +48,14 @@ 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'); xulG.unlock_tab(); } else { + dump('\twithout xulG.unlock_tab\n'); oils_unsaved_data_P(); } } else { + dump('\twithout xulG.unlock_tab\n'); oils_unsaved_data_P(); } return window.oils_lock; diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js index a3bc8e8b9..b5b15aba5 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js @@ -233,7 +233,9 @@ function set_marc_edit() { g.error.standard_unexpected_error_alert(document.getElementById('offlineStrings').getString("cat.save.failure"), E); } } - } + }, + 'lock_tab' : xulG.lock_tab, + 'unlock_tab' : xulG.unlock_tab }; if (marc_edit_reset) { bottom_pane.reset_iframe( a,b,c ); diff --git a/Open-ILS/xul/staff_client/server/cat/bibs_abreast.js b/Open-ILS/xul/staff_client/server/cat/bibs_abreast.js index bb477eebc..3b3d088e0 100644 --- a/Open-ILS/xul/staff_client/server/cat/bibs_abreast.js +++ b/Open-ILS/xul/staff_client/server/cat/bibs_abreast.js @@ -162,7 +162,9 @@ function set_edit_pane(deck,record_id) { alert('Error in bibs_abreast.js, set_edit_pane, save: ' + E); } } - } + }, + 'lock_tab' : xulG.lock_tab(), + 'unlock_tab' : xulG.unlock_tab() }; for (var i in xulG) { my_xulG[i] = xulG[i]; } deck.set_iframe( urls.XUL_MARC_EDIT, {}, my_xulG ); diff --git a/Open-ILS/xul/staff_client/server/cat/marc_new.xul b/Open-ILS/xul/staff_client/server/cat/marc_new.xul index ddc54f3fe..5ba34ff11 100644 --- a/Open-ILS/xul/staff_client/server/cat/marc_new.xul +++ b/Open-ILS/xul/staff_client/server/cat/marc_new.xul @@ -136,7 +136,9 @@ ); } } - } + }, + 'lock_tab' : xulG.lock_tab, + 'unlock_tab' : xulG.unlock_tab }; var marc_editor = document.createElement('iframe'); $('marc_editor_box').appendChild(marc_editor); diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index 34a553109..46b3db659 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -468,6 +468,7 @@ function setFocusToNextTag (row, direction) { function createMARCTextbox (element,attrs) { var box = createComplexXULElement('textbox', attrs, Array.prototype.slice.apply(arguments, [2]) ); + box.addEventListener('change',function(ev) { oils_lock_page(); },false); box.onkeypress = function (event) { var root_node; var node = element; @@ -1585,6 +1586,7 @@ function save_attempt(xml_string) { try { var result = window.xulG.save.func( xml_string ); if (result) { + oils_unlock_page(); if (result.id) fastItemAdd_attempt(result.id); if (typeof result.on_complete == 'function') result.on_complete(); } diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.xul b/Open-ILS/xul/staff_client/server/cat/marcedit.xul index 7ff4d284c..7b36212c2 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.xul +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.xul @@ -28,9 +28,9 @@