MDL-22548, hide main file element completely

This commit is contained in:
Dongsheng Cai 2010-05-26 07:09:02 +00:00
parent 1daea7fa49
commit ac9c14dd29
4 changed files with 23 additions and 13 deletions

View file

@ -71,3 +71,4 @@ $string['resourceadministration'] = 'Resource administration';
$string['resourcecontent'] = 'Files and subfolders';
$string['resource:exportresource'] = 'Export resource';
$string['resource:view'] = 'View resource';
$string['selectmainfile'] = 'Please select the main file by clicking the icon next to file name.';

View file

@ -72,8 +72,7 @@ class mod_resource_mod_form extends moodleform_mod {
$mform->addElement('filemanager', 'files', get_string('selectfiles'), null, $filemanager_options);
//TODO: ohlala, it should be hidden when JS file manager loaded, the main file should be somehow highlighted directly in editor
$mform->addElement('text', 'mainfile', get_string('areamainfile', 'repository'));
$mform->addElement('hidden', 'mainfile', get_string('areamainfile', 'repository'), array('id'=>'id_mainfile'));
$mform->setType('mainfile', PARAM_PATH);
//-------------------------------------------------------
@ -211,9 +210,8 @@ class mod_resource_mod_form extends moodleform_mod {
$filepaths[] = $file->get_filepath().$file->get_filename();
}
if (!in_array($data['mainfile'], $filepaths)) {
$errors['mainfile'] = 'Please type correct main file path'; //TODO: will not be needed, do NOT localize!
$errors['files'] = get_string('selectmainfile', 'resource');
}
return $errors;
}
}