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

bowersj2 lon-capa-cvs@mail.lon-capa.org
Thu, 20 Mar 2003 18:38:01 -0000


bowersj2		Thu Mar 20 13:38:01 2003 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  Repair some part mechanisms that were broken by the transition to packages.
  They now work correctly rather then relying on hacks.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.162 loncom/interface/lonnavmaps.pm:1.163
--- loncom/interface/lonnavmaps.pm:1.162	Thu Mar 20 13:03:14 2003
+++ loncom/interface/lonnavmaps.pm	Thu Mar 20 13:38:01 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.162 2003/03/20 18:03:14 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.163 2003/03/20 18:38:01 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -700,7 +700,7 @@
         $title = "";
     }
 
-    if ($params->{'multipart'} && $params->{'condensed'}) {
+    if ($params->{'condensed'} && $resource->countParts() > 1) {
         $nonLinkedText .= ' (' . $resource->countParts() . ' parts)';
     }
 
@@ -2698,14 +2698,16 @@
     my $self = shift;
     
     my $parts = $self->parts();
+    my $delta = 0;
+    for my $part (@$parts) {
+        if ($part eq '0') { $delta--; }
+    }
 
     if ($self->{RESOURCE_ERROR}) {
         return 0;
     }
 
-    if (scalar(@{$parts}) < 2) { return 1;}
-
-    return scalar(@{$parts}) - 1;
+    return scalar(@{$parts}) + $delta;
 }
 
 # Private function: Extracts the parts information and saves it