Diff for /loncom/interface/lonnavmaps.pm between versions 1.158 and 1.159

version 1.158, 2003/03/13 19:57:10 version 1.159, 2003/03/13 20:46:36
Line 550  Most of these parameters are only useful Line 550  Most of these parameters are only useful
   
 =item * B<condenseParts>: A flag. If yes (default), if all parts of the problem have the same status and that status is Nothing Set, Correct, or Network Failure, then only one line will be displayed for that resource anyhow. If no, all parts will always be displayed. If showParts is 0, this is ignored.  =item * B<condenseParts>: A flag. If yes (default), if all parts of the problem have the same status and that status is Nothing Set, Correct, or Network Failure, then only one line will be displayed for that resource anyhow. If no, all parts will always be displayed. If showParts is 0, this is ignored.
   
 =item * B<jumpCount>: A string identifying the URL to place the anchor 'curloc' at. Default to no anchor at all. It is the responsibility of the renderer user to ensure that the #curloc is in the URL. By default, determined through the use of the ENV{} 'jump' and 'jumpType' information.  =item * B<jumpCount>: A string identifying the URL to place the anchor 'curloc' at. Default to no anchor at all. It is the responsibility of the renderer user to ensure that the #curloc is in the URL. By default, determined through the use of the ENV{} 'jump' information, and should normally "just work" correctly.
   
 =item * B<here>: A Symb identifying where to place the 'here' marker. Default empty, which means no marker.  =item * B<here>: A Symb identifying where to place the 'here' marker. Default empty, which means no marker.
   
Line 651  sub render_resource { Line 651  sub render_resource {
             $linkopen .= "&condition=" . $it->{CONDITION} . '&hereType='              $linkopen .= "&condition=" . $it->{CONDITION} . '&hereType='
                 . $params->{'hereType'} . '&here=' .                  . $params->{'hereType'} . '&here=' .
                 &Apache::lonnet::escape($params->{'here'}) .                   &Apache::lonnet::escape($params->{'here'}) . 
                 '&jumpType=' . SYMB() . '&jump=' .                  '&jump=' .
                 &Apache::lonnet::escape($resource->symb()) .                   &Apache::lonnet::escape($resource->symb()) . 
                 "&folderManip=1'>";                  "&folderManip=1'>";
         } else {          } else {
Line 839  sub render { Line 839  sub render {
   
     my $r = $args->{'r'};      my $r = $args->{'r'};
     my $queryString = $args->{'queryString'};      my $queryString = $args->{'queryString'};
     my $jumpToURL = $args->{'jumpToURL'};      my $jump = $args->{'jump'};
     my $jumpToSymb = $args->{'jumpToSymb'};  
     my $jumpType;  
     my $here = $args->{'here'};      my $here = $args->{'here'};
     my $jump;  
     my $currentJumpIndex = setDefault($args->{'currentJumpIndex'}, 0);      
     my $suppressNavmap = setDefault($args->{'suppressNavmap'}, 0);      my $suppressNavmap = setDefault($args->{'suppressNavmap'}, 0);
     my $currentJumpDelta = 2; # change this to change how many resources are displayed      my $currentJumpDelta = 2; # change this to change how many resources are displayed
                              # before the current resource when using #current                               # before the current resource when using #current
Line 879  sub render { Line 875  sub render {
         # Step two: Locate what kind of here marker is necessary          # Step two: Locate what kind of here marker is necessary
         # Determine where the "here" marker is and where the screen jumps to.          # Determine where the "here" marker is and where the screen jumps to.
   
         # We're coming from the remote. We have either a url, a symb, or nothing,  
         # and we need to figure out what.  
         # Preference: Symb  
           
         if ($ENV{'form.symb'}) {          if ($ENV{'form.symb'}) {
             $here = $jump = $ENV{'form.symb'};              $here = $jump = $ENV{'form.symb'};
         } elsif ($ENV{'form.postdata'}) {          } elsif ($ENV{'form.postdata'}) {
Line 899  sub render { Line 891  sub render {
         my $depth = 1;          my $depth = 1;
         $mapIterator->next(); # discard the first BEGIN_MAP          $mapIterator->next(); # discard the first BEGIN_MAP
         my $curRes = $mapIterator->next();          my $curRes = $mapIterator->next();
         my $counter = 0;  
         my $found = 0;          my $found = 0;
                   
         # We only need to do this if we need to open the maps to show the          # We only need to do this if we need to open the maps to show the
Line 925  sub render { Line 916  sub render {
                           
             $curRes = $mapIterator->next();              $curRes = $mapIterator->next();
         }                      }            
   
         # Since we changed the folders, (re-)locate the jump point, if any  
         $mapIterator = $navmap->getIterator(undef, undef, $filterHash, 0);  
         $depth = 1;  
         $mapIterator->next();  
         $curRes = $mapIterator->next();  
         my $foundJump = 0;  
           
         while ($depth > 0 && !$foundJump) {  
             if ($curRes == $mapIterator->BEGIN_MAP()) { $depth++; }  
             if ($curRes == $mapIterator->END_MAP()) { $depth--; }  
             if (ref($curRes)) { $counter++; }  
               
             if (ref($curRes) &&   
                 (($jumpType == SYMB() && $curRes->symb() eq $jump) ||  
                  ($jumpType == URL() && $curRes->src() eq $jump))) {  
                   
                 # This is why we have to use the main iterator instead of the  
                 # potentially faster DFS: The count has to be the same, so  
                 # the order has to be the same, which DFS won't give us.  
                 $currentJumpIndex = $counter;  
                 $foundJump = 1;  
             }  
               
             $curRes = $mapIterator->next();  
         }  
       
     }              }        
   
     if ( !defined($args->{'iterator'}) && $ENV{'form.folderManip'} ) { # we came from a user's manipulation of the nav page      if ( !defined($args->{'iterator'}) && $ENV{'form.folderManip'} ) { # we came from a user's manipulation of the nav page
         # If this is a click on a folder or something, we want to preserve the "here"          # If this is a click on a folder or something, we want to preserve the "here"
         # from the querystring, and get the new "jump" marker          # from the querystring, and get the new "jump" marker
Line 987  sub render { Line 952  sub render {
         }          }
     }      }
           
       # (re-)Locate the jump point, if any
       my $mapIterator = $navmap->getIterator(undef, undef, $filterHash, 0);
       my $depth = 1;
       $mapIterator->next();
       my $curRes = $mapIterator->next();
       my $foundJump = 0;
       my $counter = 0;
       
       while ($depth > 0 && !$foundJump) {
           if ($curRes == $mapIterator->BEGIN_MAP()) { $depth++; }
           if ($curRes == $mapIterator->END_MAP()) { $depth--; }
           if (ref($curRes)) { $counter++; }
           
           if (ref($curRes) && $jump eq $curRes->symb()) {
               
               # This is why we have to use the main iterator instead of the
               # potentially faster DFS: The count has to be the same, so
               # the order has to be the same, which DFS won't give us.
               $args->{'currentJumpIndex'} = $counter;
               $foundJump = 1;
           }
           
           $curRes = $mapIterator->next();
       }
   
     my $showParts = setDefault($args->{'showParts'}, 1);      my $showParts = setDefault($args->{'showParts'}, 1);
     my $condenseParts = setDefault($args->{'condenseParts'}, 1);      my $condenseParts = setDefault($args->{'condenseParts'}, 1);
     # keeps track of when the current resource is found,      # keeps track of when the current resource is found,
Line 1059  sub render { Line 1049  sub render {
   
     my $displayedJumpMarker = 0;      my $displayedJumpMarker = 0;
     # Set up iteration.      # Set up iteration.
     my $depth = 1;      $depth = 1;
     $it->next(); # discard initial BEGIN_MAP      $it->next(); # discard initial BEGIN_MAP
     my $curRes = $it->next();      $curRes = $it->next();
     my $now = time();      my $now = time();
     my $in24Hours = $now + 24 * 60 * 60;      my $in24Hours = $now + 24 * 60 * 60;
     my $rownum = 0;      my $rownum = 0;
Line 1218  sub render { Line 1208  sub render {
     }      }
           
     # Print out the part that jumps to #curloc if it exists      # Print out the part that jumps to #curloc if it exists
       # delay needed because the browser is processing the jump before
       # it finishes rendering, so it goes to the wrong place!
       # onload might be better, but this routine has no access to that.
       # On mozilla, the 0-millisecond timeout seems to prevent this;
       # it's quite likely this might fix other browsers, too, and 
       # certainly won't hurt anything.
     if ($displayedJumpMarker) {      if ($displayedJumpMarker) {
         $result .= "<script>location += \"#curloc\";</script>\n";          $result .= "<script>setTimeout(\"location += '#curloc';\", 0)</script>\n";
     }      }
   
     $result .= "</table>";      $result .= "</table>";

Removed from v.1.158  
changed lines
  Added in v.1.159


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