version 1.126, 2003/01/13 22:41:20
|
version 1.130, 2003/01/14 18:47:50
|
Line 46 use Apache::Constants qw(:common :http);
|
Line 46 use Apache::Constants qw(:common :http);
|
use Apache::loncommon(); |
use Apache::loncommon(); |
use POSIX qw (floor strftime); |
use POSIX qw (floor strftime); |
|
|
|
my %navmaphash; |
|
my %parmhash; |
|
|
|
sub cleanup { |
|
if (tied(%navmaphash)){ |
|
&Apache::lonnet::logthis('Cleanup navmaps: navmaphash'); |
|
unless (untie(%navmaphash)) { |
|
&Apache::lonnet::logthis('Failed cleanup navmaps: navmaphash'); |
|
} |
|
} |
|
if (tied(%parmhash)){ |
|
&Apache::lonnet::logthis('Cleanup navmaps: parmhash'); |
|
unless (untie(%parmhash)) { |
|
&Apache::lonnet::logthis('Failed cleanup navmaps: parmhash'); |
|
} |
|
} |
|
} |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
real_handler($r); |
real_handler($r); |
Line 273 sub real_handler {
|
Line 291 sub real_handler {
|
$mapIterator->next(); # discard the first BEGIN_MAP |
$mapIterator->next(); # discard the first BEGIN_MAP |
my $curRes = $mapIterator->next(); |
my $curRes = $mapIterator->next(); |
my $counter = 0; |
my $counter = 0; |
<<<<<<< lonnavmaps.pm |
|
|
|
# We only need to do this if we need to open the maps to show the |
|
# current position |
|
while ($depth > 0 && !$ENV{'form.alreadyHere'}) { |
|
======= |
|
my $foundJump = ($jumpType == $NOTHING); # look for jump point if we have one |
my $foundJump = ($jumpType == $NOTHING); # look for jump point if we have one |
my $looped = 0; |
my $looped = 0; |
|
|
Line 286 sub real_handler {
|
Line 298 sub real_handler {
|
# current position. This will change the counter so we can't count |
# current position. This will change the counter so we can't count |
# for the jump marker with this loop. |
# for the jump marker with this loop. |
while ($depth > 0 && !$ENV{'form.alreadyHere'}) { |
while ($depth > 0 && !$ENV{'form.alreadyHere'}) { |
>>>>>>> 1.122 |
|
if ($curRes == $mapIterator->BEGIN_MAP()) { $depth++; } |
if ($curRes == $mapIterator->BEGIN_MAP()) { $depth++; } |
if ($curRes == $mapIterator->END_MAP()) { $depth--; } |
if ($curRes == $mapIterator->END_MAP()) { $depth--; } |
|
|
Line 305 sub real_handler {
|
Line 316 sub real_handler {
|
} |
} |
$ENV{'form.alreadyHere'} = 1; |
$ENV{'form.alreadyHere'} = 1; |
} |
} |
<<<<<<< lonnavmaps.pm |
|
|
|
======= |
|
$looped = 1; |
$looped = 1; |
|
|
$curRes = $mapIterator->next(); |
$curRes = $mapIterator->next(); |
Line 337 sub real_handler {
|
Line 345 sub real_handler {
|
$foundJump = 1; |
$foundJump = 1; |
} |
} |
|
|
>>>>>>> 1.122 |
|
$curRes = $mapIterator->next(); |
$curRes = $mapIterator->next(); |
} |
} |
|
|
Line 699 sub real_handler {
|
Line 706 sub real_handler {
|
|
|
$navmap->untieHashes(); |
$navmap->untieHashes(); |
|
|
$r->print("<h1>Course Map Untied</h1></body></html>"); |
$r->print("</body></html>"); |
|
|
return OK; |
return OK; |
} |
} |
Line 996 sub new {
|
Line 1003 sub new {
|
$self->{NETWORK_FAILURE} = 0; |
$self->{NETWORK_FAILURE} = 0; |
|
|
# tie the nav hash |
# tie the nav hash |
my %navmaphash; |
|
if (!(tie(%navmaphash, 'GDBM_File', $self->{NAV_HASH_FILE}, |
if (!(tie(%navmaphash, 'GDBM_File', $self->{NAV_HASH_FILE}, |
&GDBM_READER(), 0640))) { |
&GDBM_READER(), 0640))) { |
return undef; |
return undef; |
} |
} |
|
|
my %parmhash; |
|
if (!(tie(%parmhash, 'GDBM_File', $self->{PARM_HASH_FILE}, |
if (!(tie(%parmhash, 'GDBM_File', $self->{PARM_HASH_FILE}, |
&GDBM_READER(), 0640))) |
&GDBM_READER(), 0640))) |
{ |
{ |
Line 1010 sub new {
|
Line 1016 sub new {
|
return undef; |
return undef; |
} |
} |
|
|
|
$self->{HASH_TIED} = 1; |
$self->{NAV_HASH} = \%navmaphash; |
$self->{NAV_HASH} = \%navmaphash; |
$self->{PARM_HASH} = \%parmhash; |
$self->{PARM_HASH} = \%parmhash; |
|
|
bless($self); |
bless($self); |
$self->untieHashes(); |
|
|
|
return $self; |
return $self; |
} |
} |
Line 1490 sub new {
|
Line 1496 sub new {
|
if ($curRes == $iterator->END_MAP()) { $depth--; } |
if ($curRes == $iterator->END_MAP()) { $depth--; } |
|
|
if (ref($curRes)) { |
if (ref($curRes)) { |
<<<<<<< lonnavmaps.pm |
|
# If there's only one resource, this will save it |
|
$resource = $curRes; $resourceCount++; |
|
======= |
|
# If there's only one resource, this will save it |
# If there's only one resource, this will save it |
# we have to filter empty resources from consideration here, |
# we have to filter empty resources from consideration here, |
# or even "empty", redirecting maps have two (start & finish) |
# or even "empty", redirecting maps have two (start & finish) |
Line 1501 sub new {
|
Line 1503 sub new {
|
if($direction == FORWARD && $curRes->src()) { |
if($direction == FORWARD && $curRes->src()) { |
$resource = $curRes; $resourceCount++; |
$resource = $curRes; $resourceCount++; |
} |
} |
>>>>>>> 1.122 |
|
my $resultingVal = $curRes->{DATA}->{$valName}; |
my $resultingVal = $curRes->{DATA}->{$valName}; |
my $nextResources = $curRes->$nextResourceMethod(); |
my $nextResources = $curRes->$nextResourceMethod(); |
my $nextCount = scalar(@{$nextResources}); |
my $nextCount = scalar(@{$nextResources}); |