MDL-5811 - Quiz editing outputs nasty junk before print_header sometimes. Second attempt at fixing. I forgot to mention the bug number in the previous commit to mod/quiz/edit.php. Backported from MOODLE_17_STABLE.
This commit is contained in:
@@ -38,15 +38,6 @@
|
||||
$streditingquestions = get_string('editquestions', "quiz");
|
||||
$streditingquiz = get_string("editinga", "moodle", $strquiz);
|
||||
|
||||
// We might get here after editing a question in a popup window.
|
||||
// In which case we will want to close the window automatically.
|
||||
//
|
||||
// Unfortunately, we can only detect this condition at the top of
|
||||
// this file, but we should only output the JavaScript after print_header,
|
||||
// which has to happen lower down the file. Therefore, we cache
|
||||
// any necessary JavaScript in this variable.
|
||||
$scripttooutputafterprint_header = '';
|
||||
|
||||
if ($modform = data_submitted() and !empty($modform->course)) { // data submitted
|
||||
|
||||
$SESSION->modform = $modform; // Save the form in the current session
|
||||
@@ -79,17 +70,6 @@
|
||||
error('cmunknown');
|
||||
}
|
||||
} else {
|
||||
$scripttooutputafterprint_header = '<script type="text/javascript">
|
||||
<!--
|
||||
if (self.name == "editquestion") {
|
||||
self.close();
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
<noscript>
|
||||
' . notify(get_string('pleaseclose', 'quiz'), 'notifyproblem', 'center', true) . '
|
||||
</noscript>
|
||||
';
|
||||
// no quiz or course was specified so we need to use the stored modform
|
||||
if (isset($SESSION->modform)) {
|
||||
$modform = $SESSION->modform;
|
||||
@@ -319,7 +299,6 @@ if (self.name == "editquestion") {
|
||||
" -> <a href=\"view.php?q=$modform->instance\">".format_string($modform->name).'</a>'.
|
||||
" -> $streditingquiz", "", "",
|
||||
true, $strupdatemodule);
|
||||
echo $scripttooutputafterprint_header;
|
||||
|
||||
$currenttab = 'edit';
|
||||
$mode = 'editq';
|
||||
@@ -357,7 +336,6 @@ if (self.name == "editquestion") {
|
||||
" -> <a href=\"view.php?q=$modform->instance\">".format_string($modform->name).'</a>'.
|
||||
" -> $streditingquiz",
|
||||
"", "", true, $strupdatemodule);
|
||||
echo $scripttooutputafterprint_header;
|
||||
|
||||
$currenttab = 'edit';
|
||||
$mode = 'editq';
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
$qtype = optional_param('qtype', '', PARAM_FILE);
|
||||
$category = optional_param('category', 0, PARAM_INT);
|
||||
|
||||
$inpopup = optional_param('inpopup', 0, PARAM_BOOL);
|
||||
|
||||
$CFG->pagepath = 'question/type/'.$qtype;
|
||||
|
||||
@@ -252,7 +252,14 @@
|
||||
// $QTYPES[$question->qtype]->get_question_options($question);
|
||||
// quiz_regrade_question_in_quizzes($question, $replaceinquiz);
|
||||
//}
|
||||
redirect($SESSION->returnurl);
|
||||
|
||||
$strsaved = get_string('changessaved');
|
||||
if ($inpopup) {
|
||||
notify($strsaved, '');
|
||||
close_window(3);
|
||||
} else {
|
||||
redirect($SESSION->returnurl, $strsaved);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -463,7 +463,7 @@ class default_questiontype {
|
||||
if (isteacheredit($cmoptions->course)) {
|
||||
$stredit = get_string('edit');
|
||||
$linktext = '<img src="'.$CFG->pixpath.'/t/edit.gif" border="0" alt="'.$stredit.'" />';
|
||||
$editlink = link_to_popup_window('/question/question.php?id='.$question->id, $stredit, $linktext, 450, 550, $stredit, '', true);
|
||||
$editlink = link_to_popup_window('/question/question.php?inpopup=1&id='.$question->id, 'editquestion', $linktext, 450, 550, $stredit, '', true);
|
||||
}
|
||||
|
||||
$grade = '';
|
||||
@@ -999,7 +999,8 @@ class default_questiontype {
|
||||
echo '<input type="submit" name="cancel" value="'.get_string("cancel").'" />
|
||||
<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />
|
||||
<input type="hidden" name="id" value="'.$question->id.'" />
|
||||
<input type="hidden" name="qtype" value="'.$question->qtype.'" />';
|
||||
<input type="hidden" name="qtype" value="'.$question->qtype.'" />
|
||||
<input type="hidden" name="inpopup" value="'.optional_param('inpopup', 0, PARAM_INT).'" />';
|
||||
// The following hidden field indicates that the versioning code should be turned on, i.e.,
|
||||
// that old versions should be kept if necessary
|
||||
echo '<input type="hidden" name="versioning" value="on" />
|
||||
|
||||
Reference in New Issue
Block a user