Added popup window scorm player and its settings
authorbobopinna <bobopinna>
Mon, 21 Jun 2004 11:27:52 +0000 (11:27 +0000)
committerbobopinna <bobopinna>
Mon, 21 Jun 2004 11:27:52 +0000 (11:27 +0000)
14 files changed:
mod/scorm/api1_2.php
mod/scorm/config.html [new file with mode: 0755]
mod/scorm/db/mysql.php
mod/scorm/db/mysql.sql
mod/scorm/db/postgres7.php
mod/scorm/db/postgres7.sql
mod/scorm/details.php
mod/scorm/lib.php
mod/scorm/mod.html
mod/scorm/playscorm.php
mod/scorm/report.php
mod/scorm/scormAPI.php
mod/scorm/version.php
mod/scorm/view.php

index 6b5e8b1..360e981 100644 (file)
@@ -1,47 +1,11 @@
-//
-// CMI Initialization SCORM 1.2
-//
-       var cmi= new Object();
-       
-       cmi.core = new Object();
-       cmi.core._children = "student_id,student_name,lesson_location,credit,lesson_status,exit,entry,session_time,total_time,lesson_mode,score,suspend_data,launch_data";
-       cmi.core.student_id = "<?php echo $USER->username; ?>";
-       cmi.core.student_name = "<?php echo $USER->firstname." ".$USER->lastname; ?>";
-       cmi.core.lesson_location = "<?php echo $sco_user->cmi_core_lesson_location; ?>";
-       cmi.core.credit = "credit";
-       cmi.core.lesson_status = "<?php echo $sco_user->cmi_core_lesson_status; ?>";
-       cmi.core.exit = "<?php echo $sco_user->cmi_core_exit ?>";
-       cmi.core.entry = "<?php if ($sco_user->cmi_core_lesson_status=="not attempted") 
-                                   echo 'ab-initio'; 
-                               else 
-                                   if ($sco_user->cmi_core_lesson_status!="completed") 
-                                       echo 'resume'; 
-                                   else 
-                                       echo '';?>";
-       cmi.core.session_time = "<?php echo $sco_user->cmi_core_session_time; ?>";
-       cmi.core.total_time = "<?php echo $sco_user->cmi_core_total_time; ?>";
-       cmi.core.lesson_mode = "<?php echo $mode; ?>";
-       
-       cmi.core.score = new Object();
-       cmi.core.score._children = "raw,min,max";
-       cmi.core.score.raw = "<?php echo $sco_user->cmi_core_score_raw; ?>";
-       cmi.suspend_data = "<?php echo $sco_user->cmi_suspend_data; ?>";
-       cmi.launch_data = "<?php echo $sco_user->cmi_launch_data; ?>";
-/*     cmi.interactions = new Object();
-       cmi.interactions._children = "id,objectives,time,type,correct_responses,weighting,student_response,result,latency";
-       cmi.interactions._count = 0;
-*/
-       var errorCode = 0;
-
-//
-// end CMI Initialization
-//
-
-
 // 
 // SCORM API 1.2 Implementation
 //
 function SCORMapi() {
+    var cmi= new Object();
+
+    var errorCode = 0;
+    
     var Initialized = false;
 
     function LMSInitialize (param) {
@@ -52,6 +16,37 @@ function SCORMapi() {
        if (!Initialized) {
            Initialized = true;
            errorCode = 0;
+           
+           //
+           // CMI Initialization SCORM 1.2
+           //
+           cmi.core = new Object();
+           cmi.core._children = "student_id,student_name,lesson_location,credit,lesson_status,exit,entry,session_time,total_time,lesson_mode,score,suspend_data,launch_data";
+           cmi.core.student_id = "<?php echo $USER->username; ?>";
+           cmi.core.student_name = "<?php echo $USER->firstname." ".$USER->lastname; ?>";
+           cmi.core.lesson_location = "<?php echo $sco_user->cmi_core_lesson_location; ?>";
+           cmi.core.credit = "credit";
+           cmi.core.lesson_status = "<?php echo $sco_user->cmi_core_lesson_status; ?>";
+           cmi.core.exit = "<?php echo $sco_user->cmi_core_exit ?>";
+           cmi.core.entry = "<?php if ($sco_user->cmi_core_lesson_status=="not attempted") 
+                                       echo 'ab-initio'; 
+                                   else 
+                                       if ($sco_user->cmi_core_lesson_status!="completed") 
+                                           echo 'resume'; 
+                                       else 
+                                           echo '';?>";
+           cmi.core.session_time = "";
+           cmi.core.total_time = "<?php echo $sco_user->cmi_core_total_time; ?>";
+           cmi.core.lesson_mode = "<?php echo $mode; ?>";
+           cmi.core.score = new Object();
+           cmi.core.score._children = "raw,min,max";
+           cmi.core.score.raw = "<?php echo $sco_user->cmi_core_score_raw; ?>";
+           cmi.suspend_data = "<?php echo $sco_user->cmi_suspend_data; ?>";
+           cmi.launch_data = "<?php echo $sco_user->cmi_launch_data; ?>";
+           //
+           // end CMI Initialization
+           //
+
            return "true";
        } else {
            errorCode = 101;
@@ -277,6 +272,7 @@ function SCORMapi() {
        
        return hours + ":" + mins + ":" + secs;
     }
+    
     this.LMSInitialize = LMSInitialize;
     this.LMSGetValue = LMSGetValue;
     this.LMSSetValue = LMSSetValue;
diff --git a/mod/scorm/config.html b/mod/scorm/config.html
new file mode 100755 (executable)
index 0000000..b4c8e24
--- /dev/null
@@ -0,0 +1,50 @@
+<form method="post" action="module.php" name="form">
+
+<table cellpadding=9 cellspacing=0 >
+<tr valign=top>
+       <td align=right><p>scorm_framesize:</td>
+       <td>
+    <input name=scorm_framesize type=text size=5 value="<?php p($CFG->scorm_framesize) ?>">
+    </td>
+    <td>
+    <?php print_string("configframesize", "scorm") ?>
+    </td>
+</tr>
+<tr valign=top>
+       <td align=right><p>scorm_popup:</td>
+       <td>
+    <?php
+        unset($choices);
+        $choices[""] = get_string("no");
+        $choices["checked"] = get_string("yes");
+        choose_from_menu ($choices, "scorm_popup", $CFG->scorm_popup, "");
+    ?>
+    </td>
+    <td>
+    <?php print_string("configpopup", "scorm") ?>
+    </td>
+</tr>
+<?php foreach ($SCORM_WINDOW_OPTIONS as $optionname) {
+          $defaultvalue = "scorm_popup$optionname";
+          echo "<tr valign=top>";
+             echo "<td align=right><p>$defaultvalue:</td>";
+             echo "<td>";
+          if ($optionname == "height" or $optionname == "width") {
+              echo "<input name=$defaultvalue type=text size=5 value=\"".$CFG->$defaultvalue."\">";
+          } else {
+              choose_from_menu ($choices, $defaultvalue, $CFG->$defaultvalue, "");
+          }
+          echo "</td>";
+          echo "<td>";
+          print_string("configpopup$optionname", "scorm");
+          echo "</td>";
+          echo "</tr>";
+      }
+?>
+<tr>
+    <td colspan=3 align=center>
+       <input type="submit" value="<?php print_string("savechanges") ?>"></td>
+</tr>
+</table>
+
+</form>
index d9ae381..d1aaf48 100755 (executable)
@@ -5,14 +5,17 @@ function scorm_upgrade($oldversion) {
 /// older versions to match current functionality
     global $CFG;
     if ($oldversion < 2004033000) {
-       execute_sql(" ALTER TABLE `{$CFG->prefix}scorm` ADD `auto` TINYINT( 1 ) UNSIGNED DEFAULT '0' NOT NULL AFTER `summary`"); 
+       table_column("scorm", "", "auto", "TINYINT", "1", "UNSIGNED", "0", "NOT NULL", "summary"); 
     }
     if ($oldversion < 2004040900) {
-       execute_sql(" ALTER TABLE `{$CFG->prefix}scorm_sco_users` ADD `cmi_core_score_raw` FLOAT( 3 ) DEFAULT '0' NOT NULL AFTER `cmi_core_session_time`"); 
+        table_column("scorm_sco_users", "", "cmi_core_score_raw", "FLOAT", "3", "", "0", "NOT NULL", "cmi_core_session_time");
+    }
+    if ($oldversion < 2004061800) {
+       table_column("scorm", "", "popup", "VARCHAR", "255", "", "", "NOT NULL", "auto");
+       table_column("scorm", "reference", "reference", "VARCHAR", "255", "", "", "NOT NULL");
     }
     return true;
 }
 
 
 ?>
-
index 58b2046..4a19a1c 100755 (executable)
@@ -6,11 +6,12 @@ CREATE TABLE prefix_scorm (
   id int(10) unsigned NOT NULL auto_increment,
   course int(10) unsigned NOT NULL default '0',
   name varchar(255) NOT NULL default '',
-  reference varchar(255) default NULL,
+  reference varchar(255) NOT NULL default '',
   datadir varchar(255) NOT NULL default '',
   launch int(10) unsigned NOT NULL default 0,
   summary text NOT NULL,
   auto tinyint(1) unsigned NOT NULL default '0',
+  popup varchar(255) NOT NULL default '',
   timemodified int(10) unsigned NOT NULL default '0',
   PRIMARY KEY  (id),
   UNIQUE KEY id (id)
index 90c53dd..b56d414 100755 (executable)
@@ -3,7 +3,17 @@
 function scorm_upgrade($oldversion) {
 // This function does anything necessary to upgrade
 // older versions to match current functionality
-
+    global $CFG;
+    if ($oldversion < 2004033000) {
+       table_column("scorm", "", "auto", "integer", "1", "", "0", "NOT NULL", "summary"); 
+    }
+    if ($oldversion < 2004040900) {
+        table_column("scorm_sco_users", "", "cmi_core_score_raw", "real", "3", "", "0", "NOT NULL", "cmi_core_session_time");
+    }
+    if ($oldversion < 2004061800) {
+       table_column("scorm", "", "popup", "varchar", "255", "", "", "NOT NULL", "auto");
+       table_column("scorm", "reference", "reference", "varchar", "255", "", "", "NOT NULL");
+    }
     return true;
 }
 
index aa2df46..8d0d21c 100755 (executable)
@@ -6,11 +6,12 @@ CREATE TABLE prefix_scorm (
   id SERIAL PRIMARY KEY,
   course integer NOT NULL default '0',
   name varchar(255) NOT NULL default '',
-  reference varchar(255) default NULL,
+  reference varchar(255) NOT NULL default '',
   datadir varchar(255) NOT NULL default '',
   launch integer NOT NULL default '0',
   summary text NOT NULL default '',
   auto integer NOT NULL default '0',
+  popup varchar(255) NOT NULL default '',
   timemodified integer NOT NULL default '0'
 );
 
index f4e60fa..f2bc1f5 100755 (executable)
        echo "<table cellpadding=\"5\" align=\"center\">\n";
        echo "    <tr><td align=\"right\" nowrap><p><b>$strname:</b></p></td><td><p>$form->name</p></a></td></tr>\n";
        echo "    <tr><td align=\"right\" nowrap><p><b>".get_string("validation","scorm").":</b></p></td><td><p>".get_string($result,"scorm")."</p></a></td></tr>\n";
-       if (($form->mode == "update") && ($form->launch == 0) && (get_records("scorm_sco_user","scormid",$form->instance)))
+       if (($form->mode == "update") && ($form->launch == 0) && (get_records("scorm_sco_users","scormid",$form->instance)))
            echo "    <tr><td align=\"center\" colspan=\"2\" nowrap><p><b>".get_string("trackingloose","scorm")."</b></p></td></tr>\n";
        echo "</table>\n";
        if ($result == "regular") {
+           if (empty($form->auto)) {
+               $form->auto = "";
+           }
            echo "<form name=\"theform\" method=\"post\" action=\"$form->destination\">\n";
+           
+           $form->popup = $CFG->scorm_popup;
+           $strnewwindow     = get_string("newwindow", "scorm");
+            $strnewwindowopen = get_string("newwindowopen", "scorm");
+           foreach ($SCORM_WINDOW_OPTIONS as $optionname) {
+               $stringname = "str$optionname";
+               $$stringname = get_string("new$optionname", "scorm");
+               $window->$optionname = "";
+               $jsoption[] = "\"$optionname\"";
+            }
+            $alljsoptions = implode(",", $jsoption);
+
+            if ($form->instance) {     // Re-editing
+               if ($form->popup == "") {
+                    $newwindow = "";   // Disable the new window
+               } else {
+                   $newwindow = "checked";
+                    $rawoptions = explode(',', $form->popup); 
+                    foreach ($rawoptions as $rawoption) {
+                       $option = explode('=', trim($rawoption));
+                       if ((option != 'location') && (option != 'menubar') && (option != 'toolbar')) {
+                           $optionname = $option[0];
+                           $optionvalue = $option[1];
+                           if ($optionname == "height" or $optionname == "width") {
+                               $window->$optionname = $optionvalue;
+                           } else if ($optionvalue) {
+                               $window->$optionname = "checked";
+                           }
+                       }
+                   }
+               }
+           } else {
+               foreach ($SCORM_WINDOW_OPTIONS as $optionname) {
+                    $defaultvalue = "scorm_popup$optionname";
+                    $window->$optionname = $CFG->$defaultvalue;
+               }
+               $newwindow = $CFG->scorm_popup;
+           }
+           
 ?>
+       <table cellpadding="5" align="center">
+         <tr valign=top>
+           <td align=right><p><b><?php print_string("autocontinue","scorm") ?>:</b></p></td>
+           <td>
+           <?php
+               $options[]=get_string("no");
+               $options[]=get_string("yes");
+               choose_from_menu ($options, "auto", $form->auto);
+           ?>
+           </td>
+         </tr>
+         <tr valign="top">
+            <td align="right" nowrap>
+                <p><b><?php p($strnewwindow) ?></b></p>
+            </td>
+            <td>
+                <script>
+                    var subitems = [<?php echo $alljsoptions; ?>];
+                    
+                    function autowindow() {
+                        if (document.theform.newwindow.checked) 
+                            document.theform.auto.disabled=true;
+                        else
+                            document.theform.auto.disabled=false;
+                    }
+                </script>
+                <input name="setnewwindow" type=hidden value=1>
+                <input name="newwindow" type=checkbox value=1 <?php p($newwindow) ?> 
+                        onclick="autowindow();return lockoptions('theform','newwindow', subitems);"> 
+                <?php p($strnewwindowopen) ?>
+                <ul>
+                <?php
+                    foreach ($window as $name => $value) {
+                        if ($name == "height" or $name == "width") {
+                            continue;
+                        }
+                        echo "\t\t<input name=\"h$name\" type=hidden value=0>\n";
+                        echo "\t\t<input name=\"$name\" type=checkbox value=1 ".$window->$name."> ";
+                        $stringname = "str$name";
+                        echo $$stringname."<br />\n";
+                     }
+                 ?>
+
+                 <input name="hwidth" type=hidden value=0>
+                 <input name="width" type=text size=4 value="<?php p($window->width) ?>">
+                 <?php p($strwidth) ?><br />
+
+                 <input name="hheight" type=hidden value=0>
+                 <input name="height" type=text size=4 value="<?php p($window->height) ?>">
+                 <?php p($strheight) ?><br />
+                 <?php
+                     if (!$newwindow) {
+                         echo "<script>";
+                         echo "lockoptions('theform','newwindow', subitems);";
+                         echo "</script>";
+                     }
+                 ?>
+                 </ul>
+                 </p>
+             </td>
+           </tr>
+        </table>
         <input type="hidden" name="reference"  value="<?php p($form->reference) ?>">
         <input type="hidden" name="datadir"    value="<?php p(substr($tempdir,strlen($scormdir))) ?>">
         <input type="hidden" name="summary"    value="<?php p($form->summary) ?>">
-        <input type="hidden" name="auto"       value="<?php p($form->auto) ?>">
         <input type="hidden" name="name"       value="<?php p($form->name) ?>">
        <input type="hidden" name="launch"      value="<?php p($form->launch) ?>">
         <input type="hidden" name="course"     value="<?php p($form->course) ?>">
index 5aa5e02..5340699 100755 (executable)
@@ -3,8 +3,28 @@
 /// Library of functions and constants for module scorm
 /// (replace scorm with the name of your module and delete this line)
 
+$SCORM_WINDOW_OPTIONS = array("resizable", "scrollbars", "status", "height", "width");
+
+if (!isset($CFG->scorm_popup)) {
+    set_config("scorm_popup", "");
+}  
+
+foreach ($SCORM_WINDOW_OPTIONS as $popupoption) {
+    $popupoption = "scorm_popup$popupoption";
+    if (!isset($CFG->$popupoption)) {
+        if ($popupoption == "scorm_popupheight") {
+            set_config($popupoption, 450);
+        } else if ($popupoption == "scorm_popupwidth") {
+            set_config($popupoption, 620);
+        } else {
+            set_config($popupoption, "checked");
+        }
+    }  
+}
 
-$SCORM_FRAME_SIZE = 140;
+if (!isset($CFG->scorm_framesize)) {
+    set_config("scorm_framesize", 140);
+}
 
 function scorm_add_instance($scorm) {
 /// Given an object containing all the necessary data, 
@@ -15,6 +35,19 @@ function scorm_add_instance($scorm) {
     $scorm->timemodified = time();
 
     # May have to add extra stuff in here #
+    global $SCORM_WINDOW_OPTIONS;
+    
+    if (isset($scorm->setnewwindow)) {
+        $optionlist = array();
+        foreach ($SCORM_WINDOW_OPTIONS as $option) {
+            if (isset($scorm->$option)) {
+                $optionlist[] = $option."=".$scorm->$option;
+            }
+        }
+        $scorm->popup = implode(',', $optionlist);
+        $scorm->popup .= ',location=0,menubar=0,toolbar=0';
+        $scorm->auto = '0';
+    }
     
     return insert_record("scorm", $scorm);
 }
@@ -24,11 +57,24 @@ function scorm_update_instance($scorm) {
 /// Given an object containing all the necessary data, 
 /// (defined by the form in mod.html) this function 
 /// will update an existing instance with new data.
-
+    
     $scorm->timemodified = time();
     $scorm->id = $scorm->instance;
 
     # May have to add extra stuff in here #
+    global $SCORM_WINDOW_OPTIONS;
+    
+    if (isset($scorm->setnewwindow)) {
+        $optionlist = array();
+        foreach ($SCORM_WINDOW_OPTIONS as $option) {
+            if (isset($scorm->$option)) {
+                $optionlist[] = $option."=".$scorm->$option;
+            }
+        }
+        $scorm->popup = implode(',', $optionlist);
+        $scorm->popup .= ',location=0,menubar=0,toolbar=0';
+        $scorm->auto = '0';
+    }
 
     return update_record("scorm", $scorm);
 }
index efd858e..b6f874d 100755 (executable)
@@ -11,9 +11,6 @@
     if (empty($form->launch)) {
        $form->launch = "";
     }
-    if (empty($form->auto)) {
-       $form->auto = "";
-    }
 ?>
 
 
         <?php print_textarea($usehtmleditor, 20, 50, 680, 400, "summary", $form->summary); ?>
            </td>
        </tr>
-       <tr valign=top>
-           <td align=right><p><b><?php print_string("autocontinue","scorm") ?>:</b></p></td>
-           <td>
-           <?php
-               $options[]=get_string("no");
-               $options[]=get_string("yes");
-               choose_from_menu ($options, "auto", $form->auto);
-           ?>
-           </td>
-       </tr>
     </table>
     <input type="hidden" name=course   value="<?php p($form->course) ?>">
     <input type="hidden" name=coursemodule     value="<?php p($form->coursemodule) ?>">
index 88b70ff..8f7862a 100755 (executable)
                "$navigation <a target=\"{$CFG->framename}\" href=\"view.php?id=$cm->id\" title=\"$scorm->summary\">$scorm->name</a>",
                "", "", true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm, '_top'));
        
-       echo "<table width=\"100%\">\n    <tr><td align=\"center\">".text_to_html($scorm->summary, true, false)."</td></tr></table>\n";
+       echo "<table width=\"100%\">\n    <tr><td align=\"center\">".text_to_html($scorm->summary, true, false)."</td>\n";
+       if ($_GET["mode"] == "browse")
+           echo "<td align=\"right\" width=\"10%\" nowrap>".get_string("browsemode","scorm")."</td>\n";
+       echo "     </tr>\n</table>\n";
+       
        
-       if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' order by id ASC")){
-           $level=0;                   
-           $parents[$level]="/";
-           foreach ($scoes as $sco) {
-               if ($parents[$level]!=$sco->parent) {
-                   if ($level>0 && $parents[$level-1]==$sco->parent) {
-                       $level--;
-                   } else {
-                       $level++;
-                       $parents[$level]=$sco->parent;
-                   }
-               }
-               $indenting = "";
-               for ($i=0;$i<$level;$i++) {
-                    $indenting .= "-";
-               }
-               $options[$sco->id] = $indenting."&gt; ".$sco->title;
-           }
-       }
            
        echo "<table width=\"100%\">\n    <tr>\n";
-       echo "          <td nowrap>
+       echo "          <td align=\"center\" nowrap>
                     <iframe name=\"cmi\" width=\"1\" height=\"1\" src=\"cmi.php?id=$cm->id\" style=\"visibility: hidden;\"></iframe>
                     <form name=\"navform\" method=\"POST\" action=\"playscorm.php?id=$cm->id\" target=\"_top\">
                        <input name=\"scoid\" type=\"hidden\" />
                        <input name=\"mode\" type=\"hidden\" value=\"".$_GET["mode"]."\" />
                        <input name=\"prev\" type=\"button\" value=\"".get_string("prev","scorm")."\" onClick=\"top.changeSco('prev');\" />&nbsp;\n";
-       choose_from_menu($options, "courseStructure", "", "", "document.navform.scoid.value=document.navform.courseStructure.options[document.navform.courseStructure.selectedIndex].value;document.navform.submit();");
-       echo "          &nbsp;<input name=\"next\" type=\"button\" value=\"".get_string("next","scorm")."\" onClick=\"top.changeSco('next')\" />
-                    </form>
+                       
+       if ($scorm->popup == "") {
+           if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' order by id ASC")){
+               $level=0;                       
+               $parents[$level]="/";
+               foreach ($scoes as $sco) {
+                   if ($parents[$level]!=$sco->parent) {
+                       if ($level>0 && $parents[$level-1]==$sco->parent) {
+                           $level--;
+                       } else {
+                           $level++;
+                           $parents[$level]=$sco->parent;
+                       }
+                   }
+                   $indenting = "";
+                   for ($i=0;$i<$level;$i++) {
+                       $indenting .= "-";
+                   }
+                   $options[$sco->id] = $indenting."&gt; ".$sco->title;
+               }
+           }
+           choose_from_menu($options, "courseStructure", "", "", "document.navform.scoid.value=document.navform.courseStructure.options[document.navform.courseStructure.selectedIndex].value;document.navform.submit();");
+       }
+       echo "          &nbsp;<input name=\"next\" type=\"button\" value=\"".get_string("next","scorm")."\" onClick=\"top.changeSco('next')\" />\n";
+       echo "       </form>
                </td>\n";
-       if ($_GET["mode"] == "browse")
-           echo "<td align=\"right\">".get_string("browsemode","scorm")."</td>\n";
+       
        echo "</tr>\n</table>\n";
+        if ($scorm->popup != "") {
+           $currentSCO = "";
+            if (!empty($_GET['scoid']))
+                $currentSCO = $_GET['scoid'];
+        ?>
+            <br />
+            <script language="Javascript">
+            <!--
+                function playSCO(scoid) {
+                   document.navform.scoid.value=scoid;
+                   document.navform.submit();
+               }
+               
+               function expandCollide(which,list) {
+                   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";
+       
+                   if (eval(beg+list+mid+".display") != "none") {
+                       which.src = "pix/plus.gif";
+                       eval(beg+list+mid+".display='none';");
+                   } else {
+                       which.src = "pix/minus.gif";
+                       eval(beg+list+mid+".display='block';");
+                   }
+       
+               }
+            -->
+            </script>
+            <style type="text/css">
+                .scormlist { list-style-type:none; }
+            </style>
+        <?php
+            print_simple_box_start("CENTER");
+           echo "<table>\n";
+           echo "  <tr><th>".get_string("coursestruct","scorm")."</th></tr>\n";
+           echo "  <tr><td nowrap>\n<ul class=\"scormlist\"'>\n";
+           $incomplete = false;
+           if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' order by id ASC")){
+               $level=0;
+               $sublist=0;
+               $parents[$level]="/";
+               foreach ($scoes as $sco) {
+                   if ($parents[$level]!=$sco->parent) {
+                       if ($level>0 && $parents[$level-1]==$sco->parent) {
+                           echo "  </ul></li>\n";
+                           $level--;
+                       } else {
+                           echo "  <li><ul id='".$sublist."' class=\"scormlist\"'>\n";
+                           $level++;
+                           $parents[$level]=$sco->parent;
+                       }
+                   }
+                   echo "    <li>\n";
+                   $nextsco = next($scoes);
+                   if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent != $parents[$level-1])))) {
+                       $sublist++;
+                       echo "      <img src=\"pix/minus.gif\" onClick='expandCollide(this,".$sublist.");'/>\n";
+                   } else {
+                       echo "      <img src=\"pix/spacer.gif\" />\n";
+                   }
+                   
+                   if ($sco->launch) {
+                       $startbold = '';
+                       $endbold = '';
+                       if ($sco->id == $currentSCO) {
+                           $startbold = '<b><u>';
+                           $endbold = '</u></b>';
+                       }
+                       if ($sco_user=get_record("scorm_sco_users","scoid",$sco->id,"userid",$USER->id)) {
+                           if ( $sco_user->cmi_core_lesson_status == "")
+                               $sco_user->cmi_core_lesson_status = "not attempted";
+                           echo "      <img src=\"pix/".scorm_remove_spaces($sco_user->cmi_core_lesson_status).".gif\" alt=\"".get_string(scorm_remove_spaces($sco_user->cmi_core_lesson_status),"scorm")."\" title=\"".get_string(scorm_remove_spaces($sco_user->cmi_core_lesson_status),"scorm")."\" />\n";
+                           if (($sco_user->cmi_core_lesson_status == "not attempted") || ($sco_user->cmi_core_lesson_status == "incomplete")) {
+                               if ($currentSCO == "") {
+                                   $incomplete = true;
+                                   $currentSCO = $sco->id;
+                                   $startbold = '<b><u>';
+                                   $endbold = '</u></b>';
+                               }
+                           }
+                       } else {
+                           echo "      <img src=\"pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" />";
+                           $incomplete = true;
+                       }
+                       echo "      &nbsp;$startbold<a href=\"javascript:playSCO(".$sco->id.");\">$sco->title</a>$endbold\n    </li>\n";
+                   } else {
+                       echo "      &nbsp;$sco->title\n    </li>\n";
+                   }
+               }
+               for ($i=0;$i<$level;$i++){
+                   echo "  </ul></li>\n";
+               }
+           }
+           echo "</ul></td></tr>\n";
+           echo "</table>\n";
+           print_simple_box_end();
+        }
        echo "</body>\n</html>\n";
     } else {
-       // 
-       // Frameset
-       //
-       if ($_POST["scoid"])
+        if ($_POST["scoid"])
            $scoid = "&scoid=".$_POST["scoid"];
-       echo "<html>\n";
+       echo "<html>\n";
         echo "<head><title>$course->shortname: $scorm->name</title></head>\n";
         echo "<script id=\"scormAPI\" language=\"JavaScript\" type=\"text/javascript\" src=\"scormAPI.php?id=$cm->id&mode=".$_POST["mode"].$scoid."\"></script>\n";
-        echo "<frameset rows=\"$SCORM_FRAME_SIZE,*\" onLoad=\"SCOInitialize();\">\n";
-        echo "     <frame name=\"nav\" src=\"playscorm.php?id=$cm->id&mode=".$_POST["mode"]."&frameset=top\">\n";
-        echo "     <frame name=\"main\" src=\"\">\n";
+
+        if ($scorm->popup == "") {
+           // 
+           // Frameset
+           //
+           echo "<frameset rows=\"$CFG->scorm_framesize,*\" onLoad=\"SCOInitialize();\">\n";
+            echo "         <frame name=\"nav\" src=\"playscorm.php?id=$cm->id&mode=".$_POST["mode"]."&frameset=top\">\n";
+            echo "         <frame name=\"main\" src=\"\">\n";
+        } else {
+            echo "<script language=\"Javascript\">\n";
+            echo '<!--';
+            echo "\nmain = window.open('','SCO Display','$scorm->popup');\n";
+            echo "-->\n";
+            echo '</script>';
+            echo "\n<frameset rows=\"*\" onLoad=\"SCOInitialize();\">\n";
+            echo "         <frame name=\"nav\" src=\"playscorm.php?id=$cm->id&mode=".$_POST["mode"]."&frameset=top".$scoid."\">\n";
+        }
         echo "</frameset>\n";
         echo "</html>\n";
     }
index c5dbaf1..42c7a43 100755 (executable)
@@ -90,6 +90,8 @@
                                    $scoreview = "";
                                    if ($data->cmi_core_score_raw > 0)
                                        $scoreview = "<br />".get_string("score","scorm").":&nbsp;".$data->cmi_core_score_raw;
+                                   if ( $data->cmi_core_lesson_status == "")
+                                       $data->cmi_core_lesson_status = "not attempted";
                                    $row[]="<img src=\"pix/".scorm_remove_spaces($data->cmi_core_lesson_status).".gif\" 
                                                   alt=\"".get_string(scorm_remove_spaces($data->cmi_core_lesson_status),"scorm")."\"
                                                   title=\"".get_string(scorm_remove_spaces($data->cmi_core_lesson_status),"scorm")."\">&nbsp;"
index e61621b..92880df 100755 (executable)
     include("api1_2.php");
 
 ?>
+
 function hilightcurrent(popupmenu) {
     for (i=0;i < popupmenu.options.length;i++) {
         if ( popupmenu.options[i].value == <?php echo $sco->id; ?> )
@@ -154,8 +155,9 @@ function SCOInitialize() {
     }
 ?>
        top.main.location="<?php echo $result; ?>";
+<?php  if ($scorm->popup == "") { ?>
        hilightcurrent(top.nav.document.navform.courseStructure);
-       
+<?php   } ?>
 } 
 
 function changeSco(direction) {
index 26e5a16..d1a9144 100755 (executable)
@@ -5,7 +5,7 @@
 ///  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 /////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2004060400;   // The (date) version of this module
+$module->version  = 2004061800;   // The (date) version of this module
 $module->requires = 2004051600;   // The version of Moodle that is required
 $module->cron     = 0;            // How often should cron check this module (seconds)?
 
index f89a562..97eae95 100755 (executable)
@@ -93,7 +93,7 @@
         print_simple_box_start("CENTER");
        echo "<table>\n";
        echo "  <tr><th>".get_string("coursestruct","scorm")."</th></tr>\n";
-       echo "  <tr><td nowrap>\n<ul compact class=\"scormlist\"'>\n";
+       echo "  <tr><td nowrap>\n<ul class=\"scormlist\"'>\n";
        $incomplete = false;
        if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' order by id ASC")){
            $level=0;
            foreach ($scoes as $sco) {
                if ($parents[$level]!=$sco->parent) {
                    if ($level>0 && $parents[$level-1]==$sco->parent) {
-                       echo "  </ul>\n";
+                       echo "  </ul></li>\n";
                        $level--;
                    } else {
-                       echo "  <ul id='".$sublist."' compact class=\"scormlist\"'>\n";
+                       echo "  <li><ul id='".$sublist."' class=\"scormlist\"'>\n";
                        $level++;
                        $parents[$level]=$sco->parent;
                    }
                }
            }
            for ($i=0;$i<$level;$i++){
-                echo "  </ul>\n";
+                echo "  </ul></li>\n";
            }
        }
        echo "</ul></td></tr>\n";