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

version 1.157, 2003/03/13 17:10:25 version 1.158, 2003/03/13 19:57:10
Line 158  sub real_handler { Line 158  sub real_handler {
     $r->print("<title>Navigate Course Contents</title>");      $r->print("<title>Navigate Course Contents</title>");
 # ------------------------------------------------------------ Get query string  # ------------------------------------------------------------ Get query string
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register']);      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register']);
       
 # ----------------------------------------------------- Force menu registration  # ----------------------------------------------------- Force menu registration
     my $addentries='';      my $addentries='';
     if ($ENV{'form.register'}) {      if ($ENV{'form.register'}) {
Line 177  sub real_handler { Line 178  sub real_handler {
     # Now that we've displayed some stuff to the user, init the navmap      # Now that we've displayed some stuff to the user, init the navmap
     $navmap->init();      $navmap->init();
   
   
     $r->print('<br>&nbsp;');      $r->print('<br>&nbsp;');
     $r->rflush();      $r->rflush();
   
Line 361  sub lastTry { Line 361  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{'user.adv'};
 }  }
Line 546  Most of these parameters are only useful Line 552  Most of these parameters are only useful
   
 =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' and 'jumpType' information.
   
 =item * B<hereURL>: A URL identifying where to place the 'here' marker. By default, will pull this from the ENV{'form.here*'} info.  =item * B<here>: A Symb identifying where to place the 'here' marker. Default empty, which means no marker.
   
 =item * B<hereSymb>: A Symb identifying where to place the 'here' marker. Default same as hereURL.  
   
 =item * B<indentString>: A string identifying the indentation string to use. By default, this is a 25 pixel whitespace image with no alt text.  =item * B<indentString>: A string identifying the indentation string to use. By default, this is a 25 pixel whitespace image with no alt text.
   
Line 683  sub render_resource { Line 687  sub render_resource {
     my $curMarkerEnd = '';      my $curMarkerEnd = '';
   
     # Is this the current resource?      # Is this the current resource?
     if (!$params->{'displayedHereMarker'} &&      if (!$params->{'displayedHereMarker'} && 
         (($params->{'hereType'} == SYMB() &&           $resource->symb() eq $params->{'here'} ) {
           $resource->symb() eq $params->{'here'}) ||  
          ($params->{'hereType'} == URL() &&  
           $resource->src() eq $params->{'here'}))) {  
         $curMarkerBegin = '<font color="red" size="+2">&gt; </font>';          $curMarkerBegin = '<font color="red" size="+2">&gt; </font>';
         $curMarkerEnd = '<font color="red" size="+2">&lt;</font>';          $curMarkerEnd = '<font color="red" size="+2">&lt;</font>';
           $params->{'displayedHereMarker'} = 1;
     }      }
   
     if ($resource->is_problem() && $part ne "" &&       if ($resource->is_problem() && $part ne "" && 
Line 835  sub render { Line 837  sub render {
         $navmap = $args->{'navmap'};          $navmap = $args->{'navmap'};
     }      }
   
       my $r = $args->{'r'};
     my $queryString = $args->{'queryString'};      my $queryString = $args->{'queryString'};
     my $jumpToURL = $args->{'jumpToURL'};      my $jumpToURL = $args->{'jumpToURL'};
     my $jumpToSymb = $args->{'jumpToSymb'};      my $jumpToSymb = $args->{'jumpToSymb'};
     my $jumpType;      my $jumpType;
     my $hereURL = $args->{'hereURL'};      my $here = $args->{'here'};
     my $hereSymb = $args->{'hereSymb'};  
     my $hereType;  
     my $here;  
     my $jump;      my $jump;
     my $currentJumpIndex = setDefault($args->{'currentJumpIndex'}, 0);          my $currentJumpIndex = setDefault($args->{'currentJumpIndex'}, 0);    
     my $suppressNavmap = setDefault($args->{'suppressNavmap'}, 0);      my $suppressNavmap = setDefault($args->{'suppressNavmap'}, 0);
Line 884  sub render { Line 884  sub render {
         # Preference: Symb          # Preference: Symb
                   
         if ($ENV{'form.symb'}) {          if ($ENV{'form.symb'}) {
             $hereType = $jumpType = SYMB();  
             $here = $jump = $ENV{'form.symb'};              $here = $jump = $ENV{'form.symb'};
         } elsif ($ENV{'form.postdata'}) {          } elsif ($ENV{'form.postdata'}) {
             # couldn't find a symb, is there a URL?              # couldn't find a symb, is there a URL?
             my $currenturl = $ENV{'form.postdata'};              my $currenturl = $ENV{'form.postdata'};
             $currenturl=~s/^http\:\/\///;              #$currenturl=~s/^http\:\/\///;
             $currenturl=~s/^[^\/]+//;              #$currenturl=~s/^[^\/]+//;
                           
             $hereType = $jumpType = URL;              $here = $jump = &Apache::lonnet::symbread($currenturl);
             $here = $jump = $currenturl;  
         } else {  
             # Nothing  
             $hereType = $jumpType = NOTHING();  
         }          }
   
         # Step three: Ensure the folders are open          # Step three: Ensure the folders are open
         my $mapIterator = $navmap->getIterator(undef, undef, undef, 1);          my $mapIterator = $navmap->getIterator(undef, undef, undef, 1);
         my $depth = 1;          my $depth = 1;
Line 913  sub render { Line 909  sub render {
             if ($curRes == $mapIterator->BEGIN_MAP()) { $depth++; }              if ($curRes == $mapIterator->BEGIN_MAP()) { $depth++; }
             if ($curRes == $mapIterator->END_MAP()) { $depth--; }              if ($curRes == $mapIterator->END_MAP()) { $depth--; }
                           
             if (ref($curRes) &&               if (ref($curRes) && $curRes->symb() eq $here) {
                 ($hereType == SYMB() && $curRes->symb() eq $here) ||  
                 (ref($curRes) && $hereType == URL() && $curRes->src() eq $here)) {  
                 my $mapStack = $mapIterator->getStack();                  my $mapStack = $mapIterator->getStack();
                                   
                 # Ensure the parent maps are open                  # Ensure the parent maps are open
Line 962  sub render { Line 956  sub render {
     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
         $hereType = $ENV{'form.hereType'};  
         $here = $ENV{'form.here'};          $here = $ENV{'form.here'};
         $jumpType = $ENV{'form.jumpType'} || NOTHING();  
         $jump = $ENV{'form.jump'};          $jump = $ENV{'form.jump'};
     }       } 
           
Line 1000  sub render { Line 992  sub render {
     # keeps track of when the current resource is found,      # keeps track of when the current resource is found,
     # so we can back up a few and put the anchor above the      # so we can back up a few and put the anchor above the
     # current resource      # current resource
     my $r = $args->{'r'};  
     my $printKey = $args->{'printKey'};      my $printKey = $args->{'printKey'};
     my $printCloseAll = $args->{'printCloseAll'};      my $printCloseAll = $args->{'printCloseAll'};
     if (!defined($printCloseAll)) { $printCloseAll = 1; }      if (!defined($printCloseAll)) { $printCloseAll = 1; }
Line 1032  sub render { Line 1023  sub render {
     if ($printCloseAll) {      if ($printCloseAll) {
         if ($condition) {          if ($condition) {
             $result.="<a href=\"navmaps?condition=0&filter=&$queryString" .              $result.="<a href=\"navmaps?condition=0&filter=&$queryString" .
                 "&hereType=$hereType&here=" . Apache::lonnet::escape($here) .                  "&here=" . Apache::lonnet::escape($here) .
                 "\">Close All Folders</a>";                  "\">Close All Folders</a>";
         } else {          } else {
             $result.="<a href=\"navmaps?condition=1&filter=&$queryString" .              $result.="<a href=\"navmaps?condition=1&filter=&$queryString" .
                 "&hereType=$hereType&here=" . Apache::lonnet::escape($here) .                   "&here=" . Apache::lonnet::escape($here) . 
                 "\">Open All Folders</a>";                  "\">Open All Folders</a>";
         }          }
         $result .= "<br /><br />\n";          $result .= "<br /><br />\n";
Line 1077  sub render { Line 1068  sub render {
   
     # export "here" marker information      # export "here" marker information
     $args->{'here'} = $here;      $args->{'here'} = $here;
     $args->{'hereType'} = $hereType;  
   
     while ($depth > 0) {      while ($depth > 0) {
         if ($curRes == $it->BEGIN_MAP()) { $depth++; }          if ($curRes == $it->BEGIN_MAP()) { $depth++; }

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


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