From b3687f28f12f54707435eaa45c2002d2b00f57dd Mon Sep 17 00:00:00 2001 From: gbateson Date: Thu, 4 Oct 2007 05:32:27 +0000 Subject: [PATCH] use target="$CFG->framename" instead of $CFG->frametarget when HotPot navigation is set to "Moodle navigation frame"so that Moodle does not get stuck in sub frame --- mod/hotpot/lib.php | 13 +++++++++---- mod/hotpot/view.php | 6 +++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/mod/hotpot/lib.php b/mod/hotpot/lib.php index 2b02b0da94..a2379d2d38 100644 --- a/mod/hotpot/lib.php +++ b/mod/hotpot/lib.php @@ -1781,7 +1781,7 @@ class hotpot_xml_quiz extends hotpot_xml_tree { $script = ''."\n"; $this->html = preg_replace('||i', $script.'', $this->html, 1); } - function insert_submission_form($attemptid, $startblock, $endblock, $keep_contents=false) { + function insert_submission_form($attemptid, $startblock, $endblock, $keep_contents=false, $targetframe='') { $form_name = 'store'; $form_fields = '' . '' @@ -1791,7 +1791,7 @@ class hotpot_xml_quiz extends hotpot_xml_tree { . '' . '' ; - $this->insert_form($startblock, $endblock, $form_name, $form_fields, $keep_contents); + $this->insert_form($startblock, $endblock, $form_name, $form_fields, $keep_contents, false, $targetframe); } function insert_giveup_form($attemptid, $startblock, $endblock, $keep_contents=false) { $form_name = ''; // no
tag will be generated @@ -1804,15 +1804,20 @@ class hotpot_xml_quiz extends hotpot_xml_tree { ; $this->insert_form($startblock, $endblock, $form_name, $form_fields, $keep_contents, true); } - function insert_form($startblock, $endblock, $form_name, $form_fields, $keep_contents, $center=false) { + function insert_form($startblock, $endblock, $form_name, $form_fields, $keep_contents, $center=false, $targetframe='') { global $CFG; $search = '#('.preg_quote($startblock).')(.*?)('.preg_quote($endblock).')#s'; $replace = $form_fields; if ($keep_contents) { $replace .= '\\2'; } + if ($targetframe) { + $frametarget = ' target="'.$targetframe.'"'; + } else { + $frametarget = $CFG->frametarget; + } if ($form_name) { - $replace = 'frametarget.'>'.$replace.'
'; + $replace = '
'.$replace.'
'; } if ($center) { $replace = '
'.$replace.'
'; diff --git a/mod/hotpot/view.php b/mod/hotpot/view.php index ad5496989a..2b43347cfd 100644 --- a/mod/hotpot/view.php +++ b/mod/hotpot/view.php @@ -156,6 +156,7 @@ $hp->adjust_media_urls(); if (empty($frameset)) { // HP6 v6 + $targetframe = ''; switch ($hotpot->navigation) { case HOTPOT_NAVIGATION_BUTTONS: // do nothing (i.e. leave buttons as they are) @@ -163,13 +164,16 @@ case HOTPOT_NAVIGATION_GIVEUP: $hp->insert_giveup_form($attemptid, '', ''); break; + case HOTPOT_NAVIGATION_FRAME: + $targetframe = $CFG->framename; + // drop through to remove nav buttons too default: $hp->remove_nav_buttons(); } if (isset($hp->real_outputformat) && $hp->real_outputformat==HOTPOT_OUTPUTFORMAT_MOBILE) { $hp->insert_submission_form($attemptid, '', '', true); } else { - $hp->insert_submission_form($attemptid, '', ''); + $hp->insert_submission_form($attemptid, '', '', false, $targetframe); } } else { // HP5 v5 -- 2.39.5