--- loncom/interface/lonnavmaps.pm 2004/06/28 15:09:13 1.263 +++ loncom/interface/lonnavmaps.pm 2004/10/07 19:55:52 1.267.2.8 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.263 2004/06/28 15:09:13 albertel Exp $ +# $Id: lonnavmaps.pm,v 1.267.2.8 2004/10/07 19:55:52 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -138,9 +138,8 @@ sub real_handler { &Apache::loncommon::bodytag('Navigate Course Contents','', $addentries,'','',$ENV{'form.register'})); $r->print(''. - &Apache::loncommon::help_open_topic('Navigation_Screen'). - &Apache::loncommon::help_open_bug('RAT')); - + &Apache::loncommon::help_open_menu('','Navigation Screen','Navigation_Screen','',undef,'RAT')); + $r->rflush(); # Check that it's defined @@ -514,7 +513,7 @@ sub timeToHumanString { } # Not this year, so show the year - my $timeStr = strftime("on %A, %b %e %G at %I:%M %P", localtime($time)); + my $timeStr = strftime("on %A, %b %e %Y at %I:%M %P", localtime($time)); $timeStr =~ s/12:00 am/00:00/; $timeStr =~ s/12:00 pm/noon/; return $timeStr; @@ -972,7 +971,7 @@ sub render_resource { $nonLinkedText .= ' (' . $resource->countParts() . ' parts)'; } - if (!$params->{'resource_nolink'} && !$resource->is_sequence()) { + if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) { $result .= " $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText"; } else { $result .= " $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText"; @@ -1261,7 +1260,7 @@ sub render { # 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 (($curRes = $mapIterator->next()) && !$found) { + while ($here && ($curRes = $mapIterator->next()) && !$found) { if (ref($curRes) && $curRes->symb() eq $here) { my $mapStack = $mapIterator->getStack(); @@ -1370,9 +1369,22 @@ sub render { "&here=" . Apache::lonnet::escape($here) . "\">".&mt('Open All Folders').""; } - $result .= "

\n"; - } + $result .= "\n"; + } + # Check for any unread discussions in all resources. + if (!$args->{'resource_no_folder_link'}) { + my $time=time; + my $mapr = &mt('Mark all posts read'); + $result .= (<$mapr (Help: NavMaps_MarkPostsLink) +
+ + +
+END + } + $result .= "
\n"; if ($r) { $r->print($result); $r->rflush(); @@ -1846,17 +1858,11 @@ sub generate_email_discuss_status { foreach my $msgid (split(/\&/, $keys)) { $msgid=&Apache::lonnet::unescape($msgid); - my $plain=&Apache::lonnet::unescape(&Apache::lonnet::unescape($msgid)); - if ($plain=~/(Error|Feedback) \[([^\]]+)\]/) { - my ($what,$url)=($1,$2); - my %status= - &Apache::lonnet::get('email_status',[$msgid]); - if ($status{$msgid}=~/^error\:/) { - $status{$msgid}=''; - } - - if (($status{$msgid} eq 'new') || - (!$status{$msgid})) { + if ((!$emailstatus{$msgid}) || ($emailstatus{$msgid} eq 'new')) { + my $plain= + &Apache::lonnet::unescape(&Apache::lonnet::unescape($msgid)); + if ($plain=~/(Error|Feedback) \[([^\]]+)\]/) { + my ($what,$url)=($1,$2); if ($what eq 'Error') { $error{$url}.=','.$msgid; } else { @@ -1866,8 +1872,10 @@ sub generate_email_discuss_status { } } + #url's of resources that have feedbacks $self->{FEEDBACK} = \%feedback; - $self->{ERROR_MSG} = \%error; # what is this? JB + #or errors + $self->{ERROR_MSG} = \%error; $self->{DISCUSSION_TIME} = \%discussiontime; $self->{EMAIL_STATUS} = \%emailstatus; $self->{LAST_READ} = \%lastreadtime; @@ -1943,7 +1951,7 @@ sub hasDiscussion { # backward compatibility (bulletin boards used to be 'wrapped') my $ressymb = $symb; if ($ressymb =~ m|adm/(\w+)/(\w+)/(\d+)/bulletinboard$|) { - unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) { + unless ($ressymb =~ m|adm/wrapper/adm|) { $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard'; } } @@ -1951,7 +1959,8 @@ sub hasDiscussion { if ( defined ( $self->{LAST_READ}->{$ressymb} ) ) { return $self->{DISCUSSION_TIME}->{$ressymb} > $self->{LAST_READ}->{$ressymb}; } else { - return $self->{DISCUSSION_TIME}->{$ressymb} > $self->{LAST_CHECK}; +# return $self->{DISCUSSION_TIME}->{$ressymb} > $self->{LAST_CHECK}; # v.1.1 behavior + return $self->{DISCUSSION_TIME}->{$ressymb} > 0; # in 1.2 will display speech bubble icons for all items with posts until marked as read (even if read in v 1.1). } } @@ -3255,6 +3264,12 @@ sub is_survey { return 0; } +sub is_empty_sequence { + my $self=shift; + my $src = $self->src(); + return !$self->is_page() && $self->navHash("is_map_", 1) && !$self->navHash("map_type_" . $self->map_pc()); +} + # Private method: Shells out to the parmval in the nav map, handler parts. sub parmval { my $self = shift; @@ -3735,6 +3750,20 @@ sub extractParts { } } } + my $resorder = &Apache::lonnet::metadata($self->src(),'responseorder'); + if ($resorder) { + my @resorder=split(/,/,$resorder); + foreach my $part (keys(%responseIdHash)) { + my %resids = map { ($_,1) } @{ $responseIdHash{$part} }; + my @neworder; + foreach my $possibleid (@resorder) { + if (exists($resids{$possibleid})) { + push(@neworder,$possibleid); + } + } + $responseIdHash{$part}=\@neworder; + } + } $self->{RESPONSE_IDS} = \%responseIdHash; $self->{RESPONSE_TYPES} = \%responseTypeHash; } @@ -3928,6 +3957,7 @@ sub getCompletionStatus { # Left as separate if statements in case we ever do more with this if ($status eq 'correct_by_student') {return $self->CORRECT;} + if ($status eq 'correct_by_scantron') {return $self->CORRECT;} if ($status eq 'correct_by_override') {return $self->CORRECT_BY_OVERRIDE; } if ($status eq 'incorrect_attempted') {return $self->INCORRECT; } if ($status eq 'incorrect_by_override') {return $self->INCORRECT_BY_OVERRIDE; } @@ -4078,7 +4108,7 @@ sub status { if ($dateStatus == PAST_DUE_ANSWER_LATER || $dateStatus == PAST_DUE_NO_ANSWER ) { - return $dateStatus; + return $suppressFeedback ? ANSWER_SUBMITTED : $dateStatus; } if ($dateStatus == ANSWER_OPEN) {