Making the user profile selector disabled rather than readonly
authorJames Fournie <jfournie@sitka.bclibraries.ca>
Wed, 16 Nov 2011 00:56:16 +0000 (16:56 -0800)
committerMike Rylander <mrylander@gmail.com>
Tue, 10 Jan 2012 16:42:16 +0000 (11:42 -0500)
in the case of a user editing their own account.  This prevents
a nasty bug whereby Dojo widgets with the readOnly flag set
become labels and therefore do not correctly hold a 'value'
like a normal form widget.  See LP#806625 for details.

Signed-off-by: James Fournie <jfournie@sitka.bclibraries.ca>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/web/js/ui/default/actor/user/register.js

index fffe460..f30a3b2 100644 (file)
@@ -909,8 +909,6 @@ function fleshFMRow(row, fmcls, args) {
         // not overwritten when the profile groups arrive and update
         wargs.forceSync = true;
         wargs.disableQuery = {usergroup : 'f'};
-        if(!patron.isnew() && !checkGrpAppPerm(patron.profile()))
-            wargs.readOnly = true;
     } else {
         wargs.forceSync = false;
     }
@@ -923,7 +921,12 @@ function fleshFMRow(row, fmcls, args) {
     var widget = new openils.widget.AutoFieldWidget(wargs);
     widget.build(
         function(w, ww) {
-            if(fmfield == 'profile') { trimGrpTree(ww); }
+            if(fmfield == 'profile') {
+                trimGrpTree(ww);
+                if(!patron.isnew() && !checkGrpAppPerm(patron.profile())){
+                    w.attr('disabled', true);
+                }
+            }
         }
     );