mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-9565 - Question preview links don't work in developer debug mode, and not XHTML strict. Merged from OU Moodle.
This commit is contained in:
parent
9cb2c25061
commit
443768b8aa
6 changed files with 28 additions and 26 deletions
|
@ -76,7 +76,7 @@ define("QUESTION_NUMANS_ADD", 3);
|
||||||
/**
|
/**
|
||||||
* The options used when popping up a question preview window in Javascript.
|
* The options used when popping up a question preview window in Javascript.
|
||||||
*/
|
*/
|
||||||
define('QUESTION_PREVIEW_POPUP_OPTIONS', "'scrollbars=yes,resizable=yes,width=700,height=540'");
|
define('QUESTION_PREVIEW_POPUP_OPTIONS', 'scrollbars=yes,resizable=yes,width=700,height=540');
|
||||||
|
|
||||||
/**#@+
|
/**#@+
|
||||||
* Option flags for ->optionflags
|
* Option flags for ->optionflags
|
||||||
|
|
|
@ -275,11 +275,8 @@ function quiz_print_question_list($quiz, $allowdelete=true, $showbreaks=true, $r
|
||||||
echo '</td><td align="center">';
|
echo '</td><td align="center">';
|
||||||
|
|
||||||
$context = $quiz->id ? '&contextquiz='.$quiz->id : '';
|
$context = $quiz->id ? '&contextquiz='.$quiz->id : '';
|
||||||
$quiz_id = $quiz->id ? '&quizid=' . $quiz->id : '';
|
|
||||||
if ($question->qtype != 'random') {
|
if ($question->qtype != 'random') {
|
||||||
echo "<a title=\"$strpreview\" href=\"javascript:void(0)\" onclick=\"openpopup('/question/preview.php?id=$qnum$quiz_id','questionpreview', " .
|
quiz_question_preview_button($quiz, $question);
|
||||||
QUESTION_PREVIEW_POPUP_OPTIONS . ", false)\">
|
|
||||||
<img src=\"$CFG->pixpath/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" /></a>";
|
|
||||||
}
|
}
|
||||||
if ($canedit) {
|
if ($canedit) {
|
||||||
echo "<a title=\"$stredit\" href=\"$CFG->wwwroot/question/question.php?id=$qnum$context\">
|
echo "<a title=\"$stredit\" href=\"$CFG->wwwroot/question/question.php?id=$qnum$context\">
|
||||||
|
|
|
@ -600,19 +600,19 @@ function quiz_upgrade_states($attempt) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ULPGc ecastro
|
/**
|
||||||
function quiz_get_question_review($quiz, $question) {
|
* @param object $quiz the quiz
|
||||||
// returns a question icon
|
* @param object $question the question
|
||||||
$qnum = $question->id;
|
* @return the HTML for a preview question icon.
|
||||||
|
*/
|
||||||
|
function quiz_question_preview_button($quiz, $question) {
|
||||||
|
global $CFG;
|
||||||
$strpreview = get_string('previewquestion', 'quiz');
|
$strpreview = get_string('previewquestion', 'quiz');
|
||||||
$context = $quiz->id ? '&contextquiz='.$quiz->id : '';
|
return link_to_popup_window('/question/preview.php?id=' . $question->id . '&quizid=' . $quiz->id, 'questionpreview',
|
||||||
$quiz_id = $quiz->id ? '&quizid=' . $quiz->id : '';
|
"<img src=\"$CFG->pixpath/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" />",
|
||||||
return "<a title=\"$strpreview\" href=\"javascript:void(0)\" onclick=\"openpopup('/question/preview.php?id=$qnum$quiz_id','questionpreview', " .
|
0, 0, $strpreview, QUESTION_PREVIEW_POPUP_OPTIONS, true);
|
||||||
QUESTION_PREVIEW_POPUP_OPTIONS . ", false)\">
|
|
||||||
<img src=\"../../pix/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" /></a>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine render options
|
* Determine render options
|
||||||
*
|
*
|
||||||
|
|
|
@ -312,7 +312,7 @@ class quiz_report extends quiz_default_report {
|
||||||
$qnumber = " (".link_to_popup_window('/question/question.php?id='.$qid,'editquestion', $qid, 450, 550, get_string('edit'), 'none', true ).") ";
|
$qnumber = " (".link_to_popup_window('/question/question.php?id='.$qid,'editquestion', $qid, 450, 550, get_string('edit'), 'none', true ).") ";
|
||||||
$qname = '<div class="qname">'.format_text($question->name." : ", $question->questiontextformat, $format_options, $quiz->course).'</div>';
|
$qname = '<div class="qname">'.format_text($question->name." : ", $question->questiontextformat, $format_options, $quiz->course).'</div>';
|
||||||
$qicon = print_question_icon($question, true);
|
$qicon = print_question_icon($question, true);
|
||||||
$qreview = quiz_get_question_review($quiz, $question);
|
$qreview = quiz_question_preview_button($quiz, $question);
|
||||||
$qtext = format_text($question->questiontext, $question->questiontextformat, $format_options, $quiz->course);
|
$qtext = format_text($question->questiontext, $question->questiontextformat, $format_options, $quiz->course);
|
||||||
$qquestion = $qname."\n".$qtext."\n";
|
$qquestion = $qname."\n".$qtext."\n";
|
||||||
|
|
||||||
|
|
|
@ -302,14 +302,14 @@ function question_list($course, $categoryid, $quizid=0,
|
||||||
|
|
||||||
// add to quiz
|
// add to quiz
|
||||||
if ($editingquiz) {
|
if ($editingquiz) {
|
||||||
echo "<a title=\"$straddtoquiz\" href=\"edit.php?addquestion=$question->id&quizid=$quizid&sesskey=$USER->sesskey\"><img
|
echo "<a title=\"$straddtoquiz\" href=\"$CFG->wwwroot/question/edit.php?addquestion=$question->id&quizid=$quizid&sesskey=$USER->sesskey\"><img
|
||||||
src=\"$CFG->pixpath/t/moveleft.gif\" alt=\"$straddtoquiz\" /></a> ";
|
src=\"$CFG->pixpath/t/moveleft.gif\" alt=\"$straddtoquiz\" /></a> ";
|
||||||
}
|
}
|
||||||
|
|
||||||
// preview
|
// preview
|
||||||
echo "<a title=\"$strpreview\" href=\"javascript:void();\" onclick=\"openpopup('/question/preview.php?id=$question->id&quizid=$quizid','$strpreview', " .
|
link_to_popup_window('/question/preview.php?id=' . $question->id . '&quizid=' . $quizid, 'questionpreview',
|
||||||
QUESTION_PREVIEW_POPUP_OPTIONS . ", false)\"><img
|
"<img src=\"$CFG->pixpath/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" />",
|
||||||
src=\"$CFG->pixpath/t/preview.gif\" alt=\"$strpreview\" /></a> ";
|
0, 0, $strpreview, QUESTION_PREVIEW_POPUP_OPTIONS);
|
||||||
|
|
||||||
// edit, hide, delete question, using question capabilities, not quiz capabilieies
|
// edit, hide, delete question, using question capabilities, not quiz capabilieies
|
||||||
if ($canedit) {
|
if ($canedit) {
|
||||||
|
@ -317,10 +317,10 @@ function question_list($course, $categoryid, $quizid=0,
|
||||||
src=\"$CFG->pixpath/t/edit.gif\" alt=\"$stredit\" /></a> ";
|
src=\"$CFG->pixpath/t/edit.gif\" alt=\"$stredit\" /></a> ";
|
||||||
// hide-feature
|
// hide-feature
|
||||||
if($question->hidden) {
|
if($question->hidden) {
|
||||||
echo "<a title=\"$strrestore\" href=\"edit.php?courseid=$course->id&unhide=$question->id&sesskey=$USER->sesskey\"><img
|
echo "<a title=\"$strrestore\" href=\"$CFG->wwwroot/question/edit.php?courseid=$course->id&unhide=$question->id&sesskey=$USER->sesskey\"><img
|
||||||
src=\"$CFG->pixpath/t/restore.gif\" alt=\"$strrestore\" /></a>";
|
src=\"$CFG->pixpath/t/restore.gif\" alt=\"$strrestore\" /></a>";
|
||||||
} else {
|
} else {
|
||||||
echo "<a title=\"$strdelete\" href=\"edit.php?courseid=$course->id&deleteselected=$question->id&q$question->id=1\"><img
|
echo "<a title=\"$strdelete\" href=\"$CFG->wwwroot/question/edit.php?courseid=$course->id&deleteselected=$question->id&q$question->id=1\"><img
|
||||||
src=\"$CFG->pixpath/t/delete.gif\" alt=\"$strdelete\" /></a>";
|
src=\"$CFG->pixpath/t/delete.gif\" alt=\"$strdelete\" /></a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,12 @@
|
||||||
unset($SESSION->quizpreview);
|
unset($SESSION->quizpreview);
|
||||||
// Redirect to ourselves but with continue=1; prevents refreshing the page
|
// Redirect to ourselves but with continue=1; prevents refreshing the page
|
||||||
// from restarting an attempt (needed so that random questions don't change)
|
// from restarting an attempt (needed so that random questions don't change)
|
||||||
$quizid = $quizid ? '&quizid=' . $quizid : '';
|
$url = $CFG->wwwroot . '/question/preview.php?id=' . $id;
|
||||||
redirect($CFG->wwwroot . '/question/preview.php?id=' . $id . $quizid .
|
if ($quizid) {
|
||||||
'&continue=1');
|
$url .= '&quizid=' . $quizid;
|
||||||
|
}
|
||||||
|
$url .= '&continue=1';
|
||||||
|
redirect($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($quizid)) {
|
if (empty($quizid)) {
|
||||||
|
@ -179,7 +182,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$strpreview = get_string('preview', 'quiz').' '.format_string($questions[$id]->name);
|
$strpreview = get_string('preview', 'quiz').' '.format_string($questions[$id]->name);
|
||||||
print_header($strpreview);
|
$questionlist = array($id);
|
||||||
|
$headtags = get_html_head_contributions($questionlist, $questions, $states[$historylength]);
|
||||||
|
print_header($strpreview, '', '', '', $headtags);
|
||||||
print_heading($strpreview);
|
print_heading($strpreview);
|
||||||
|
|
||||||
if (!empty($quizid)) {
|
if (!empty($quizid)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue