mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 16:04:25 +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
4642650fa2
commit
7d87171ba9
@ -76,7 +76,7 @@ define("QUESTION_NUMANS_ADD", 3);
|
||||
/**
|
||||
* 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
|
||||
|
@ -275,11 +275,8 @@ function quiz_print_question_list($quiz, $allowdelete=true, $showbreaks=true, $r
|
||||
echo '</td><td align="center">';
|
||||
|
||||
$context = $quiz->id ? '&contextquiz='.$quiz->id : '';
|
||||
$quiz_id = $quiz->id ? '&quizid=' . $quiz->id : '';
|
||||
if ($question->qtype != 'random') {
|
||||
echo "<a title=\"$strpreview\" href=\"javascript:void(0)\" onclick=\"openpopup('/question/preview.php?id=$qnum$quiz_id','questionpreview', " .
|
||||
QUESTION_PREVIEW_POPUP_OPTIONS . ", false)\">
|
||||
<img src=\"$CFG->pixpath/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" /></a>";
|
||||
quiz_question_preview_button($quiz, $question);
|
||||
}
|
||||
if ($canedit) {
|
||||
echo "<a title=\"$stredit\" href=\"$CFG->wwwroot/question/question.php?id=$qnum$context\">
|
||||
|
@ -595,16 +595,17 @@ function quiz_upgrade_states($attempt) {
|
||||
}
|
||||
}
|
||||
|
||||
// ULPGc ecastro
|
||||
function quiz_get_question_review($quiz, $question) {
|
||||
// returns a question icon
|
||||
$qnum = $question->id;
|
||||
/**
|
||||
* @param object $quiz the quiz
|
||||
* @param object $question the question
|
||||
* @return the HTML for a preview question icon.
|
||||
*/
|
||||
function quiz_question_preview_button($quiz, $question) {
|
||||
global $CFG;
|
||||
$strpreview = get_string('previewquestion', 'quiz');
|
||||
$context = $quiz->id ? '&contextquiz='.$quiz->id : '';
|
||||
$quiz_id = $quiz->id ? '&quizid=' . $quiz->id : '';
|
||||
return "<a title=\"$strpreview\" href=\"javascript:void(0)\" onclick=\"openpopup('/question/preview.php?id=$qnum$quiz_id','questionpreview', " .
|
||||
QUESTION_PREVIEW_POPUP_OPTIONS . ", false)\">
|
||||
<img src=\"../../pix/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" /></a>";
|
||||
return link_to_popup_window('/question/preview.php?id=' . $question->id . '&quizid=' . $quiz->id, 'questionpreview',
|
||||
"<img src=\"$CFG->pixpath/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" />",
|
||||
0, 0, $strpreview, QUESTION_PREVIEW_POPUP_OPTIONS, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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 ).") ";
|
||||
$qname = '<div class="qname">'.format_text($question->name." : ", $question->questiontextformat, $format_options, $quiz->course).'</div>';
|
||||
$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);
|
||||
$qquestion = $qname."\n".$qtext."\n";
|
||||
|
||||
|
@ -303,14 +303,14 @@ function question_list($course, $categoryid, $quizid=0,
|
||||
|
||||
// add to quiz
|
||||
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> ";
|
||||
}
|
||||
|
||||
// preview
|
||||
echo "<a title=\"$strpreview\" href=\"javascript:void();\" onclick=\"openpopup('/question/preview.php?id=$question->id&quizid=$quizid','$strpreview', " .
|
||||
QUESTION_PREVIEW_POPUP_OPTIONS . ", false)\"><img
|
||||
src=\"$CFG->pixpath/t/preview.gif\" alt=\"$strpreview\" /></a> ";
|
||||
link_to_popup_window('/question/preview.php?id=' . $question->id . '&quizid=' . $quizid, 'questionpreview',
|
||||
"<img src=\"$CFG->pixpath/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" />",
|
||||
0, 0, $strpreview, QUESTION_PREVIEW_POPUP_OPTIONS);
|
||||
|
||||
// edit, hide, delete question, using question capabilities, not quiz capabilieies
|
||||
if ($canedit) {
|
||||
@ -318,10 +318,10 @@ function question_list($course, $categoryid, $quizid=0,
|
||||
src=\"$CFG->pixpath/t/edit.gif\" alt=\"$stredit\" /></a> ";
|
||||
// hide-feature
|
||||
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>";
|
||||
} 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>";
|
||||
}
|
||||
}
|
||||
|
@ -50,9 +50,12 @@
|
||||
unset($SESSION->quizpreview);
|
||||
// Redirect to ourselves but with continue=1; prevents refreshing the page
|
||||
// from restarting an attempt (needed so that random questions don't change)
|
||||
$quizid = $quizid ? '&quizid=' . $quizid : '';
|
||||
redirect($CFG->wwwroot . '/question/preview.php?id=' . $id . $quizid .
|
||||
'&continue=1');
|
||||
$url = $CFG->wwwroot . '/question/preview.php?id=' . $id;
|
||||
if ($quizid) {
|
||||
$url .= '&quizid=' . $quizid;
|
||||
}
|
||||
$url .= '&continue=1';
|
||||
redirect($url);
|
||||
}
|
||||
|
||||
if (empty($quizid)) {
|
||||
@ -178,7 +181,9 @@
|
||||
}
|
||||
|
||||
$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);
|
||||
|
||||
if (!empty($quizid)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user