--- loncom/interface/lonnavmaps.pm 2002/12/02 14:20:24 1.120 +++ loncom/interface/lonnavmaps.pm 2003/01/13 22:41:20 1.126 @@ -2,7 +2,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.120 2002/12/02 14:20:24 bowersj2 Exp $ +# $Id: lonnavmaps.pm,v 1.126 2003/01/13 22:41:20 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -96,6 +96,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(''); @@ -178,9 +183,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.' . @@ -271,15 +273,20 @@ sub real_handler { $mapIterator->next(); # discard the first BEGIN_MAP my $curRes = $mapIterator->next(); 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 $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'}) { +>>>>>>> 1.122 if ($curRes == $mapIterator->BEGIN_MAP()) { $depth++; } if ($curRes == $mapIterator->END_MAP()) { $depth--; } @@ -298,6 +305,9 @@ sub real_handler { } $ENV{'form.alreadyHere'} = 1; } +<<<<<<< lonnavmaps.pm + +======= $looped = 1; $curRes = $mapIterator->next(); @@ -327,6 +337,7 @@ sub real_handler { $foundJump = 1; } +>>>>>>> 1.122 $curRes = $mapIterator->next(); } @@ -488,6 +499,10 @@ sub real_handler { '"'; my $title = $curRes->compTitle(); + if ($src=~/^\/uploaded\//) { + $nonLinkedText=$title; + $title=''; + } my $partLabel = ""; my $newBranchText = ""; @@ -598,7 +613,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 +633,19 @@ sub real_handler { } } - $r->print(""); + if ($curRes->getErrors()) { + my $errors = $curRes->getErrors(); + foreach (split(/,/, $errors)) { + if ($_) { + $errorHTML .= ' ' + . ''; + } + } + } + + $r->print(""); # Is this the first displayed part of a multi-part problem # that has not been condensed, so we should suppress these two @@ -670,10 +697,10 @@ sub real_handler { $r->print(''); } - $r->print(""); - $navmap->untieHashes(); + $r->print("

Course Map Untied

"); + return OK; } @@ -983,12 +1010,8 @@ sub new { return undef; } - # Now copy the hashes for speed (?) - my %realnav; my %realparm; - foreach (%navmaphash) { $realnav{$_} = $navmaphash{$_}; } - foreach (%parmhash) { $realparm{$_} = $navmaphash{$_}; } - $self->{NAV_HASH} = \%realnav; - $self->{PARM_HASH} = \%realparm; + $self->{NAV_HASH} = \%navmaphash; + $self->{PARM_HASH} = \%parmhash; bless($self); $self->untieHashes(); @@ -1062,7 +1085,7 @@ sub init { my %emailstatus = &Apache::lonnet::dump('email_status'); my $logoutTime = $emailstatus{'logout'}; my $courseLeaveTime = $emailstatus{'logout_'.$ENV{'request.course.id'}}; - $self->{LAST_CHECK} = ($courseLeaveTime > $logoutTime ? + $self->{LAST_CHECK} = ($courseLeaveTime < $logoutTime ? $courseLeaveTime : $logoutTime); my %discussiontime = &Apache::lonnet::dump('discussiontimes', $cdom, $cnum); @@ -1143,18 +1166,19 @@ sub DESTROY { $self->untieHashes(); } -# Private function: Does the given resource (as a symb string) have +# Private method: Does the given resource (as a symb string) have # current discussion? Returns 0 if chat/mail data not extracted. sub hasDiscussion { my $self = shift; my $symb = shift; if (!defined($self->{DISCUSSION_TIME})) { return 0; } + #return defined($self->{DISCUSSION_TIME}->{$symb}); return $self->{DISCUSSION_TIME}->{$symb} > $self->{LAST_CHECK}; } -# Private function: Does the given resource (as a symb string) have +# Private method: Does the given resource (as a symb string) have # current feedback? Returns the string in the feedback hash, which # will be false if it does not exist. sub getFeedback { @@ -1166,6 +1190,15 @@ sub getFeedback { return $self->{FEEDBACK}->{$symb}; } +# Private method: Get the errors for that resource (by source). +sub getErrors { + my $self = shift; + my $src = shift; + + if (!defined($self->{ERROR_MSG})) { return ""; } + return $self->{ERROR_MSG}->{$src}; +} + =pod =item * B(id): Based on the ID of the resource (1.1, 3.2, etc.), get a resource object for that resource. This method, or other methods that use it (as in the resource object) is the only proper way to obtain a resource object. @@ -1457,6 +1490,10 @@ sub new { if ($curRes == $iterator->END_MAP()) { $depth--; } 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 # we have to filter empty resources from consideration here, # or even "empty", redirecting maps have two (start & finish) @@ -1464,6 +1501,7 @@ sub new { if($direction == FORWARD && $curRes->src()) { $resource = $curRes; $resourceCount++; } +>>>>>>> 1.122 my $resultingVal = $curRes->{DATA}->{$valName}; my $nextResources = $curRes->$nextResourceMethod(); my $nextCount = scalar(@{$nextResources}); @@ -2231,7 +2269,16 @@ sub hasDiscussion { sub getFeedback { my $self = shift; - return $self->{NAV_MAP}->getFeedback($self->src()); + my $source = $self->src(); + if ($source =~ /^\/res\//) { $source = substr $source, 5; } + return $self->{NAV_MAP}->getFeedback($source); +} + +sub getErrors { + my $self = shift; + my $source = $self->src(); + if ($source =~ /^\/res\//) { $source = substr $source, 5; } + return $self->{NAV_MAP}->getErrors($source); } =pod
Key:  $discussionHTML$feedbackHTML $discussionHTML$feedbackHTML$errorHTML