[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm
bowersj2
lon-capa-cvs@mail.lon-capa.org
Tue, 22 Apr 2003 17:54:27 -0000
bowersj2 Tue Apr 22 13:54:27 2003 EDT
Modified files:
/loncom/interface lonnavmaps.pm
Log:
Should fix the problem with trying to open or close folders when there's
only one folder on the top-level.
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.177 loncom/interface/lonnavmaps.pm:1.178
--- loncom/interface/lonnavmaps.pm:1.177 Sat Apr 19 16:47:41 2003
+++ loncom/interface/lonnavmaps.pm Tue Apr 22 13:54:27 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.177 2003/04/19 20:47:41 www Exp $
+# $Id: lonnavmaps.pm,v 1.178 2003/04/22 17:54:27 bowersj2 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -169,30 +169,34 @@
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 (!defined($ENV{'form.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