[prev in list] [next in list] [prev in thread] [next in thread]
List: lon-capa-cvs
Subject: [LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm
From: bowersj2 <lon-capa-cvs () mail ! lon-capa ! org>
Date: 2002-10-28 20:48:29
Message-ID: cvsbowersj21035838109 () cvsserver
[Download RAW message or body]
bowersj2 Mon Oct 28 15:48:29 2002 EDT
Modified files:
/loncom/interface lonnavmaps.pm
Log:
Fixes some re-my-ing declarations.
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.88 loncom/interface/lonnavmaps.pm:1.89
--- loncom/interface/lonnavmaps.pm:1.88 Mon Oct 28 14:10:35 2002
+++ loncom/interface/lonnavmaps.pm Mon Oct 28 15:48:29 2002
@@ -2,7 +2,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.88 2002/10/28 19:10:35 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.89 2002/10/28 20:48:29 bowersj2 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -995,15 +995,14 @@
my $isNewBranch = 0;
my $now = time();
my $in24Hours = $now + 24 * 60 * 60;
- my $depth = 1;
my $displayedHereMarker = 0;
# We know the first thing is a BEGIN_MAP (see "$self->{STARTED}"
# code in iterator->next), so ignore the first one
- my $mapIterator = $navmap->getIterator(undef, undef, \%filterHash,
+ $mapIterator = $navmap->getIterator(undef, undef, \%filterHash,
$condition);
$mapIterator->next();
- my $curRes = $mapIterator->next();
+ $curRes = $mapIterator->next();
my $deltadepth = 0;
my @backgroundColors = ("#FFFFFF", "#F6F6F6");
@@ -1739,7 +1738,8 @@
sub getIterator {
my $self = shift;
my $iterator = Apache::lonnavmaps::iterator->new($self, shift, shift,
- shift, undef, shift);
+ shift, undef, shift,
+ $ENV{'form.direction'});
return $iterator;
}
@@ -1963,7 +1963,7 @@
=over 4
-=item B<getIterator>(firstResource, finishResource, filterHash, condition): All \
parameters are optional. firstResource is a resource reference corresponding to where \
the iterator should start. It defaults to navmap->firstResource() for the \
corresponding nav map. finishResource corresponds to where you want the iterator to \
end, defaulting to navmap->finishResource(). filterHash is a hash used as a set \
containing strings representing the resource IDs, defaulting to empty. Condition is a \
1 or 0 that sets what to do with the filter hash: If a 0, then only resource that \
exist IN the filterHash will be recursed on. If it is a 1, only resources NOT in the \
filterHash will be recursed on. Defaults to 0, which is to say, do not recurse unless \
explicitly asked to. +=item B<getIterator>(firstResource, finishResource, filterHash, \
condition, direction): All parameters are optional. firstResource is a resource \
reference corresponding to where the iterator should start. It defaults to \
navmap->firstResource() for the corresponding nav map. finishResource corresponds to \
where you want the iterator to end, defaulting to navmap->finishResource(). \
filterHash is a hash used as a set containing strings representing the resource IDs, \
defaulting to empty. Condition is a 1 or 0 that sets what to do with the filter hash: \
If a 0, then only resource that exist IN the filterHash will be recursed on. If it is \
a 1, only resources NOT in the filterHash will be recursed on. Defaults to 0, which \
is to say, do not recurse unless explicitly asked to. Direction specifies which \
direction to recurse, either FORWARD or BACKWARD, with FORWARD being default.
Thus, by default, all resources will be shown. Change the condition to a 1 without \
changing the hash, and only the top level of the map will be shown. Changing the \
condition to 1 and including some values in the hash will allow you to selectively \
examine parts of the navmap, while leaving it on 0 and adding things to the hash will \
allow you to selectively ignore parts of the nav map. See the handler code for \
examples: By default, the condition is 0 and all folders are closed unless explicitly \
opened. Clicking "Show All Resources" will use a condition of 1 and an empty \
filterHash, resulting in all resources being shown.
@@ -1993,6 +1993,8 @@
sub END_MAP { return 2; } # end of the map
sub BEGIN_BRANCH { return 3; } # beginning of a branch
sub END_BRANCH { return 4; } # end of a branch
+sub FORWARD { return 1; } # go forward
+sub BACKWARD { return 2; }
# Params: nav map, start resource, end resource, filter, condition,
# already seen hash ref
@@ -2023,6 +2025,7 @@
$self->{ALREADY_SEEN} = shift;
if (!defined($self->{ALREADY_SEEN})) { $self->{ALREADY_SEEN} = {} };
$self->{CONDITION} = shift;
+ $self->{DIRECTION} = shift || FORWARD();
# Flag: Have we started yet? If not, the first action is to return BEGIN_MAP.
$self->{STARTED} = 0;
@@ -2047,7 +2050,11 @@
$self->{FORCE_NEXT} = undef;
# Start with the first resource
- push @{$self->{BRANCH_STACK}}, $self->{FIRST_RESOURCE};
+ if ($self->{DIRECTION} == FORWARD) {
+ push @{$self->{BRANCH_STACK}}, $self->{FIRST_RESOURCE};
+ } else {
+ push @{$self->{BRANCH_STACK}), $self->{FINISH_RESOURCE};
+ }
$self->{BRANCH_STACK_SIZE} = 1;
bless($self);
@@ -2144,7 +2151,11 @@
$self->{ALREADY_SEEN}->{$self->{HERE}->{ID}} = 1;
# Get the next possible resources
- my $nextUnfiltered = $self->{HERE}->getNext();
+ if ($self->{DIRECTION} == FORWARD()) {
+ my $nextUnfiltered = $self->{HERE}->getNext();
+ } else {
+ my $nextUnfiltered = $self->{HERE}->getPrevious();
+ }
my $next = [];
# filter the next possibilities to remove things we've
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic