]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11892 Propogate Fixes for 'calls to expand javascript' to SCORM 1.2 code. Minor...
authorpiers <piers>
Fri, 18 Jul 2008 06:03:51 +0000 (06:03 +0000)
committerpiers <piers>
Fri, 18 Jul 2008 06:03:51 +0000 (06:03 +0000)
mod/scorm/datamodels/scorm_12lib.php
mod/scorm/datamodels/scorm_13lib.php
mod/scorm/player.php

index 84b2bbab7556830a578f5d48b64e7126ce379d0c..f6d9fa2901abf0cd5f942870cb4d2073bf67a389 100644 (file)
@@ -272,8 +272,7 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                 if (isset($_COOKIE['hide:SCORMitem'.$nextsco->id])) {
                     $icon = 'plus';
                 }
-               $result->toc .= '<a href="javascript:expandCollide(\'img'.$sublist.'\','.$sublist.','.$nextsco->id.');"><img id="img'.$sublist.'" src="'.$scormpixdir.'/'.$icon.'.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
-               // $result->toc .= '<a href="#" onclick="elementToggleHide(\''.$sublist.'\',true);"><img id="img'.$sublist.'" src="'.$scormpixdir.'/'.$icon.'.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
+                $result->toc .= '<a href="javascript:expandCollide(\'img'.$sublist.'\',\'s'.$sublist.'\','.$nextsco->id.');"><img id="img'.$sublist.'" src="'.$scormpixdir.'/'.$icon.'.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
             } else if ($isvisible) {
                 $result->toc .= '<img src="'.$scormpixdir.'/spacer.gif" />';
             }
@@ -380,21 +379,17 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
         $result->toc .= '
           <script type="text/javascript">
           //<![CDATA[
-               function expandCollide(which,list,item) {
-                  var nn=document.ids?true:false
-                  var w3c=document.getElementById?true:false
-                  var beg=nn?"document.ids.":w3c?"document.getElementById(":"document.all.";
-                  
-                  var mid=w3c?").style":".style";
+              function expandCollide(which,list,item) {
+                                 var el = document.ids ? document.ids[list] : document.getElementById ? document.getElementById(list) : document.all[list];
                   which = which.substring(0,(which.length));
-
-                  if (eval(beg+list+mid+".display") != "none") {
-                      document.getElementById(which).src = "'.$scormpixdir.'/plus.gif";
-                      eval(beg+list+mid+".display=\'none\';");
+                                 var el2 = document.ids ? document.ids[which] : document.getElementById ? document.getElementById(which) : document.all[which];
+                  if (el.style.display != "none") {
+                      el2.src = "'.$scormpixdir.'/plus.gif";
+                      el.style.display=\'none\';
                       new cookie("hide:SCORMitem" + item, 1, 356, "/").set();
                   } else {
-                      document.getElementById(which).src = "'.$scormpixdir.'/minus.gif";
-                      eval(beg+list+mid+".display=\'block\';");
+                      el2.src = "'.$scormpixdir.'/minus.gif";
+                      el.style.display=\'block\';
                       new cookie("hide:SCORMitem" + item, 1, -1, "/").set();
                   }
               }
index 07766f5b336b1b15a440b95ec740824277405546..fc450bcd9e5fe136974070e59cd5ade4cf996516 100644 (file)
@@ -226,19 +226,16 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
           <script type="text/javascript">
           //<![CDATA[
               function expandCollide(which,list,item) {
-                  var nn=document.ids?true:false
-                  var w3c=document.getElementById?true:false
-                  var beg=nn?"document.ids.":w3c?"document.getElementById(\'":"document.all.";
-                  var mid=w3c?"\').style":".style";
-
+                                 var el = document.ids ? document.ids[list] : document.getElementById ? document.getElementById(list) : document.all[list];
                   which = which.substring(0,(which.length));
-                  if (eval(beg+list+mid+".display") != "none") {
-                      document.getElementById(which).src = "'.$scormpixdir.'/plus.gif";
-                      eval(beg+list+mid+".display=\'none\';");
+                                 var el2 = document.ids ? document.ids[which] : document.getElementById ? document.getElementById(which) : document.all[which];
+                  if (el.style.display != "none") {
+                      el2.src = "'.$scormpixdir.'/plus.gif";
+                      el.style.display=\'none\';
                       new cookie("hide:SCORMitem" + item, 1, 356, "/").set();
                   } else {
-                      document.getElementById(which).src = "'.$scormpixdir.'/minus.gif";
-                      eval(beg+list+mid+".display=\'block\';");
+                      el2.src = "'.$scormpixdir.'/minus.gif";
+                      el.style.display=\'block\';
                       new cookie("hide:SCORMitem" + item, 1, -1, "/").set();
                   }
               }
index c0946a7bae5158f680682818545f47438b1de905..53607a2dd1db99aa3f71ee76a771957738c4a1e8 100755 (executable)
                         width = <?php p($scorm->width) ?>;
                         height = <?php p($scorm->height) ?>;
                         var main = openpopup(url, "<?php p($scorm->name) ?>", "<?php p($scorm->options) ?>", width, height);
+                   //]]>
                     </script>
                     <noscript>
-                        <iframe id="main" class="scoframe" src="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr ?>">
+                    <iframe id="main" class="scoframe" src="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr ?>">
                     </iframe>
                     </noscript>
 <?php