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

bowersj2 lon-capa-cvs@mail.lon-capa.org
Mon, 14 Jul 2003 15:01:07 -0000


bowersj2		Mon Jul 14 11:01:07 2003 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  The top-level map's title is now the name of the course; looks better then 
  "default.sequence" on the grading screen.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.212 loncom/interface/lonnavmaps.pm:1.213
--- loncom/interface/lonnavmaps.pm:1.212	Wed Jun 25 14:32:06 2003
+++ loncom/interface/lonnavmaps.pm	Mon Jul 14 11:01:07 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.212 2003/06/25 18:32:06 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.213 2003/07/14 15:01:07 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1041,6 +1041,10 @@
         $result .= '(randomly select ' . $resource->randompick() .')';
     }
 
+    # Debugging code
+    #$result .= " " . $resource->awarded($part) . '/' . $resource->weight($part) .
+    #	' - Part: ' . $part;
+
     $result .= "</td>\n";
     
     return $result;
@@ -2077,8 +2081,13 @@
         $map = $self->getResourceByUrl($map);
     }
 
+    # If nothing was passed, assume top-level map
+    if (!$map) {
+	$map = $self->getById('0.0');
+    }
+
     # Check the map's validity.
-    if (!$map || !$map->is_map()) {
+    if (!$map->is_map()) {
         # Oh, to throw an exception.... how I'd love that!
         return ();
     }
@@ -2922,7 +2931,14 @@
          $self->navHash('map_id_'.$first)) 
         . '___' . $second . '___' . $symbSrc;
 }
-sub title { my $self=shift; return $self->navHash("title_", 1); }
+sub title { 
+    my $self=shift; 
+    if ($self->{ID} eq '0.0') {
+	# If this is the top-level map, return the title of the course
+	# since this map can not be titled otherwise.
+	return $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
+    }
+    return $self->navHash("title_", 1); }
 sub to { my $self=shift; return $self->navHash("to_", 1); }
 sub compTitle {
     my $self = shift;