version 1.469, 2011/11/29 01:49:00
|
version 1.470, 2011/11/29 11:58:53
|
Line 225 automatically.
|
Line 225 automatically.
|
|
|
=over 4 |
=over 4 |
|
|
=item * B<iterator>: default: constructs one from %env |
=item * B<iterator: default: constructs one from %env |
|
|
A reference to a fresh ::iterator to use from the navmaps. The |
A reference to a fresh ::iterator to use from the navmaps. The |
rendering will reflect the options passed to the iterator, so you can |
rendering will reflect the options passed to the iterator, so you can |
Line 487 use DateTime();
|
Line 487 use DateTime();
|
|
|
# For debugging |
# For debugging |
|
|
use Data::Dumper; |
# use Data::Dumper; |
|
|
|
|
# symbolic constants |
# symbolic constants |
Line 1397 sub render {
|
Line 1397 sub render {
|
} |
} |
} |
} |
|
|
|
|
# (re-)Locate the jump point, if any |
# (re-)Locate the jump point, if any |
# Note this does not take filtering or hidden into account... need |
# Note this does not take filtering or hidden into account... need |
# to be fixed? |
# to be fixed? |
Line 1649 END
|
Line 1650 END
|
$curRes = shift(@resources); |
$curRes = shift(@resources); |
} else { |
} else { |
$curRes = $it->next($closeAllPages); |
$curRes = $it->next($closeAllPages); |
|
|
} |
} |
if (!$curRes) { last; } |
if (!$curRes) { last; } |
|
|
Line 1995 sub new {
|
Line 1997 sub new {
|
# assume there are course hashes for the specific requested user@domamin: |
# assume there are course hashes for the specific requested user@domamin: |
# |
# |
|
|
if (($self->{USERNAME} eq $env{'user.name'}) && ($self->{DOMAIN} eq $env{'user.domain'})) { |
if ( ($self->{USERNAME} eq $env{'user.name'}) && ($self->{DOMAIN} eq $env{'user.domain'})) { |
|
|
# tie the nav hash |
# tie the nav hash |
|
|
Line 2020 sub new {
|
Line 2022 sub new {
|
} else { |
} else { |
$self->change_user($self->{USERNAME}, $self->{DOMAIN}); |
$self->change_user($self->{USERNAME}, $self->{DOMAIN}); |
} |
} |
|
|
|
my $d = Data::Dumper->new([$self]); |
|
|
return $self; |
return $self; |
} |
} |
|
|
Line 2055 sub change_user {
|
Line 2059 sub change_user {
|
&Apache::lonmap::loadmap($cnum, $cdom, $self->{USERNAME}, $self->{DOMAIN}, \%big_hash); |
&Apache::lonmap::loadmap($cnum, $cdom, $self->{USERNAME}, $self->{DOMAIN}, \%big_hash); |
$self->{NAV_HASH} = \%big_hash; |
$self->{NAV_HASH} = \%big_hash; |
|
|
|
|
|
|
# Now clear the parm cache and reconstruct the parm hash fromt he big_hash |
# Now clear the parm cache and reconstruct the parm hash fromt he big_hash |
# param.xxxx keys. |
# param.xxxx keys. |
|
|
Line 2070 sub change_user {
|
Line 2076 sub change_user {
|
} |
} |
|
|
$self->{PARM_HASH} = \%parm_hash; |
$self->{PARM_HASH} = \%parm_hash; |
|
|
|
|
|
|
|
|
Line 3062 sub new {
|
Line 3069 sub new {
|
if ($resourceCount == 1 && $resource->is_sequence() && !$self->{FORCE_TOP}) { |
if ($resourceCount == 1 && $resource->is_sequence() && !$self->{FORCE_TOP}) { |
my $firstResource = $resource->map_start(); |
my $firstResource = $resource->map_start(); |
my $finishResource = $resource->map_finish(); |
my $finishResource = $resource->map_finish(); |
return |
my $result; |
Apache::lonnavmaps::iterator->new($self->{NAV_MAP}, $firstResource, |
my $rdump = Data::Dumper->new([$result]); |
$finishResource, $self->{FILTER}, |
$result = Apache::lonnavmaps::iterator->new($self->{NAV_MAP}, $firstResource, |
$self->{ALREADY_SEEN}, |
$finishResource, $self->{FILTER}, |
$self->{CONDITION}, |
$self->{ALREADY_SEEN}, |
$self->{FORCE_TOP}); |
$self->{CONDITION}, |
|
$self->{FORCE_TOP}); |
|
return $result; |
|
|
|
|
} |
} |
|
|
Line 3087 sub new {
|
Line 3097 sub new {
|
$self->{ALREADY_SEEN}->{$self->{FIRST_RESOURCE}->{ID}} = 1; |
$self->{ALREADY_SEEN}->{$self->{FIRST_RESOURCE}->{ID}} = 1; |
|
|
bless ($self); |
bless ($self); |
|
my $selfDump = Data::Dumper->new([$self]); |
|
|
return $self; |
return $self; |
} |
} |
Line 3102 sub next {
|
Line 3113 sub next {
|
# do so. |
# do so. |
if ($self->{RETURN_0} && !$self->{HAVE_RETURNED_0}) { |
if ($self->{RETURN_0} && !$self->{HAVE_RETURNED_0}) { |
$self->{HAVE_RETURNED_0} = 1; |
$self->{HAVE_RETURNED_0} = 1; |
|
my $nextTopLevel = $self->{NAV_MAP}->getById('0.0'); |
|
|
return $self->{NAV_MAP}->getById('0.0'); |
return $self->{NAV_MAP}->getById('0.0'); |
} |
} |
if ($self->{RETURN_0} && !$self->{HAVE_RETURNED_0_BEGIN_MAP}) { |
if ($self->{RETURN_0} && !$self->{HAVE_RETURNED_0_BEGIN_MAP}) { |
Line 3121 sub next {
|
Line 3134 sub next {
|
if ($self->{RECURSIVE_DEPTH} == 0) { |
if ($self->{RECURSIVE_DEPTH} == 0) { |
$self->{RECURSIVE_ITERATOR_FLAG} = 0; |
$self->{RECURSIVE_ITERATOR_FLAG} = 0; |
} |
} |
|
|
return $next; |
return $next; |
} |
} |
|
|
if (defined($self->{FORCE_NEXT})) { |
if (defined($self->{FORCE_NEXT})) { |
my $tmp = $self->{FORCE_NEXT}; |
my $tmp = $self->{FORCE_NEXT}; |
$self->{FORCE_NEXT} = undef; |
$self->{FORCE_NEXT} = undef; |
|
|
return $tmp; |
return $tmp; |
} |
} |
|
|
Line 3197 sub next {
|
Line 3210 sub next {
|
# So we need to look at all the resources we can get to from here, |
# So we need to look at all the resources we can get to from here, |
# categorize them if we haven't seen them, remember if we have a new |
# categorize them if we haven't seen them, remember if we have a new |
my $nextUnfiltered = $here->getNext(); |
my $nextUnfiltered = $here->getNext(); |
|
|
|
|
my $maxDepthAdded = -1; |
my $maxDepthAdded = -1; |
|
|
for (@$nextUnfiltered) { |
for (@$nextUnfiltered) { |
Line 3230 sub next {
|
Line 3245 sub next {
|
$self->{RECURSIVE_ITERATOR_FLAG} = 1; |
$self->{RECURSIVE_ITERATOR_FLAG} = 1; |
my $firstResource = $self->{HERE}->map_start(); |
my $firstResource = $self->{HERE}->map_start(); |
my $finishResource = $self->{HERE}->map_finish(); |
my $finishResource = $self->{HERE}->map_finish(); |
|
|
$self->{RECURSIVE_ITERATOR} = |
$self->{RECURSIVE_ITERATOR} = |
Apache::lonnavmaps::iterator->new($self->{NAV_MAP}, $firstResource, |
Apache::lonnavmaps::iterator->new($self->{NAV_MAP}, $firstResource, |
$finishResource, $self->{FILTER}, |
$finishResource, $self->{FILTER}, |
Line 3248 sub next {
|
Line 3262 sub next {
|
return $self->next($closeAllPages); |
return $self->next($closeAllPages); |
} |
} |
|
|
|
my $hereResource = $self->{HERE}; |
|
|
return $self->{HERE}; |
return $self->{HERE}; |
|
|
} |
} |
Line 3414 sub next {
|
Line 3430 sub next {
|
my $nextUnfiltered; |
my $nextUnfiltered; |
if ($self->{DIRECTION} == FORWARD()) { |
if ($self->{DIRECTION} == FORWARD()) { |
$nextUnfiltered = $self->{HERE}->getNext(); |
$nextUnfiltered = $self->{HERE}->getNext(); |
|
|
} else { |
} else { |
$nextUnfiltered = $self->{HERE}->getPrevious(); |
$nextUnfiltered = $self->{HERE}->getPrevious(); |
} |
} |