Diff for /loncom/interface/lonnavmaps.pm between versions 1.112 and 1.113

version 1.112, 2002/11/16 22:45:22 version 1.113, 2002/11/18 20:59:21
Line 207  sub handler { Line 207  sub handler {
     # maps in their own folders, in favor of "inlining" them.      # maps in their own folders, in favor of "inlining" them.
     my $topResource = $navmap->getById("0.0");      my $topResource = $navmap->getById("0.0");
     my $inlineTopLevelMaps = $topResource->src() =~ m|^/uploaded/.*default\.sequence$|;      my $inlineTopLevelMaps = $topResource->src() =~ m|^/uploaded/.*default\.sequence$|;
       my $inlinedelta = $inlineTopLevelMaps? -1 : 0;
   
     # Begin the HTML table      # Begin the HTML table
     # four cols: resource + indent, chat+feedback, icon, text string      # four cols: resource + indent, chat+feedback, icon, text string
Line 288  sub handler { Line 289  sub handler {
                                            $condition);                                             $condition);
     $mapIterator->next();      $mapIterator->next();
     $curRes = $mapIterator->next();      $curRes = $mapIterator->next();
     my $deltadepth = 0;  
     $depth = 1;      $depth = 1;
   
     my @backgroundColors = ("#FFFFFF", "#F6F6F6");      my @backgroundColors = ("#FFFFFF", "#F6F6F6");
Line 302  sub handler { Line 302  sub handler {
     }      }
   
     while ($depth > 0) {      while ($depth > 0) {
         # If this is an inlined map, cancel the shift to the right,  
         # which has the effect of making the map look inlined  
         if ($inlineTopLevelMaps && scalar(@{$mapIterator->getStack()}) == 1 &&  
             ref($curRes) && $curRes->is_map()) {  
             $deltadepth = -1;  
             $curRes = $mapIterator->next();  
             next;  
         }  
   
         if ($curRes == $mapIterator->BEGIN_MAP() ||          if ($curRes == $mapIterator->BEGIN_MAP() ||
             $curRes == $mapIterator->BEGIN_BRANCH()) {              $curRes == $mapIterator->BEGIN_BRANCH()) {
             $indentLevel++;              $indentLevel++;
Line 327  sub handler { Line 318  sub handler {
   
         if (ref($curRes)) { $counter++; }          if (ref($curRes)) { $counter++; }
   
         if ($depth == 1) { $deltadepth = 0; } # we're done shifting, because we're  
                                               # out of the inlined map  
   
         # Is this resource being ignored because it is in a random-out          # Is this resource being ignored because it is in a random-out
         # map and it was not selected?          # map and it was not selected?
         if (ref($curRes) && !advancedUser() && $curRes->randomout()) {          if (ref($curRes) && !advancedUser() && $curRes->randomout()) {
Line 339  sub handler { Line 327  sub handler {
   
         if (ref($curRes) && $curRes->src()) {          if (ref($curRes) && $curRes->src()) {
   
               my $deltalevel = $isNewBranch? 1 : 0; # reserves space for branch icon
   
               if ($indentLevel - $deltalevel + $inlinedelta < 0) {
                   # If this would be at a negative depth (top-level maps in
                   # new-style courses, we want to suppress their title display)
                   # then ignore it.
                   $curRes = $mapIterator->next();
                   next;
               }
   
             # Step one: Decide which parts to show              # Step one: Decide which parts to show
             my @parts = @{$curRes->parts()};              my @parts = @{$curRes->parts()};
             my $multipart = scalar(@parts) > 1;              my $multipart = scalar(@parts) > 1;
Line 424  sub handler { Line 422  sub handler {
             # For each part we intend to display...              # For each part we intend to display...
             foreach my $part (@parts) {              foreach my $part (@parts) {
   
                 my $deltalevel = 0; # for inserting the branch icon  
                 my $nonLinkedText = ""; # unlinked stuff after title                  my $nonLinkedText = ""; # unlinked stuff after title
                                   
                 my $stack = $mapIterator->getStack();                  my $stack = $mapIterator->getStack();
Line 446  sub handler { Line 443  sub handler {
                 if ($isNewBranch) {                  if ($isNewBranch) {
                     $newBranchText = "<img src=\"/adm/lonIcons/branch.gif\" border=\"0\">";                      $newBranchText = "<img src=\"/adm/lonIcons/branch.gif\" border=\"0\">";
                     $isNewBranch = 0;                      $isNewBranch = 0;
                     $deltalevel = 1; # reserves space for the branch icon  
                 }                  }
   
                 # links to open and close the folders                  # links to open and close the folders
Line 524  sub handler { Line 520  sub handler {
                 }                  }
   
                 # print indentation                  # print indentation
                 for (my $i = 0; $i < $indentLevel - $deltalevel + $deltadepth; $i++) {                  for (my $i = 0; $i < $indentLevel - $deltalevel + $inlinedelta; $i++) {
                     $r->print($indentString);                      $r->print($indentString);
                 }                  }
   
Line 555  sub handler { Line 551  sub handler {
                                               '<font size="-1">Host down</font>'));                                                '<font size="-1">Host down</font>'));
                     }                      }
   
                   $r->print("</td>\n");
   
                 # SECOND COL: Is there text, feedback, errors??                  # SECOND COL: Is there text, feedback, errors??
                 my $discussionHTML = ""; my $feedbackHTML = "";                  my $discussionHTML = ""; my $feedbackHTML = "";
   
Line 613  sub handler { Line 611  sub handler {
                 }                  }
   
                 $r->print("&nbsp;</td></tr>\n");                  $r->print("&nbsp;</td></tr>\n");
   
                   if (!($counter % 20)) { $r->rflush(); }
                   if ($counter == 2) { $r->rflush(); }
             }              }
         }          }
         $curRes = $mapIterator->next();          $curRes = $mapIterator->next();

Removed from v.1.112  
changed lines
  Added in v.1.113


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