Index: course/moodleform_mod.php =================================================================== RCS file: /cvsroot/moodle/moodle/course/moodleform_mod.php,v retrieving revision 1.79 diff -u -r1.79 moodleform_mod.php --- course/moodleform_mod.php 21 Sep 2010 08:13:12 -0000 1.79 +++ course/moodleform_mod.php 8 Oct 2010 06:22:44 -0000 @@ -468,7 +468,7 @@ $count = 1; } - $this->repeat_elements(array($group), $count, array(), 'conditiongraderepeats', 'conditiongradeadds', 2, + $this->repeat_elements(array($group), $count, array(), 'conditiongrade', 2, get_string('addgrades', 'condition'), true); $mform->addHelpButton('conditiongradegroup[0]', 'gradecondition', 'condition'); @@ -502,7 +502,7 @@ $count = empty($this->_cm) ? 1 : count($this->_cm->conditionscompletion)+1; $this->repeat_elements(array($group),$count,array(), - 'conditioncompletionrepeats','conditioncompletionadds',2, + 'conditioncompletion',2, get_string('addcompletions','condition'),true); $mform->addHelpButton('conditioncompletiongroup[0]', 'completioncondition', 'condition'); } Index: lib/formslib.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/formslib.php,v retrieving revision 1.227 diff -u -r1.227 formslib.php --- lib/formslib.php 21 Sep 2010 08:07:46 -0000 1.227 +++ lib/formslib.php 8 Oct 2010 20:33:39 -0000 @@ -852,20 +852,20 @@ * 'helpbutton' - helpbutton params array is value * 'disabledif' - last three moodleform::disabledIf() * params are value as an array - * @param string $repeathiddenname name for hidden element storing no of repeats in this form - * @param string $addfieldsname name for button to add more fields + * @param string $prefix prefix for additional form elements, added by the repeat_elements function * @param int $addfieldsno how many fields to add at a time * @param string $addstring name of button, {no} is replaced by no of blanks that will be added. * @param boolean $addbuttoninside if true, don't call closeHeaderBefore($addfieldsname). Default false. * @return int no of repeats of element in this page */ - function repeat_elements($elementobjs, $repeats, $options, $repeathiddenname, - $addfieldsname, $addfieldsno=5, $addstring=null, $addbuttoninside=false){ + function repeat_elements($elementobjs, $repeats, $options, $prefix, $addfieldsno=5, $addstring=null, $addbuttoninside=false){ if ($addstring===null){ $addstring = get_string('addfields', 'form', $addfieldsno); } else { $addstring = str_ireplace('{no}', $addfieldsno, $addstring); } + $repeathiddenname = $prefix.'_repeats'; + $addfieldsname = $prefix.'_add_button'; $repeats = optional_param($repeathiddenname, $repeats, PARAM_INT); $addfields = optional_param($addfieldsname, '', PARAM_TEXT); if (!empty($addfields)){ Index: mod/choice/mod_form.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/choice/mod_form.php,v retrieving revision 1.39 diff -u -r1.39 mod_form.php --- mod/choice/mod_form.php 2 Sep 2010 18:29:40 -0000 1.39 +++ mod/choice/mod_form.php 8 Oct 2010 06:22:16 -0000 @@ -57,7 +57,7 @@ $mform->setType('optionid', PARAM_INT); $this->repeat_elements($repeatarray, $repeatno, - $repeateloptions, 'option_repeats', 'option_add_fields', 3); + $repeateloptions, 'option', 3); Index: mod/quiz/mod_form.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/mod_form.php,v retrieving revision 1.59 diff -u -r1.59 mod_form.php --- mod/quiz/mod_form.php 2 Sep 2010 18:29:40 -0000 1.59 +++ mod/quiz/mod_form.php 8 Oct 2010 06:22:02 -0000 @@ -309,7 +309,7 @@ $numfeedbacks = max(count($this->_feedbacks) * 1.5, 5); $nextel=$this->repeat_elements($repeatarray, $numfeedbacks - 1, - array(), 'boundary_repeats', 'boundary_add_fields', 3, + array(), 'boundary', 3, get_string('addmoreoverallfeedbacks', 'quiz'), true); // Put some extra elements in before the button Index: question/type/edit_question_form.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/type/edit_question_form.php,v retrieving revision 1.35 diff -u -r1.35 edit_question_form.php --- question/type/edit_question_form.php 21 Sep 2010 08:20:48 -0000 1.35 +++ question/type/edit_question_form.php 8 Oct 2010 06:21:59 -0000 @@ -316,7 +316,7 @@ $repeatsatstart = $countanswers; } - $this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions, 'noanswers', 'addanswers', $addoptions, get_string('addmorechoiceblanks', 'qtype_multichoice')); + $this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions, 'answers', $addoptions, get_string('addmorechoiceblanks', 'qtype_multichoice')); } function set_data($question) { Index: question/type/numerical/questiontype.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/type/numerical/questiontype.php,v retrieving revision 1.66 diff -u -r1.66 questiontype.php --- question/type/numerical/questiontype.php 2 Oct 2010 01:59:17 -0000 1.66 +++ question/type/numerical/questiontype.php 8 Oct 2010 06:21:55 -0000 @@ -1035,7 +1035,7 @@ } else { $repeatsatstart = $countunits; } - $that->repeat_elements($repeated, $repeatsatstart, array(), 'nounits', 'addunits', 2, get_string('addmoreunitblanks', 'qtype_calculated', '{no}')); + $that->repeat_elements($repeated, $repeatsatstart, array(), 'units', 2, get_string('addmoreunitblanks', 'qtype_calculated', '{no}')); if ($mform->elementExists('multiplier[0]')){ $firstunit =& $mform->getElement('multiplier[0]');