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

bowersj2 lon-capa-cvs@mail.lon-capa.org
Mon, 16 Jun 2003 15:08:22 -0000


bowersj2		Mon Jun 16 11:08:22 2003 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  Pages now have their own icon and are correctly linked. Folders 
  (sequences) are never linked, which is probably the most correct.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.204 loncom/interface/lonnavmaps.pm:1.205
--- loncom/interface/lonnavmaps.pm:1.204	Fri Jun 13 20:11:12 2003
+++ loncom/interface/lonnavmaps.pm	Mon Jun 16 11:08:22 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.204 2003/06/14 00:11:12 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.205 2003/06/16 15:08:22 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -161,7 +161,7 @@
     # Now that we've displayed some stuff to the user, init the navmap
     $navmap->init();
 
-    $r->print('<br>&nbsp;');
+    $r->print('<br>');
     $r->rflush();
 
     # Check that it's defined
@@ -556,9 +556,9 @@
 
 The main handler generates the navigational listing for the course,
 the other objects export this information in a usable fashion for
-other modules
+other modules.
 
-=head1 Object: render
+=head1 Subroutine: render
 
 The navmap renderer package provides a sophisticated rendering of the
 standard navigation maps interface into HTML. The provided nav map
@@ -572,7 +572,7 @@
 undef, 0" when you mostly want default behaviors.
 
 The package provides a function called 'render', called as
-Apache::lonnavmaps::renderer->render({}).
+Apache::lonnavmaps::render({}).
 
 =head2 Overview of Columns
 
@@ -580,7 +580,7 @@
 it. The table is consists of several columns, and a row for each
 resource (or possibly each part). You tell the renderer how many
 columns to create and what to place in each column, optionally using
-one or more of the preparent columns, and the renderer will assemble
+one or more of the prepared columns, and the renderer will assemble
 the table.
 
 Any additional generally useful column types should be placed in the
@@ -598,7 +598,7 @@
 be inserted into the HTML representation as it.
 
 The pre-packaged column names are refered to by constants in the
-Apache::lonnavmaps::renderer namespace. The following currently exist:
+Apache::lonnavmaps namespace. The following currently exist:
 
 =over 4
 
@@ -606,7 +606,7 @@
 
 The general info about the resource: Link, icon for the type, etc. The
 first column in the standard nav map display. This column also accepts
-the following parameter in the renderer hash:
+the following parameters in the renderer hash:
 
 =over 4
 
@@ -865,8 +865,10 @@
             $nowOpen = !$nowOpen;
         }
 
+	my $folderType = $resource->is_sequence() ? 'folder' : 'page';
+
         if (!$params->{'resource_no_folder_link'}) {
-            $icon = 'navmap.folder.' . ($nowOpen ? 'closed' : 'open') . '.gif';
+            $icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . '.gif';
             $icon = "<img src='/adm/lonIcons/$icon' alt='' border='0' />";
 
             $linkopen = "<a href='" . $params->{'url'} . '?' . 
@@ -882,7 +884,7 @@
                 "&folderManip=1'>";
         } else {
             # Don't allow users to manipulate folder
-            $icon = 'navmap.folder.' . ($nowOpen ? 'closed' : 'open') .
+            $icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') .
                 '.nomanip.gif';
             $icon = "<img src='/adm/lonIcons/$icon' alt='' border='0' />";
 
@@ -931,7 +933,7 @@
     }
 
     if (!$params->{'resource_nolink'} && $src !~ /^\/uploaded\// &&
-	!$resource->is_map()) {
+	!$resource->is_sequence()) {
         $result .= "  $curMarkerBegin<a href='$link'>$title$partLabel</a>$curMarkerEnd $nonLinkedText</td>";
     } else {
         $result .= "  $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText</td>";
@@ -2140,7 +2142,7 @@
 navmap->finishResource(). filterHash is a hash used as a set
 containing strings representing the resource IDs, defaulting to
 empty. Condition is a 1 or 0 that sets what to do with the filter
-hash: If a 0, then only resource that exist IN the filterHash will be
+hash: If a 0, then only resources that exist IN the filterHash will be
 recursed on. If it is a 1, only resources NOT in the filterHash will
 be recursed on. Defaults to 0. forceTop is a boolean value. If it is
 false (default), the iterator will only return the first level of map
@@ -2950,7 +2952,8 @@
 sub is_page {
     my $self=shift;
     my $src = $self->src();
-    return ($src =~ /page$/);
+    return $self->navHash("is_map_", 1) && 
+	$self->navHash("map_type_" . $self->map_pc()) eq 'page';
 }
 sub is_problem {
     my $self=shift;
@@ -2960,7 +2963,8 @@
 sub is_sequence {
     my $self=shift;
     my $src = $self->src();
-    return ($src =~ /sequence$/);
+    return $self->navHash("is_map_", 1) && 
+	$self->navHash("map_type_" . $self->map_pc()) eq 'sequence';
 }
 
 # Private method: Shells out to the parmval in the nav map, handler parts.
@@ -3034,8 +3038,6 @@
     my $pc = $self->map_pc();
     return $self->navHash("map_type_$pc", 0);
 }
-
-
 
 #####
 # Property queries