--- loncom/interface/lonnavmaps.pm 2005/01/26 22:52:25 1.313 +++ loncom/interface/lonnavmaps.pm 2005/02/01 21:03:13 1.314 @@ -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 courseMapDefined { 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 @@ you're not sure if $res is already an ob 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(map, filterFunc, recursive, bailout): +=item * B(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 @@ function that takes a resource object as 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 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 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 @@ sub retrieveResources { 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 @@ sub retrieveResources { # Get an iterator. my $it = $self->getIterator($map->map_start(), $map->map_finish(), - undef, $recursive); + undef, $recursive, $showall); my @resources = (); @@ -2901,7 +2903,8 @@ sub new { 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 @@ sub next { $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.