From 775e8fbd28df60ca5513126ce7d2413582bb8077 Mon Sep 17 00:00:00 2001 From: phasefx Date: Thu, 9 Dec 2010 11:09:13 +0000 Subject: [PATCH] unsaved data warning for patron editor. some debug output for lock_tab/unlock_tab git-svn-id: svn://svn.open-ils.org/ILS/trunk@18945 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/ui/default/actor/user/register.js | 16 +++++++++++++++- Open-ILS/xul/staff_client/chrome/content/main/menu.js | 2 ++ Open-ILS/xul/staff_client/server/patron/display.js | 8 ++++++-- Open-ILS/xul/staff_client/server/patron/info_group.js | 6 +++++- Open-ILS/xul/staff_client/server/patron/staged.js | 4 +++- 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index 835129b933..ea4279739c 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -50,7 +50,7 @@ var dupeUsrname = false; var dupeBarcode = false; if(!window.xulG) var xulG = null; - +var lock_ready = false; function load() { staff = new openils.User().user; @@ -146,6 +146,8 @@ function load() { } else { input.widget.attr('disabled', true).attr('readOnly', true); } + + lock_ready = true; } @@ -679,6 +681,16 @@ function checkClaimsNoCheckoutCountPerm() { function attachWidgetEvents(fmcls, fmfield, widget) { + dojo.connect( + widget.widget, + 'onChange', + function(){ + if (lock_ready && xulG && typeof xulG.lock_tab == 'function') { + xulG.lock_tab(); + } + } + ); + if(fmcls == 'ac') { if(fmfield == 'barcode') { dojo.connect(widget.widget, 'onChange', @@ -1134,6 +1146,8 @@ function _uEditSave(doClone) { { async: true, params: [openils.User.authtoken, patron], oncomplete: function(r) { + lock_ready = false; + if (xulG && typeof xulG.unlock_tab == 'function') { xulG.unlock_tab(); } newPatron = openils.Util.readResponse(r); if(newPatron) { uEditUpdateUserSettings(newPatron.id()); diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index c6f9e959a9..7185650d42 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -1674,6 +1674,7 @@ main.menu.prototype = { while ( panel.lastChild ) panel.removeChild( panel.lastChild ); content_params.lock_tab = function() { + dump('lock_tab\n'); var id = tab.getAttribute('id'); if (typeof obj.tab_semaphores[id] == 'undefined') { obj.tab_semaphores[id] = 0; @@ -1683,6 +1684,7 @@ main.menu.prototype = { return obj.tab_semaphores[id]; }; content_params.unlock_tab = function() { + dump('unlock_tab\n'); var id = tab.getAttribute('id'); if (typeof obj.tab_semaphores[id] == 'undefined') { obj.tab_semaphores[id] = 0; diff --git a/Open-ILS/xul/staff_client/server/patron/display.js b/Open-ILS/xul/staff_client/server/patron/display.js index 67c1709666..fad8d2959c 100644 --- a/Open-ILS/xul/staff_client/server/patron/display.js +++ b/Open-ILS/xul/staff_client/server/patron/display.js @@ -251,7 +251,9 @@ patron.display.prototype = { JSAN.use('patron.util'); patron.util.work_log_patron_edit(p_obj); } - } + }, + 'lock_tab' : function() { return xulG.lock_tab(); }, + 'unlock_tab' : function() { return xulG.unlock_tab(); } } ); } @@ -289,7 +291,9 @@ patron.display.prototype = { 'get_new_session' : function(a) { return xulG.get_new_session(a); }, 'new_tab' : function(a,b,c) { return xulG.new_tab(a,b,c); }, 'new_patron_tab' : function(a,b) { return xulG.new_patron_tab(a,b); } - } + }, + 'lock_tab' : function() { return xulG.lock_tab(); }, + 'unlock_tab' : function() { return xulG.unlock_tab(); } } ); } diff --git a/Open-ILS/xul/staff_client/server/patron/info_group.js b/Open-ILS/xul/staff_client/server/patron/info_group.js index 65591faa49..0dcb98f35f 100644 --- a/Open-ILS/xul/staff_client/server/patron/info_group.js +++ b/Open-ILS/xul/staff_client/server/patron/info_group.js @@ -333,6 +333,8 @@ function clone_patron() { }, 'url_prefix' : xulG.url_prefix, 'new_tab' : xulG.new_tab, + 'lock_tab' : xulG.lock_tab, + 'unlock_tab' : xulG.unlock_tab } ); } @@ -363,7 +365,9 @@ function spawn_editor(p) { 'tab_name' : $("patronStrings").getString('staff.patron.info_group.spawn_editor.editing_patron'), 'passthru_content_params' : passthru, 'url_prefix' : xulG.url_prefix, - 'new_tab' : xulG.new_tab + 'new_tab' : xulG.new_tab, + 'lock_tab' : xulG.lock_tab, + 'unlock_tab' : xulG.unlock_tab } ); diff --git a/Open-ILS/xul/staff_client/server/patron/staged.js b/Open-ILS/xul/staff_client/server/patron/staged.js index 21397f29a4..706d449866 100644 --- a/Open-ILS/xul/staff_client/server/patron/staged.js +++ b/Open-ILS/xul/staff_client/server/patron/staged.js @@ -161,7 +161,9 @@ function spawn_editor(p,func) { 'new_patron_tab' : xulG.new_patron_tab, 'on_save' : function(p) { patron.util.work_log_patron_edit(p); if (typeof func == 'function') { func(p); } }, 'params' : p - } + }, + 'lock_tab' : xulG.lock_tab, + 'unlock_tab' : xulG.unlock_tab } ); } -- 2.11.0