Diff for /loncom/interface/lonnavmaps.pm between versions 1.42 and 1.48

version 1.42, 2002/08/18 21:45:41 version 1.48, 2002/09/05 19:47:29
Line 67  my %courseopt; Line 67  my %courseopt;
 my %useropt;  my %useropt;
 my %parmhash;  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  # ------------------------------------------------------------------ Euclid gcd
   
 sub euclid {  sub euclid {
Line 339  sub tracetable { Line 343  sub tracetable {
     my ($sofar,$rid,$beenhere,$showtypes,$indent,$linkid)=@_;      my ($sofar,$rid,$beenhere,$showtypes,$indent,$linkid)=@_;
     my $newshowtypes=$showtypes;      my $newshowtypes=$showtypes;
     my $further=$sofar;      my $further=$sofar;
     #$Apache::lonxml::debug=1;  # $Apache::lonxml::debug=1;
     &Apache::lonxml::debug("$rid ; $linkid ; $sofar ; $beenhere ; ".$hash{'src_'.$rid});      &Apache::lonxml::debug("$rid ; $linkid ; $sofar ; $beenhere ; ".$hash{'src_'.$rid});
     if ($beenhere=~/\&$rid\&/) { return $further; }      if ($beenhere=~/\&$rid\&/) { return $further; }
     $beenhere.=$rid.'&';      $beenhere.=$rid.'&';
Line 458  sub handler { Line 462  sub handler {
  my ($cdom,$cnum)=split(/\_/,$cid);   my ($cdom,$cnum)=split(/\_/,$cid);
   
  my $userprefix=$uname.'_'.$udom.'_';   my $userprefix=$uname.'_'.$udom.'_';
   
  unless ($uhome eq 'no_host') {    unless ($uhome eq 'no_host') { 
 # -------------------------------------------------------------- Get coursedata  # ------------------------------------------------- Get coursedata (if present)
     unless ((time-$courserdatas{$cid.'.last_cache'})<240) {      unless ((time-$courserdatas{$cid.'.last_cache'})<240) {
  my $reply=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.   my $reply=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.
  ':resourcedata',$chome);   ':resourcedata',$chome);
Line 468  sub handler { Line 472  sub handler {
     $courserdatas{$cid}=$reply;      $courserdatas{$cid}=$reply;
     $courserdatas{$cid.'.last_cache'}=time;      $courserdatas{$cid.'.last_cache'}=time;
  }   }
    # check to see if network failed
    elsif ( $reply=~/no.such.host/i || $reply=~/con.*lost/i )
    {
       $networkFailedFlag = 1;
    }
     }      }
     foreach (split(/\&/,$courserdatas{$cid})) {      foreach (split(/\&/,$courserdatas{$cid})) {
  my ($name,$value)=split(/\=/,$_);   my ($name,$value)=split(/\=/,$_);
Line 491  sub handler { Line 500  sub handler {
   
  @rows=();   @rows=();
   
  &tracetable(0,$firstres,'&'.$lastres.'&','',0);   &tracetable(0,$firstres,'&','',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;  
     }  
  }  
   
 # ------------------------------------------------------------------ Page parms  # ------------------------------------------------------------------ Page parms
   
Line 569  sub handler { Line 572  sub handler {
  }   }
     }      }
 # ----------------------------------------------------------- Start Page Output  # ----------------------------------------------------------- Start Page Output
     $r->print('<html><head><title>Navigate LON-CAPA Maps</title></head>');              my $bodytagadd='';
     $r->print('<body bgcolor="#FFFFFF"');      $r->print(
                      '<html><head><title>Navigate Course Map</title></head>');
     if (($currenturl=~/^\/res/) &&      if (($currenturl=~/^\/res/) &&
  ($currenturl!~/^\/res\/adm/)) {   ($currenturl!~/^\/res\/adm/)) {
  $r->print(' onLoad="window.location.hash='."'curloc'".'"');   $bodytagadd='onLoad="window.location.hash='."'curloc'".'"';
     }      }
     $r->print('><script>window.focus();</script>'.      $r->print(&Apache::loncommon::bodytag('Navigate Course Map','',
       '<img align=right src=/adm/lonIcons/lonlogos.gif>'.                                                    $bodytagadd));
       '<h1>Navigate Course Map</h1>');      $r->print('<script>window.focus();</script>');
     my $desc=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};      my $desc=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};
     if (defined($desc)) { $r->print("<h2>$desc</h2>\n"); }      if (defined($desc)) { $r->print("<h2>$desc</h2>\n"); }
     $r->print("<h3>$date</h3>\n");      $r->print("<h3>$date</h3>\n");
Line 589  sub handler { Line 593  sub handler {
  ($currenturl!~/^\/res\/adm/)) {   ($currenturl!~/^\/res\/adm/)) {
  $r->print('<a href="#curloc">Current Location</a><p>');   $r->print('<a href="#curloc">Current Location</a><p>');
     }      }
   
       # Handle a network error
   
       if ($networkFailedFlag)
       {
    $r->print('<H2>LON-CAPA network failure.</H2>'."\n");
    $r->print("<p>LON-CAPA's network is having difficulties, some problem" .
     " information, such as due dates, will not be available.");
       }
 # ----------------------------------------------------- The little content list  # ----------------------------------------------------- The little content list
     for ($i=0;$i<=$#rows;$i++) {      for ($i=0;$i<=$#rows;$i++) {
  if ($rows[$i]) {   if ($rows[$i]) {
Line 612  sub handler { Line 625  sub handler {
     $r->print("\n<tr>");      $r->print("\n<tr>");
     my @colcont=split(/\&/,$rows[$i]);      my @colcont=split(/\&/,$rows[$i]);
     my $avespan=$lcm/($#colcont+1);      my $avespan=$lcm/($#colcont+1);
   
       # for each item I wish to print on this row...
     for ($j=0;$j<=$#colcont;$j++) {      for ($j=0;$j<=$#colcont;$j++) {
  my $indent;my $indentstr;   my $indent;my $indentstr;
  my $linkid;   my $linkid;
Line 645  sub handler { Line 660  sub handler {
     my $tcode=$2;      my $tcode=$2;
     my $ctext=$3;      my $ctext=$3;
     $rid=$4;      $rid=$4;
     if ($tcode eq '1') {      
       # will open later
       if ($tcode eq '1') { 
  $add='<td bgcolor="#AAAAAA">';   $add='<td bgcolor="#AAAAAA">';
     }      }
   
       # solved/correct
     if ($code eq '3') {      if ($code eq '3') {
  $add='<td bgcolor="#AAFFAA">';   $add='<td bgcolor="#AAFFAA">';
     } elsif ($code eq '4') {      } elsif ($code eq '4') { # partially correct
  $add='<td bgcolor="#E0FFAA">';   $add='<td bgcolor="#E0FFAA">';
     } else {      } else {
  $add='<td bgcolor="#FFAAAA">';   # not attempted
  if ($tcode eq '2') {  
    # we end up here on network failure, so pick a neutral
    # color if the network failed instead of bright red.
    if ( $networkFailedFlag )
    {
       $add = '<td bgcolor="#AAAAAA">';
    }
    else
    {
       $add='<td bgcolor="#FFAAAA">';
    }
   
    if ($tcode eq '2') { # open, not past due
     $add='<td bgcolor="#FFFFAA">';      $add='<td bgcolor="#FFFFAA">';
  }   }
  if ($tcode eq '4') {  
    if ($tcode eq '4') { # due in next 24 hours
     $add='<td bgcolor="#FFFF33">';      $add='<td bgcolor="#FFFF33">';
     $adde='</td>';      $adde='</td>';
  }   }
Line 675  sub handler { Line 707  sub handler {
  $hwk='<font color="#229922"><b>';   $hwk='<font color="#229922"><b>';
  $hwke='</b> ('.$ctext.')</font>';   $hwke='</b> ('.$ctext.')</font>';
     }      }
       if ($networkFailedFlag) 
       {
    $hwke='</b> (status unavailable)</font>';
       }
  }   }
  if ($rid && $hash{'src_'.$rid} eq $currenturl) {   if ($rid && $hash{'src_'.$rid} eq $currenturl) {
     $add=$add.'<a name="curloc"></a>'.      $add=$add.'<a name="curloc"></a>'.

Removed from v.1.42  
changed lines
  Added in v.1.48


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>