Diff for /loncom/interface/lonnavmaps.pm between versions 1.143 and 1.144

version 1.143, 2003/02/13 23:44:30 version 1.144, 2003/02/20 22:08:55
Line 463  The pre-packaged column names are refere Line 463  The pre-packaged column names are refere
   
 =item * B<resource_part_count>: If true (default), the resource will show a part count if the full part list is not displayed. If false, the resource will never show a part count.  =item * B<resource_part_count>: If true (default), the resource will show a part count if the full part list is not displayed. If false, the resource will never show a part count.
   
   =item * B<resource_no_folder_link>: If true, the resource's folder will not be clickable to open or close it. Default is false.
   
 =back  =back
   
 =item B<communication_status>: Whether there is discussion on the resource, email for the user, or (lumped in here) perl errors in the execution of the problem. This is the second column in the main nav map.  =item B<communication_status>: Whether there is discussion on the resource, email for the user, or (lumped in here) perl errors in the execution of the problem. This is the second column in the main nav map.
Line 491  Most of these parameters are only useful Line 493  Most of these parameters are only useful
   
 =over 4  =over 4
   
 =item * B<iterator>: A reference to a fresh ::iterator to use from the navmaps. The rendering will reflect the options passed to the iterator, so you can use that to just render a certain part of the course, if you like. If one is not passed, the renderer will attempt to construct one from ENV{'form.filter'} and ENV{'form.condition'} information.  =item * B<iterator>: A reference to a fresh ::iterator to use from the navmaps. The rendering will reflect the options passed to the iterator, so you can use that to just render a certain part of the course, if you like. If one is not passed, the renderer will attempt to construct one from ENV{'form.filter'} and ENV{'form.condition'} information, plus the 'iterator_map' parameter if any.
   
   =item * B<iterator_map>: If you are letting the renderer do the iterator handling, you can instruct the renderer to render only a particular map by passing it the source of the map you want to process, like '/res/103/jerf/navmap.course.sequence'.
   
 =item * B<navmap>: A reference to a navmap, used only if an iterator is not passed in. If this is necessary to make an iterator but it is not passed in, a new one will be constructed based on ENV info. This is useful to do basic error checking before passing it off to render.  =item * B<navmap>: A reference to a navmap, used only if an iterator is not passed in. If this is necessary to make an iterator but it is not passed in, a new one will be constructed based on ENV info. This is useful to do basic error checking before passing it off to render.
   
Line 587  sub render_resource { Line 591  sub render_resource {
         if ($it->{CONDITION}) {          if ($it->{CONDITION}) {
             $nowOpen = !$nowOpen;              $nowOpen = !$nowOpen;
         }          }
         $icon = 'navmap.folder.' . ($nowOpen ? 'closed' : 'open') . '.gif';  
         $icon = "<img src='/adm/lonIcons/$icon' alt='' border='0' />";          if (!$params->{'resource_no_folder_link'}) {
                       $icon = 'navmap.folder.' . ($nowOpen ? 'closed' : 'open') . '.gif';
         $linkopen = "<a href='" . $params->{'url'} . '?' .               $icon = "<img src='/adm/lonIcons/$icon' alt='' border='0' />";
             $params->{'queryString'} . '&filter=';  
         $linkopen .= ($nowOpen xor $it->{CONDITION}) ?              $linkopen = "<a href='" . $params->{'url'} . '?' . 
             addToFilter($filter, $mapId) :                  $params->{'queryString'} . '&filter=';
             removeFromFilter($filter, $mapId);              $linkopen .= ($nowOpen xor $it->{CONDITION}) ?
         $linkopen .= "&condition=" . $it->{CONDITION} . '&hereType='                  addToFilter($filter, $mapId) :
             . $params->{'hereType'} . '&here=' .                  removeFromFilter($filter, $mapId);
             &Apache::lonnet::escape($params->{'here'}) .               $linkopen .= "&condition=" . $it->{CONDITION} . '&hereType='
             '&jumpType=' . SYMB() . '&jump=' .                  . $params->{'hereType'} . '&here=' .
             &Apache::lonnet::escape($resource->symb()) .                   &Apache::lonnet::escape($params->{'here'}) . 
             "&folderManip=1'>";                  '&jumpType=' . SYMB() . '&jump=' .
                   &Apache::lonnet::escape($resource->symb()) . 
                   "&folderManip=1'>";
           } else {
               # Don't allow users to manipulate folder
               $icon = 'navmap.folder.' . ($nowOpen ? 'closed' : 'open') .
                   '.nomanip.gif';
               $icon = "<img src='/adm/lonIcons/$icon' alt='' border='0' />";
   
               $linkopen = "";
               $linkclose = "";
           }
     }      }
   
     if ($resource->randomout()) {      if ($resource->randomout()) {
Line 644  sub render_resource { Line 659  sub render_resource {
         $nonLinkedText .= ' (' . $resource->countParts() . ' parts)';          $nonLinkedText .= ' (' . $resource->countParts() . ' parts)';
     }      }
   
     $result .= "  $curMarkerBegin<a href='$link'>$title$partLabel</a>$curMarkerEnd $nonLinkedText</td>";      if (!$params->{'resource_nolink'}) {
           $result .= "  $curMarkerBegin<a href='$link'>$title$partLabel</a>$curMarkerEnd $nonLinkedText</td>";
       } else {
           $result .= "  $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText</td>";
       }
   
     return $result;      return $result;
 }  }
Line 919  sub render { Line 938  sub render {
         # Paranoia: Make sure it's ready          # Paranoia: Make sure it's ready
         $navmap->init();          $navmap->init();
   
         $args->{'iterator'} = $it = $navmap->getIterator(undef, undef, $filterHash, $condition);          # See if we're being passed a specific map
           if ($args->{'iterator_map'}) {
               my $map = $args->{'iterator_map'};
               $map = &Apache::lonnet::clutter($map);
               $map = $navmap->{NAV_HASH}->{'ids_' . $map};
               $map = $navmap->getById($map);
               my $firstResource = $map->map_start();
               my $finishResource = $map->map_finish();
   
               $args->{'iterator'} = $it = $navmap->getIterator($firstResource, $finishResource, $filterHash, $condition);
           } else {
               $args->{'iterator'} = $it = $navmap->getIterator(undef, undef, $filterHash, $condition);
           }
     }      }
           
     my $showParts = setDefault($args->{'showParts'}, 1);      my $showParts = setDefault($args->{'showParts'}, 1);
Line 933  sub render { Line 964  sub render {
     if (!defined($printCloseAll)) { $printCloseAll = 1; }      if (!defined($printCloseAll)) { $printCloseAll = 1; }
     my $filterFunc = setDefault($args->{'filterFunc'},      my $filterFunc = setDefault($args->{'filterFunc'},
                                 sub {return 1;});                                  sub {return 1;});
       
     # Print key?      # Print key?
     if ($printKey) {      if ($printKey) {
         $result .= '<table border="0" cellpadding="2" cellspacing="0">';          $result .= '<table border="0" cellpadding="2" cellspacing="0">';
Line 2324  These methods are useful for getting inf Line 2355  These methods are useful for getting inf
 sub map_finish {  sub map_finish {
     my $self = shift;      my $self = shift;
     my $src = $self->src();      my $src = $self->src();
       $src = Apache::lonnet::clutter($src);
     my $res = $self->navHash("map_finish_$src", 0);      my $res = $self->navHash("map_finish_$src", 0);
     $res = $self->{NAV_MAP}->getById($res);      $res = $self->{NAV_MAP}->getById($res);
     return $res;      return $res;
Line 2336  sub map_pc { Line 2368  sub map_pc {
 sub map_start {  sub map_start {
     my $self = shift;      my $self = shift;
     my $src = $self->src();      my $src = $self->src();
       $src = Apache::lonnet::clutter($src);
     my $res = $self->navHash("map_start_$src", 0);      my $res = $self->navHash("map_start_$src", 0);
     $res = $self->{NAV_MAP}->getById($res);      $res = $self->{NAV_MAP}->getById($res);
     return $res;      return $res;

Removed from v.1.143  
changed lines
  Added in v.1.144


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