--- loncom/interface/lonnavmaps.pm 2002/11/26 16:25:36 1.116 +++ loncom/interface/lonnavmaps.pm 2002/11/26 17:01:29 1.117 @@ -2,7 +2,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.116 2002/11/26 16:25:36 bowersj2 Exp $ +# $Id: lonnavmaps.pm,v 1.117 2002/11/26 17:01:29 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1384,7 +1384,12 @@ sub new { if (ref($curRes)) { # If there's only one resource, this will save it - if($direction == FORWARD) { $resource = $curRes; $resourceCount++; } + # we have to filter empty resources from consideration here, + # or even "empty", redirecting maps have two (start & finish) + # or three (start, finish, plus redirector) + if($direction == FORWARD && $curRes->src()) { + $resource = $curRes; $resourceCount++; + } my $resultingVal = $curRes->{DATA}->{$valName}; my $nextResources = $curRes->$nextResourceMethod(); my $nextCount = scalar(@{$nextResources}); @@ -1576,6 +1581,8 @@ sub next { } # If this is a blank resource, don't actually return it. + # Should you ever find you need it, make sure to add an option to the code + # that you can use; other things depend on this behavior. if (!$self->{HERE}->src()) { return $self->next(); } @@ -1626,6 +1633,9 @@ package Apache::lonnavmaps::DFSiterator; # but this might as well be left seperate, since it is possible some other # use might be found for it. - Jeremy +# Unlike the main iterator, this DOES return all resources, even blank ones. +# The main iterator needs them to correctly preprocess the map. + sub BEGIN_MAP { return 1; } # begining of a new map sub END_MAP { return 2; } # end of the map sub FORWARD { return 1; } # go forward @@ -1763,11 +1773,6 @@ sub next { $self->{CONDITION}, $self->{DIRECTION}); } - # If this is a blank resource, ignore it. - if (!$self->{HERE}->src()) { - return $self->next(); - } - return $self->{HERE}; }