[open-ils-commits] r19247 - trunk/Open-ILS/web/js/ui/default/actor/user (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Jan 21 11:58:47 EST 2011


Author: phasefx
Date: 2011-01-21 11:58:44 -0500 (Fri, 21 Jan 2011)
New Revision: 19247

Modified:
   trunk/Open-ILS/web/js/ui/default/actor/user/register.js
Log:
fix spurious unsaved data prompt with repeated use of same patron editor (only set tab lock once with patron editor, since we only unlock once upon save)


Modified: trunk/Open-ILS/web/js/ui/default/actor/user/register.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/actor/user/register.js	2011-01-21 15:51:45 UTC (rev 19246)
+++ trunk/Open-ILS/web/js/ui/default/actor/user/register.js	2011-01-21 16:58:44 UTC (rev 19247)
@@ -51,6 +51,7 @@
 
 if(!window.xulG) var xulG = null;
 var lock_ready = false;
+var already_locked = false;
 
 function load() {
     staff = new openils.User().user;
@@ -765,7 +766,10 @@
         'onKeyPress',
         function(){
             if (lock_ready && xulG && typeof xulG.lock_tab == 'function') {
-                xulG.lock_tab();
+                if (! already_locked) {
+                    xulG.lock_tab();
+                    already_locked = true;
+                }
             }
         }
     );
@@ -774,7 +778,10 @@
         'onChange',
         function(){
             if (lock_ready && xulG && typeof xulG.lock_tab == 'function') {
-                xulG.lock_tab();
+                if (! already_locked) {
+                    xulG.lock_tab();
+                    already_locked = true;
+                }
             }
         }
     );
@@ -1236,7 +1243,10 @@
             params: [openils.User.authtoken, patron],
             oncomplete: function(r) {
                 lock_ready = false;
-                if (xulG && typeof xulG.unlock_tab == 'function') { xulG.unlock_tab(); }
+                if (xulG && typeof xulG.unlock_tab == 'function') {
+                    xulG.unlock_tab();
+                    already_locked = false;
+                }
                 newPatron = openils.Util.readResponse(r);
                 if(newPatron) {
                     uEditUpdateUserSettings(newPatron.id());



More information about the open-ils-commits mailing list