--- loncom/interface/lonnavmaps.pm 2004/07/03 20:45:23 1.265
+++ loncom/interface/lonnavmaps.pm 2004/08/24 22:09:27 1.267.2.3
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.265 2004/07/03 20:45:23 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.267.2.3 2004/08/24 22:09:27 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -513,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;
@@ -971,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";
@@ -1369,9 +1369,43 @@ 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 $totdisc = 0;
+ my $haveDisc = '';
+ my @allres=$navmap->retrieveResources();
+ foreach my $resource (@allres) {
+ if ($resource->hasDiscussion()) {
+ my $ressymb;
+ if ($resource->symb() =~ m-(___adm/\w+/\w+)/(\d+)/bulletinboard$-) {
+ $ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard';
+ } else {
+ $ressymb = $resource->symb();
+ }
+ $haveDisc .= $ressymb.':';
+ $totdisc ++;
+ }
+ }
+ if ($totdisc > 0) {
+ $haveDisc =~ s/:$//;
+ my %lt = &Apache::lonlocal::texthash(
+ 'mapr' => 'Mark all posts read',
+ );
+ $result .= (<$lt{'mapr'}
+
+END
+ } else {
+ $result .= '
';
+ }
+ }
+ $result .= "
\n";
if ($r) {
$r->print($result);
$r->rflush();
@@ -1942,7 +1976,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';
}
}
@@ -1950,7 +1984,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).
}
}
@@ -3254,6 +3289,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;
@@ -4091,7 +4132,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) {