--- loncom/interface/lonnavmaps.pm 2004/07/03 20:45:23 1.265 +++ loncom/interface/lonnavmaps.pm 2004/07/09 23:05:51 1.266 @@ -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.266 2004/07/09 23:05:51 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -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,41 @@ sub render { "&here=" . Apache::lonnet::escape($here) . "\">".&mt('Open All Folders').""; } - $result .= "

\n"; - } + $result .= "\n"; + } + # Check for any unread discussions in all resources. + 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'} (Help: NavMaps_MarkPostsLink) +
+ + +
+END + } else { + $result .= '
'; + } + $result .= "
\n"; if ($r) { $r->print($result); $r->rflush(); @@ -1942,7 +1974,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 +1982,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 +3287,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;