]> git.mjollnir.org Git - moodle.git/commitdiff
use target="$CFG->framename" instead of $CFG->frametarget when HotPot navigation...
authorgbateson <gbateson>
Thu, 4 Oct 2007 05:32:27 +0000 (05:32 +0000)
committergbateson <gbateson>
Thu, 4 Oct 2007 05:32:27 +0000 (05:32 +0000)
mod/hotpot/lib.php
mod/hotpot/view.php

index 2b02b0da94117f8fd67e983a32473954af24336c..a2379d2d38b105727475441e8ac5f597b63bd6ba 100644 (file)
@@ -1781,7 +1781,7 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
         $script = '<script src="'.$src.'" type="text/javascript"></script>'."\n";
         $this->html = preg_replace('|</head>|i', $script.'</head>', $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 = ''
         .   '<input type="hidden" name="attemptid" value="'.$attemptid.'" />'
@@ -1791,7 +1791,7 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
         .   '<input type="hidden" name="detail" value="" />'
         .   '<input type="hidden" name="status" value="" />'
         ;
-        $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 <form> 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 = '<form action="'.$CFG->wwwroot.'/mod/hotpot/attempt.php" method="post" name="'.$form_name.'"'.$CFG->frametarget.'>'.$replace.'</form>';
+            $replace = '<form action="'.$CFG->wwwroot.'/mod/hotpot/attempt.php" method="post" name="'.$form_name.'"'.$frametarget.'>'.$replace.'</form>';
         }
         if ($center) {
             $replace = '<div style="margin-left:auto; margin-right:auto; text-align: center;">'.$replace.'</div>';
index ad5496989a206d946008b49ac5c255823eca3efd..2b43347cfd38c21479ec6acf8fc961fd34f9bc91 100644 (file)
             $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)
                     case HOTPOT_NAVIGATION_GIVEUP:
                         $hp->insert_giveup_form($attemptid, '<!-- BeginTopNavButtons -->', '<!-- EndTopNavButtons -->');
                         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, '<!-- BeginSubmissionForm -->', '<!-- EndSubmissionForm -->', true);
                 } else {
-                    $hp->insert_submission_form($attemptid, '<!-- BeginSubmissionForm -->', '<!-- EndSubmissionForm -->');
+                    $hp->insert_submission_form($attemptid, '<!-- BeginSubmissionForm -->', '<!-- EndSubmissionForm -->', false, $targetframe);
                 }
             } else {
                 // HP5 v5