From 3318cc4ecfd863101552fe1f2729a8eca01eda11 Mon Sep 17 00:00:00 2001 From: piers Date: Fri, 29 Aug 2008 04:13:35 +0000 Subject: [PATCH] MDL-14492 - Provide feedback to user about redirect delay in loadsco.php. Add sanity checking for scorm_resize() as it tries to set -ve heights if user specifies a small area. Thanks francois. backport 1.9. --- mod/scorm/rd.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/mod/scorm/rd.js b/mod/scorm/rd.js index 67f7d0165b8..98570e4cb0e 100644 --- a/mod/scorm/rd.js +++ b/mod/scorm/rd.js @@ -66,16 +66,24 @@ function scorm_resize (cwidth, cheight) { // 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 @@ -83,14 +91,14 @@ function scorm_resize (cwidth, cheight) { 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'; } } --> \ No newline at end of file