--- loncom/interface/lonnavmaps.pm 2002/09/02 19:35:31 1.46 +++ loncom/interface/lonnavmaps.pm 2002/09/03 20:46:30 1.47 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.46 2002/09/02 19:35:31 bowersj2 Exp $ +# $Id: lonnavmaps.pm,v 1.47 2002/09/03 20:46:30 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -67,6 +67,10 @@ my %courseopt; my %useropt; my %parmhash; +# This parameter keeps track of whether obtaining the user's information +# failed, which the colorizer in astatus can use +my $networkFailedFlag = 0; + # ------------------------------------------------------------------ Euclid gcd sub euclid { @@ -458,7 +462,7 @@ sub handler { my ($cdom,$cnum)=split(/\_/,$cid); my $userprefix=$uname.'_'.$udom.'_'; - + unless ($uhome eq 'no_host') { # -------------------------------------------------------------- Get coursedata unless ((time-$courserdatas{$cid.'.last_cache'})<240) { @@ -468,6 +472,10 @@ sub handler { $courserdatas{$cid}=$reply; $courserdatas{$cid.'.last_cache'}=time; } + else + { + $networkFailedFlag = 1; + } } foreach (split(/\&/,$courserdatas{$cid})) { my ($name,$value)=split(/\=/,$_); @@ -584,6 +592,15 @@ sub handler { ($currenturl!~/^\/res\/adm/)) { $r->print('Current Location

'); } + + # Handle a network error + + if ($networkFailedFlag) + { + $r->print('

LON-CAPA network failure.

'."\n"); + $r->print("

LON-CAPA's network is having difficulties, some problem" . + " information, such as due dates, will not be available."); + } # ----------------------------------------------------- The little content list for ($i=0;$i<=$#rows;$i++) { if ($rows[$i]) { @@ -642,19 +659,36 @@ sub handler { my $tcode=$2; my $ctext=$3; $rid=$4; - if ($tcode eq '1') { + + # will open later + if ($tcode eq '1') { $add=''; } + + # solved/correct if ($code eq '3') { $add=''; - } elsif ($code eq '4') { + } elsif ($code eq '4') { # partially correct $add=''; } else { - $add=''; - if ($tcode eq '2') { + # not attempted + + # we end up here on network failure, so pick a neutral + # color if the network failed instead of bright red. + if ( $networkFailedFlag ) + { + $add = ''; + } + else + { + $add=''; + } + + if ($tcode eq '2') { # open, not past due $add=''; } - if ($tcode eq '4') { + + if ($tcode eq '4') { # due in next 24 hours $add=''; $adde=''; } @@ -672,6 +706,10 @@ sub handler { $hwk=''; $hwke=' ('.$ctext.')'; } + if ($networkFailedFlag) + { + $hwke=' (status unavailable)'; + } } if ($rid && $hash{'src_'.$rid} eq $currenturl) { $add=$add.''.