version 1.20, 2001/08/13 19:36:39
|
version 1.22, 2001/08/16 01:42:07
|
Line 13
|
Line 13
|
# 10/19,10/20,10/30, |
# 10/19,10/20,10/30, |
# 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 Gerd Kortemeyer |
# 07/27,07/28,07/30,08/03,08/06,08/08,08/09,08/10,8/13,8/15 Gerd Kortemeyer |
|
|
package Apache::lonmsg; |
package Apache::lonmsg; |
|
|
Line 121 sub user_crit_msg {
|
Line 121 sub user_crit_msg {
|
unless (($message)&&($user)&&($domain)) { $status='empty'; }; |
unless (($message)&&($user)&&($domain)) { $status='empty'; }; |
my $homeserver=&Apache::lonnet::homeserver($user,$domain); |
my $homeserver=&Apache::lonnet::homeserver($user,$domain); |
if ($homeserver ne 'no_host') { |
if ($homeserver ne 'no_host') { |
my $msgid; |
|
($msgid,$message)=&packagemsg($subject,$message); |
($msgid,$message)=&packagemsg($subject,$message); |
$status=&Apache::lonnet::critical( |
$status=&Apache::lonnet::critical( |
'put:'.$domain.':'.$user.':critical:'. |
'put:'.$domain.':'.$user.':critical:'. |
Line 175 sub user_normal_msg {
|
Line 174 sub user_normal_msg {
|
unless (($message)&&($user)&&($domain)) { $status='empty'; }; |
unless (($message)&&($user)&&($domain)) { $status='empty'; }; |
my $homeserver=&Apache::lonnet::homeserver($user,$domain); |
my $homeserver=&Apache::lonnet::homeserver($user,$domain); |
if ($homeserver ne 'no_host') { |
if ($homeserver ne 'no_host') { |
my $msgid; |
|
($msgid,$message)=&packagemsg($subject,$message,$citation); |
($msgid,$message)=&packagemsg($subject,$message,$citation); |
$status=&Apache::lonnet::critical( |
$status=&Apache::lonnet::critical( |
'put:'.$domain.':'.$user.':nohist_email:'. |
'put:'.$domain.':'.$user.':nohist_email:'. |
Line 382 sub compout {
|
Line 380 sub compout {
|
$content{'sendername'}.' at '.$content{'senderdomain'}; |
$content{'sendername'}.' at '.$content{'senderdomain'}; |
} |
} |
my $defdom=$ENV{'user.domain'}; |
my $defdom=$ENV{'user.domain'}; |
$r->print('<form action="/adm/email" name="compemail" method=post>'. |
$r->print( |
|
'<form action="/adm/email" name="compemail" method=post'. |
|
' enctype="multipart/form-data">'. |
'<input type=hidden name=sendmail value=on><table>'); |
'<input type=hidden name=sendmail value=on><table>'); |
unless ($broadcast eq 'group') { |
unless (($broadcast eq 'group') || ($broadcast eq 'upload')) { |
$r->print(<<"ENDREC"); |
$r->print(<<"ENDREC"); |
<table> |
<table> |
<tr><td>Username:</td><td><input type=text size=12 name=recuname></td></tr> |
<tr><td>Username:</td><td><input type=text size=12 name=recuname></td></tr> |
Line 392 sub compout {
|
Line 392 sub compout {
|
<td><input type=text size=12 name=recdomain value="$defdom"></td></tr> |
<td><input type=text size=12 name=recdomain value="$defdom"></td></tr> |
ENDREC |
ENDREC |
} |
} |
$r->print(<<"ENDCOMP"); |
unless ($broadcast eq 'upload') { |
|
$r->print(<<"ENDCOMP"); |
<tr><td>Additional Recipients<br><tt>username\@domain,username\@domain, ... |
<tr><td>Additional Recipients<br><tt>username\@domain,username\@domain, ... |
</tt></td><td> |
</tt></td><td> |
<input type=text size=50 name=additionalrec></td></tr> |
<input type=text size=50 name=additionalrec></td></tr> |
Line 403 ENDREC
|
Line 404 ENDREC
|
$dispcrit |
$dispcrit |
<input type=submit value="$func Mail"> |
<input type=submit value="$func Mail"> |
ENDCOMP |
ENDCOMP |
|
} |
|
if ($broadcast eq 'upload') { |
|
$r->print(<<ENDUPLOAD); |
|
<input type=hidden name=sendmode value=upload> |
|
<h3>Generate messages from a file</h3> |
|
Subject: <input type=text size=50 name=subject> |
|
<pre> |
|
username1\@domain1: text |
|
username2\@domain2: text |
|
username1\@domain1: text |
|
</pre> |
|
The messages will be assembled from all lines with the respective |
|
<tt>username\@domain</tt>, and appended to the general message text.<p> |
|
<input type=file name=upfile size=20><p> |
|
General message text:<p> |
|
<textarea name=message cols=60 rows=10>$dismsg |
|
</textarea><p> |
|
$dispcrit |
|
<input type=submit value="Upload and send"> |
|
ENDUPLOAD |
|
} |
if ($broadcast eq 'group') { |
if ($broadcast eq 'group') { |
&discourse; |
&discourse; |
} |
} |
Line 531 sub handler {
|
Line 553 sub handler {
|
if ($ENV{'form.sendmode'} eq 'group') { |
if ($ENV{'form.sendmode'} eq 'group') { |
map { |
map { |
if ($_=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) { |
if ($_=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) { |
$toaddr{$1}=1; |
$toaddr{$1}=''; |
} |
} |
} keys %ENV; |
} keys %ENV; |
|
} elsif ($ENV{'form.sendmode'} eq 'upload') { |
|
map { |
|
my ($rec,$txt)=split(/\s*\:\s*/,$_); |
|
if ($txt) { |
|
$rec=~s/\@/\:/; |
|
$toaddr{$rec}.=$txt."\n"; |
|
} |
|
} split(/[\n\r\f]+/,$ENV{'form.upfile'}); |
} else { |
} else { |
$toaddr{$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}}=1; |
$toaddr{$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}}=''; |
} |
} |
if ($ENV{'form.additionalrec'}) { |
if ($ENV{'form.additionalrec'}) { |
map { |
map { |
my ($auname,$audom)=split(/\@/,$_); |
my ($auname,$audom)=split(/\@/,$_); |
$toaddr{$auname.':'.$audom}=1; |
$toaddr{$auname.':'.$audom}=''; |
} split(/\,/,$ENV{'form.additionalrec'}); |
} split(/\,/,$ENV{'form.additionalrec'}); |
} |
} |
map { |
map { |
my ($recuname,$recdomain)=split(/\:/,$_); |
my ($recuname,$recdomain)=split(/\:/,$_); |
|
my $msgtxt=$ENV{'form.message'}; |
|
if ($toaddr{$_}) { $msgtxt.='<hr>'.$toaddr{$_}; } |
if (($ENV{'form.critmsg'}) && |
if (($ENV{'form.critmsg'}) && |
(&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'}, |
$ENV{'form.message'}, |
$msgtxt, |
$content{'citation'})); |
$content{'citation'})); |
} else { |
} else { |
$r->print('Sending: '.&user_normal_msg($recuname,$recdomain, |
$r->print('Sending: '.&user_normal_msg($recuname,$recdomain, |
$ENV{'form.subject'}, |
$ENV{'form.subject'}, |
$ENV{'form.message'}, |
$msgtxt, |
$content{'citation'})); |
$content{'citation'})); |
} |
} |
$r->print('<br>'); |
$r->print('<br>'); |