--- loncom/interface/lonnavmaps.pm 2004/04/05 18:16:36 1.257 +++ loncom/interface/lonnavmaps.pm 2004/06/15 15:50:03 1.262 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.257 2004/04/05 18:16:36 raeburn Exp $ +# $Id: lonnavmaps.pm,v 1.262 2004/06/15 15:50:03 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -137,7 +137,9 @@ sub real_handler { $r->print(''. &Apache::loncommon::bodytag('Navigate Course Contents','', $addentries,'','',$ENV{'form.register'})); - $r->print(''); + $r->print(''. + &Apache::loncommon::help_open_topic('Navigation_Screen'). + &Apache::loncommon::help_open_bug('RAT')); $r->rflush(); @@ -864,10 +866,7 @@ sub render_resource { my $filter = $it->{FILTER}; my $title = $resource->compTitle(); -# if ($src =~ /^\/uploaded\//) { -# $nonLinkedText=$title; -# $title = ''; -# } + my $partLabel = ""; my $newBranchText = ""; @@ -973,9 +972,7 @@ sub render_resource { $nonLinkedText .= ' (' . $resource->countParts() . ' parts)'; } -# if (!$params->{'resource_nolink'} && $src !~ /^\/uploaded\// && -# !$resource->is_sequence()) { - if (!$params->{'resource_nolink'} && !$resource->is_sequence()) { + if (!$params->{'resource_nolink'} && !$resource->is_sequence()) { $result .= " $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText"; } else { $result .= " $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText"; @@ -1818,6 +1815,7 @@ sub generate_course_user_opt { sub generate_email_discuss_status { my $self = shift; + my $symb = shift; if ($self->{EMAIL_DISCUSS_GENERATED}) { return; } my $cid=$ENV{'request.course.id'}; @@ -1830,6 +1828,15 @@ sub generate_email_discuss_status { $courseLeaveTime : $logoutTime); my %discussiontime = &Apache::lonnet::dump('discussiontimes', $cdom, $cnum); + my %lastread = &Apache::lonnet::dump('nohist_'.$cid.'_discuss', + $ENV{'user.domain'},$ENV{'user.name'},'lastread'); + my %lastreadtime = (); + foreach (keys %lastread) { + my $key = $_; + $key =~ s/_lastread$//; + $lastreadtime{$key} = $lastread{$_}; + } + my %feedback=(); my %error=(); my $keys = &Apache::lonnet::reply('keys:'. @@ -1863,6 +1870,7 @@ sub generate_email_discuss_status { $self->{ERROR_MSG} = \%error; # what is this? JB $self->{DISCUSSION_TIME} = \%discussiontime; $self->{EMAIL_STATUS} = \%emailstatus; + $self->{LAST_READ} = \%lastreadtime; $self->{EMAIL_DISCUSS_GENERATED} = 1; } @@ -1931,8 +1939,20 @@ sub hasDiscussion { if (!defined($self->{DISCUSSION_TIME})) { return 0; } #return defined($self->{DISCUSSION_TIME}->{$symb}); - return $self->{DISCUSSION_TIME}->{$symb} > - $self->{LAST_CHECK}; + +# 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|) { + $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard'; + } + } + + if ( defined ( $self->{LAST_READ}->{$ressymb} ) ) { + return $self->{DISCUSSION_TIME}->{$ressymb} > $self->{LAST_READ}->{$ressymb}; + } else { + return $self->{DISCUSSION_TIME}->{$ressymb} > $self->{LAST_CHECK}; + } } # Private method: Does the given resource (as a symb string) have @@ -3223,6 +3243,17 @@ sub is_sequence { return $self->navHash("is_map_", 1) && $self->navHash("map_type_" . $self->map_pc()) eq 'sequence'; } +sub is_survey { + my $self = shift(); + my $part = shift(); + if ($self->src() =~ /\.(survey)$/) { + return 1; + } + if ($self->parmval('type',$part) eq 'survey') { + return 1; + } + return 0; +} # Private method: Shells out to the parmval in the nav map, handler parts. sub parmval { @@ -3399,6 +3430,11 @@ sub awarded { } sub duedate { (my $self, my $part) = @_; + my $interval=$self->parmval("interval", $part); + if ($interval) { + my $first_access=&Apache::lonnet::get_first_access('map',$self->symb); + if ($first_access) { return ($first_access+$interval); } + } return $self->parmval("duedate", $part); } sub maxtries {