--- loncom/interface/lonnavmaps.pm 2002/10/08 20:39:43 1.71 +++ loncom/interface/lonnavmaps.pm 2002/10/11 14:56:43 1.72 @@ -1,7 +1,8 @@ + # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.71 2002/10/08 20:39:43 www Exp $ +# $Id: lonnavmaps.pm,v 1.72 2002/10/11 14:56:43 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -930,16 +931,21 @@ sub new_handle { } my $mapIterator = $navmap->getIterator(undef, undef, \%filterHash, $condition); - my $curRes = $mapIterator->next(); undef $res; # so we don't accidentally use it later - my $indentLevel = -1; + my $indentLevel = 0; my $indentString = "\"\""; my $isNewBranch = 0; my $now = time(); my $in24Hours = $now + 24 * 60 * 60; + my $depth = 1; + + # We know the first thing is a BEGIN_MAP (see "$self->{STARTED}" + # code in iterator->next), so ignore the first one + $mapIterator->next(); + my $curRes = $mapIterator->next(); - while ($curRes != $mapIterator->END_MAP()) { + while ($depth > 0) { if ($curRes == $mapIterator->BEGIN_MAP() || $curRes == $mapIterator->BEGIN_BRANCH()) { $indentLevel++; @@ -951,6 +957,12 @@ sub new_handle { if ($curRes == $mapIterator->BEGIN_BRANCH()) { $isNewBranch = 1; } + if ($curRes == $mapIterator->BEGIN_MAP()) { + $depth++; + } + if ($curRes == $mapIterator->END_MAP()) { + $depth--; + } # Is this resource being blotted out? if (ref($curRes) && !advancedUser() && $curRes->randomout()) {