version 1.89, 2002/10/28 20:48:29
|
version 1.91, 2002/10/29 20:17:39
|
Line 926 sub new_handle {
|
Line 926 sub new_handle {
|
my $queryAdd = "postdata=" . &Apache::lonnet::escape($currenturl) . |
my $queryAdd = "postdata=" . &Apache::lonnet::escape($currenturl) . |
"&alreadyHere=1"; |
"&alreadyHere=1"; |
|
|
$r->print('<a href="navmaps?condition=1&filter=">Show All Resources</a><br /><br />'); |
|
|
|
# Begin the HTML table |
|
# four cols: resource + indent, chat+feedback, icon, text string |
|
$r->print('<table cellspacing="0" cellpadding="3" border="0" bgcolor="#FFFFFF">' ."\n"); |
|
|
|
my $condition = 0; |
my $condition = 0; |
if ($ENV{'form.condition'}) { |
if ($ENV{'form.condition'}) { |
$condition = 1; |
$condition = 1; |
} |
} |
|
|
|
if ($condition) { |
|
$r->print('<a href="navmaps?condition=0&filter=">Close All Folders</a><br /><br />'); |
|
} else { |
|
$r->print('<a href="navmaps?condition=1&filter=">Open All Folders</a><br /><br />'); |
|
} |
|
|
|
# Begin the HTML table |
|
# four cols: resource + indent, chat+feedback, icon, text string |
|
$r->print('<table cellspacing="0" cellpadding="3" border="0" bgcolor="#FFFFFF">' ."\n"); |
|
|
# This needs to be updated to use symbs from the remote, |
# This needs to be updated to use symbs from the remote, |
# instead of uris. The changes to this and the main rendering |
# instead of uris. The changes to this and the main rendering |
# loop should be obvious. |
# loop should be obvious. |
Line 946 sub new_handle {
|
Line 950 sub new_handle {
|
my $mapIterator = $navmap->getIterator(undef, undef, {}, 1); |
my $mapIterator = $navmap->getIterator(undef, undef, {}, 1); |
my $found = 0; |
my $found = 0; |
my $depth = 1; |
my $depth = 1; |
|
my $currentUrlIndex = 0; # keeps track of when the current resource is found, |
|
# so we can back up a few and put the anchor above the |
|
# current resource |
$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; |
|
|
while ($depth > 0) { |
while ($depth > 0) { |
if ($curRes == $mapIterator->BEGIN_MAP()) { |
if ($curRes == $mapIterator->BEGIN_MAP()) { |
Line 957 sub new_handle {
|
Line 965 sub new_handle {
|
$depth--; |
$depth--; |
} |
} |
|
|
|
if (ref($curRes)) { $counter++; } |
|
|
my $mapStack = $mapIterator->getStack(); |
my $mapStack = $mapIterator->getStack(); |
if ($currenturl && !$ENV{'form.alreadyHere'} && ref($curRes) && |
if ($currenturl && !$ENV{'form.alreadyHere'} && ref($curRes) && |
$curRes->src() eq $currenturl) { |
$curRes->src() eq $currenturl) { |
# If this is the correct resource, be sure to |
# If this is the correct resource, be sure to |
# show it by making sure the containing maps |
# show it by making sure the containing maps |
# are open. |
# are open. |
|
|
|
$currentUrlIndex = $counter; |
|
|
for my $map (@{$mapStack}) { |
for my $map (@{$mapStack}) { |
if ($condition) { |
if ($condition) { |
Line 1004 sub new_handle {
|
Line 1016 sub new_handle {
|
$mapIterator->next(); |
$mapIterator->next(); |
$curRes = $mapIterator->next(); |
$curRes = $mapIterator->next(); |
my $deltadepth = 0; |
my $deltadepth = 0; |
|
$depth = 1; |
|
|
my @backgroundColors = ("#FFFFFF", "#F6F6F6"); |
my @backgroundColors = ("#FFFFFF", "#F6F6F6"); |
my $rowNum = 0; |
my $rowNum = 0; |
|
|
|
$counter = 0; |
|
|
while ($depth > 0) { |
while ($depth > 0) { |
# If we're in a new style course, and this is a BEGIN_MAP, END_MAP, or |
# If we're in a new style course, and this is a BEGIN_MAP, END_MAP, or |
# map resource and the stack depth is only one, just plain ignore this resource |
# map resource and the stack depth is only one, just plain ignore this resource |
Line 1040 sub new_handle {
|
Line 1055 sub new_handle {
|
$depth--; |
$depth--; |
} |
} |
|
|
|
if (ref($curRes)) { $counter++; } |
|
|
if ($depth == 1) { $deltadepth = 0; } # we're done shifting, because we're |
if ($depth == 1) { $deltadepth = 0; } # we're done shifting, because we're |
# out of the inlined map |
# out of the inlined map |
|
|
Line 1230 sub new_handle {
|
Line 1247 sub new_handle {
|
$rowNum++; |
$rowNum++; |
my $backgroundColor = $backgroundColors[$rowNum % scalar(@backgroundColors)]; |
my $backgroundColor = $backgroundColors[$rowNum % scalar(@backgroundColors)]; |
|
|
# FIRST COL: The resource indentation, branch icon, and name |
# FIRST COL: The resource indentation, branch icon, name, and anchor |
$r->print(" <tr bgcolor=\"$backgroundColor\"><td align=\"left\" valign=\"center\" width=\"60%\">\n"); |
$r->print(" <tr bgcolor=\"$backgroundColor\"><td align=\"left\" valign=\"center\" width=\"60%\">\n"); |
|
|
|
# anchor for current resource... - 5 is deliberate: If it's that |
|
# high on the screen, don't bother focusing on it. Also this will |
|
# print multiple anchors if this is an expanded multi-part problem... |
|
# who cares? |
|
if ($counter == $currentUrlIndex - 5) { |
|
$r->print('<a name="current" />'); |
|
} |
|
|
# print indentation |
# print indentation |
for (my $i = 0; $i < $indentLevel - $deltalevel + $deltadepth; $i++) { |
for (my $i = 0; $i < $indentLevel - $deltalevel + $deltadepth; $i++) { |
$r->print($indentString); |
$r->print($indentString); |
Line 2053 sub new {
|
Line 2078 sub new {
|
if ($self->{DIRECTION} == FORWARD) { |
if ($self->{DIRECTION} == FORWARD) { |
push @{$self->{BRANCH_STACK}}, $self->{FIRST_RESOURCE}; |
push @{$self->{BRANCH_STACK}}, $self->{FIRST_RESOURCE}; |
} else { |
} else { |
push @{$self->{BRANCH_STACK}), $self->{FINISH_RESOURCE}; |
push @{$self->{BRANCH_STACK}}, $self->{FINISH_RESOURCE}; |
} |
} |
$self->{BRANCH_STACK_SIZE} = 1; |
$self->{BRANCH_STACK_SIZE} = 1; |
|
|
Line 2151 sub next {
|
Line 2176 sub next {
|
$self->{ALREADY_SEEN}->{$self->{HERE}->{ID}} = 1; |
$self->{ALREADY_SEEN}->{$self->{HERE}->{ID}} = 1; |
|
|
# Get the next possible resources |
# Get the next possible resources |
|
my $nextUnfiltered; |
if ($self->{DIRECTION} == FORWARD()) { |
if ($self->{DIRECTION} == FORWARD()) { |
my $nextUnfiltered = $self->{HERE}->getNext(); |
$nextUnfiltered = $self->{HERE}->getNext(); |
} else { |
} else { |
my $nextUnfiltered = $self->{HERE}->getPrevious(); |
$nextUnfiltered = $self->{HERE}->getPrevious(); |
} |
} |
my $next = []; |
my $next = []; |
|
|
Line 2205 sub next {
|
Line 2231 sub next {
|
$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}, $self->{ALREADY_SEEN}, |
$finishResource, $self->{FILTER}, $self->{ALREADY_SEEN}, |
$self->{CONDITION}); |
$self->{CONDITION}, $self->{DIRECTION}); |
} |
} |
|
|
return $self->{HERE}; |
return $self->{HERE}; |