Making the user profile selector disabled rather than readonly user/jamesrf/lp806625-readOnly-profiles
authorJames Fournie <jfournie@sitka.bclibraries.ca>
Wed, 16 Nov 2011 00:56:16 +0000 (16:56 -0800)
committerJames Fournie <jfournie@sitka.bclibraries.ca>
Wed, 16 Nov 2011 01:01:08 +0000 (17:01 -0800)
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>
Open-ILS/web/js/ui/default/actor/user/register.js

index 30359fe..0a8d886 100644 (file)
@@ -818,8 +818,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;
     }
@@ -832,7 +830,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);
+                }
+            }
         }
     );