From 828a673d9deaafb47aa2613ba87cd1ff63ca2d3a Mon Sep 17 00:00:00 2001 From: skodak Date: Wed, 26 Nov 2008 09:05:04 +0000 Subject: [PATCH] MDL-15262 fixing previous incorrect merging --- course/edit_form.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/course/edit_form.php b/course/edit_form.php index 93d412ba94..627b9a0190 100644 --- a/course/edit_form.php +++ b/course/edit_form.php @@ -75,9 +75,16 @@ class course_edit_form extends moodleform { $mform->setDefault('category', $courseconfig->category); $mform->setType('category', PARAM_INT); - $mform->addElement('text','fullname', get_string('fullname'),'maxlength="254" size="50"'); - $mform->setHelpButton('fullname', array('coursefullname', get_string('fullname')), true); - $mform->setDefault('fullname', get_string('defaultcoursefullname')); + $fullname = get_string('defaultcoursefullname'); + $shortname = get_string('defaultcourseshortname'); + while ($DB->record_exists('course', array('fullname'=>$fullname)) + or $DB->record_exists('course', array('fullname'=>$fullname))) { + $fullname++; + $shortname++; + } + + $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)) { @@ -85,9 +92,10 @@ class course_edit_form extends moodleform { $mform->setConstant('fullname', $course->fullname); } - $mform->addElement('text','shortname', get_string('shortname'),'maxlength="100" size="20"'); - $mform->setHelpButton('shortname', array('courseshortname', get_string('shortname')), true); - $mform->setDefault('shortname', get_string('defaultcourseshortname')); + $mform->setDefault('fullname', $fullname); + + $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)) { @@ -95,6 +103,8 @@ class course_edit_form extends moodleform { $mform->setConstant('shortname', $course->shortname); } + $mform->setDefault('shortname', $shortname); + $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); -- 2.39.5