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

www lon-capa-cvs@mail.lon-capa.org
Fri, 31 Jan 2003 21:46:36 -0000


www		Fri Jan 31 16:46:36 2003 EDT

  Modified files:              
    /loncom/auth	lonauth.pm 
    /loncom/html/res/adm/pages	menu.html 
    /loncom/interface	lonmenu.pm 
  Log:
  Attempt to work on bug #1205 by changing the timing of events at login for the
  remote. Also, trying to isolate remote-related code into lonmenu.pm so that
  alternative remotes/navigation become easier to implement later.
  
  
Index: loncom/auth/lonauth.pm
diff -u loncom/auth/lonauth.pm:1.34 loncom/auth/lonauth.pm:1.35
--- loncom/auth/lonauth.pm:1.34	Wed Jan 15 20:37:26 2003
+++ loncom/auth/lonauth.pm	Fri Jan 31 16:46:36 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # User Authentication Module
 #
-# $Id: lonauth.pm,v 1.34 2003/01/16 01:37:26 www Exp $
+# $Id: lonauth.pm,v 1.35 2003/01/31 21:46:36 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -165,8 +165,9 @@
     $cookie="lonID=$cookie; path=/";
 # -------------------------------------------------------- Menu script and info
     my $windowinfo=&Apache::lonmenu::open($clientos);
-# ------------------------------------------------------------- Info for Remote
-    my $configmenu=&Apache::lonmenu::rawconfig($r);
+    my $startupremote=&Apache::lonmenu::startupremote($lowerurl);
+    my $setflags=&Apache::lonmenu::setflags();
+    my $maincall=&Apache::lonmenu::maincall();
 # ------------------------------------------------- Output for successful login
 
     $r->send_cgi_header(<<ENDHEADER);
@@ -178,52 +179,17 @@
 <html>
 <head>
 <title>Successful Login to the LearningOnline Network with CAPA</title>
-<script>
-
-// --------------------------------------------- Checks if server frame defined
-
-function checkdef() {
-   if ((menuloaded==0) && (tim==0)) { setTimeout('checkdef()',100); }
-}
-
-// ---------------------------------------------------------- The wait function
-var canceltim;
-function wait() {
-   if ((menuloaded==1) || (tim==1)) {
-      if (tim==0) {
-         clearTimeout(canceltim);
-         $configmenu
-         window.location='$lowerurl';  
-      } else {
-         alert("Remote Control Timed Out.");
-      }
-   } else {
-      setTimeout('wait();',100);
-   }
-}
-
-function main() {
-   canceltim=setTimeout('tim=1;',80000);
-   checkdef();
-   wait();
-}
-
-</script>
+$startupremote
 </head>
 <body bgcolor="#FFFFFF">
-<script>
-    menuloaded=0;
-    tim=0;
-</script>
+$setflags
 $windowinfo
 <h1>Welcome!</h1>
 Welcome to the Learning<i>Online</i> Network with CAPA.
 Please wait while your session
 is being set up.<p>
 <a href="/adm/loginproblems.html">Problems?</a></p>
-<script>
-    main();
-</script>
+$maincall
 </body>
 </html>
 ENDSUCCESS
Index: loncom/html/res/adm/pages/menu.html
diff -u loncom/html/res/adm/pages/menu.html:1.84 loncom/html/res/adm/pages/menu.html:1.85
--- loncom/html/res/adm/pages/menu.html:1.84	Wed Jan 29 10:22:06 2003
+++ loncom/html/res/adm/pages/menu.html	Fri Jan 31 16:46:36 2003
@@ -4,7 +4,7 @@
 Remote Control
 
 //
-// $Id: menu.html,v 1.84 2003/01/29 15:22:06 www Exp $
+// $Id: menu.html,v 1.85 2003/01/31 21:46:36 www Exp $
 //
 // Copyright Michigan State University Board of Trustees
 //
@@ -37,6 +37,7 @@
 <body bgcolor="#BBBBBB" 
       background="remotebg.gif"
       onUnload="logout();"
+      onLoad="activate();"
       >
 <font size="1">
 <script type="text/javascript">
@@ -165,7 +166,7 @@
 }
 
 function activate () {
-   opener.menuloaded=1;
+   setTimeout('opener.menuloaded=1;',3000);
    setTimeout('active=1;',2000);
    advanceclock();
 }
@@ -227,7 +228,11 @@
    dt[idx]=texttop;
    db[idx]=textbot;
    ds[idx]=desc;
-   eval('this.document.links.link'+idx+'.title="'+desc+'"');
+   for (var k=0;k<document.links.length;k++) {
+       if (document.links[k].name=='link'+idx) {
+          document.links[k].title=desc;
+       }
+   }
 } 
 
 function clearbut(row,col) {
@@ -237,7 +242,11 @@
    dt[idx]='';
    db[idx]='';
    ds[idx]='';
-   eval('this.document.links.link'+idx+'.title=""');
+   for (var k=0;k<document.links.length;k++) {
+       if (document.links[k].name=='link'+idx) {
+          document.links[k].title='';
+       }
+   }
 }
 
 function setstatus(tp,bt) {
@@ -521,9 +530,6 @@
 <input type="hidden" name="url" value="none" />
 <input type="hidden" name="symb" value="none" />
 </form>
-<script>
-activate();
-</script>
 </font>
 </body>
 </html>
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.31 loncom/interface/lonmenu.pm:1.32
--- loncom/interface/lonmenu.pm:1.31	Wed Jan 29 10:22:06 2003
+++ loncom/interface/lonmenu.pm	Fri Jan 31 16:46:36 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.31 2003/01/29 15:22:06 www Exp $
+# $Id: lonmenu.pm,v 1.32 2003/01/31 21:46:36 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -39,6 +39,55 @@
 use Apache::File;
 use vars qw(@desklines $readdesk);
 
+# ============================================================= Start up remote
+
+sub startupremote {
+    my ($lowerurl)=@_;
+    my $configmenu=&rawconfig();
+    return(<<ENDREMOTESTARTUP);
+<script>
+
+// ---------------------------------------------------------- The wait function
+var canceltim;
+function wait() {
+   if ((menuloaded==1) || (tim==1)) {
+      if (tim==0) {
+         clearTimeout(canceltim);
+         $configmenu
+         window.location='$lowerurl';  
+      } else {
+         alert("Remote Control Timed Out.");
+      }
+   } else {
+      setTimeout('wait();',100);
+   }
+}
+
+function main() {
+   canceltim=setTimeout('tim=1;',80000);
+   wait();
+}
+
+</script>
+ENDREMOTESTARTUP
+}
+
+sub setflags() {
+    return(<<ENDSETFLAGS);
+<script>
+    menuloaded=0;
+    tim=0;
+</script>
+ENDSETFLAGS
+}
+
+sub maincall() {
+    return(<<ENDMAINCALL);
+<script>
+    main();
+</script>
+ENDMAINCALL
+}
 # ================================================================= Reopen menu
 
 sub reopenmenu {
@@ -123,7 +172,6 @@
 }
 
 sub rawconfig {
-    my $r = shift;
     my $output="var swmenu=".&openmenu();
     my $uname=$ENV{'user.name'};
     my $udom=$ENV{'user.domain'};
@@ -183,7 +231,7 @@
                     }                       
                     $act =~ s/\$caname/$caname/g;
                     my $home = &Apache::lonnet::homeserver($caname,$cadom);
-                    if ($home eq $r->dir_config('lonHostID')) {
+                    if ($home eq $Apache::lonnet::perlvar{'lonHostID'}) {
                         $output.=switch($caname,$cadom,
                                         $row,$col,$img,$top,$bot,$act,$desc);
                     }