--- loncom/interface/lonnavmaps.pm 2002/03/16 08:56:53 1.32 +++ 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.32 2002/03/16 08:56:53 albertel 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 { @@ -338,9 +342,8 @@ sub followlinks () { sub tracetable { my ($sofar,$rid,$beenhere,$showtypes,$indent,$linkid)=@_; my $newshowtypes=$showtypes; - my $newlinkid=$linkid; my $further=$sofar; - #$Apache::lonxml::debug=1; +# $Apache::lonxml::debug=1; &Apache::lonxml::debug("$rid ; $linkid ; $sofar ; $beenhere ; ".$hash{'src_'.$rid}); if ($beenhere=~/\&$rid\&/) { return $further; } $beenhere.=$rid.'&'; @@ -355,9 +358,11 @@ sub tracetable { eq 'page') { $tprefix='j'; if ($indent) { $tprefix='i'.$indent.','.$tprefix; } + if ($linkid) { $tprefix='l'.$linkid.','.$tprefix; } $newshowtypes='problems'; $indent++; - $newlinkid=$rid; + #if in a .page continue to link the encompising .page + if (!$linkid) { $linkid=$rid; } } if (defined($rows[$sofar])) { $rows[$sofar].='&'.$tprefix.$rid; @@ -368,10 +373,10 @@ sub tracetable { (defined($hash{'map_finish_'.$hash{'src_'.$rid}}))) { my $frid=$hash{'map_finish_'.$hash{'src_'.$rid}}; $sofar=&tracetable($sofar,$hash{'map_start_'.$hash{'src_'.$rid}}, - '&'.$frid.'&',$newshowtypes,$indent,$newlinkid); + '&'.$frid.'&',$newshowtypes,$indent,$linkid); &addresource($hash{'src_'.$frid},\$sofar,$frid,$newshowtypes, - $indent,$newlinkid); - if ($tprefix =~ /j$/) { $indent--; } + $indent,$linkid); + if ($tprefix =~ /j$/) { $indent--; $linkid=''; } } } else { &addresource($hash{'src_'.$rid},\$sofar,$rid,$showtypes, @@ -410,10 +415,10 @@ sub handler { if ($ENV{'request.course.fn'}) { $fn=$ENV{'request.course.fn'}; if (-e "$fn.db") { - if ((tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER,0640)) && + if ((tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER(),0640)) && (tie(%parmhash,'GDBM_File', $ENV{'request.course.fn'}.'_parms.db', - &GDBM_READER,0640))) { + &GDBM_READER(),0640))) { $hashtied=1; } } @@ -433,8 +438,10 @@ sub handler { &Apache::loncommon::no_cache($r); $r->send_http_header; - my $firstres=$hash{'map_start_/res/'.$ENV{'request.course.uri'}}; - my $lastres=$hash{'map_finish_/res/'.$ENV{'request.course.uri'}}; + my $firstres=$hash{'map_start_'. + &Apache::lonnet::clutter($ENV{'request.course.uri'})}; + my $lastres=$hash{'map_finish_'. + &Apache::lonnet::clutter($ENV{'request.course.uri'})}; if (!(($firstres) && ($lastres))) { $r->print('
Coursemap undefined.'); } else { @@ -455,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) { @@ -465,6 +472,10 @@ sub handler { $courserdatas{$cid}=$reply; $courserdatas{$cid.'.last_cache'}=time; } + else + { + $networkFailedFlag = 1; + } } foreach (split(/\&/,$courserdatas{$cid})) { my ($name,$value)=split(/\=/,$_); @@ -488,13 +499,7 @@ sub handler { @rows=(); - &tracetable(0,$firstres,'&'.$lastres.'&','',0); - if ($hash{'src_'.$lastres}) { - my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$lastres}); - if (($brepriv eq '2') || ($brepriv eq 'F')) { - $rows[$#rows+1]=''.$lastres; - } - } + &tracetable(0,$firstres,'&','',0); # ------------------------------------------------------------------ Page parms @@ -566,16 +571,19 @@ sub handler { } } # ----------------------------------------------------------- Start Page Output - $r->print(''); } + + # Handle a network error + + if ($networkFailedFlag) + { + $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]) { @@ -607,10 +624,17 @@ sub handler { $r->print("\n