Skip to content

Commit

Permalink
Tidying up the interface.
Browse files Browse the repository at this point in the history
Fixed default data bug in menu type.
  • Loading branch information
ikawhero committed Jan 12, 2007
1 parent 55526ee commit 253625c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
12 changes: 11 additions & 1 deletion user/profile/field/menu/field.class.php
Expand Up @@ -41,6 +41,7 @@ function validate_data($data) {
}

function save_data_preprocess($data) {

if (!isset($this->options[$data])) { /// validate_data should already have caught this
return '';
} else {
Expand All @@ -60,7 +61,9 @@ function edit_field_specific(&$form) {

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');
Expand All @@ -73,6 +76,13 @@ function edit_validate_specific($data) {
}
return $err;
}

function edit_save_preprocess($data) {
$data->param1 = str_replace("\r", '', $data->param1);

return $data;
}

}

?>
2 changes: 1 addition & 1 deletion user/profile/index.php
Expand Up @@ -172,7 +172,7 @@
} else {

if ($id == 0) {
$strheading = get_string('profilecreatenewfield', 'admin');
$strheading = get_string('profilecreatenewfield', 'admin', $datatypes[$type]);
} else {
$strheading = get_string('profileeditfield', 'admin', $field->name);
}
Expand Down
2 changes: 2 additions & 0 deletions user/profile/lib.php
Expand Up @@ -218,6 +218,8 @@ function edit_field_common (&$form) {
$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();
Expand Down

0 comments on commit 253625c

Please sign in to comment.