[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm

bowersj2 lon-capa-cvs@mail.lon-capa.org
Fri, 25 Apr 2003 17:02:26 -0000


bowersj2		Fri Apr 25 13:02:26 2003 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  Correctly detect when a network error occurs that prevents us from
  corrently retrieving coursedata. Display "Having technical difficulties; 
  please check status later" instead of nothing.
  
  (The message is verbose but unfortunately we can't just stick it at
  the top of the screen; nobody will see it there.)
  
  Should fix bug 1362.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.181 loncom/interface/lonnavmaps.pm:1.182
--- loncom/interface/lonnavmaps.pm:1.181	Thu Apr 24 14:18:38 2003
+++ loncom/interface/lonnavmaps.pm	Fri Apr 25 13:02:26 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.181 2003/04/24 18:18:38 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.182 2003/04/25 17:02:26 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -271,7 +271,9 @@
     my $part = shift;
     my $status = $res->status($part);
 
-    if ($status == $res->NETWORK_FAILURE) { return ""; }
+    if ($status == $res->NETWORK_FAILURE) { 
+        return "Having technical difficulties; please check status later"; 
+    }
     if ($status == $res->NOTHING_SET) {
         return "Not currently assigned.";
     }
@@ -1472,14 +1474,12 @@
             unless ((time-$courserdatas{$cid.'.last_cache'})<240) {
                 my $reply=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.
                                                  ':resourcedata',$chome);
-                if ($reply!~/^error\:/) {
+                # Check for network failure
+                if ( $reply =~ /no.such.host/i || $reply =~ /con_lost/i) {
+                    $self->{NETWORK_FAILURE} = 1;
+                } elsif ($reply!~/^error\:/) {
                     $courserdatas{$cid}=$reply;
                     $courserdatas{$cid.'.last_cache'}=time;
-                }
-                # check to see if network failed
-                elsif ( $reply=~/no.such.host/i || $reply=~/con.*lost/i )
-                {
-                    $self->{NETWORK_FAILURE} = 1;
                 }
             }
             foreach (split(/\&/,$courserdatas{$cid})) {