[LON-CAPA-cvs] cvs: loncom /html/res/adm/pages menu.html /interface lonmenu.pm /xml lonxml.pm

www lon-capa-cvs@mail.lon-capa.org
Mon, 15 Jul 2002 19:45:18 -0000


www		Mon Jul 15 15:45:18 2002 EDT

  Modified files:              
    /loncom/html/res/adm/pages	menu.html 
    /loncom/interface	lonmenu.pm 
    /loncom/xml	lonxml.pm 
  Log:
  Doing timeout is not precise enough to keep a clock going on many systems.
  On sync, figure out time difference between client and server, use client
  clock and apply delta instead.
  
  
Index: loncom/html/res/adm/pages/menu.html
diff -u loncom/html/res/adm/pages/menu.html:1.59 loncom/html/res/adm/pages/menu.html:1.60
--- loncom/html/res/adm/pages/menu.html:1.59	Wed May 29 12:22:09 2002
+++ loncom/html/res/adm/pages/menu.html	Mon Jul 15 15:45:18 2002
@@ -4,7 +4,7 @@
 Remote Control
 
 //
-// $Id: menu.html,v 1.59 2002/05/29 16:22:09 www Exp $
+// $Id: menu.html,v 1.60 2002/07/15 19:45:18 www Exp $
 //
 // Copyright Michigan State University Board of Trustees
 //
@@ -70,7 +70,9 @@
 var currentStale=1;
 var menucltim;
 
-var clock=new Date();
+var constructURL='';
+
+var clockdelta=0;
 
 // not used (yet)
 // var w_Annotator;
@@ -104,8 +106,14 @@
 var clienthost=window.location.host;
 var clientwindow=opener;
 
+function syncclock(servertime) {
+    var clientclock=new Date;
+    clockdelta=servertime-clientclock.getTime();
+}
+
 function advanceclock() {
-    clock.setTime(clock.getTime()+1000);
+    var clock=new Date();
+    clock.setTime(clock.getTime()+clockdelta);
 
     var days=""+clock.getDate();
     if (days.length<2) { days="0"+days; }
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.23 loncom/interface/lonmenu.pm:1.24
--- loncom/interface/lonmenu.pm:1.23	Fri Jun 14 16:02:43 2002
+++ loncom/interface/lonmenu.pm	Mon Jul 15 15:45:18 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.23 2002/06/14 20:02:43 www Exp $
+# $Id: lonmenu.pm,v 1.24 2002/07/15 19:45:18 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -174,7 +174,7 @@
             }
         }
     }
-    $output.="swmenu.clock.setTime(1000*".time.");";
+    $output.="swmenu.syncclock(1000*".time.");";
     return $output;
 }
 
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.180 loncom/xml/lonxml.pm:1.181
--- loncom/xml/lonxml.pm:1.180	Fri Jul 12 12:37:38 2002
+++ loncom/xml/lonxml.pm	Mon Jul 15 15:45:18 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.180 2002/07/12 16:37:38 albertel Exp $
+# $Id: lonxml.pm,v 1.181 2002/07/15 19:45:18 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -346,7 +346,7 @@
     $Apache::lonxml::registered=1;
     my $nothing='';
     if ($ENV{'browser.type'} eq 'explorer') { $nothing='javascript:void(0);'; }
-    my $timesync='menu.clock.setTime(1000*'.time.');';
+    my $timesync='menu.syncclock(1000*'.time.');';
     if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
         my $hwkadd='';
         if ($ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {