version 1.8, 2002/02/05 00:01:32
|
version 1.10, 2002/06/24 14:33:21
|
Line 50 sub handler {
|
Line 50 sub handler {
|
# |
# |
# Start document |
# Start document |
# |
# |
$r->print(<<ENDDOCUMENT); |
$r->print(<<END); |
<html> |
<html> |
<head> |
<head> |
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
Line 58 sub handler {
|
Line 58 sub handler {
|
<body bgcolor="#FFFFFF"> |
<body bgcolor="#FFFFFF"> |
<img align=right src=/adm/lonIcons/lonlogos.gif> |
<img align=right src=/adm/lonIcons/lonlogos.gif> |
<h1>Communicate</h1> |
<h1>Communicate</h1> |
ENDDOCUMENT |
END |
my $st='<table><tr><td bgcolor="#FFFFAA"><b>'; |
$r->print(<<END); |
my $en='</b></td><tr></table>'; |
<table cellspacing="10" cellpadding="2"> |
$r->print('<p>'. |
<tr><td bgcolor="#FFFFAA"> |
$st.'<a href="/adm/email/">All Messages</a>'.$en.'<p>'. |
<b><a href="/adm/email/">View All Messages</a></b> |
$st.'<a href="/adm/email?critical=display">Critical Messages</a>'.$en.'<p>'. |
</td></tr> |
$st.'<a href="/adm/email?compose=individual">Send message to user(s)</a>'.$en |
<tr><td bgcolor="#FFFFAA"> |
); |
<b><a href="/adm/email?critical=display">View Critical Messages</a></b> |
|
</td></tr> |
|
<tr><td bgcolor="#FFFFAA"> |
|
<b><a href="/adm/email?compose=individual">Send message to user(s)</a></b> |
|
</td></tr> |
|
END |
if (($ENV{'request.course.id'}) && |
if (($ENV{'request.course.id'}) && |
(&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { |
(&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { |
$r->print( |
$r->print(<<END); |
'<p>'.$st. |
<tr><td bgcolor="#FFFFAA"> |
'<a href="/adm/email?compose=group">Broadcast message to course</a>'.$en. |
<b><a href="/adm/email?compose=group">Broadcast message to course</a></b> |
'<p>'.$st. |
</td></tr> |
'<a href="/adm/email?compose=upload">Upload messages to course</a>'.$en); |
<tr><td bgcolor="#FFFFAA"> |
|
<b><a href="/adm/email?compose=upload">Upload messages to course</a></b> |
|
</td></tr> |
|
END |
} |
} |
$r->print(<<ENDTABLE); |
$r->print('</table>'); |
|
my @msgids = sort split(/\&/,&Apache::lonnet::reply |
|
('keys:'.$ENV{'user.domain'}.':'. |
|
$ENV{'user.name'}.':nohist_email', |
|
$ENV{'user.home'})); |
|
my @newmsgs; |
|
foreach (@msgids) { |
|
my ($sendtime,$shortsubj,$fromname,$fromdom,$status)= |
|
&Apache::lonmsg::unpackmsgid($_); |
|
if ($sendtime!~/error/) { |
|
$sendtime = localtime($sendtime); |
|
if ($status eq 'new') { |
|
push @newmsgs, { |
|
msgid => $_, |
|
sendtime => $sendtime, |
|
shortsub => &Apache::lonnet::unescape($shortsubj), |
|
from => $fromname, |
|
fromdom => $fromdom |
|
} |
|
} |
|
} |
|
} |
|
if ($#newmsgs >= 0) { |
|
$r->print(<<TABLEHEAD); |
<h3>New Messages</h3> |
<h3>New Messages</h3> |
<table border=2><tr><th> </th> |
<table border=2><tr><th> </th> |
<th>Date</th><th>Username</th><th>Domain</th><th>Subject</th></tr> |
<th>Date</th><th>Username</th><th>Domain</th><th>Subject</th></tr> |
ENDTABLE |
TABLEHEAD |
foreach (sort split(/\&/,&Apache::lonnet::reply('keys:'. |
foreach my $msg (@newmsgs) { |
$ENV{'user.domain'}.':'. |
$r->print(<<"ENDLINK"); |
$ENV{'user.name'}.':nohist_email', |
<tr bgcolor="#FFBB77"> |
$ENV{'user.home'}))) { |
<td><a href="/adm/email?display=$msg->{'msgid'}">Open</a></td> |
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)= |
ENDLINK |
&Apache::lonmsg::unpackmsgid($_); |
foreach ('sendtime','from','fromdom','shortsub') { |
if ($status eq 'new') { |
$r->print("<td>$msg->{$_}</td>"); |
$r->print( |
} |
'<tr bgcolor="#FFBB77"><td><a href="/adm/email?display='.$_. |
$r->print("</td></tr>"); |
'">Open</a></td><td>'.localtime($sendtime).'</td><td>'. |
|
$fromname.'</td><td>'.$fromdomain.'</td><td>'. |
|
&Apache::lonnet::unescape($shortsubj).'</td></tr>'); |
|
} |
} |
|
$r->print('</table></body></html>'); |
|
} else { |
|
$r->print("<h3>You have no unread messages</h3>"); |
} |
} |
$r->print('</table></body></html>'); |
|
return OK; |
return OK; |
} |
} |
|
|