version 1.11, 2006/04/23 07:13:21
|
version 1.13, 2006/04/25 19:50:09
|
Line 1719 sub sendoffmail {
|
Line 1719 sub sendoffmail {
|
%content=&Apache::lonmsg::unpackagemsg($message{$msgid},1); |
%content=&Apache::lonmsg::unpackagemsg($message{$msgid},1); |
&statuschange($msgid,'replied',$folder); |
&statuschange($msgid,'replied',$folder); |
} |
} |
my %toaddr=(); |
|
undef %toaddr; |
my %toaddr; |
if ($env{'form.sendmode'} eq 'group') { |
if ($env{'form.sendmode'} eq 'group') { |
foreach (keys %env) { |
foreach $address (keys(%env)) { |
if ($_=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) { |
if ($address=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) { |
$toaddr{$1}=''; |
$toaddr{$1}=''; |
} |
} |
} |
} |
} elsif ($env{'form.sendmode'} eq 'upload') { |
} elsif ($env{'form.sendmode'} eq 'upload') { |
foreach (split(/[\n\r\f]+/,$env{'form.upfile'})) { |
foreach my $line (split(/[\n\r\f]+/,$env{'form.upfile'})) { |
my ($rec,$txt)=split(/\s*\:\s*/,$_); |
my ($rec,$txt)=split(/\s*\:\s*/,$line); |
if ($txt) { |
if ($txt) { |
$rec=~s/\@/\:/; |
$rec=~s/\@/\:/; |
$toaddr{$rec}.=$txt."\n"; |
$toaddr{$rec}.=$txt."\n"; |
Line 1761 sub sendoffmail {
|
Line 1761 sub sendoffmail {
|
$savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'}); |
$savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'}); |
} |
} |
|
|
foreach (keys %toaddr) { |
foreach my $address (sort(keys(%toaddr))) { |
my ($recuname,$recdomain)=split(/\:/,$_); |
my ($recuname,$recdomain)=split(/\:/,$address); |
my $msgtxt = $savemsg; |
my $msgtxt = $savemsg; |
if ($toaddr{$_}) { $msgtxt.='<hr />'.$toaddr{$_}; } |
if ($toaddr{$address}) { $msgtxt.='<hr />'.$toaddr{$address}; } |
my $thismsg; |
my @thismsg; |
if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && |
if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && |
(&Apache::lonnet::allowed('srm',$env{'request.course.id'}) |
(&Apache::lonnet::allowed('srm',$env{'request.course.id'}) |
|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}. |
|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}. |
'/'.$env{'request.course.sec'}))) { |
'/'.$env{'request.course.sec'}))) { |
$r->print(&mt('Sending critical message').' '.$recuname.'@'.$recdomain.': '); |
$r->print(&mt('Sending critical message').' '.$recuname.':'.$recdomain.': '); |
$thismsg=&Apache::lonmsg::user_crit_msg($recuname,$recdomain,$msgsubj,$msgtxt, |
@thismsg= |
$env{'form.sendbck'},$env{'form.permanent'}, |
&Apache::lonmsg::user_crit_msg($recuname,$recdomain, |
\$sentmessage{$_}); |
$msgsubj,$msgtxt, |
|
$env{'form.sendbck'}, |
|
$env{'form.permanent'}, |
|
\$sentmessage{$address}); |
} else { |
} else { |
$r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': '); |
$r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': '); |
$thismsg=&Apache::lonmsg::user_normal_msg($recuname,$recdomain,$msgsubj,$msgtxt, |
@thismsg= |
$content{'citation'},undef,undef,$env{'form.permanent'},\$sentmessage{$_}); |
&Apache::lonmsg::user_normal_msg($recuname,$recdomain, |
|
$msgsubj,$msgtxt, |
|
$content{'citation'}, |
|
undef,undef, |
|
$env{'form.permanent'}, |
|
\$sentmessage{$address}); |
} |
} |
if (($env{'request.course.id'}) && (($msgtype eq 'critical') || |
if (($env{'request.course.id'}) && (($msgtype eq 'critical') || |
($env{'form.sendmode'} eq 'group'))) { |
($env{'form.sendmode'} eq 'group'))) { |
$specialmsg_status{$recuname.':'.$recdomain} = $thismsg; |
$specialmsg_status{$recuname.':'.$recdomain} = |
if ($thismsg eq 'ok') { |
join(' ',@thismsg); |
$numspecial ++; |
foreach my $result (@thismsg) { |
} |
if ($result eq 'ok') { |
|
$numspecial++; |
|
} |
|
} |
} |
} |
$r->print($thismsg.'<br />'); |
$sendstatus.=' '.join(' ',@thismsg); |
$sendstatus.=' '.$thismsg; |
|
} |
} |
if (($env{'request.course.id'}) && (($env{'form.sendmode'} eq 'group') |
if (($env{'request.course.id'}) && (($env{'form.sendmode'} eq 'group') |
|| ($msgtype eq 'critical'))) { |
|| ($msgtype eq 'critical'))) { |
Line 1810 sub sendoffmail {
|
Line 1820 sub sendoffmail {
|
} |
} |
if ($specialresult eq 'ok') { |
if ($specialresult eq 'ok') { |
my $record_sent; |
my $record_sent; |
my @recusers = (); |
my @recusers; |
my @recudoms = (); |
my @recudoms; |
my ($stamp,$crssubj,$msgname,$msgdom,$msgcount,$context,$pid) = |
my ($stamp,$crssubj,$msgname,$msgdom,$msgcount,$context,$pid) = |
split(/\:/,&Apache::lonnet::unescape($specialmsgid)); |
split(/\:/,&Apache::lonnet::unescape($specialmsgid)); |
|
|
foreach my $recipient (sort(keys(%toaddr))) { |
foreach my $recipient (sort(keys(%toaddr))) { |
if ($specialmsg_status{$recipient} eq 'ok') { |
if ($specialmsg_status{$recipient} eq 'ok') { |
my $usersubj = $subj_prefix.'['.$recipient.']'; |
my $usersubj = $subj_prefix.'['.$recipient.']'; |
Line 1825 sub sendoffmail {
|
Line 1836 sub sendoffmail {
|
&Apache::lonmsg::user_normal_msg_raw($cnum,$cdom,$subj_prefix. |
&Apache::lonmsg::user_normal_msg_raw($cnum,$cdom,$subj_prefix. |
' ['.$recipient.']',$msgsubj,undef, |
' ['.$recipient.']',$msgsubj,undef, |
undef,undef,undef,$usermsgid,undef,undef,$specialmsgid); |
undef,undef,undef,$usermsgid,undef,undef,$specialmsgid); |
my ($uname,$udom) = split/:/,$recipient; |
my ($uname,$udom) = split(/:/,$recipient); |
push(@recusers,$uname); |
push(@recusers,$uname); |
push(@recudoms,$udom); |
push(@recudoms,$udom); |
} |
} |
} |
} |
if (@recusers) { |
if (@recusers) { |
my $specialmessage; |
my $specialmessage; |
my $sentsubj = $subj_prefix.' ('.$numspecial.' sent) '. |
my $sentsubj = |
$msgsubj; |
$subj_prefix.' ('.$numspecial.' sent) '.$msgsubj; |
$sentsubj = &HTML::Entities::encode($sentsubj,'<>&"'); |
$sentsubj = &HTML::Entities::encode($sentsubj,'<>&"'); |
my $sentmsgid = |
my $sentmsgid = |
&Apache::lonmsg::buildmsgid($stamp,$sentsubj,$msgname, |
&Apache::lonmsg::buildmsgid($stamp,$sentsubj,$msgname, |