version 1.156, 2005/11/23 22:32:11
|
version 1.157, 2005/11/28 18:32:39
|
Line 810 sub sortedmessages {
|
Line 810 sub sortedmessages {
|
my $msgid=&Apache::lonnet::escape($_); |
my $msgid=&Apache::lonnet::escape($_); |
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid)= |
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid)= |
&Apache::lonmsg::unpackmsgid($msgid,$folder); |
&Apache::lonmsg::unpackmsgid($msgid,$folder); |
|
my $description = &get_course_desc($fromcid); |
my @temp1 = ($sendtime,$shortsubj,$fromname,$fromdomain,$status, |
my @temp1 = ($sendtime,$shortsubj,$fromname,$fromdomain,$status, |
$msgid); |
$msgid,$description); |
# Check whether message was sent during blocking period. |
# Check whether message was sent during blocking period. |
if ($sendtime >= $startblock && ($sendtime <= $endblock && $endblock > 0) ) { |
if ($sendtime >= $startblock && ($sendtime <= $endblock && $endblock > 0) ) { |
my $escid = &Apache::lonnet::unescape($msgid); |
my $escid = &Apache::lonnet::unescape($msgid); |
Line 847 sub sortedmessages {
|
Line 848 sub sortedmessages {
|
if ($env{'form.sortedby'} eq "revsubject"){ |
if ($env{'form.sortedby'} eq "revsubject"){ |
@temp = sort {lc($b->[1]) cmp lc($a->[1])} @temp; |
@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"){ |
if ($env{'form.sortedby'} eq "status"){ |
@temp = sort {$a->[4] cmp $b->[4]} @temp; |
@temp = sort {$a->[4] cmp $b->[4]} @temp; |
} |
} |
Line 856 sub sortedmessages {
|
Line 863 sub sortedmessages {
|
return @temp; |
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 |
# ======================================================== Display new messages |
|
|
|
|
Line 864 sub disnew {
|
Line 883 sub disnew {
|
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'nm' => 'New Messages', |
'nm' => 'New Messages', |
'su' => 'Subject', |
'su' => 'Subject', |
|
'co' => 'Course', |
'da' => 'Date', |
'da' => 'Date', |
'us' => 'Username', |
'us' => 'Username', |
'op' => 'Open', |
'op' => 'Open', |
Line 885 sub disnew {
|
Line 905 sub disnew {
|
my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= |
my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= |
&Apache::lonmsg::unpackmsgid($_); |
&Apache::lonmsg::unpackmsgid($_); |
if (defined($sendtime) && $sendtime!~/error/) { |
if (defined($sendtime) && $sendtime!~/error/) { |
|
my $description = &get_course_desc($fromcid); |
my $numsendtime = $sendtime; |
my $numsendtime = $sendtime; |
$sendtime = &Apache::lonlocal::locallocaltime($sendtime); |
$sendtime = &Apache::lonlocal::locallocaltime($sendtime); |
if ($status eq 'new') { |
if ($status eq 'new') { |
Line 897 sub disnew {
|
Line 918 sub disnew {
|
sendtime => $sendtime, |
sendtime => $sendtime, |
shortsub => &Apache::lonnet::unescape($shortsubj), |
shortsub => &Apache::lonnet::unescape($shortsubj), |
from => $fromname, |
from => $fromname, |
fromdom => $fromdom |
fromdom => $fromdom, |
|
course => $description |
} |
} |
} |
} |
} |
} |
Line 907 sub disnew {
|
Line 929 sub disnew {
|
$r->print(<<TABLEHEAD); |
$r->print(<<TABLEHEAD); |
<h2>$lt{'nm'}</h2> |
<h2>$lt{'nm'}</h2> |
<table border=2><tr><th> </th> |
<table border=2><tr><th> </th> |
<th>$lt{'da'}</th><th>$lt{'us'}</th><th>$lt{'do'}</th><th>$lt{'su'}</th></tr> |
<th>$lt{'da'}</th><th>$lt{'us'}</th><th>$lt{'do'}</th><th>$lt{'su'}</th><th>$lt{'co'}</th></tr> |
TABLEHEAD |
TABLEHEAD |
foreach my $msg (@newmsgs) { |
foreach my $msg (@newmsgs) { |
$r->print(<<"ENDLINK"); |
$r->print(<<"ENDLINK"); |
Line 915 TABLEHEAD
|
Line 937 TABLEHEAD
|
onMouseOut="javascript:style.backgroundColor='#FFBB77'"> |
onMouseOut="javascript:style.backgroundColor='#FFBB77'"> |
<td><a href="/adm/email?dismode=new&display=$msg->{'msgid'}">$lt{'op'}</a></td> |
<td><a href="/adm/email?dismode=new&display=$msg->{'msgid'}">$lt{'op'}</a></td> |
ENDLINK |
ENDLINK |
foreach ('sendtime','from','fromdom','shortsub') { |
foreach ('sendtime','from','fromdom','shortsub','course') { |
$r->print("<td>$msg->{$_}</td>"); |
$r->print("<td>$msg->{$_}</td>"); |
} |
} |
$r->print("</td></tr>"); |
$r->print("</td></tr>"); |
Line 1029 ENDDISHEADER
|
Line 1051 ENDDISHEADER
|
$r->print('<a href = "?sortedby=revsubject'.$fsqs.'">'.&mt('Subject').'</a>'); |
$r->print('<a href = "?sortedby=revsubject'.$fsqs.'">'.&mt('Subject').'</a>'); |
} |
} |
$r->print('</th><th>'); |
$r->print('</th><th>'); |
|
if ($env{'form.sortedby'} eq "revcourse") { |
|
$r->print('<a href = "?sortedby=course'.$fsqs.'">'.&mt('Course').'</a>'); |
|
} else { |
|
$r->print('<a href = "?sortedby=revcourse'.$fsqs.'">'.&mt('Course').'</a>'); |
|
} |
|
$r->print('</th><th>'); |
if ($env{'form.sortedby'} eq "revstatus") { |
if ($env{'form.sortedby'} eq "revstatus") { |
$r->print('<a href = "?sortedby=status'.$fsqs.'">'.&mt('Status').'</a></th>'); |
$r->print('<a href = "?sortedby=status'.$fsqs.'">'.&mt('Status').'</a></th>'); |
} else { |
} else { |
Line 1036 ENDDISHEADER
|
Line 1064 ENDDISHEADER
|
} |
} |
$r->print("</tr>\n"); |
$r->print("</tr>\n"); |
for (my $n=$firstdis;$n<=$lastdis;$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 ne 'deleted') && defined($sendtime) && $sendtime!~/error/) { |
if ($status eq 'new') { |
if ($status eq 'new') { |
$r->print('<tr bgcolor="#FFBB77" onMouseOver="javascript:style.backgroundColor=\'#DD9955\'" onMouseOut="javascript:style.backgroundColor=\'#FFBB77\'">'); |
$r->print('<tr bgcolor="#FFBB77" onMouseOver="javascript:style.backgroundColor=\'#DD9955\'" onMouseOut="javascript:style.backgroundColor=\'#FFBB77\'">'); |
Line 1054 ENDDISHEADER
|
Line 1082 ENDDISHEADER
|
'<td>'.&Apache::lonlocal::locallocaltime($sendtime).'</td><td>'. |
'<td>'.&Apache::lonlocal::locallocaltime($sendtime).'</td><td>'. |
$fromname.'</td><td>'.$fromdomain.'</td><td>'. |
$fromname.'</td><td>'.$fromdomain.'</td><td>'. |
&Apache::lonnet::unescape($shortsubj).'</td><td>'. |
&Apache::lonnet::unescape($shortsubj).'</td><td>'. |
$status."</td></tr>\n"); |
$description.'</td><td>'.$status.'</td></tr>'."\n"); |
} elsif ($status eq 'deleted') { |
} elsif ($status eq 'deleted') { |
# purge |
# purge |
&movemsg(&Apache::lonnet::unescape($origID),$folder,'trash'); |
&movemsg(&Apache::lonnet::unescape($origID),$folder,'trash'); |