Navigation Menu

Skip to content

Commit

Permalink
Fix hotpotatoes iframe in LP view - refs #8418
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Sep 15, 2016
1 parent 44861b5 commit 2c0f501
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
20 changes: 12 additions & 8 deletions main/exercise/showinframes.php
Expand Up @@ -75,13 +75,17 @@ function Finish() {
$nameTools = $title;
$noPHP_SELF = true;

$htmlHeadXtra[] = '
<script>
$(document).ready( function(){
var height = $(this).innerHeight() - 20;
$("#hotpotatoe").css("height", height)
});
</script>';
$htmlHeadXtra[] = /** @lang HTML */<<<HTML
<script>
$(document).on('ready', function () {
var iframe = document.getElementById('hotpotatoe');
iframe.onload = function () {
this.height = $(this.contentDocument.body).outerHeight(true)
};
});
</script>
HTML;

$interbreadcrumb[]= array ("url"=>"./exercise.php", "name"=> get_lang('Exercises'));
if ($origin == 'learnpath') {
Expand All @@ -90,6 +94,6 @@ function Finish() {
Display::display_header($nameTools, "Exercise");
}
$url = $document_web_path.$doc_url.$user_id.'.t.html?time='.intval($time);
echo '<iframe id="hotpotatoe" width="100%" frameborder="0" src="'.$url.'"></iframe>';
echo '<iframe id="hotpotatoe" name="hotpotatoe" width="100%" height="100%" frameborder="0" src="'.$url.'"></iframe>';
echo '</body></html>';
exit;
4 changes: 2 additions & 2 deletions main/template/default/learnpath/view.tpl
Expand Up @@ -214,13 +214,13 @@
LPViewUtils.setHeightLPToc();
$('.scorm_item_normal a, #scorm-previous, #scorm-next').on('click', function () {
$('.lp-view-tabs').fadeOut();
$('.lp-view-tabs').animate({opacity: 0}, 500);
});
$('#learning_path_right_zone #lp-view-content iframe').on('load', function () {
$('.lp-view-tabs a[href="#lp-view-content"]').tab('show');
$('.lp-view-tabs').fadeIn();
$('.lp-view-tabs').animate({opacity: 1}, 500);
});
loadForumThread({{ lp_id }}, {{ lp_current_item_id }});
Expand Down

0 comments on commit 2c0f501

Please sign in to comment.