Diff for /loncom/interface/lonnavmaps.pm between versions 1.30 and 1.31

version 1.30, 2002/03/15 21:56:11 version 1.31, 2002/03/15 23:39:41
Line 268  sub astatus { Line 268  sub astatus {
     return 'p'.$code.$tcode.'"'.$ctext.'"';      return 'p'.$code.$tcode.'"'.$ctext.'"';
 }  }
   
 # ------------------------------------------------------------ Build page table  
   
 sub tracetable {  sub addresource {
     my ($sofar,$rid,$beenhere)=@_;      my ($resource,$sofar,$rid,$showtypes)=@_;
     my $further=$sofar;      &Apache::lonxml::debug("Adding $resource allowing $showtypes");
     unless ($beenhere=~/\&$rid\&/) {      if ($showtypes eq 'problems') {
  $beenhere.=$rid.'&';     if ($resource!~/\.(problem|exam|quiz|assess|survey|form)$/) {
       &Apache::lonxml::debug("Returning early");
  if (defined($hash{'is_map_'.$rid})) {      return;
     $sofar++;   } 
     my $tprefix='';      }
     if ($hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$rid}}}       my $brepriv=&Apache::lonnet::allowed('bre',$resource);
  eq 'sequence') {       if ($hash{'src_'.$rid}) {
  $tprefix='h';    if (($brepriv eq '2') || ($brepriv eq 'F')) {
     } else {      my $pprefix='';
  #if it's a page we need to still pull out the problems      if ($resource=~/\.(problem|exam|quiz|assess|survey|form)$/) {
    $pprefix=&astatus($rid);
     }      }
     if (defined($rows[$sofar])) {      if (defined($rows[$sofar])) {
  $rows[$sofar].='&'.$tprefix.$rid;   $rows[$sofar].='&'.$pprefix.$rid;
     } else {      } else {
  $rows[$sofar]=$tprefix.$rid;   $rows[$sofar]=$pprefix.$rid;
     }      }
     if ((defined($hash{'map_start_'.$hash{'src_'.$rid}})) &&   }
  (defined($hash{'map_finish_'.$hash{'src_'.$rid}})) &&      }
  ($tprefix eq 'h')) {  }
  my $frid=$hash{'map_finish_'.$hash{'src_'.$rid}};  
  $sofar=  sub followlinks () {
     &tracetable($sofar,$hash{'map_start_'.$hash{'src_'.$rid}},      my ($rid,$sofar,$beenhere,$further,$showtypes)=@_;
  '&'.$frid.'&');      my $mincond=1;
  $sofar++;      my $next='';
  if ($hash{'src_'.$frid}) {      foreach (split(/\,/,$hash{'to_'.$rid})) {
     my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$frid});   my $thiscond=
     if (($brepriv eq '2') || ($brepriv eq 'F')) {      &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$_}});
  my $pprefix='';   if ($thiscond>=$mincond) {
  if ($hash{'src_'.$frid}=~      if ($next) {
     /\.(problem|exam|quiz|assess|survey|form)$/) {   $next.=','.$_.':'.$thiscond;
     $pprefix=&astatus($frid);      } else {
    $next=$_.':'.$thiscond;
  }  
  if (defined($rows[$sofar])) {  
     $rows[$sofar].='&'.$pprefix.$frid;  
  } else {  
     $rows[$sofar]=$pprefix.$frid;  
  }  
     }  
  }  
     }      }
       if ($thiscond>$mincond) { $mincond=$thiscond; }
    }
       }
       foreach (split(/\,/,$next)) {
    my ($linkid,$condval)=split(/\:/,$_);
    if ($condval>=$mincond) {
       &Apache::lonxml::debug("following link $linkid");
       my $now=&tracetable($sofar,$hash{'goesto_'.$linkid},
    $beenhere,$showtypes);
       if ($now>$further) { $further=$now; }
    }
       }
       return $further;
   }
   # ------------------------------------------------------------ Build page table
   
   sub tracetable {
       my ($sofar,$rid,$beenhere,$showtypes)=@_;
       my $further=$sofar;
       #$Apache::lonxml::debug=1;
       &Apache::lonxml::debug("$rid ; $sofar ; $beenhere");
       if ($beenhere=~/\&$rid\&/) {
    return $further;
       }
       $beenhere.=$rid.'&';  
   
       if (defined($hash{'is_map_'.$rid})) {
    $sofar++;
    my $tprefix='';
    if ($hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$rid}}}
       eq 'sequence') {
       $tprefix='h';
    } elsif ($hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$rid}}}
    eq 'page') {
       $tprefix='i';
       $showtypes='problems';
    }
    if (defined($rows[$sofar])) {
       $rows[$sofar].='&'.$tprefix.$rid;
  } else {   } else {
     $sofar++;      $rows[$sofar]=$tprefix.$rid;
     if ($hash{'src_'.$rid}) {  
  my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$rid});  
  if (($brepriv eq '2') || ($brepriv eq 'F')) {  
     my $pprefix='';  
     if ($hash{'src_'.$rid}=~  
  /\.(problem|exam|quiz|assess|survey|form)$/) {  
  $pprefix=&astatus($rid);  
     }  
     if (defined($rows[$sofar])) {  
  $rows[$sofar].='&'.$pprefix.$rid;  
     } else {  
  $rows[$sofar]=$pprefix.$rid;  
     }  
  }  
     }  
  }   }
    if ((defined($hash{'map_start_'.$hash{'src_'.$rid}})) &&
  if (defined($hash{'to_'.$rid})) {      (defined($hash{'map_finish_'.$hash{'src_'.$rid}}))) {
     my $mincond=1;      my $frid=$hash{'map_finish_'.$hash{'src_'.$rid}};
     my $next='';      $sofar=&tracetable($sofar,
     foreach (split(/\,/,$hash{'to_'.$rid})) {         $hash{'map_start_'.$hash{'src_'.$rid}},
  my $thiscond=         '&'.$frid.'&',$showtypes);
     &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$_}});      $sofar++;
  if ($thiscond>=$mincond) {      &addresource($hash{'src_'.$frid},$sofar,$frid,$showtypes);
     if ($next) {      if ($tprefix eq 'i') { $showtypes=''; }
  $next.=','.$_.':'.$thiscond;  
     } else {  
  $next=$_.':'.$thiscond;  
     }  
     if ($thiscond>$mincond) { $mincond=$thiscond; }  
  }  
     }  
     foreach (split(/\,/,$next)) {  
  my ($linkid,$condval)=split(/\:/,$_);  
  if ($condval>=$mincond) {  
     my $now=&tracetable($sofar,$hash{'goesto_'.$linkid},$beenhere);  
     if ($now>$further) { $further=$now; }  
  }  
     }  
  }   }
       } else {
    $sofar++;
    &addresource($hash{'src_'.$rid},$sofar,$rid,$showtypes);
     }      }
   
       if (defined($hash{'to_'.$rid})) {
    $further=&followlinks($rid,$sofar,$beenhere,$further,$showtypes);
       }
   
     return $further;      return $further;
 }  }
   
Line 482  sub handler { Line 492  sub handler {
   
  for ($i=0;$i<=$#rows;$i++) {   for ($i=0;$i<=$#rows;$i++) {
     if ($rows[$i]) {      if ($rows[$i]) {
    &Apache::lonxml::debug($rows[$i]);
  $contents++;   $contents++;
  my @colcont=split(/\&/,$rows[$i]);   my @colcont=split(/\&/,$rows[$i]);
  $lcm*=($#colcont+1)/euclid($lcm,($#colcont+1));   $lcm*=($#colcont+1)/euclid($lcm,($#colcont+1));
Line 592  sub handler { Line 603  sub handler {
     $add='<th bgcolor="#AAFF55"><a name="'.$rid.'">';      $add='<th bgcolor="#AAFF55"><a name="'.$rid.'">';
     $adde='</th>';      $adde='</th>';
  }   }
    if ($rid=~/^i(.+)/) { $rid=$1; }
  if ($rid=~/^p(\d)(\d)\"([\w\: \(\)\/\,]*)\"(.+)/) {   if ($rid=~/^p(\d)(\d)\"([\w\: \(\)\/\,]*)\"(.+)/) {
     # sub astatus describes what code/tcode mean      # sub astatus describes what code/tcode mean
     my $code=$1;      my $code=$1;

Removed from v.1.30  
changed lines
  Added in v.1.31


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