Diff for /loncom/interface/lonnavmaps.pm between versions 1.175 and 1.181

version 1.175, 2003/04/11 20:13:25 version 1.181, 2003/04/24 18:18:38
Line 169  sub real_handler { Line 169  sub real_handler {
         return OK;          return OK;
     }      }
   
     # See if there's only one map in the top-level... if so,      # See if there's only one map in the top-level, if we don't
     # automatically display it      # already have a filter... if so, automatically display it
     my $iterator = $navmap->getIterator(undef, undef, undef, 0);      if ($ENV{QUERY_STRING} !~ /filter/) {
     my $depth = 1;          my $iterator = $navmap->getIterator(undef, undef, undef, 0);
     $iterator->next();          my $depth = 1;
     my $curRes = $iterator->next();          $iterator->next();
     my $sequenceCount = 0;          my $curRes = $iterator->next();
     my $sequenceId;          my $sequenceCount = 0;
     while ($depth > 0) {          my $sequenceId;
         if ($curRes == $iterator->BEGIN_MAP()) { $depth++; }          while ($depth > 0) {
         if ($curRes == $iterator->END_MAP()) { $depth--; }              if ($curRes == $iterator->BEGIN_MAP()) { $depth++; }
               if ($curRes == $iterator->END_MAP()) { $depth--; }
         if (ref($curRes) && $curRes->is_sequence()) {              
             $sequenceCount++;              if (ref($curRes) && $curRes->is_sequence()) {
             $sequenceId = $curRes->map_pc();                  $sequenceCount++;
                   $sequenceId = $curRes->map_pc();
               }
               
               $curRes = $iterator->next();
           }
           
           if ($sequenceCount == 1) {
               # The automatic iterator creation in the render call 
               # will pick this up. We know the condition because
               # the defined($ENV{'form.filter'}) also ensures this
               # is a fresh call.
               $ENV{'form.filter'} = "$sequenceId";
         }          }
   
         $curRes = $iterator->next();  
     }  
   
     if ($sequenceCount == 1) {  
         # The automatic iterator creation in the render call   
         # will pick this up.  
         $ENV{'form.filter'} = "$sequenceId";  
     }      }
   
     # renderer call      # renderer call
Line 343  sub lastTry { Line 347  sub lastTry {
 }  }
   
 # This puts a human-readable name on the ENV variable.  # This puts a human-readable name on the ENV variable.
 # FIXME: This needs better logic: Who gets the advanced view of navmaps?  
 #   As of 3-13-03, it's an open question. Guy doesn't want to check  
 #   roles directly because it should be a check of capabilities for future  
 #   role compatibity. There is no capability that matches this one for  
 #   now, so this is done. (A hack for 1.0 might be to simply check roles  
 #   anyhow.)  
 sub advancedUser {  sub advancedUser {
     return $ENV{'user.adv'};      return $ENV{'request.role.adv'};
 }  }
   
   
Line 2690  sub to { my $self=shift; return $self->n Line 2689  sub to { my $self=shift; return $self->n
 sub compTitle {  sub compTitle {
     my $self = shift;      my $self = shift;
     my $title = $self->title();      my $title = $self->title();
       $title=~s/\&colon\;/\:/gs;
     if (!$title) {      if (!$title) {
         $title = $self->src();          $title = $self->src();
         $title = substr($title, rindex($title, '/') + 1);          $title = substr($title, rindex($title, '/') + 1);
Line 3078  sub extractParts { Line 3078  sub extractParts {
   
     $self->{PARTS} = [];      $self->{PARTS} = [];
   
       my %parts;
   
     # Retrieve part count, if this is a problem      # Retrieve part count, if this is a problem
     if ($self->is_problem()) {      if ($self->is_problem()) {
         my $metadata = &Apache::lonnet::metadata($self->src(), 'packages');          my $metadata = &Apache::lonnet::metadata($self->src(), 'packages');
Line 3089  sub extractParts { Line 3091  sub extractParts {
         foreach (split(/\,/,$metadata)) {          foreach (split(/\,/,$metadata)) {
             if ($_ =~ /^part_(.*)$/) {              if ($_ =~ /^part_(.*)$/) {
                 my $part = $1;                  my $part = $1;
                   # This floods the logs
                   #if (defined($parts{$part})) {
                   #    Apache::lonnet::logthis("$part multiply defined in metadata for " . $self->symb());
                   #  }
   
                 # check to see if part is turned off.                  # check to see if part is turned off.
                 if (! Apache::loncommon::check_if_partid_hidden($part, $self->symb())) {  
                     push @{$self->{PARTS}}, $1;                  if (!Apache::loncommon::check_if_partid_hidden($part, $self->symb())) {
                       $parts{$part} = 1;
                 }                  }
             }              }
         }          }
                   
                   
         my @sortedParts = sort @{$self->{PARTS}};          my @sortedParts = sort keys %parts;
         $self->{PARTS} = \@sortedParts;          $self->{PARTS} = \@sortedParts;
     }      }
   

Removed from v.1.175  
changed lines
  Added in v.1.181


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