Diff for /loncom/interface/lonnavmaps.pm between versions 1.509.2.2 and 1.509.2.3

version 1.509.2.2, 2016/08/06 23:22:30 version 1.509.2.3, 2016/08/10 21:29:52
Line 1006  sub render_resource { Line 1006  sub render_resource {
                          '</a>';                           '</a>';
             }              }
         }          }
     }          if ($params->{'mapHidden'} || $resource->randomout()) {
               $nonLinkedText .= ' <span class="LC_warning">('.&mt('hidden').')</span> ';
     if ($resource->randomout()) {          }
         $nonLinkedText .= ' <span class="LC_warning">('.&mt('hidden').')</span> ';      } else {
           if ($resource->randomout()) {
               $nonLinkedText .= ' <span class="LC_warning">('.&mt('hidden').')</span> ';
           }
     }      }
     if (!$resource->condval()) {      if (!$resource->condval()) {
         $nonLinkedText .= ' <span class="LC_info">('.&mt('conditionally hidden').')</span> ';          $nonLinkedText .= ' <span class="LC_info">('.&mt('conditionally hidden').')</span> ';
Line 1584  END Line 1587  END
     $args->{'indentString'} = setDefault($args->{'indentString'}, "<img src='$location' alt='' />");      $args->{'indentString'} = setDefault($args->{'indentString'}, "<img src='$location' alt='' />");
     $args->{'displayedHereMarker'} = 0;      $args->{'displayedHereMarker'} = 0;
   
     # If we're suppressing empty sequences, look for them here. Use DFS for speed,      # If we're suppressing empty sequences, look for them here.
     # since structure actually doesn't matter, except what map has what resources.      # We also do this even if $args->{'suppressEmptySequences'}
     if ($args->{'suppressEmptySequences'}) {      # is not true, so we can hide empty sequences for which the
         my $dfsit = Apache::lonnavmaps::DFSiterator->new($navmap,      # hiddenresource parameter is set to yes (at map level), or
                                                          $it->{FIRST_RESOURCE},      # mark as hidden for users who have $userCanSeeHidden.
                                                          $it->{FINISH_RESOURCE},      # Use DFS for speed, since structure actually doesn't matter,
                                                          {}, undef, 1);      # except what map has what resources.
         my $depth = 0;  
         $dfsit->next();      my $dfsit = Apache::lonnavmaps::DFSiterator->new($navmap,
         my $curRes = $dfsit->next();                                                       $it->{FIRST_RESOURCE},
         while ($depth > -1) {                                                       $it->{FINISH_RESOURCE},
             if ($curRes == $dfsit->BEGIN_MAP()) { $depth++; }                                                       {}, undef, 1);
             if ($curRes == $dfsit->END_MAP()) { $depth--; }  
       my $depth = 0;
             if (ref($curRes)) {       $dfsit->next();
                 # Parallel pre-processing: Do sequences have non-filtered-out children?      my $curRes = $dfsit->next();
                 if ($curRes->is_map()) {      while ($depth > -1) {
                     $curRes->{DATA}->{HAS_VISIBLE_CHILDREN} = 0;          if ($curRes == $dfsit->BEGIN_MAP()) { $depth++; }
                     # Sequences themselves do not count as visible children,          if ($curRes == $dfsit->END_MAP()) { $depth--; }
                     # unless those sequences also have visible children.  
                     # This means if a sequence appears, there's a "promise"          if (ref($curRes)) {
                     # that there's something under it if you open it, somewhere.              # Parallel pre-processing: Do sequences have non-filtered-out children?
                 } else {              if ($curRes->is_map()) {
                     # Not a sequence: if it's filtered, ignore it, otherwise                  $curRes->{DATA}->{HAS_VISIBLE_CHILDREN} = 0;
                     # rise up the stack and mark the sequences as having children                  # Sequences themselves do not count as visible children,
                     if (&$filterFunc($curRes)) {                  # unless those sequences also have visible children.
                         for my $sequence (@{$dfsit->getStack()}) {                  # This means if a sequence appears, there's a "promise"
                             $sequence->{DATA}->{HAS_VISIBLE_CHILDREN} = 1;                  # that there's something under it if you open it, somewhere.
                         }              } elsif ($curRes->src()) {
                   # Not a sequence: if it's filtered, ignore it, otherwise
                   # rise up the stack and mark the sequences as having children
                   if (&$filterFunc($curRes)) {
                       for my $sequence (@{$dfsit->getStack()}) {
                           $sequence->{DATA}->{HAS_VISIBLE_CHILDREN} = 1;
                     }                      }
                 }                  }
             }              }
         } continue {  
             $curRes = $dfsit->next();  
         }          }
       } continue {
           $curRes = $dfsit->next();
     }      }
   
     my $displayedJumpMarker = 0;      my $displayedJumpMarker = 0;
Line 1711  END Line 1719  END
         }           } 
   
         # If this is an empty sequence and we're filtering them, continue on          # If this is an empty sequence and we're filtering them, continue on
         if ($curRes->is_map() && $args->{'suppressEmptySequences'} &&          $args->{'mapHidden'} = 0;
             !$curRes->{DATA}->{HAS_VISIBLE_CHILDREN}) {          if (($curRes->is_map()) && (!$curRes->{DATA}->{HAS_VISIBLE_CHILDREN})) {
             next;              if ($args->{'suppressEmptySequences'}) {
                   next;
               } else {
                   my $mapname = &Apache::lonnet::declutter($curRes->src());
                   $mapname = &Apache::lonnet::deversion($mapname);
                   if (lc($navmap->get_mapparam(undef,$mapname,"0.hiddenresource")) eq 'yes') {
                       if ($userCanSeeHidden) {
                           $args->{'mapHidden'} = 1;
                       } else {
                           next;
                       }
                   }
               }
         }          }
   
         # If we're suppressing navmaps and this is a navmap, continue on          # If we're suppressing navmaps and this is a navmap, continue on
Line 2723  sub map_printdates { Line 2743  sub map_printdates {
   
   
   
     my $opendate = $self->get_mapparam($res->symb(), "$part.printstartdate");      my $opendate = $self->get_mapparam($res->symb(),'',"$part.printstartdate");
     my $closedate= $self->get_mapparam($res->symb(), "$part.printenddate");      my $closedate= $self->get_mapparam($res->symb(),'', "$part.printenddate");
   
   
     return ($opendate, $closedate);      return ($opendate, $closedate);
 }  }
   
 sub get_mapparam {  sub get_mapparam {
     my ($self, $symb, $what) = @_;      my ($self, $symb, $mapname, $what) = @_;
   
     # Ensure the course option hash is populated:      # Ensure the course option hash is populated:
   
Line 2750  sub get_mapparam { Line 2770  sub get_mapparam {
     my $uname=$self->{USERNAME};      my $uname=$self->{USERNAME};
     my $udom=$self->{DOMAIN};      my $udom=$self->{DOMAIN};
   
     unless ($symb) { return ['']; }      unless ($symb || $mapname) { return; }
     my $result='';      my $result='';
       my ($recursed,@recurseup);
   
     # Figure out which map we are in.      # Figure out which map we are in.
   
     my ($mapname,$id,$fn)=&Apache::lonnet::decode_symb($symb);      if ($symb && !$mapname) {
     $mapname = &Apache::lonnet::deversion($mapname);          my ($id,$fn);
           ($mapname,$id,$fn)=&Apache::lonnet::decode_symb($symb);
           $mapname = &Apache::lonnet::deversion($mapname);
       }
   
     my $rwhat=$what;      my $rwhat=$what;
     $what=~s/^parameter\_//;      $what=~s/^parameter\_//;
Line 2815  sub get_mapparam { Line 2837  sub get_mapparam {
     }      }
     # Check the map parameters themselves:      # Check the map parameters themselves:
   
     my $thisparm = $$parmhash{$symbparm};      if ($symb) {
     if (defined($thisparm)) {          my $symbparm=$symb.'.'.$what;
  return $thisparm;          my $thisparm = $$parmhash{$symbparm};
           if (defined($thisparm)) {
               return $thisparm;
           }
     }      }
   
   

Removed from v.1.509.2.2  
changed lines
  Added in v.1.509.2.3


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