--- loncom/interface/lonnavmaps.pm 2003/04/04 21:36:01 1.174 +++ loncom/interface/lonnavmaps.pm 2003/04/22 18:38:47 1.179 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.174 2003/04/04 21:36:01 albertel Exp $ +# $Id: lonnavmaps.pm,v 1.179 2003/04/22 18:38:47 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -169,30 +169,34 @@ sub real_handler { return OK; } - # See if there's only one map in the top-level... if so, - # automatically display it - my $iterator = $navmap->getIterator(undef, undef, undef, 0); - my $depth = 1; - $iterator->next(); - my $curRes = $iterator->next(); - my $sequenceCount = 0; - my $sequenceId; - while ($depth > 0) { - if ($curRes == $iterator->BEGIN_MAP()) { $depth++; } - if ($curRes == $iterator->END_MAP()) { $depth--; } - - if (ref($curRes) && $curRes->is_sequence()) { - $sequenceCount++; - $sequenceId = $curRes->map_pc(); + # See if there's only one map in the top-level, if we don't + # already have a filter... if so, automatically display it + if ($ENV{QUERY_STRING} !~ /filter/) { + my $iterator = $navmap->getIterator(undef, undef, undef, 0); + my $depth = 1; + $iterator->next(); + my $curRes = $iterator->next(); + my $sequenceCount = 0; + my $sequenceId; + while ($depth > 0) { + if ($curRes == $iterator->BEGIN_MAP()) { $depth++; } + if ($curRes == $iterator->END_MAP()) { $depth--; } + + if (ref($curRes) && $curRes->is_sequence()) { + $sequenceCount++; + $sequenceId = $curRes->map_pc(); + } + + $curRes = $iterator->next(); + } + + if ($sequenceCount == 1) { + # The automatic iterator creation in the render call + # will pick this up. We know the condition because + # the defined($ENV{'form.filter'}) also ensures this + # is a fresh call. + $ENV{'form.filter'} = "$sequenceId"; } - - $curRes = $iterator->next(); - } - - if ($sequenceCount == 1) { - # The automatic iterator creation in the render call - # will pick this up. - $ENV{'form.filter'} = "$sequenceId"; } # renderer call @@ -343,14 +347,9 @@ sub lastTry { } # This puts a human-readable name on the ENV variable. -# FIXME: This needs better logic: Who gets the advanced view of navmaps? -# As of 3-13-03, it's an open question. Guy doesn't want to check -# roles directly because it should be a check of capabilities for future -# role compatibity. There is no capability that matches this one for -# now, so this is done. (A hack for 1.0 might be to simply check roles -# anyhow.) + sub advancedUser { - return $ENV{'user.adv'}; + return $ENV{'request.role.adv'}; } @@ -1000,8 +999,8 @@ sub render { # Step two: Locate what kind of here marker is necessary # Determine where the "here" marker is and where the screen jumps to. - if ($ENV{'form.symb'}) { - $here = $jump = $ENV{'form.symb'}; + if ($ENV{'form.postsymb'}) { + $here = $jump = $ENV{'form.postsymb'}; } elsif ($ENV{'form.postdata'}) { # couldn't find a symb, is there a URL? my $currenturl = $ENV{'form.postdata'}; @@ -1227,6 +1226,8 @@ sub render { # Decide what parts to show. if ($curRes->is_problem() && $showParts) { + $curRes->parts(); + $curRes->parts(); @parts = @{$curRes->parts()}; $args->{'multipart'} = scalar(@parts) > 1; @@ -1351,7 +1352,7 @@ sub render { $r->rflush(); } - #if ($mustCloseNavMap) { $navmap->untieHashes(); } + if ($mustCloseNavMap) { $navmap->untieHashes(); } return $result; } @@ -2690,6 +2691,7 @@ sub to { my $self=shift; return $self->n sub compTitle { my $self = shift; my $title = $self->title(); + $title=~s/\&colon\;/\:/gs; if (!$title) { $title = $self->src(); $title = substr($title, rindex($title, '/') + 1);