Index: lang/en_utf8/qtype_shortanswer.php =================================================================== RCS file: /cvsroot/moodle/moodle/lang/en_utf8/qtype_shortanswer.php,v retrieving revision 1.1.6.1 diff -u -r1.1.6.1 qtype_shortanswer.php --- lang/en_utf8/qtype_shortanswer.php 28 Aug 2008 01:46:47 -0000 1.1.6.1 +++ lang/en_utf8/qtype_shortanswer.php 10 Jan 2009 20:11:12 -0000 @@ -3,4 +3,5 @@ $string['answerno'] = 'Answer $a'; $string['filloutoneanswer'] = 'You must provide at least one possible answer. Answers left blank will not be used. \'*\' can be used as a wildcard to match any characters. The first matching answer will be used to determine the score and feedback.'; $string['answermustbegiven'] = 'You must enter an answer if there is a grade or feedback.'; +$string['answersinstruct'] = $string['filloutoneanswer']; ?> \ No newline at end of file Index: question/type/shortanswer/edit_shortanswer_form.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/type/shortanswer/edit_shortanswer_form.php,v retrieving revision 1.10.2.3 diff -u -r1.10.2.3 edit_shortanswer_form.php --- question/type/shortanswer/edit_shortanswer_form.php 28 Aug 2008 01:46:48 -0000 1.10.2.3 +++ question/type/shortanswer/edit_shortanswer_form.php 10 Jan 2009 19:40:32 -0000 @@ -19,16 +19,20 @@ * @param MoodleQuickForm $mform the form being built. */ function definition_inner(&$mform) { - $menu = array(get_string('caseno', 'quiz'), get_string('caseyes', 'quiz')); - $mform->addElement('select', 'usecase', get_string('casesensitive', 'quiz'), $menu); + + $this->definition_extra_fields(&$mform); + + $answersinstruct=get_string('answersinstruct', 'qtype_'.$this->qtype()); + if($answersinstruct!='[[answersinstruct]]') { + $mform->addElement('static', 'answersinstruct', get_string('correctanswers', 'quiz'), $answersinstruct); + $mform->closeHeaderBefore('answersinstruct'); + } - $mform->addElement('static', 'answersinstruct', get_string('correctanswers', 'quiz'), get_string('filloutoneanswer', 'quiz')); - $mform->closeHeaderBefore('answersinstruct'); $creategrades = get_grade_options(); $gradeoptions = $creategrades->gradeoptions; $repeated = array(); - $repeated[] =& $mform->createElement('header', 'answerhdr', get_string('answerno', 'qtype_shortanswer', '{no}')); + $repeated[] =& $mform->createElement('header', 'answerhdr', get_string('answerno', 'qtype_'.$this->qtype(), '{no}')); $repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'quiz'), array('size' => 54)); $repeated[] =& $mform->createElement('select', 'fraction', get_string('grade'), $gradeoptions); $repeated[] =& $mform->createElement('htmleditor', 'feedback', get_string('feedback', 'quiz'), @@ -48,10 +52,15 @@ $repeatedoptions = array(); $mform->setType('answer', PARAM_RAW); $repeatedoptions['fraction']['default'] = 0; - $this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions, 'noanswers', 'addanswers', QUESTION_NUMANS_ADD, get_string('addmoreanswerblanks', 'qtype_shortanswer')); + $this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions, 'noanswers', 'addanswers', QUESTION_NUMANS_ADD, get_string('addmoreanswerblanks', 'qtype_'.$this->qtype())); } + function definition_extra_fields(&$mform) { + $menu = array(get_string('caseno', 'quiz'), get_string('caseyes', 'quiz')); + $mform->addElement('select', 'usecase', get_string('casesensitive', 'quiz'), $menu); + } + function set_data($question) { if (isset($question->options)){ $answers = $question->options->answers; @@ -64,11 +73,16 @@ $key++; } } - $default_values['usecase'] = $question->options->usecase; + $this->set_data_extra_fields($question, &$default_values); $question = (object)((array)$question + $default_values); } parent::set_data($question); } + + function set_data_extra_fields($question, &$default_values) { + $default_values['usecase'] = $question->options->usecase; + } + function validation($data, $files) { $errors = parent::validation($data, $files); $answers = $data['answer'];