mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 08:55:15 +02:00
MDL-13794 - Reordering tool does not work if you type the same number into two boxes.
Also, fix some javascript that did not work in IE7.
This commit is contained in:
parent
54294d3b09
commit
758c50b1cd
@ -238,13 +238,21 @@
|
||||
$questions = array(); // for questions in the new order
|
||||
$rawgrades = $_POST;
|
||||
unset($quiz->grades);
|
||||
foreach ($rawgrades as $key => $value) { // Parse input for question -> grades
|
||||
foreach ($rawgrades as $key => $value) {
|
||||
/// Parse input for question -> grades
|
||||
if (preg_match('!^q([0-9]+)$!', $key, $matches)) {
|
||||
$key = $matches[1];
|
||||
$quiz->grades[$key] = $value;
|
||||
quiz_update_question_instance($quiz->grades[$key], $key, $quiz->instance);
|
||||
} elseif (preg_match('!^o([0-9]+)$!', $key, $matches)) { // Parse input for ordering info
|
||||
|
||||
/// Parse input for ordering info
|
||||
} elseif (preg_match('!^o([0-9]+)$!', $key, $matches)) {
|
||||
$key = $matches[1];
|
||||
// Make sure two questions don't overwrite each other. If we get a second
|
||||
// question with the same position, shift the second one along to the next gap.
|
||||
while (array_key_exists($value, $questions)) {
|
||||
$value++;
|
||||
}
|
||||
$questions[$value] = $oldquestions[$key];
|
||||
}
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete=true, $showbreak
|
||||
if ($showbreaks) {
|
||||
echo ' checked="checked"';
|
||||
}
|
||||
echo ' onchange="getElementById(\'showbreaks\').submit(); return true;" />';
|
||||
echo ' onclick="form.submit(); return true;" />';
|
||||
print_string('showbreaks', 'quiz');
|
||||
|
||||
if ($showbreaks) {
|
||||
@ -350,7 +350,7 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete=true, $showbreak
|
||||
if ($reordertool) {
|
||||
echo ' checked="checked"';
|
||||
}
|
||||
echo ' onchange="getElementById(\'showbreaks\').submit(); return true;" />';
|
||||
echo ' onclick="form.submit(); return true;" />';
|
||||
print_string('reordertool', 'quiz');
|
||||
echo ' ';
|
||||
helpbutton('reorderingtool', get_string('reordertool', 'quiz'), 'quiz');
|
||||
|
Loading…
x
Reference in New Issue
Block a user