Diff for /rat/lonpage.pm between versions 1.56 and 1.57

version 1.56, 2004/03/22 20:37:06 version 1.57, 2004/08/29 18:34:36
Line 45  use Apache::Constants qw(:common :http); Line 45  use Apache::Constants qw(:common :http);
 use Apache::lonnet();  use Apache::lonnet();
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonxml();  use Apache::lonxml();
   use Apache::lonlocal;
 use Apache::lonmenu;  use Apache::lonmenu;
 use HTML::TokeParser;  use HTML::TokeParser;
 use GDBM_File;  use GDBM_File;
Line 72  sub euclid { Line 73  sub euclid {
 sub tracetable {  sub tracetable {
     my ($sofar,$rid,$beenhere)=@_;      my ($sofar,$rid,$beenhere)=@_;
     my $further=$sofar;      my $further=$sofar;
       my $randomout=0;
       if ($ENV{'request.role'} =~ /^st/) {
           $randomout = $hash{'randomout_'.$rid};
       }
     unless ($beenhere=~/\&$rid\&/) {      unless ($beenhere=~/\&$rid\&/) {
        $beenhere.=$rid.'&';            $beenhere.=$rid.'&';
           unless ($randomout) {
        if (defined($hash{'is_map_'.$rid})) {              if (defined($hash{'is_map_'.$rid})) {
            if ((defined($hash{'map_start_'.$hash{'src_'.$rid}})) &&                  if ((defined($hash{'map_start_'.$hash{'src_'.$rid}})) &&
                (defined($hash{'map_finish_'.$hash{'src_'.$rid}}))) {                      (defined($hash{'map_finish_'.$hash{'src_'.$rid}}))) {
               my $frid=$hash{'map_finish_'.$hash{'src_'.$rid}};                      my $frid=$hash{'map_finish_'.$hash{'src_'.$rid}};
       $sofar=              $sofar=
                 &tracetable($sofar,$hash{'map_start_'.$hash{'src_'.$rid}},                         &tracetable($sofar,$hash{'map_start_'.$hash{'src_'.$rid}},
                 '&'.$frid.'&');                         '&'.$frid.'&');
               $sofar++;                      $sofar++;
               if ($hash{'src_'.$frid}) {                      if ($hash{'src_'.$frid}) {
                my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$frid});                          my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$frid});
                if (($brepriv eq '2') || ($brepriv eq 'F')) {                          if (($brepriv eq '2') || ($brepriv eq 'F')) {
                  if (defined($rows[$sofar])) {                              if (defined($rows[$sofar])) {
                    $rows[$sofar].='&'.$frid;                                  $rows[$sofar].='&'.$frid;
                  } else {                              } else {
                    $rows[$sofar]=$frid;                                  $rows[$sofar]=$frid;
                  }                              }
        }                  }
       }              }
    }          }
        } else {              } else {
           $sofar++;                  $sofar++;
           if ($hash{'src_'.$rid}) {                  if ($hash{'src_'.$rid}) {
            my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$rid});                      my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$rid});
            if (($brepriv eq '2') || ($brepriv eq 'F')) {                      if (($brepriv eq '2') || ($brepriv eq 'F')) {
              if (defined($rows[$sofar])) {                          if (defined($rows[$sofar])) {
                $rows[$sofar].='&'.$rid;                              $rows[$sofar].='&'.$rid;
              } else {                          } else {
                $rows[$sofar]=$rid;                              $rows[$sofar]=$rid;
              }                          }
    }              }
           }                  }
        }              }
           }
        if (defined($hash{'to_'.$rid})) {  
   my $mincond=1;          if (defined($hash{'to_'.$rid})) {
           my $next='';      my $mincond=1;
           foreach (split(/\,/,$hash{'to_'.$rid})) {              my $next='';
               my $thiscond=              foreach (split(/\,/,$hash{'to_'.$rid})) {
                   my $thiscond=
       &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$_}});        &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$_}});
               if ($thiscond>=$mincond) {                  if ($thiscond>=$mincond) {
   if ($next) {      if ($next) {
       $next.=','.$_.':'.$thiscond;          $next.=','.$_.':'.$thiscond;
                   } else {                      } else {
                       $next=$_.':'.$thiscond;                          $next=$_.':'.$thiscond;
   }      }
                   if ($thiscond>$mincond) { $mincond=$thiscond; }                      if ($thiscond>$mincond) { $mincond=$thiscond; }
       }          }
           }              }
           foreach (split(/\,/,$next)) {              foreach (split(/\,/,$next)) {
               my ($linkid,$condval)=split(/\:/,$_);                  my ($linkid,$condval)=split(/\:/,$_);
               if ($condval>=$mincond) {                  if ($condval>=$mincond) {
                 my $now=&tracetable($sofar,$hash{'goesto_'.$linkid},$beenhere);                      my $now=&tracetable($sofar,$hash{'goesto_'.$linkid},$beenhere);
                 if ($now>$further) { $further=$now; }                      if ($now>$further) { $further=$now; }
       }          }
           }              }
           }
        }  
     }      }
     return $further;      return $further;
 }  }

Removed from v.1.56  
changed lines
  Added in v.1.57


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