version 1.61, 2003/08/13 15:57:51
|
version 1.64, 2003/08/18 17:37:42
|
Line 638 sub disall {
|
Line 638 sub disall {
|
} |
} |
</script> |
</script> |
ENDDISHEADER |
ENDDISHEADER |
$r->print( |
$r->print('<h1>Display All Messages</h1><form method=post name=disall '. |
'<h1>Display All Messages</h1><form method=post name=disall '. |
'action="/adm/email">'. |
'action="/adm/email">'. |
'<table border=2><tr><th colspan=2> </th><th>'); |
'<table border=2><tr><th colspan=2> </th><th>Date</th>'. |
if ($ENV{'form.sortedby'} eq "revdate") { |
'<th>Username</th><th>Domain</th><th>Subject</th><th>Status</th></tr>'); |
$r->print('<a href = "?sortedby=date">Date</a></th>'); |
foreach (sort split(/\&/,&Apache::lonnet::reply('keys:'. |
} else { |
$ENV{'user.domain'}.':'. |
$r->print('<a href = "?sortedby=revdate">Date</a></th>'); |
$ENV{'user.name'}.':nohist_email', |
} |
$ENV{'user.home'}))) { |
$r->print('<th>'); |
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)= |
if ($ENV{'form.sortedby'} eq "revuser") { |
|
$r->print('<a href = "?sortedby=user">Username</a>'); |
|
} else { |
|
$r->print('<a href = "?sortedby=revuser">Username</a>'); |
|
} |
|
$r->print('</th><th>'); |
|
if ($ENV{'form.sortedby'} eq "revdomain") { |
|
$r->print('<a href = "?sortedby=domain">Domain</a>'); |
|
} else { |
|
$r->print('<a href = "?sortedby=revdomain">Domain</a>'); |
|
} |
|
$r->print('</th><th>'); |
|
if ($ENV{'form.sortedby'} eq "revsubject") { |
|
$r->print('<a href = "?sortedby=subject">Subject</a>'); |
|
} else { |
|
$r->print('<a href = "?sortedby=revsubject">Subject</a>'); |
|
} |
|
$r->print('</th><th>'); |
|
if ($ENV{'form.sortedby'} eq "revstatus") { |
|
$r->print('<a href = "?sortedby=status">Status</th>'); |
|
} else { |
|
$r->print('<a href = "?sortedby=revstatus">Status</th>'); |
|
} |
|
$r->print('</tr>'); |
|
my @messages = split(/\&/,&Apache::lonnet::reply('keys:'.$ENV{'user.domain'}.':'.$ENV{'user.name'}.':nohist_email',$ENV{'user.home'})); |
|
#unpack the varibles and repack into temp for sorting |
|
my @temp; |
|
foreach (@messages) { |
|
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)= |
&Apache::lonmsg::unpackmsgid($_); |
&Apache::lonmsg::unpackmsgid($_); |
|
my @temp1 = ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$_); |
|
push @temp ,\@temp1; |
|
} |
|
#default sort |
|
@temp = sort {$a->[0] <=> $b->[0]} @temp; |
|
if ($ENV{'form.sortedby'} eq "date"){ |
|
@temp = sort {$a->[0] <=> $b->[0]} @temp; |
|
} |
|
if ($ENV{'form.sortedby'} eq "revdate"){ |
|
@temp = sort {$b->[0] <=> $a->[0]} @temp; |
|
} |
|
if ($ENV{'form.sortedby'} eq "user"){ |
|
@temp = sort {lc($a->[2]) cmp lc($b->[2])} @temp; |
|
} |
|
if ($ENV{'form.sortedby'} eq "revuser"){ |
|
@temp = sort {lc($b->[2]) cmp lc($a->[2])} @temp; |
|
} |
|
if ($ENV{'form.sortedby'} eq "domain"){ |
|
@temp = sort {$a->[3] cmp $b->[3]} @temp; |
|
} |
|
if ($ENV{'form.sortedby'} eq "revdomain"){ |
|
@temp = sort {$b->[3] cmp $a->[3]} @temp; |
|
} |
|
if ($ENV{'form.sortedby'} eq "subject"){ |
|
@temp = sort {lc($a->[1]) cmp lc($b->[1])} @temp; |
|
} |
|
if ($ENV{'form.sortedby'} eq "revsubject"){ |
|
@temp = sort {lc($b->[1]) cmp lc($a->[1])} @temp; |
|
} |
|
if ($ENV{'form.sortedby'} eq "status"){ |
|
@temp = sort {$a->[4] cmp $b->[4]} @temp; |
|
} |
|
if ($ENV{'form.sortedby'} eq "revstatus"){ |
|
@temp = sort {$b->[4] cmp $a->[4]} @temp; |
|
} |
|
foreach (@temp){ |
|
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$origID)= @$_; |
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">'); |
$r->print('<tr bgcolor="#FFBB77">'); |
} elsif ($status eq 'read') { |
} elsif ($status eq 'read') { |
$r->print('<tr bgcolor="#BBBB77">'); |
$r->print('<tr bgcolor="#BBBB77">'); |
} elsif ($status eq 'replied') { |
} elsif ($status eq 'replied') { |
$r->print('<tr bgcolor="#AAAA88">'); |
$r->print('<tr bgcolor="#AAAA88">'); |
} else { |
} else { |
$r->print('<tr bgcolor="#99BBBB">'); |
$r->print('<tr bgcolor="#99BBBB">'); |
} |
} |
$r->print('<td><a href="/adm/email?display='.$_. |
$r->print('<td><a href="/adm/email?display='.$origID. |
'">Open</a></td><td><a href="/adm/email?markdel='.$_. |
'">Open</a></td><td><a href="/adm/email?markdel='.$origID. |
'">Delete</a><input type=checkbox name="delmark_'.$_.'"></td>'. |
'">Delete</a><input type=checkbox name="delmark_'.$origID.'"></td>'. |
'<td>'.localtime($sendtime).'</td><td>'. |
'<td>'.localtime($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>'); |
$status.'</td></tr>'); |
} |
} |
} |
} |
$r->print('</table><p>'. |
$r->print('</table><p>'. |
'<a href="javascript:checkall()">Check All</a> '. |
'<a href="javascript:checkall()">Check All</a> '. |
'<a href="javascript:uncheckall()">Uncheck All</a><p>'. |
'<a href="javascript:uncheckall()">Uncheck All</a><p>'. |
Line 888 sub handler {
|
Line 953 sub handler {
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['display','replyto','forward','markread','markdel','markunread', |
['display','replyto','forward','markread','markdel','markunread', |
'sendreply','compose','sendmail','critical','recname','recdom', |
'sendreply','compose','sendmail','critical','recname','recdom', |
'recordftf']); |
'recordftf','sortedby']); |
|
|
# ------------------------------------------------------ They checked for email |
# ------------------------------------------------------ They checked for email |
&Apache::lonnet::put('email_status',{'recnewemail'=>0}); |
&Apache::lonnet::put('email_status',{'recnewemail'=>0}); |