version 1.185, 2006/06/12 22:55:23
|
version 1.187, 2006/12/05 02:55:53
|
Line 33 use Apache::lonnet;
|
Line 33 use Apache::lonnet;
|
use HTML::TokeParser(); |
use HTML::TokeParser(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Mail::Send; |
use Mail::Send; |
use lib '/home/httpd/lib/perl/'; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA; |
|
|
|
{ |
{ |
my $uniq; |
my $uniq; |
Line 210 sub unpackmsgid {
|
Line 209 sub unpackmsgid {
|
|
|
sub sendemail { |
sub sendemail { |
my ($to,$subject,$body)=@_; |
my ($to,$subject,$body)=@_; |
|
my %senderemails=&Apache::loncommon::getemails(); |
|
my $senderaddress=''; |
|
foreach my $type ('notification','permanentemail','critnotification') { |
|
if ($senderemails{$type}) { |
|
$senderaddress=$senderemails{$type}; |
|
} |
|
} |
$body= |
$body= |
"*** ".&mt('This is an automatic message generated by the LON-CAPA system.')."\n". |
"*** ".&mt('This is an automatic message generated by the LON-CAPA system.')."\n". |
"*** ".&mt('Please do not reply to this address.')."\n\n".$body; |
"*** ".($senderaddress?&mt('You can reply to this message'):&mt('Please do not reply to this address.')."\n*** ". |
|
&mt('A reply will not be received by the recipient!'))."\n\n".$body; |
my $msg = new Mail::Send; |
my $msg = new Mail::Send; |
$msg->to($to); |
$msg->to($to); |
$msg->subject('[LON-CAPA] '.$subject); |
$msg->subject('[LON-CAPA] '.$subject); |
|
if ($senderaddress) { $msg->add('Reply-to',$senderaddress); } |
if (my $fh = $msg->open()) { |
if (my $fh = $msg->open()) { |
print $fh $body; |
print $fh $body; |
$fh->close; |
$fh->close; |
Line 299 sub author_res_msg {
|
Line 307 sub author_res_msg {
|
sub retrieve_author_res_msg { |
sub retrieve_author_res_msg { |
my $url=shift; |
my $url=shift; |
$url=&Apache::lonnet::declutter($url); |
$url=&Apache::lonnet::declutter($url); |
my ($domain,$author)=($url=~/^(\w+)\/(\w+)\//); |
my ($domain,$author)=($url=~/^($match_domain)\/($match_username)\//); |
my %errormsgs=&Apache::lonnet::dump('nohist_res_msgs',$domain,$author); |
my %errormsgs=&Apache::lonnet::dump('nohist_res_msgs',$domain,$author); |
my $msgs=''; |
my $msgs=''; |
foreach (keys %errormsgs) { |
foreach (keys %errormsgs) { |
Line 319 sub retrieve_author_res_msg {
|
Line 327 sub retrieve_author_res_msg {
|
sub del_url_author_res_msg { |
sub del_url_author_res_msg { |
my $url=shift; |
my $url=shift; |
$url=&Apache::lonnet::declutter($url); |
$url=&Apache::lonnet::declutter($url); |
my ($domain,$author)=($url=~/^(\w+)\/(\w+)\//); |
my ($domain,$author)=($url=~/^($match_domain)\/($match_username)\//); |
my @delmsgs=(); |
my @delmsgs=(); |
foreach (&Apache::lonnet::getkeys('nohist_res_msgs',$domain,$author)) { |
foreach (&Apache::lonnet::getkeys('nohist_res_msgs',$domain,$author)) { |
if ($_=~/^\Q$url\E\_\d+$/) { |
if ($_=~/^\Q$url\E\_\d+$/) { |
Line 333 sub del_url_author_res_msg {
|
Line 341 sub del_url_author_res_msg {
|
sub clear_author_res_msg { |
sub clear_author_res_msg { |
my $url=shift; |
my $url=shift; |
$url=&Apache::lonnet::declutter($url); |
$url=&Apache::lonnet::declutter($url); |
my ($domain,$author)=($url=~/^(\w+)\/(\w+)\//); |
my ($domain,$author)=($url=~/^($match_domain)\/($match_username)\//); |
my @delmsgs=(); |
my @delmsgs=(); |
foreach (&Apache::lonnet::getkeys('nohist_res_msgs',$domain,$author)) { |
foreach (&Apache::lonnet::getkeys('nohist_res_msgs',$domain,$author)) { |
if ($_=~/^\Q$url\E/) { |
if ($_=~/^\Q$url\E/) { |
Line 390 sub user_crit_msg_raw {
|
Line 398 sub user_crit_msg_raw {
|
$status='no_host'; |
$status='no_host'; |
} |
} |
# Notifications |
# Notifications |
my %userenv = &Apache::lonnet::get('environment',['critnotification', |
my %userenv = &Apache::loncommon::getemails($user,$domain); |
'permanentemail'], |
|
$domain,$user); |
|
if ($userenv{'critnotification'}) { |
if ($userenv{'critnotification'}) { |
&sendnotification($userenv{'critnotification'},$user,$domain,$subject,1, |
&sendnotification($userenv{'critnotification'},$user,$domain,$subject,1, |
$text); |
$text); |