[LON-CAPA-cvs] cvs: loncom /interface lonmsg.pm lonwhatsnew.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Mon, 11 Apr 2005 21:51:44 -0000
raeburn Mon Apr 11 17:51:44 2005 EDT
Modified files:
/loncom/interface lonmsg.pm lonwhatsnew.pm
Log:
Adding course_id to msgid for LON-CAPA COM messages (uses course context of sender). Fixes to display of ungraded items, and change in parameters extracted from msgid to filter for course messages.
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.140 loncom/interface/lonmsg.pm:1.141
--- loncom/interface/lonmsg.pm:1.140 Thu Apr 7 02:56:23 2005
+++ loncom/interface/lonmsg.pm Mon Apr 11 17:51:43 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging
#
-# $Id: lonmsg.pm,v 1.140 2005/04/07 06:56:23 albertel Exp $
+# $Id: lonmsg.pm,v 1.141 2005/04/11 21:51:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -141,7 +141,8 @@
$partsubj=&Apache::lonnet::escape($partsubj);
my $msgid=&Apache::lonnet::escape(
$now.':'.$partsubj.':'.$env{'user.name'}.':'.
- $env{'user.domain'}.':'.$msgcount.':'.$$);
+ $env{'user.domain'}.':'.$msgcount.':'.
+ $env{'request.course.id'}.':'.$$);
my $result='<sendername>'.$env{'user.name'}.'</sendername>'.
'<senderdomain>'.$env{'user.domain'}.'</senderdomain>'.
'<subject>'.$subject.'</subject>'.
@@ -209,13 +210,13 @@
my ($msgid,$folder)=@_;
$msgid=&Apache::lonnet::unescape($msgid);
my $suffix=&foldersuffix($folder);
- my ($sendtime,$shortsubj,$fromname,$fromdomain)=split(/\:/,
+ my ($sendtime,$shortsubj,$fromname,$fromdomain,$count,$fromcid)=split(/\:/,
&Apache::lonnet::unescape($msgid));
my %status=&Apache::lonnet::get('email_status'.$suffix,[$msgid]);
if ($status{$msgid}=~/^error\:/) { $status{$msgid}=''; }
unless ($status{$msgid}) { $status{$msgid}='new'; }
- return ($sendtime,$shortsubj,$fromname,$fromdomain,$status{$msgid});
-}
+ return ($sendtime,$shortsubj,$fromname,$fromdomain,$status{$msgid},$fromcid);
+}
sub sendemail {
@@ -762,7 +763,7 @@
my @temp;
foreach (@messages) {
my $msgid=&Apache::lonnet::escape($_);
- my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)=
+ my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid)=
&Apache::lonmsg::unpackmsgid($msgid,$folder);
my @temp1 = ($sendtime,$shortsubj,$fromname,$fromdomain,$status,
$msgid);
@@ -836,7 +837,7 @@
# Check for blocking of display because of scheduled online exams.
&blockcheck(\%setters,\$startblock,\$endblock);
foreach (@msgids) {
- my ($sendtime,$shortsubj,$fromname,$fromdom,$status)=
+ my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)=
&Apache::lonmsg::unpackmsgid($_);
if (defined($sendtime) && $sendtime!~/error/) {
my $numsendtime = $sendtime;
Index: loncom/interface/lonwhatsnew.pm
diff -u loncom/interface/lonwhatsnew.pm:1.9 loncom/interface/lonwhatsnew.pm:1.10
--- loncom/interface/lonwhatsnew.pm:1.9 Mon Apr 11 11:52:40 2005
+++ loncom/interface/lonwhatsnew.pm Mon Apr 11 17:51:43 2005
@@ -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 @@
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 @@
# 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 @@
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
});