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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 01 Feb 2005 21:03:14 -0000


albertel		Tue Feb  1 16:03:14 2005 EDT

  Modified files:              
    /loncom/homework	grades.pm 
    /loncom/interface	lonnavmaps.pm 
  Log:
   - BUG#3883 need to show intervening blank maps sometimes like when grading an exam.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.239 loncom/homework/grades.pm:1.240
--- loncom/homework/grades.pm:1.239	Fri Jan 28 19:09:54 2005
+++ loncom/homework/grades.pm	Tue Feb  1 16:03:13 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.239 2005/01/29 00:09:54 albertel Exp $
+# $Id: grades.pm,v 1.240 2005/02/01 21:03:13 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3060,14 +3060,16 @@
     my $minder = 0;
 
     # Gather every sequence that has problems.
-    my @sequences = $navmap->retrieveResources(undef, sub { shift->is_map(); }, 1);
+    my @sequences = $navmap->retrieveResources(undef, sub { shift->is_map(); },
+					       1,0,1);
     for my $sequence ($navmap->getById('0.0'), @sequences) {
-	if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) {
+#	if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) {
+	Apache->request->print($sequence->map_pc()."<br />");
 	    my $title = $minder.'.'.$sequence->compTitle();
 	    push @titles, $title; # minder in case two titles are identical
 	    $symbx{$title} = $sequence->symb();
 	    $minder++;
-	}
+#	}
     }
     return \@titles,\%symbx;
 }
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.313 loncom/interface/lonnavmaps.pm:1.314
--- loncom/interface/lonnavmaps.pm:1.313	Wed Jan 26 17:52:25 2005
+++ loncom/interface/lonnavmaps.pm	Tue Feb  1 16:03:13 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.313 2005/01/26 22:52:25 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.314 2005/02/01 21:03:13 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2257,7 +2257,8 @@
 sub getIterator {
     my $self = shift;
     my $iterator = Apache::lonnavmaps::iterator->new($self, shift, shift,
-                                                     shift, undef, shift);
+                                                     shift, undef, shift,
+						     shift, shift);
     return $iterator;
 }
 
@@ -2524,7 +2525,7 @@
 resource appears multiple times in the course, only the first instance
 will be returned. As a result, this is probably useful only for maps.
 
-=item * B<retrieveResources>(map, filterFunc, recursive, bailout):
+=item * B<retrieveResources>(map, filterFunc, recursive, bailout, showall):
 
 The map is a specification of a map to retreive the resources from,
 either as a url or as an object. The filterFunc is a reference to a
@@ -2532,13 +2533,14 @@
 true if the resource should be included, or false if it should not
 be. If recursive is true, the map will be recursively examined,
 otherwise it will not be. If bailout is true, the function will return
-as soon as it finds a resource, if false it will finish. By default,
-the map is the top-level map of the course, filterFunc is a function
-that always returns 1, recursive is true, bailout is false. The
-resources will be returned in a list containing the resource objects
-for the corresponding resources, with B<no structure information> in
-the list; regardless of branching, recursion, etc., it will be a flat
-list.
+as soon as it finds a resource, if false it will finish. If showall is
+true it will not hide maps that contain nothing but one other map. By
+default, the map is the top-level map of the course, filterFunc is a
+function that always returns 1, recursive is true, bailout is false,
+showall is false. The resources will be returned in a list containing
+the resource objects for the corresponding resources, with B<no
+structure information> in the list; regardless of branching,
+recursion, etc., it will be a flat list.
 
 Thus, this is suitable for cases where you don't want the structure,
 just a list of all resources. It is also suitable for finding out how
@@ -2585,7 +2587,7 @@
     if (!defined($recursive)) { $recursive = 1; }
     my $bailout = shift;
     if (!defined($bailout)) { $bailout = 0; }
-
+    my $showall = shift;
     # Create the necessary iterator.
     if (!ref($map)) { # assume it's a url of a map.
         $map = $self->getResourceByUrl($map);
@@ -2604,7 +2606,7 @@
 
     # Get an iterator.
     my $it = $self->getIterator($map->map_start(), $map->map_finish(),
-                                undef, $recursive);
+                                undef, $recursive, $showall);
 
     my @resources = ();
 
@@ -2901,7 +2903,8 @@
             Apache::lonnavmaps::iterator->new($self->{NAV_MAP}, $firstResource,
                                               $finishResource, $self->{FILTER},
                                               $self->{ALREADY_SEEN}, 
-                                              $self->{CONDITION}, 0);
+                                              $self->{CONDITION},
+					      $self->{FORCE_TOP});
         
     }
 
@@ -3064,7 +3067,9 @@
         $self->{RECURSIVE_ITERATOR} = 
             Apache::lonnavmaps::iterator->new($self->{NAV_MAP}, $firstResource,
                                               $finishResource, $self->{FILTER},
-                                              $self->{ALREADY_SEEN}, $self->{CONDITION});
+                                              $self->{ALREADY_SEEN},
+					      $self->{CONDITION},
+					      $self->{FORCE_TOP});
     }
 
     # If this is a blank resource, don't actually return it.