workaround for Bug #6035 - editing quiz in one tab changes quiz in other
This commit is contained in:
@@ -236,6 +236,10 @@ if (self.name == 'editquestion') {
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['savechanges']) and confirm_sesskey()) {
|
||||
$savequizid = required_param('savequizid', PARAM_INT);
|
||||
if ($modform->id != $savequizid) {
|
||||
error("Error saving quiz settings, please do not change two quizes from the same browser", $CFG->wwwroot.'/mod/quiz/edit.php?quizid='.$savequizid);
|
||||
}
|
||||
/// We need to save the new ordering (if given) and the new grades
|
||||
$oldquestions = explode(",", $modform->questions); // the questions in the old order
|
||||
$questions = array(); // for questions in the new order
|
||||
|
||||
@@ -211,15 +211,15 @@ function quiz_print_question_list($quiz, $allowdelete=true, $showbreaks=true, $r
|
||||
echo '<td width="50">Page break</td>';
|
||||
echo '<td><hr noshade="noshade" /></td><td width="45">';
|
||||
if ($count > 1) {
|
||||
echo "<a title=\"$strmoveup\" href=\"edit.php?up=$count&sesskey=$USER->sesskey\"><img
|
||||
echo "<a title=\"$strmoveup\" href=\"edit.php?up=$count&quizid=$quiz->id&sesskey=$USER->sesskey\"><img
|
||||
src=\"$CFG->pixpath/t/up.gif\" border=\"0\" alt=\"$strmoveup\" /></a>";
|
||||
}
|
||||
echo ' ';
|
||||
if ($count < $lastindex) {
|
||||
echo "<a title=\"$strmovedown\" href=\"edit.php?down=$count&sesskey=$USER->sesskey\"><img
|
||||
echo "<a title=\"$strmovedown\" href=\"edit.php?down=$count&quizid=$quiz->id&sesskey=$USER->sesskey\"><img
|
||||
src=\"$CFG->pixpath/t/down.gif\" border=\"0\" alt=\"$strmovedown\" /></a>";
|
||||
|
||||
echo "<a title=\"$strremove\" href=\"edit.php?delete=$count&sesskey=$USER->sesskey\">
|
||||
echo "<a title=\"$strremove\" href=\"edit.php?delete=$count&quizid=$quiz->id&sesskey=$USER->sesskey\">
|
||||
<img src=\"$CFG->pixpath/t/delete.gif\" border=\"0\" alt=\"$strremove\" /></a>";
|
||||
}
|
||||
echo '</td></tr></table></td>';
|
||||
@@ -233,13 +233,13 @@ function quiz_print_question_list($quiz, $allowdelete=true, $showbreaks=true, $r
|
||||
|
||||
echo "<td>";
|
||||
if ($count != 0) {
|
||||
echo "<a title=\"$strmoveup\" href=\"edit.php?up=$count&sesskey=$USER->sesskey\"><img
|
||||
echo "<a title=\"$strmoveup\" href=\"edit.php?up=$count&quizid=$quiz->id&sesskey=$USER->sesskey\"><img
|
||||
src=\"$CFG->pixpath/t/up.gif\" border=\"0\" alt=\"$strmoveup\" /></a>";
|
||||
}
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
if ($count < $lastindex-1) {
|
||||
echo "<a title=\"$strmovedown\" href=\"edit.php?down=$count&sesskey=$USER->sesskey\"><img
|
||||
echo "<a title=\"$strmovedown\" href=\"edit.php?down=$count&quizid=$quiz->id&sesskey=$USER->sesskey\"><img
|
||||
src=\"$CFG->pixpath/t/down.gif\" border=\"0\" alt=\"$strmovedown\" /></a>";
|
||||
}
|
||||
echo "</td>";
|
||||
@@ -274,7 +274,7 @@ function quiz_print_question_list($quiz, $allowdelete=true, $showbreaks=true, $r
|
||||
<img src=\"$CFG->pixpath/t/edit.gif\" border=\"0\" alt=\"$stredit\" /></a>";
|
||||
}
|
||||
if ($allowdelete) {
|
||||
echo "<a title=\"$strremove\" href=\"edit.php?delete=$count&sesskey=$USER->sesskey\">
|
||||
echo "<a title=\"$strremove\" href=\"edit.php?delete=$count&quizid=$quiz->id&sesskey=$USER->sesskey\">
|
||||
<img src=\"$CFG->pixpath/t/removeright.gif\" border=\"0\" alt=\"$strremove\" /></a>";
|
||||
}
|
||||
|
||||
@@ -300,6 +300,7 @@ function quiz_print_question_list($quiz, $allowdelete=true, $showbreaks=true, $r
|
||||
|
||||
echo '<div align="center"><input type="submit" value="'.get_string('savechanges').'" />';
|
||||
echo '<input type="hidden" name="savechanges" value="save" /></div>';
|
||||
echo '<input type="hidden" name="savequizid" value="'.$quiz->id.'" /></div>'; // ugly hack to prevent modform session "mistakes"
|
||||
|
||||
print_simple_box_end();
|
||||
echo "</form>\n";
|
||||
|
||||
@@ -336,7 +336,7 @@ function question_list($course, $categoryid, $quizid=0,
|
||||
foreach ($questions as $question) {
|
||||
echo "<tr>\n<td nowrap=\"nowrap\">\n";
|
||||
if ($quizid) {
|
||||
echo "<a title=\"$straddtoquiz\" href=\"edit.php?addquestion=$question->id&sesskey=$USER->sesskey\"><img
|
||||
echo "<a title=\"$straddtoquiz\" href=\"edit.php?addquestion=$question->id&quizid=$quizid&sesskey=$USER->sesskey\"><img
|
||||
src=\"$CFG->pixpath/t/moveleft.gif\" border=\"0\" alt=\"$straddtoquiz\" /></a> ";
|
||||
}
|
||||
echo "<a title=\"$strpreview\" href=\"javascript:void();\" onClick=\"openpopup('/question/preview.php?id=$question->id&quizid=$quizid','$strpreview','scrollbars=yes,resizable=yes,width=700,height=480', false)\"><img
|
||||
|
||||
Reference in New Issue
Block a user