quiz 'secure' window MDL-23713 securewindow_access_rule::make_review_link was broken.

This commit is contained in:
Tim Hunt
2010-08-11 17:20:05 +00:00
parent 1d6ba3f577
commit c0934fc42a
2 changed files with 25 additions and 19 deletions
+24 -17
View File
@@ -210,7 +210,8 @@ class quiz_access_manager {
public function print_start_attempt_button($canpreview, $buttontext, $unfinished) {
global $OUTPUT;
$button = new single_button($this->_quizobj->start_attempt_url(), $buttontext);
$url = $this->_quizobj->start_attempt_url();
$button = new single_button($url, $buttontext);
$button->class .= ' quizstartbuttondiv';
if (!$unfinished) {
@@ -225,20 +226,8 @@ class quiz_access_manager {
if ($this->securewindow_required($canpreview)) {
$button->class .= ' quizsecuremoderequired';
$popupoptions = array(
'left' => 0,
'top' => 0,
'fullscreen' => true,
'scrollbars' => true,
'resizeable' => false,
'directories' => false,
'toolbar' => false,
'titlebar' => false,
'location' => false,
'status' => false,
'menubar' => false,
);
$button->popup_action(new popup_action('click', $url, 'quizpopup', $popupoptions));
$button->add_action(new popup_action('click', $url, 'quizpopup',
securewindow_access_rule::$popupoptions));
$warning = html_writer::tag('noscript',
$OUTPUT->heading(get_string('noscript', 'quiz')));
@@ -734,6 +723,23 @@ class time_limit_access_rule extends quiz_access_rule_base {
* A rule implementing the ipaddress check against the ->submet setting.
*/
class securewindow_access_rule extends quiz_access_rule_base {
/**
* @var array options that should be used for opening the secure popup.
*/
public static $popupoptions = array(
'left' => 0,
'top' => 0,
'fullscreen' => true,
'scrollbars' => true,
'resizeable' => false,
'directories' => false,
'toolbar' => false,
'titlebar' => false,
'location' => false,
'status' => false,
'menubar' => false,
);
/**
* Make a link to the review page for an attempt.
*
@@ -743,8 +749,9 @@ class securewindow_access_rule extends quiz_access_rule_base {
*/
public function make_review_link($linktext, $attemptid) {
global $OUTPUT;
$button = new single_button($this->_quizobj->review_url($attemptid), $linktext);
$button->add_action(new popup_action('click', $form->url, 'quizpopup', $this->windowoptions));
$url = $this->_quizobj->review_url($attemptid);
$button = new single_button($url, $linktext);
$button->add_action(new popup_action('click', $url, 'quizpopup', self::$popupoptions));
return $OUTPUT->render($button);
}
+1 -2
View File
@@ -340,8 +340,7 @@ class quiz {
* @return string the URL of the review of that attempt.
*/
public function review_url($attemptid) {
global $CFG;
return $CFG->wwwroot . '/mod/quiz/review.php?attempt=' . $attemptid;
return new moodle_url('/quiz/review.php', array('attempt' => $attemptid));
}
// Bits of content =====================================================================