Skip to content

Commit

Permalink
MDL-14492 - Provide feedback to user about redirect delay in loadsco.…
Browse files Browse the repository at this point in the history
…php. Add sanity checking for scorm_resize() as it tries to set -ve heights if user specifies a small area. Thanks francois. backport 1.8.
  • Loading branch information
piers committed Aug 29, 2008
1 parent ec53cee commit b95a25b
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions mod/scorm/rd.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function scorm_get_element_style(obj, prop, cssProp) {
}

function scorm_resize (cwidth, cheight) {

var winwidth = 0, winheight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
Expand Down Expand Up @@ -60,35 +61,44 @@ function scorm_resize (cwidth, cheight) {
scormtopheight+
topmargin +
bottommargin+10; // +10 to save a minor vertical scroll always present!

var totalheighttoc = totalheight+imsnavheight;
// override total height with configured height if it is smaller
// override total height with configured height if it is defined
if (cheight > 0) {
winheight = cheight;
}
var finalheighttoc = winheight - totalheighttoc;
if (finalheighttoc <= 0) {
finalheighttoc = winheight;
}
var finalheight = winheight - totalheight;
if (finalheight <= 0) {
finalheight = winheight;
}
var toctree = document.getElementById('toctree');
if (toctree != null){
var toctreeHeight = toctree.offsetHeight;
document.getElementById('toctree').style.height = (winheight - totalheighttoc) + 'px';
document.getElementById('toctree').style.height = finalheighttoc + 'px';
var scoframe2 = document.getElementById('scoframe1');
document.getElementById('scormobject').style.height = (winheight - totalheight) + 'px';
document.getElementById('scormobject').style.height = finalheight + 'px';
}else{
var scoframe2 = document.getElementById('scoframe1');
document.getElementById('scormobject').style.height = (winheight - totalheight) + 'px';
document.getElementById('scormobject').style.height = finalheight + 'px';
}

// resize the content container too to move the footer below the SCORM content
var contenti3 = document.getElementById('content-i3');
if (contenti3) {
contenti3.style.height = (winheight - totalheight + 30) + 'px';
} else {
document.getElementById('content').style.height = (winheight - totalheight + 30) + 'px';
document.getElementById('content').style.height = (finalheight + 30) + 'px';
}
// resize the content container too to move the footer below the SCORM content
var contenti3 = document.getElementById('content-i3');
if (contenti3) {
contenti3.style.height = (winheight - totalheight + 30) + 'px';
contenti3.style.height = (finalheight + 30) + 'px';
} else {
document.getElementById('content').style.height = (winheight - totalheight + 30) + 'px';
document.getElementById('content').style.height = (finalheight + 30) + 'px';
}
}
-->

0 comments on commit b95a25b

Please sign in to comment.