[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm

bowersj2 lon-capa-cvs@mail.lon-capa.org
Thu, 13 Mar 2003 17:05:37 -0000


bowersj2		Thu Mar 13 12:05:37 2003 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  Fixed part 0 handling of resources to work as Guy suggests: All resources
  now have a "part ''", in the nav maps, and '0' is ignored. The parts
  call to a resource will return the "correct" parts list.
  
  Also cleaned up a code bit: "continue" used to advance
  the iterator instead of putting it in before every "next".
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.155 loncom/interface/lonnavmaps.pm:1.156
--- loncom/interface/lonnavmaps.pm:1.155	Sat Mar  8 16:16:38 2003
+++ loncom/interface/lonnavmaps.pm	Thu Mar 13 12:05:36 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.155 2003/03/08 21:16:38 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.156 2003/03/13 17:05:36 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -620,7 +620,7 @@
     my $icon = "<img src='/adm/lonIcons/html.gif' alt='' border='0' />";
     
     if ($resource->is_problem()) {
-        if ($part eq "0" || $params->{'condensed'}) {
+        if ($part eq "" || $params->{'condensed'}) {
             $icon = '<img src="/adm/lonIcons/problem.gif" alt="" border="0" />';
         } else {
             $icon = $params->{'indentString'};
@@ -692,7 +692,7 @@
         $curMarkerEnd = '<font color="red" size="+2">&lt;</font>';
     }
 
-    if ($resource->is_problem() && $part ne "0" && 
+    if ($resource->is_problem() && $part ne "" && 
         !$params->{'condensed'}) {
         $partLabel = " (Part $part)";
         $title = "";
@@ -1107,14 +1107,12 @@
 
         # If this has been filtered out, continue on
         if (!(&$filterFunc($curRes))) {
-            $curRes = $it->next();
             $args->{'isNewBranch'} = 0; # Don't falsely remember this
             next;
         } 
 
         # If we're suppressing navmaps and this is a navmap, continue on
         if ($suppressNavmap && $curRes->src() =~ /^\/adm\/navmaps/) {
-            $curRes = $it->next();
             next;
         }
 
@@ -1168,28 +1166,19 @@
                     
                 }
             }
-            
-        } else {
-            # Not showing parts
-            @parts = ("0"); # show main part only
         }
-
+            
         # If the multipart problem was condensed, "forget" it was multipart
         if (scalar(@parts) == 1) {
             $args->{'multipart'} = 0;
         }
 
-        # In the event of a network error, display one part.
-        # If this is a single part, we can at least show the correct
-        # status, but if it's multipart, we're lost, since we can't
-        # retreive the metadata to count the parts
-        if ($curRes->{RESOURCE_ERROR}) {
-            @parts = ("0");
-        }
-
         # Now, we've decided what parts to show. Loop through them and
         # show them.
-        foreach my $part (@parts) {
+        foreach my $part ('', @parts) {
+            if ($part eq '0') {
+                next;
+            }
             $rownum ++;
             my $backgroundColor = $backgroundColors[$rownum % scalar(@backgroundColors)];
             
@@ -1235,7 +1224,7 @@
             $result = "";
             $r->rflush();
         }
-        
+    } continue {
         $curRes = $it->next();
     }
     
@@ -2754,11 +2743,6 @@
         
         my @sortedParts = sort @{$self->{PARTS}};
         $self->{PARTS} = \@sortedParts;
-    }
-
-    # Ensure part 0 is included at the beginning.
-    if ($self->{PARTS}->[0] ne '0') {
-        unshift @{$self->{PARTS}}, '0';
     }
 
     return;