--- loncom/interface/lonmsg.pm 2005/11/23 22:32:11 1.156 +++ loncom/interface/lonmsg.pm 2005/11/28 18:32:39 1.157 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.156 2005/11/23 22:32:11 raeburn Exp $ +# $Id: lonmsg.pm,v 1.157 2005/11/28 18:32:39 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -810,8 +810,9 @@ sub sortedmessages { my $msgid=&Apache::lonnet::escape($_); my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid)= &Apache::lonmsg::unpackmsgid($msgid,$folder); + my $description = &get_course_desc($fromcid); my @temp1 = ($sendtime,$shortsubj,$fromname,$fromdomain,$status, - $msgid); + $msgid,$description); # Check whether message was sent during blocking period. if ($sendtime >= $startblock && ($sendtime <= $endblock && $endblock > 0) ) { my $escid = &Apache::lonnet::unescape($msgid); @@ -847,6 +848,12 @@ sub sortedmessages { if ($env{'form.sortedby'} eq "revsubject"){ @temp = sort {lc($b->[1]) cmp lc($a->[1])} @temp; } + if ($env{'form.sortedby'} eq "course"){ + @temp = sort {lc($a->[6]) cmp lc($b->[6])} @temp; + } + if ($env{'form.sortedby'} eq "revcourse"){ + @temp = sort {lc($b->[6]) cmp lc($a->[6])} @temp; + } if ($env{'form.sortedby'} eq "status"){ @temp = sort {$a->[4] cmp $b->[4]} @temp; } @@ -856,6 +863,18 @@ sub sortedmessages { return @temp; } +sub get_course_desc { + my ($fromcid) = @_; + my $description; + if (defined($env{'course.'.$fromcid.'.description'})) { + $description = $env{'course.'.$fromcid.'.description'}; + } else { + my %courseinfo=&Apache::lonnet::coursedescription($fromcid); + $description = $courseinfo{'description'}; + } + return $description; +} + # ======================================================== Display new messages @@ -864,6 +883,7 @@ sub disnew { my %lt=&Apache::lonlocal::texthash( 'nm' => 'New Messages', 'su' => 'Subject', + 'co' => 'Course', 'da' => 'Date', 'us' => 'Username', 'op' => 'Open', @@ -885,6 +905,7 @@ sub disnew { my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= &Apache::lonmsg::unpackmsgid($_); if (defined($sendtime) && $sendtime!~/error/) { + my $description = &get_course_desc($fromcid); my $numsendtime = $sendtime; $sendtime = &Apache::lonlocal::locallocaltime($sendtime); if ($status eq 'new') { @@ -897,7 +918,8 @@ sub disnew { sendtime => $sendtime, shortsub => &Apache::lonnet::unescape($shortsubj), from => $fromname, - fromdom => $fromdom + fromdom => $fromdom, + course => $description } } } @@ -907,7 +929,7 @@ sub disnew { $r->print(<$lt{'nm'} - + TABLEHEAD foreach my $msg (@newmsgs) { $r->print(<<"ENDLINK"); @@ -915,7 +937,7 @@ TABLEHEAD onMouseOut="javascript:style.backgroundColor='#FFBB77'"> ENDLINK - foreach ('sendtime','from','fromdom','shortsub') { + foreach ('sendtime','from','fromdom','shortsub','course') { $r->print(""); } $r->print(""); @@ -1029,6 +1051,12 @@ ENDDISHEADER $r->print(''.&mt('Subject').''); } $r->print(''); } else { @@ -1036,7 +1064,7 @@ ENDDISHEADER } $r->print("\n"); for (my $n=$firstdis;$n<=$lastdis;$n++) { - my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$origID)= @{$temp[$n]}; + my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$origID,$description)= @{$temp[$n]}; if (($status ne 'deleted') && defined($sendtime) && $sendtime!~/error/) { if ($status eq 'new') { $r->print(''); @@ -1054,7 +1082,7 @@ ENDDISHEADER '\n"); + $description.''."\n"); } elsif ($status eq 'deleted') { # purge &movemsg(&Apache::lonnet::unescape($origID),$folder,'trash');
 $lt{'da'}$lt{'us'}$lt{'do'}$lt{'su'}
$lt{'da'}$lt{'us'}$lt{'do'}$lt{'su'}$lt{'co'}
$lt{'op'}$msg->{$_}
'); + if ($env{'form.sortedby'} eq "revcourse") { + $r->print(''.&mt('Course').''); + } else { + $r->print(''.&mt('Course').''); + } + $r->print(''); if ($env{'form.sortedby'} eq "revstatus") { $r->print(''.&mt('Status').'
'.&Apache::lonlocal::locallocaltime($sendtime).''. $fromname.''.$fromdomain.''. &Apache::lonnet::unescape($shortsubj).''. - $status."
'.$status.'