Diff for /loncom/interface/londocs.pm between versions 1.28 and 1.29

version 1.28, 2002/10/16 18:48:12 version 1.29, 2002/10/16 19:15:55
Line 42  my $iconpath; Line 42  my $iconpath;
 my %hash;  my %hash;
   
 my $hashtied;  my $hashtied;
   my %alreadyseen=();
   
 # Mapread read maps into lonratedt::global arrays   # Mapread read maps into lonratedt::global arrays 
 # @order and @resources, determines status  # @order and @resources, determines status
Line 240  sub untiehash { Line 241  sub untiehash {
     $hashtied=0;      $hashtied=0;
 }  }
   
   # --------------------------------------------------------------- check on this
   
   sub checkonthis {
       my ($r,$url,$level,$title)=@_;
       $alreadyseen{$url}=1;
       $r->rflush();
       if ($url) {
          $r->print('<br />');
          for (my $i=0;$i<=$level*5;$i++) {
              $r->print('&nbsp;');
          }
          $r->print('<a href="'.$url.'" target="cat">'.
    ($title?$title:$url).'</a> ');
          if ($url=~/^\/res\//) {
     my $result=&Apache::lonnet::repcopy(
                                 &Apache::lonnet::filelocation('',$url));
             if ($result==OK) {
                $r->print('<font color="green">ok</font>');
                $r->rflush();
        my $dependencies=
                   &Apache::lonnet::metadata($url,'dependencies');
                foreach (split(/\,/,$dependencies)) {
    if (($_=~/^\/res\//) && (!$alreadyseen{$_})) {
                       &checkonthis($r,$_,$level+1);
                    }
                }
             } elsif ($result==HTTP_SERVICE_UNAVAILABLE) {
                $r->print('<font color="red"><b>connection down</b></font>');
             } elsif ($result==HTTP_NOT_FOUND) {
                $r->print('<font color="red"><b>not found</b></font>');
             } else {
                $r->print('<font color="red"><b>access denied</b></font>');
             }
         }
      }
   }
   
 # ================================================================ Main Handler  # ================================================================ Main Handler
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
Line 256  sub handler { Line 294  sub handler {
    $r->print('<html><head><title>Verify Content</title></head>'.     $r->print('<html><head><title>Verify Content</title></head>'.
               &Apache::loncommon::bodytag('Verify Course Documents'));                &Apache::loncommon::bodytag('Verify Course Documents'));
    $hashtied=0;     $hashtied=0;
    my %alreadyseen=();  
    &tiehash();     &tiehash();
    foreach (keys %hash) {     foreach (keys %hash) {
        if (($_=~/^src\_(.+)$/) && (!$alreadyseen{$hash{$_}})) {         if (($_=~/^src\_(.+)$/) && (!$alreadyseen{$hash{$_}})) {
            $alreadyseen{$hash{$_}}=1;             &checkonthis($r,$hash{$_},0,$hash{'title_'.$1});
            my $resid=$1;  
            $r->rflush();  
    if ($hash{$_}) {  
                my $fn=$hash{$_};  
                $r->print('<br /><a href="'.$fn.'" target="cat">'.  
  ($hash{'title_'.$resid}?$hash{'title_'.$resid}:$fn).'</a> ');  
         if ($fn=~/^\/res\//) {  
    my $result=&Apache::lonnet::repcopy(  
                               &Apache::lonnet::filelocation('',$fn));  
                    if ($result==OK) {  
                        $r->print('<font color="green">ok</font>');  
                        $r->rflush();  
        my $dependencies=  
                           &Apache::lonnet::metadata($hash{$_},'dependencies');  
                        $r->print('Dependencies: '.$dependencies.'<br />');  
                    } elsif ($result==HTTP_SERVICE_UNAVAILABLE) {  
                        $r->print(  
                          '<font color="red"><b>connection down</b></font>');  
                    } elsif ($result==HTTP_NOT_FOUND) {  
                        $r->print('<font color="red"><b>not found</b></font>');  
                    } else {  
                        $r->print(  
                              '<font color="red"><b>access denied</b></font>');  
                    }  
                }  
            }  
        }         }
    }     }
    &untiehash();     &untiehash();

Removed from v.1.28  
changed lines
  Added in v.1.29


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