MDL-15262 using hardFreeze instead of static, because we need this info to b returned from form; the new change* caps are not in effect when adding new courses - merged from MOODLE_19_STABLE + fixed regression in coursename/shortname automatic numbering

This commit is contained in:
skodak
2008-10-08 20:56:38 +00:00
parent cd7f72c0b6
commit 01bc9ff156
+18 -21
View File
@@ -83,34 +83,31 @@ class course_edit_form extends moodleform {
$shortname++;
}
if (has_capability('moodle/course:changefullname', $coursecontext)) {
$mform->addElement('text','fullname', get_string('fullnamecourse'),'maxlength="254" size="50"');
$mform->setHelpButton('fullname', array('coursefullname', get_string('fullnamecourse')), true);
$mform->addRule('fullname', get_string('missingfullname'), 'required', null, 'client');
$mform->setType('fullname', PARAM_MULTILANG);
} else {
$mform->addElement('static','fullname', get_string('fullname'), $fullname);
$mform->addElement('text','fullname', get_string('fullnamecourse'),'maxlength="254" size="50"');
$mform->setHelpButton('fullname', array('coursefullname', get_string('fullnamecourse')), true);
$mform->addRule('fullname', get_string('missingfullname'), 'required', null, 'client');
$mform->setType('fullname', PARAM_MULTILANG);
if ($course and !has_capability('moodle/course:changefullname', $coursecontext)) {
$mform->hardFreeze('fullname');
}
$mform->setDefault('fullname', $fullname);
if (has_capability('moodle/course:changeshortname', $coursecontext)) {
$mform->addElement('text','shortname', get_string('shortnamecourse'),'maxlength="100" size="20"');
$mform->setHelpButton('shortname', array('courseshortname', get_string('shortnamecourse')), true);
$mform->addRule('shortname', get_string('missingshortname'), 'required', null, 'client');
$mform->setType('shortname', PARAM_MULTILANG);
} else {
$mform->addElement('static','shortname', get_string('shortname'), get_string('defaultcourseshortname'));
$mform->addElement('text','shortname', get_string('shortnamecourse'),'maxlength="100" size="20"');
$mform->setHelpButton('shortname', array('courseshortname', get_string('shortnamecourse')), true);
$mform->addRule('shortname', get_string('missingshortname'), 'required', null, 'client');
$mform->setType('shortname', PARAM_MULTILANG);
if ($course and !has_capability('moodle/course:changeshortname', $coursecontext)) {
$mform->hardFreeze('shortname');
}
$mform->setDefault('shortname', get_string('defaultcourseshortname'));
$mform->setDefault('shortname', $shortname);
if (has_capability('moodle/course:changeidnumber', $coursecontext)) {
$mform->addElement('text','idnumber', get_string('idnumbercourse'),'maxlength="100" size="10"');
$mform->setHelpButton('idnumber', array('courseidnumber', get_string('idnumbercourse')), true);
$mform->setType('idnumber', PARAM_RAW);
} else {
$mform->addElement('static','idnumber', get_string('idnumber'));
$mform->addElement('text','idnumber', get_string('idnumbercourse'),'maxlength="100" size="10"');
$mform->setHelpButton('idnumber', array('courseidnumber', get_string('idnumbercourse')), true);
$mform->setType('idnumber', PARAM_RAW);
if ($course and !has_capability('moodle/course:changeidnumber', $coursecontext)) {
$mform->hardFreeze('idnumber');
}
$mform->addElement('htmleditor','summary', get_string('summary'), array('rows'=> '10', 'cols'=>'65'));