--- loncom/interface/lonnavmaps.pm 2002/12/02 14:19:38 1.119
+++ loncom/interface/lonnavmaps.pm 2003/01/30 21:36:57 1.132
@@ -2,7 +2,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.119 2002/12/02 14:19:38 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.132 2003/01/30 21:36:57 bowersj2 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -46,6 +46,24 @@ use Apache::Constants qw(:common :http);
use Apache::loncommon();
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 {
my $r = shift;
real_handler($r);
@@ -96,6 +114,11 @@ sub real_handler {
''));
$r->print('');
+ $r->rflush();
+
+ # Now that we've displayed some stuff to the user, init the navmap
+ $navmap->init();
+
$r->print('
');
my $date=localtime;
$r->print('Key: | ');
@@ -178,9 +201,6 @@ sub real_handler {
$r->print('
');
$r->rflush();
- # Now that we've displayed some stuff to the user, init the navmap
- $navmap->init();
-
# Check that it's defined
if (!($navmap->courseMapDefined())) {
$r->print('Coursemap undefined.' .
@@ -274,15 +294,13 @@ sub real_handler {
my $foundJump = ($jumpType == $NOTHING); # look for jump point if we have one
my $looped = 0;
- $r->print($hereType);
-
# We only need to do this if we need to open the maps to show the
# current position. This will change the counter so we can't count
# for the jump marker with this loop.
while ($depth > 0 && !$ENV{'form.alreadyHere'}) {
if ($curRes == $mapIterator->BEGIN_MAP()) { $depth++; }
if ($curRes == $mapIterator->END_MAP()) { $depth--; }
- $r->print($curRes . ' ');
+
if (ref($curRes) && !$ENV{'form.alreadyHere'} &&
($hereType == $SYMB && $curRes->symb() eq $here) ||
(ref($curRes) && $hereType == $URL && $curRes->src() eq $here)) {
@@ -332,7 +350,7 @@ sub real_handler {
undef $res; # so we don't accidentally use it later
my $indentLevel = 0;
- my $indentString = "";
+ my $indentString = "";
my $isNewBranch = 0;
my $now = time();
@@ -370,13 +388,6 @@ sub real_handler {
if (ref($curRes)) { $counter++; }
- # Is this resource being ignored because it is in a random-out
- # map and it was not selected?
- if (ref($curRes) && !advancedUser() && $curRes->randomout()) {
- $curRes = $mapIterator->next();
- next; # if yes, then just ignore this resource
- }
-
if (ref($curRes)) {
my $deltalevel = $isNewBranch? 1 : 0; # reserves space for branch icon
@@ -409,6 +420,9 @@ sub real_handler {
# Otherwise, only display part 0 if we want to
# attach feedback or email information to it
if ($curRes->hasDiscussion() || $curRes->getFeedback()) {
+ # Is this right? I think this will toss it
+ # if it DOES have discussion, not if it doesn't?
+ # - Jeremy (yes, commenting on his own code)
shift @parts;
} else {
# Now, we decide whether to condense the
@@ -431,7 +445,7 @@ sub real_handler {
}
}
- # $allSame is true if all the statuses were
+ # $*allSame is true if all the statuses were
# the same. Now, if they are all the same and
# match one of the statuses to condense, or they
# are all open with the same due date, or they are
@@ -488,6 +502,10 @@ sub real_handler {
'"';
my $title = $curRes->compTitle();
+ if ($src=~/^\/uploaded\//) {
+ $nonLinkedText=$title;
+ $title='';
+ }
my $partLabel = "";
my $newBranchText = "";
@@ -598,7 +616,7 @@ sub real_handler {
$r->print("\n");
# SECOND COL: Is there text, feedback, errors??
- my $discussionHTML = ""; my $feedbackHTML = "";
+ my $discussionHTML = ""; my $feedbackHTML = ""; my $errorHTML = "";
if ($curRes->hasDiscussion()) {
$discussionHTML = $linkopen .
@@ -618,7 +636,19 @@ sub real_handler {
}
}
- $r->print("$discussionHTML$feedbackHTML | ");
+ if ($curRes->getErrors()) {
+ my $errors = $curRes->getErrors();
+ foreach (split(/,/, $errors)) {
+ if ($_) {
+ $errorHTML .= ' '
+ . '';
+ }
+ }
+ }
+
+ $r->print("$discussionHTML$feedbackHTML$errorHTML | ");
# Is this the first displayed part of a multi-part problem
# that has not been condensed, so we should suppress these two
@@ -670,10 +700,10 @@ sub real_handler {
$r->print('');
}
- $r->print("