diff --git a/mod/hotpot/iframe.js b/mod/hotpot/iframe.js index 6185f98f6cd43..2b41ab9f4419e 100644 --- a/mod/hotpot/iframe.js +++ b/mod/hotpot/iframe.js @@ -1,52 +1,57 @@ - +is = new domSniffer(); \ No newline at end of file diff --git a/mod/hotpot/view.php b/mod/hotpot/view.php index 0f04e8a9c3326..8ab0e1f3c7c69 100644 --- a/mod/hotpot/view.php +++ b/mod/hotpot/view.php @@ -141,6 +141,7 @@ // HP5 v5 $get_html = empty($framename) ? true : false; } + if ($get_html) { if (HOTPOT_FIRST_ATTEMPT) { @@ -163,8 +164,43 @@ $hp->insert_giveup_form($attemptid, '', ''); break; case HOTPOT_NAVIGATION_FRAME: - $targetframe = $CFG->framename; - // drop through to remove nav buttons too + case HOTPOT_NAVIGATION_IFRAME: + if (empty($CFG->framename)) { + $targetframe = '_top'; + } else { + $targetframe = $CFG->framename; + } + if ($pos = strpos($hp->html, '')) { + $insert = '' + .''."\n" + ; + $hp->html = substr_replace($hp->html, $insert, $pos, 0); + } + $hp->remove_nav_buttons(); + break; default: $hp->remove_nav_buttons(); } @@ -375,7 +411,8 @@ switch ($hotpot->navigation) { case HOTPOT_NAVIGATION_BAR: //update_module_button($cm->id, $course->id, $strmodulename.'" style="font-size:0.8em') - print_header($title, $heading, $navigation, "", $head.$styles.$scripts, true, $button, $loggedinas, false, $body_tags + print_header( + $title, $heading, $navigation, "", $head.$styles.$scripts, true, $button, $loggedinas, false, $body_tags ); if (!empty($available_msg)) { notify($available_msg); @@ -423,25 +460,41 @@ switch ($framename) { case 'main': print $hp->html; - break; + break; default: + // set iframe attributes $iframe_id = 'hotpot_iframe'; - $body_tags = " onload=\"set_iframe_height('$iframe_id')\""; - $iframe_js = ''."\n"; + $iframe_src = $CFG->wwwroot.'/mod/hotpot/view.php?id='.$cm->id.'&framename=main'; + $iframe_onload_function = 'set_object_height'; + $iframe_js = ''."\n"; print_header( $title, $heading, $navigation, "", $head.$styles.$scripts.$iframe_js, true, $button, - $loggedinas, false, $body_tags + $loggedinas, false ); if (!empty($available_msg)) { notify($available_msg); } - print "\n"; + + // the object to hold the embedded html page + print ''."\n"; + + // javascript to simulate object onload event in IE (thanks to David Horat !) + print ''."\n"; + print $footer; - break; } // end switch $framename break; case HOTPOT_NAVIGATION_GIVEUP: