From e9a2711b855ddc02001fb5effb418fe36816992c Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Wed, 22 May 2013 14:02:38 +0100 Subject: [PATCH] MDL-47494 ddimageortext: Final form improvement tweaks. #6614 --- .../ddimageortext/edit_ddimageortext_form.php | 2 +- .../ddimageortext/edit_ddtoimage_form_base.php | 17 +++++++++-------- .../lang/en/qtype_ddimageortext.php | 3 +-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/question/type/ddimageortext/edit_ddimageortext_form.php b/question/type/ddimageortext/edit_ddimageortext_form.php index 83c1c43741813..adfe694fe73fd 100644 --- a/question/type/ddimageortext/edit_ddimageortext_form.php +++ b/question/type/ddimageortext/edit_ddimageortext_form.php @@ -131,7 +131,7 @@ protected function definition_draggable_items($mform, $itemrepeatsatstart) { $mform->addElement('header', 'draggableitemheader', get_string('draggableitems', 'qtype_ddimageortext')); $mform->addElement('advcheckbox', 'shuffleanswers', ' ', - get_string('shuffleimages', 'qtype_'.$this->qtype())); + get_string('shuffleimages', 'qtype_'.$this->qtype())); $mform->setDefault('shuffleanswers', 0); $this->repeat_elements($this->draggable_item($mform), $itemrepeatsatstart, $this->draggable_items_repeated_options(), diff --git a/question/type/ddimageortext/edit_ddtoimage_form_base.php b/question/type/ddimageortext/edit_ddtoimage_form_base.php index 099ec22a5aadf..c7ece0f71eead 100644 --- a/question/type/ddimageortext/edit_ddtoimage_form_base.php +++ b/question/type/ddimageortext/edit_ddtoimage_form_base.php @@ -51,14 +51,14 @@ public static function file_picker_options() { /** * definition_inner adds all specific fields to the form. - * @param object $mform (the form being built). + * @param MoodleQuickForm $mform (the form being built). */ protected function definition_inner($mform) { $mform->addElement('header', 'previewareaheader', get_string('previewareaheader', 'qtype_'.$this->qtype())); - $mform->addElement('static', 'previewarea', - get_string('previewarea', 'qtype_'.$this->qtype()), + $mform->setExpanded('previewareaheader'); + $mform->addElement('static', 'previewarea', '', get_string('previewareamessage', 'qtype_'.$this->qtype())); $mform->registerNoSubmitButton('refresh'); @@ -102,7 +102,7 @@ abstract protected function drop_zone($mform, $imagerepeats); abstract protected function drop_zones_repeated_options(); - abstract protected function definition_draggable_items($mform, $itemrepeatsatstart) ; + abstract protected function definition_draggable_items($mform, $itemrepeatsatstart); abstract protected function draggable_item($mform); @@ -115,11 +115,12 @@ protected function get_drag_item_repeats() { $countimages = max($countimages, $drag->no); } } - if ($this->question->formoptions->repeatelements) { - $itemrepeatsatstart = max(self::START_NUM_ITEMS, $countimages + self::ADD_NUM_ITEMS); - } else { - $itemrepeatsatstart = $countimages; + + if (!$countimages) { + $countimages = self::START_NUM_ITEMS; } + $itemrepeatsatstart = $countimages; + $imagerepeats = optional_param('noitems', $itemrepeatsatstart, PARAM_INT); $addfields = optional_param('additems', '', PARAM_TEXT); if (!empty($addfields)) { diff --git a/question/type/ddimageortext/lang/en/qtype_ddimageortext.php b/question/type/ddimageortext/lang/en/qtype_ddimageortext.php index 1ee1492e5aa74..a79053031db8d 100644 --- a/question/type/ddimageortext/lang/en/qtype_ddimageortext.php +++ b/question/type/ddimageortext/lang/en/qtype_ddimageortext.php @@ -58,8 +58,7 @@ $string['pluginnameadding'] = 'Adding drag and drop onto image'; $string['pluginnameediting'] = 'Editing drag and drop onto image'; $string['pluginnamesummary'] = 'Images or text labels are dragged and dropped into drop zones on a background image.'; -$string['previewarea'] = ''; -$string['previewareaheader'] = 'Background image'; +$string['previewareaheader'] = 'Preview'; $string['previewareamessage'] = 'Select a background image file and select draggable images or just enter text that will be made draggable. Then choose a drag item for each \'drop zone\', and drag the drag item to where the student should drag it to.'; $string['refresh'] = 'Refresh preview'; $string['shuffleimages'] = 'Shuffle drag items each time question is attempted';