version 1.23, 2001/10/01 19:24:49
|
version 1.25, 2001/11/05 21:01:54
|
Line 14
|
Line 14
|
# 02/06/01 Gerd Kortemeyer |
# 02/06/01 Gerd Kortemeyer |
# 07/27 Guy Albertelli |
# 07/27 Guy Albertelli |
# 07/27,07/28,07/30,08/03,08/06,08/08,08/09,08/10,8/13,8/15, |
# 07/27,07/28,07/30,08/03,08/06,08/08,08/09,08/10,8/13,8/15, |
# 10/1 Gerd Kortemeyer |
# 10/1,11/5 Gerd Kortemeyer |
|
|
package Apache::lonmsg; |
package Apache::lonmsg; |
|
|
Line 115 sub author_res_msg {
|
Line 115 sub author_res_msg {
|
# ================================================== Critical message to a user |
# ================================================== Critical message to a user |
|
|
sub user_crit_msg { |
sub user_crit_msg { |
my ($user,$domain,$subject,$message)=@_; |
my ($user,$domain,$subject,$message,$sendback)=@_; |
# Check if allowed missing |
# Check if allowed missing |
my $status=''; |
my $status=''; |
my $msgid='undefined'; |
my $msgid='undefined'; |
Line 123 sub user_crit_msg {
|
Line 123 sub user_crit_msg {
|
my $homeserver=&Apache::lonnet::homeserver($user,$domain); |
my $homeserver=&Apache::lonnet::homeserver($user,$domain); |
if ($homeserver ne 'no_host') { |
if ($homeserver ne 'no_host') { |
($msgid,$message)=&packagemsg($subject,$message); |
($msgid,$message)=&packagemsg($subject,$message); |
|
if ($sendback) { $message.='<sendback>true</sendback>'; } |
$status=&Apache::lonnet::critical( |
$status=&Apache::lonnet::critical( |
'put:'.$domain.':'.$user.':critical:'. |
'put:'.$domain.':'.$user.':critical:'. |
&Apache::lonnet::escape($msgid).'='. |
&Apache::lonnet::escape($msgid).'='. |
Line 146 sub user_crit_received {
|
Line 147 sub user_crit_received {
|
my $msgid=shift; |
my $msgid=shift; |
my %message=&Apache::lonnet::get('critical',[$msgid]); |
my %message=&Apache::lonnet::get('critical',[$msgid]); |
my %contents=&unpackagemsg($message{$msgid}); |
my %contents=&unpackagemsg($message{$msgid}); |
my $status='rec: '. |
my $status='rec: '.($contents{'sendback'}? |
&user_normal_msg($contents{'sendername'},$contents{'senderdomain'}, |
&user_normal_msg($contents{'sendername'},$contents{'senderdomain'}, |
'Receipt: '.$ENV{'user.name'}.' at '.$ENV{'user.domain'}, |
'Receipt: '.$ENV{'user.name'}.' at '.$ENV{'user.domain'}, |
'User '.$ENV{'user.name'}.' at '.$ENV{'user.domain'}. |
'User '.$ENV{'user.name'}.' at '.$ENV{'user.domain'}. |
' acknowledged receipt of message "'. |
' acknowledged receipt of message "'. |
$contents{'subject'}.'" dated '.$contents{'time'}.".\n\n" |
$contents{'subject'}.'" dated '.$contents{'time'}.".\n\n" |
.'Message ID: '.$contents{'msgid'}); |
.'Message ID: '.$contents{'msgid'}):'no msg req'); |
$status.=' trans: '. |
$status.=' trans: '. |
&Apache::lonnet::put( |
&Apache::lonnet::put( |
'nohist_email',{$contents{'msgid'} => $message{$msgid}}); |
'nohist_email',{$contents{'msgid'} => $message{$msgid}}); |
Line 308 sub comprep {
|
Line 309 sub comprep {
|
my $dispcrit=''; |
my $dispcrit=''; |
if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) { |
if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) { |
$dispcrit= |
$dispcrit= |
'<input type=checkbox name=critmsg> Send as critical message<p>'; |
'<input type=checkbox name=critmsg> Send as critical message<br>'. |
|
'<input type=checkbox name=sendbck> Send as critical message'. |
|
' and return receipt<p>'; |
} |
} |
$r->print(<<"ENDREPLY"); |
$r->print(<<"ENDREPLY"); |
<form action="/adm/email" method=post> |
<form action="/adm/email" method=post> |
Line 327 ENDREPLY
|
Line 330 ENDREPLY
|
|
|
sub disall { |
sub disall { |
my $r=shift; |
my $r=shift; |
$r->print('<h1>Display All Messages</h1>'. |
$r->print( |
|
'<h1>Display All Messages</h1><form method=post action="/adm/email">'. |
'<table border=2><tr><th colspan=2> </th><th>Date</th>'. |
'<table border=2><tr><th colspan=2> </th><th>Date</th>'. |
'<th>Username</th><th>Domain</th><th>Subject</th><th>Status</th></tr>'); |
'<th>Username</th><th>Domain</th><th>Subject</th><th>Status</th></tr>'); |
map { |
map { |
Line 345 sub disall {
|
Line 349 sub disall {
|
} |
} |
$r->print('<td><a href="/adm/email?display='.$_. |
$r->print('<td><a href="/adm/email?display='.$_. |
'">Open</a></td><td><a href="/adm/email?markdel='.$_. |
'">Open</a></td><td><a href="/adm/email?markdel='.$_. |
'">Delete</a></td><td>'.localtime($sendtime).'</td><td>'. |
'">Delete</a><input type=checkbox name="delmark_'.$_.'"></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>'); |
Line 354 sub disall {
|
Line 359 sub disall {
|
$ENV{'user.domain'}.':'. |
$ENV{'user.domain'}.':'. |
$ENV{'user.name'}.':nohist_email', |
$ENV{'user.name'}.':nohist_email', |
$ENV{'user.home'})); |
$ENV{'user.home'})); |
$r->print('</table></body></html>'); |
$r->print('</table><p>'. |
|
'<input type=submit name="markeddel" value="Delete Checked">'. |
|
'</form></body></html>'); |
} |
} |
|
|
# ============================================================== Compose output |
# ============================================================== Compose output |
Line 367 sub compout {
|
Line 374 sub compout {
|
my $func='Send New'; |
my $func='Send New'; |
if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) { |
if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) { |
$dispcrit= |
$dispcrit= |
'<input type=checkbox name=critmsg> Send as critical message<p>'; |
'<input type=checkbox name=critmsg> Send as critical message<br>'. |
|
'<input type=checkbox name=sendbck> Send as critical message'. |
|
' and return receipt<p>'; |
} |
} |
if ($forwarding) { |
if ($forwarding) { |
$dispcrit.='<input type=hidden name=forwid value="'. |
$dispcrit.='<input type=hidden name=forwid value="'. |
Line 493 sub handler {
|
Line 502 sub handler {
|
my %message=&Apache::lonnet::get('nohist_email',[$msgid]); |
my %message=&Apache::lonnet::get('nohist_email',[$msgid]); |
my %content=&unpackagemsg($message{$msgid}); |
my %content=&unpackagemsg($message{$msgid}); |
&statuschange($msgid,'replied'); |
&statuschange($msgid,'replied'); |
if (($ENV{'form.critmsg'}) && |
if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) && |
(&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { |
(&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { |
$r->print('Sending critical: '. |
$r->print('Sending critical: '. |
&user_crit_msg($content{'sendername'}, |
&user_crit_msg($content{'sendername'}, |
$content{'senderdomain'}, |
$content{'senderdomain'}, |
$ENV{'form.subject'}, |
$ENV{'form.subject'}, |
$ENV{'form.message'})); |
$ENV{'form.message'}, |
|
$ENV{'form.sendbck'})); |
} else { |
} else { |
$r->print('Sending: '.&user_normal_msg($content{'sendername'}, |
$r->print('Sending: '.&user_normal_msg($content{'sendername'}, |
$content{'senderdomain'}, |
$content{'senderdomain'}, |
Line 533 sub handler {
|
Line 543 sub handler {
|
} elsif ($ENV{'form.markdel'}) { |
} elsif ($ENV{'form.markdel'}) { |
&statuschange($ENV{'form.markdel'},'deleted'); |
&statuschange($ENV{'form.markdel'},'deleted'); |
&disall($r); |
&disall($r); |
|
} elsif ($ENV{'form.markeddel'}) { |
|
my $total=0; |
|
map { |
|
if ($_=~/^form\.delmark_(.*)$/) { |
|
&statuschange(&Apache::lonnet::unescape($1),'deleted'); |
|
$total++; |
|
} |
|
} keys %ENV; |
|
$r->print('Deleted '.$total.' message(s)<p>'); |
|
&disall($r); |
} elsif ($ENV{'form.markunread'}) { |
} elsif ($ENV{'form.markunread'}) { |
&statuschange($ENV{'form.markunread'},'new'); |
&statuschange($ENV{'form.markunread'},'new'); |
&disall($r); |
&disall($r); |
Line 578 sub handler {
|
Line 598 sub handler {
|
my ($recuname,$recdomain)=split(/\:/,$_); |
my ($recuname,$recdomain)=split(/\:/,$_); |
my $msgtxt=$ENV{'form.message'}; |
my $msgtxt=$ENV{'form.message'}; |
if ($toaddr{$_}) { $msgtxt.='<hr>'.$toaddr{$_}; } |
if ($toaddr{$_}) { $msgtxt.='<hr>'.$toaddr{$_}; } |
if (($ENV{'form.critmsg'}) && |
if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) && |
(&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { |
(&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { |
$r->print('Sending critical: '. |
$r->print('Sending critical: '. |
&user_crit_msg($recuname,$recdomain, |
&user_crit_msg($recuname,$recdomain, |
$ENV{'form.subject'}, |
$ENV{'form.subject'}, |
$msgtxt, |
$msgtxt, |
$content{'citation'})); |
$ENV{'form.sendbck'})); |
} else { |
} else { |
$r->print('Sending: '.&user_normal_msg($recuname,$recdomain, |
$r->print('Sending: '.&user_normal_msg($recuname,$recdomain, |
$ENV{'form.subject'}, |
$ENV{'form.subject'}, |