From: ikawhero Date: Fri, 12 Jan 2007 12:58:15 +0000 (+0000) Subject: Tidying up the interface. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=253625c5e37fa33fc0e72dd2499e9613943b24ce;p=moodle.git Tidying up the interface. Fixed default data bug in menu type. --- diff --git a/user/profile/field/menu/field.class.php b/user/profile/field/menu/field.class.php index ca9733b896..584e083e6d 100644 --- a/user/profile/field/menu/field.class.php +++ b/user/profile/field/menu/field.class.php @@ -41,6 +41,7 @@ class profile_field_menu extends profile_field_base { } function save_data_preprocess($data) { + if (!isset($this->options[$data])) { /// validate_data should already have caught this return ''; } else { @@ -60,7 +61,9 @@ class profile_field_menu extends profile_field_base { function edit_validate_specific($data) { $err = array(); - + + $data->param1 = str_replace("\r", '', $data->param1); + /// Check that we have at least 2 options if (($options = explode("\n", $data->param1)) === false) { $err['param1'] = get_string('profilemenunooptions', 'admin'); @@ -73,6 +76,13 @@ class profile_field_menu extends profile_field_base { } return $err; } + + function edit_save_preprocess($data) { + $data->param1 = str_replace("\r", '', $data->param1); + + return $data; + } + } ?> diff --git a/user/profile/index.php b/user/profile/index.php index 98f45f6cbc..3251a39300 100644 --- a/user/profile/index.php +++ b/user/profile/index.php @@ -172,7 +172,7 @@ if ( ($action == 'editcategory' )) { } else { if ($id == 0) { - $strheading = get_string('profilecreatenewfield', 'admin'); + $strheading = get_string('profilecreatenewfield', 'admin', $datatypes[$type]); } else { $strheading = get_string('profileeditfield', 'admin', $field->name); } diff --git a/user/profile/lib.php b/user/profile/lib.php index dff24522c2..e3e7e420bb 100644 --- a/user/profile/lib.php +++ b/user/profile/lib.php @@ -218,6 +218,8 @@ class profile_field_base { $choices[2] = get_string('profilevisibleall', 'admin'); $form->addElement('select', 'visible', get_string('profilevisible', 'admin'), $choices); $form->setType('visible', PARAM_INT); + $form->setDefault('visible', 2); + $form->setHelpButton('visible', array('profilevisible', get_string('profilevisible','admin'))); unset($choices); $choices = profile_list_categories();