MDL-14492 Provide feedback to user about redirect delay in loadsco.php.
authorpiers <piers>
Mon, 4 Aug 2008 02:35:13 +0000 (02:35 +0000)
committerpiers <piers>
Mon, 4 Aug 2008 02:35:13 +0000 (02:35 +0000)
mod/scorm/loadSCO.php
mod/scorm/pix/wait.gif [new file with mode: 0644]

index 1df8a94..a64d9a4 100755 (executable)
             $result = get_file_url($scorm->course .'/'. $basedir .'/'. $launcher);
         }
     }
             $result = get_file_url($scorm->course .'/'. $basedir .'/'. $launcher);
         }
     }
+    
+    $scormpixdir = $CFG->modpixpath.'/scorm/pix';
 ?>
 <html>
     <head>
         <title>LoadSCO</title>
         <script type="text/javascript">
         //<![CDATA[
 ?>
 <html>
     <head>
         <title>LoadSCO</title>
         <script type="text/javascript">
         //<![CDATA[
-            setTimeout('document.location = "<?php echo $result ?>";',<?php echo $delayseconds ?>000);
-        //]]>
+        function doredirect() {
+            var e = document.getElementById("countdown");
+            var cSeconds = parseInt(e.innerHTML);
+            var timer = setInterval(function() {
+                                            if( cSeconds ) {
+                                                e.innerHTML = --cSeconds;
+                                            } else {
+                                                clearInterval(timer);
+                                                document.body.innerHTML = "Activity loading, please wait ....";
+                                                location = "<?php echo $result ?>";
+                                            }
+                                        }, 1000);
+        }
+        //]]>         
         </script>
         <noscript>
             <meta http-equiv="refresh" content="<?php echo $delayseconds ?>;url=<?php echo $result ?>" />
         </noscript> 
     </head>
         </script>
         <noscript>
             <meta http-equiv="refresh" content="<?php echo $delayseconds ?>;url=<?php echo $result ?>" />
         </noscript> 
     </head>
-    <body>
-        &nbsp;
-    </body>
+    <body onload="doredirect();">
+        <p><?php echo get_string('activityloading', 'scorm');?> <span id="countdown"><?php echo $delayseconds ?></span> <?php echo get_string('seconds', 'scorm');?>(s). &nbsp; <img src='<?php echo $scormpixdir;?>/wait.gif'><p>
+    </body> 
 </html>
 </html>
diff --git a/mod/scorm/pix/wait.gif b/mod/scorm/pix/wait.gif
new file mode 100644 (file)
index 0000000..471c1a4
Binary files /dev/null and b/mod/scorm/pix/wait.gif differ