MDL-43019 SCORM: always use iframe instead of object - backported from 2.6 - fixes issue with IE 11 SCORM packages not loading

This commit is contained in:
Dan Marsden
2013-12-05 13:16:29 +13:00
parent 3dc57a1203
commit 421f2eca6e
3 changed files with 14 additions and 50 deletions
+13 -44
View File
@@ -100,41 +100,20 @@ M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launc
}
var content = new Y.YUI2.util.Element('scorm_content');
try {
// first try IE way - it can not set name attribute later
// and also it has some restrictions on DOM access from object tag
if (window_name || node.title == null) {
var obj = document.createElement('<iframe id="scorm_object" src="">');
if (window_name) {
var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
if(! mine) {
alert(M.str.scorm.popupsblocked);
}
mine.close()
}
}
else {
var obj = document.createElement('<iframe id="scorm_object" src="'+url_prefix + node.title+'">');
}
// fudge IE7 to redraw the screen
if (Y.YUI2.env.ua.ie > 5 && Y.YUI2.env.ua.ie < 8) {
obj.attachEvent("onload", scorm_resize_parent);
}
} catch (e) {
var obj = document.createElement('object');
obj.setAttribute('id', 'scorm_object');
obj.setAttribute('type', 'text/html');
if (!window_name && node.title != null) {
obj.setAttribute('data', url_prefix + node.title);
}
if (window_name) {
var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
if(! mine) {
alert(M.str.scorm.popupsblocked);
}
mine.close()
}
var obj = document.createElement('iframe');
obj.setAttribute('id', 'scorm_object');
obj.setAttribute('type', 'text/html');
if (!window_name && node.title != null) {
obj.setAttribute('src', url_prefix + node.title);
}
if (window_name) {
var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
if(! mine) {
alert(M.str.scorm.popupsblocked);
}
mine.close()
}
var old = Y.YUI2.util.Dom.get('scorm_object');
if (old) {
if(window_name) {
@@ -178,16 +157,6 @@ M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launc
scoes_nav[launch_sco].hidecontinue == 1));
};
var scorm_resize_parent = function() {
// fudge IE7 to redraw the screen
parent.resizeBy(-10, -10);
parent.resizeBy(10, 10);
var ifr = Y.YUI2.util.Dom.get('scorm_object');
if (ifr) {
ifr.detachEvent("onload", scorm_resize_parent);
}
};
var scorm_resize_layout = function(alsowidth) {
if (window_name) {
return;
-5
View File
@@ -235,12 +235,7 @@ if ($result->prerequisites) {
$scorm->width, $scorm->height)));
?>
<noscript>
<!--[if IE]>
<iframe id="main" class="scoframe" name="main" src="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr; ?>"></iframe>
<![endif]-->
<!--[if !IE]>
<object id="main" class="scoframe" type="text/html" data="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr; ?>"></object>
<![endif]-->
</noscript>
<?php
}
+1 -1
View File
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$module->version = 2013050102; // The current module version (Date: YYYYMMDDXX)
$module->version = 2013050103; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2013050100; // Requires this Moodle version
$module->component = 'mod_scorm'; // Full name of the plugin (used for diagnostics)
$module->cron = 300;