workaround for Bug #6035 - editing quiz in one tab changes quiz in other

This commit is contained in:
skodak
2006-07-11 13:00:34 +00:00
parent 76f8821cfc
commit b515688ddb
3 changed files with 12 additions and 7 deletions
+4
View File
@@ -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
+7 -6
View File
@@ -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&amp;sesskey=$USER->sesskey\"><img
echo "<a title=\"$strmoveup\" href=\"edit.php?up=$count&amp;quizid=$quiz->id&amp;sesskey=$USER->sesskey\"><img
src=\"$CFG->pixpath/t/up.gif\" border=\"0\" alt=\"$strmoveup\" /></a>";
}
echo '&nbsp;';
if ($count < $lastindex) {
echo "<a title=\"$strmovedown\" href=\"edit.php?down=$count&amp;sesskey=$USER->sesskey\"><img
echo "<a title=\"$strmovedown\" href=\"edit.php?down=$count&amp;quizid=$quiz->id&amp;sesskey=$USER->sesskey\"><img
src=\"$CFG->pixpath/t/down.gif\" border=\"0\" alt=\"$strmovedown\" /></a>";
echo "<a title=\"$strremove\" href=\"edit.php?delete=$count&amp;sesskey=$USER->sesskey\">
echo "<a title=\"$strremove\" href=\"edit.php?delete=$count&amp;quizid=$quiz->id&amp;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&amp;sesskey=$USER->sesskey\"><img
echo "<a title=\"$strmoveup\" href=\"edit.php?up=$count&amp;quizid=$quiz->id&amp;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&amp;sesskey=$USER->sesskey\"><img
echo "<a title=\"$strmovedown\" href=\"edit.php?down=$count&amp;quizid=$quiz->id&amp;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&amp;sesskey=$USER->sesskey\">
echo "<a title=\"$strremove\" href=\"edit.php?delete=$count&amp;quizid=$quiz->id&amp;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";
+1 -1
View File
@@ -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&amp;sesskey=$USER->sesskey\"><img
echo "<a title=\"$straddtoquiz\" href=\"edit.php?addquestion=$question->id&amp;quizid=$quizid&amp;sesskey=$USER->sesskey\"><img
src=\"$CFG->pixpath/t/moveleft.gif\" border=\"0\" alt=\"$straddtoquiz\" /></a>&nbsp;";
}
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