--- loncom/interface/lonwhatsnew.pm 2005/04/11 15:52:40 1.9 +++ loncom/interface/lonwhatsnew.pm 2005/04/11 21:51:43 1.10 @@ -1,5 +1,5 @@ # -# $Id: lonwhatsnew.pm,v 1.9 2005/04/11 15:52:40 albertel Exp $ +# $Id: lonwhatsnew.pm,v 1.10 2005/04/11 21:51:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -432,16 +432,16 @@ sub getitems { my ($uname,$udom) = split(/:/,$student); my %status=&Apache::grades::student_gradeStatus($url,$symb,$udom,$uname,$partlist); my $submitted = 0; - my $graded = 0; + my $ungraded = 0; foreach (keys(%status)) { $submitted = 1 if ($status{$_} ne 'nothing'); - $graded = 1 if ($status{$_} !~ /^correct/); + $ungraded = 1 if ($status{$_} =~ /^ungraded/); my ($foo,$partid,$foo1) = split(/\./,$_); if ($status{'resource.'.$partid.'.submitted_by'} ne '') { $submitted = 0; } } - next if (!$submitted || !$graded); + next if (!$submitted || !$ungraded); $ctr ++; } if ($ctr) { @@ -471,21 +471,25 @@ sub getmail { # Check for unread mail in course my $msgcount = 0; - my @messages = &Apache::lonnet::getkeys('nohist_email'); + my @messages = sort(&Apache::lonnet::getkeys('nohist_email')); foreach my $message (@messages) { my $msgid=&Apache::lonnet::escape($message); - my ($sendtime,$shortsubj,$fromname,$fromdom,$fromcid,$status)= + my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= &Apache::lonmsg::unpackmsgid($msgid); - if ($fromcid eq $env{'request.course.id'}) { + if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { if (defined($sendtime) && $sendtime!~/error/) { my $numsendtime = $sendtime; $sendtime = &Apache::lonlocal::locallocaltime($sendtime); if ($status eq 'new') { - $$msgcount ++; + $msgcount ++; + if ($shortsubj eq '') { + $shortsubj = &mt('No subject'); + } + $shortsubj = &Apache::lonnet::unescape($shortsubj); push(@{$newmsgs}, { msgid => $msgid, sendtime => $sendtime, - shortsub => &Apache::lonnet::unescape($shortsubj), + shortsub => $shortsubj, from => $fromname, fromdom => $fromdom }); @@ -499,17 +503,21 @@ sub getmail { my $result = ''; my $critmsgcount = 0; foreach my $msgid (sort(keys(%what))) { - my ($sendtime,$shortsubj,$fromname,$fromdom,$fromcid,$status)= - &Apache::lonmsg::unpackmsgid($_); - if ($fromcid eq $env{'request.course.id'}) { + my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= + &Apache::lonmsg::unpackmsgid($msgid); + if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { if (defined($sendtime) && $sendtime!~/error/) { my $numsendtime = $sendtime; $sendtime = &Apache::lonlocal::locallocaltime($sendtime); $critmsgcount ++; + if ($shortsubj eq '') { + $shortsubj = &mt('No subject'); + } + $shortsubj = &Apache::lonnet::unescape($shortsubj); push(@{$critmsgs}, { msgid => $msgid, sendtime => $sendtime, - shortsub => &Apache::lonnet::unescape($shortsubj), + shortsub => $shortsubj, from => $fromname, fromdom => $fromdom });