]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15993 The method to calculate the SCORM area needs to be changed - based on scree...
authorpiers <piers>
Tue, 12 Aug 2008 01:26:10 +0000 (01:26 +0000)
committerpiers <piers>
Tue, 12 Aug 2008 01:26:10 +0000 (01:26 +0000)
mod/scorm/player.php
mod/scorm/rd.js

index 5f1f8b1eeafba99c0753090c1d18f8ce6720168f..79c4ed6bb9ae578d15a902d856d064fffb5c4430 100755 (executable)
     <script type="text/javascript">
     <!--    
         window.onresize = function() {
-            scorm_resize();
+            scorm_resize(<?php echo $scorm->width.", ".$scorm->height; ?>);
         };
     -->  
     </script>
 <?php  
     if ($scorm->hidetoc == 0) {
 ?>
-
         <div id="tocbox">
-
 <?php
-
         if ($scorm->hidenav ==0){
-
 ?>
-
             <!-- Bottons nav at left-->
-
             <div id="tochead">
-
                 <form name="tochead" method="post" action="player.php?id=<?php echo $cm->id ?>" target="_top">
-
 <?php
-
             $orgstr = '&amp;currentorg='.$currentorg;
-
             if (($scorm->hidenav == 0) && ($sco->previd != 0) && (!isset($sco->previous) || $sco->previous == 0)) {
-                
                 // Print the prev LO button
-
                 $scostr = '&amp;scoid='.$sco->previd;
-
                 $url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
-
 ?>
-
                     <input name="prev" type="button" value="<?php print_string('prev','scorm') ?>" onClick="document.location.href=' <?php echo $url; ?> '"/>
-
 <?php
-
             }
-
-            
-
             if (($scorm->hidenav == 0) && ($sco->nextid != 0) && (!isset($sco->next) || $sco->next == 0)) {
-                
                 // Print the next LO button
-
                 $scostr = '&amp;scoid='.$sco->nextid;
-
                 $url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
-
 ?>
-
                     <input name="next" type="button" value="<?php print_string('next','scorm') ?>" onClick="document.location.href=' <?php echo $url; ?> '"/>
-
 <?php
-
             }
-
 ?>
-
                 </form>
-
             </div> <!-- tochead -->
-
 <?php
-
         }
 ?>
             <div id="toctree" class="generalbox">
             <?php echo $result->toc; ?>
             </div> <!-- toctree -->
-
         </div> <!--  tocbox -->
 <?php
         $class = ' class="toc"';
         <?php
             $orgstr = '&amp;currentorg='.$currentorg;
             if (($scorm->hidenav == 0) && ($sco->previd != 0) && (!isset($sco->previous) || $sco->previous == 0) && (($scorm->hidetoc == 2) || ($scorm->hidetoc == 1)) ) {
-                
                 // Print the prev LO button
                 $scostr = '&amp;scoid='.$sco->previd;
                 $url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
 ?>
-
                     <form name="scormnavprev" method="post" action="player.php?id=<?php echo $cm->id ?>" target="_top" style= "display:inline">
-
                         <input name="prev" type="button" value="<?php print_string('prev','scorm') ?>" onClick="document.location.href=' <?php echo $url; ?> '"/>
-
                     </form>
-
 <?php
             }
             if ($scorm->hidetoc == 2) {
                 echo $result->tocmenu;
             }
             if (($scorm->hidenav == 0) && ($sco->nextid != 0) && (!isset($sco->next) || $sco->next == 0) && (($scorm->hidetoc == 2) || ($scorm->hidetoc == 1))) {
-                
                 // Print the next LO button
                 $scostr = '&amp;scoid='.$sco->nextid;
                 $url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
 ?>
-
                     <form name="scormnavnext" method="post" action="player.php?id=<?php echo $cm->id ?>" target="_top" style= "display:inline">
-
                         <input name="next" type="button" value="<?php print_string('next','scorm') ?>" onClick="document.location.href=' <?php echo $url; ?> '"/>
-
                     </form>
-
 <?php
             }
         ?>
-
                 </div>
 <?php
         } 
 <?php
     if ($result->prerequisites) {
         if ($scorm->popup == 0) {
-            echo "                <script type=\"text/javascript\">scorm_resize();</script>\n";
-
+            echo "                <script type=\"text/javascript\">scorm_resize(".$scorm->width.", ".$scorm->height.");</script>\n";
             $fullurl="loadSCO.php?id=".$cm->id.$scoidstr.$modestr;
-
             echo "                <iframe id=\"scoframe1\" class=\"scoframe\" name=\"scoframe1\" src=\"{$fullurl}\"></iframe>\n";   
         } else {
             // Clean the name for the window as IE is fussy
             ?>
                     <script type="text/javascript">
                     //<![CDATA[
-                                       scorm_resize();
+                   scorm_resize(<?php echo $scorm->width.", ". $scorm->height; ?>);
                         function openpopup(url,name,options,width,height) {
                             fullurl = "<?php echo $CFG->wwwroot.'/mod/scorm/' ?>" + url;
                             windowobj = window.open(fullurl,name,options);
index ddb939a56c91978b4dfa0aba2f7b4509f920a7b6..1fedf74031e9b45368a2768026a6fc4991586bd3 100644 (file)
@@ -13,7 +13,7 @@ function scorm_get_element_style(obj, prop, cssProp) {
     return ret;
 }
 
-function scorm_resize () {
+function scorm_resize (cwidth, cheight) {
     var winwidth = 0, winheight = 0;
     if( typeof( window.innerWidth ) == 'number' ) {
         //Non-IE
@@ -62,6 +62,10 @@ function scorm_resize () {
                         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
+    if (cheight >= 400 && winheight > cheight) {
+      winheight = cheight;
+    }                        
     var toctree = document.getElementById('toctree');
     if (toctree != null){
         var toctreeHeight = toctree.offsetHeight;