unsaved data warning for patron editor. some debug output for lock_tab/unlock_tab
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 9 Dec 2010 11:09:13 +0000 (11:09 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 9 Dec 2010 11:09:13 +0000 (11:09 +0000)
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
Open-ILS/xul/staff_client/chrome/content/main/menu.js
Open-ILS/xul/staff_client/server/patron/display.js
Open-ILS/xul/staff_client/server/patron/info_group.js
Open-ILS/xul/staff_client/server/patron/staged.js

index 835129b..ea42797 100644 (file)
@@ -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());
index c6f9e95..7185650 100644 (file)
@@ -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;
index 67c1709..fad8d29 100644 (file)
@@ -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(); }
                                 }
                             );
                         }
index 65591fa..0dcb98f 100644 (file)
@@ -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
         }
     );
 
index 21397f2..706d449 100644 (file)
@@ -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
         }
     );
 }