Permalink
Browse files

More changes from disabledIf() to freeze().

Moved set_defaults() into edit.php
  • Loading branch information...
1 parent ccbef0e commit 1a4f426bc769c3c1adc1558d1569b249af87236c ikawhero committed Jan 12, 2007
Showing with 17 additions and 10 deletions.
  1. +2 −1 user/edit.php
  2. +15 −9 user/edit_form.php
View
@@ -78,8 +78,9 @@
}
- $userform = new user_edit_form(null, compact('user','course', 'authplugin'));
+ $userform = new user_edit_form(null, compact('user','course','authplugin'));
$userform->set_upload_manager(new upload_manager('imagefile',false,false,null,false,0,true,true));
+ $userform->set_defaults($user);
/// If data submitted, then process and store.
if ($usernew = $userform->data_submitted()) {
View
@@ -168,7 +168,9 @@ function definition () {
$mform->addElement('select', 'ajax', get_string('ajaxuse'), $choices);
$mform->setType('ajax', PARAM_INT);
$mform->setDefault('ajax', 1);
- $mform->disabledIf('ajax', empty($CFG->enableajax), true);
+ if (empty($CFG->enableajax)) {
+ $mform->freeze('ajax');
+ }
$mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"');
$mform->setType('city', PARAM_MULTILANG);
@@ -268,7 +270,9 @@ function definition () {
$mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="64" size="25"');
$mform->setType('idnumber', PARAM_MULTILANG);
- $mform->disabledIf('idnumber', (!$userupdate), true);
+ if (!$userupdate) {
+ $mform->freeze('idnumber');
+ }
if ($userupdate) {
$mform->addElement('text', 'institution', get_string('institution'), 'maxlength="40" size="25"');
@@ -280,19 +284,21 @@ function definition () {
$mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
$mform->setType('phone1', PARAM_CLEAN);
- $mform->disabledIf('phone1', (!$userupdate), true);
+ if (!$userupdate) {
+ $mform->freeze('phone1');
+ }
$mform->addElement('text', 'phone2', get_string('phone'), 'maxlength="20" size="25"');
$mform->setType('phone2', PARAM_CLEAN);
- $mform->disabledIf('phone2', (!$userupdate), true);
+ if (!$userupdate) {
+ $mform->freeze('phone2');
+ }
$mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"');
$mform->setType('address', PARAM_MULTILANG);
- $mform->disabledIf('address', (!$userupdate), true);
-
-
- /// override the defaults with the user settings
- $this->set_defaults($user);
+ if (!$userupdate) {
+ $mform->freeze('address');
+ }
/// disable fields that are locked by auth plugins

0 comments on commit 1a4f426

Please sign in to comment.