version 1.16, 2001/08/06 11:41:11
|
version 1.29, 2002/03/18 18:38:04
|
Line 1
|
Line 1
|
# The LearningOnline Network with CAPA |
# The LearningOnline Network with CAPA |
# |
|
# Routines for messaging |
# Routines for messaging |
# |
# |
|
# $Id$ |
|
# |
|
# Copyright Michigan State University Board of Trustees |
|
# |
|
# This file is part of the LearningOnline Network with CAPA (LON-CAPA). |
|
# |
|
# LON-CAPA is free software; you can redistribute it and/or modify |
|
# it under the terms of the GNU General Public License as published by |
|
# the Free Software Foundation; either version 2 of the License, or |
|
# (at your option) any later version. |
|
# |
|
# LON-CAPA is distributed in the hope that it will be useful, |
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
# GNU General Public License for more details. |
|
# |
|
# You should have received a copy of the GNU General Public License |
|
# along with LON-CAPA; if not, write to the Free Software |
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
# |
|
# /home/httpd/html/adm/gpl.txt |
|
# |
|
# http://www.lon-capa.org/ |
|
# |
|
# |
# (Routines to control the menu |
# (Routines to control the menu |
# |
# |
# (TeX Conversion Module |
# (TeX Conversion Module |
Line 13
|
Line 37
|
# 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 Gerd Kortemeyer |
# 07/27,07/28,07/30,08/03,08/06,08/08,08/09,08/10,8/13,8/15, |
|
# 10/1,11/5 Gerd Kortemeyer |
|
# YEAR=2002 |
|
# 1/1,3/18 Gerd Kortemeyer |
|
# |
package Apache::lonmsg; |
package Apache::lonmsg; |
|
|
use strict; |
use strict; |
Line 37 sub packagemsg {
|
Line 64 sub packagemsg {
|
$msgcount++; |
$msgcount++; |
my $partsubj=$subject; |
my $partsubj=$subject; |
$partsubj=&Apache::lonnet::escape($partsubj); |
$partsubj=&Apache::lonnet::escape($partsubj); |
$partsubj=substr($partsubj,0,50); |
|
my $msgid=&Apache::lonnet::escape( |
my $msgid=&Apache::lonnet::escape( |
$now.':'.$partsubj.':'.$ENV{'user.name'}.':'. |
$now.':'.$partsubj.':'.$ENV{'user.name'}.':'. |
$ENV{'user.domain'}.':'.$msgcount.':'.$$); |
$ENV{'user.domain'}.':'.$msgcount.':'.$$); |
Line 114 sub author_res_msg {
|
Line 140 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'; |
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); |
|
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 172 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 175 sub user_normal_msg {
|
Line 201 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 206 sub statuschange {
|
Line 231 sub statuschange {
|
} |
} |
} |
} |
|
|
|
# ======================================================= Display a course list |
|
|
|
sub discourse { |
|
my $r=shift; |
|
my %courselist=&Apache::lonnet::dump( |
|
'classlist', |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
|
my $now=time; |
|
$r->print(<<ENDDISHEADER); |
|
<input type=hidden name=sendmode value=group> |
|
<script> |
|
function checkall() { |
|
for (i=0; i<document.forms.compemail.elements.length; i++) { |
|
if |
|
(document.forms.compemail.elements[i].name.indexOf('send_to_')==0) { |
|
document.forms.compemail.elements[i].checked=true; |
|
} |
|
} |
|
} |
|
|
|
function checksec() { |
|
for (i=0; i<document.forms.compemail.elements.length; i++) { |
|
if |
|
(document.forms.compemail.elements[i].name.indexOf |
|
('send_to_&&&'+document.forms.compemail.chksec.value)==0) { |
|
document.forms.compemail.elements[i].checked=true; |
|
} |
|
} |
|
} |
|
|
|
function uncheckall() { |
|
for (i=0; i<document.forms.compemail.elements.length; i++) { |
|
if |
|
(document.forms.compemail.elements[i].name.indexOf('send_to_')==0) { |
|
document.forms.compemail.elements[i].checked=false; |
|
} |
|
} |
|
} |
|
</script> |
|
<input type=button onClick="checkall()" value="Check for All"> |
|
<input type=button onClick="checksec()" value="Check for Section/Group"> |
|
<input type=text size=5 name=chksec> |
|
<input type=button onClick="uncheckall()" value="Check for None"> |
|
<p> |
|
ENDDISHEADER |
|
foreach (sort keys %courselist) { |
|
my ($end,$start)=split(/\:/,$courselist{$_}); |
|
my $active=1; |
|
if (($end) && ($now>$end)) { $active=0; } |
|
if ($active) { |
|
my ($sname,$sdom)=split(/\:/,$_); |
|
my %reply=&Apache::lonnet::get('environment', |
|
['firstname','middlename','lastname','generation'], |
|
$sdom,$sname); |
|
my $section=&Apache::lonnet::usection |
|
($sdom,$sname,$ENV{'request.course.id'}); |
|
$r->print( |
|
'<br><input type=checkbox name="send_to_&&&'.$section.'&&&_'.$_.'"> '. |
|
$reply{'firstname'}.' '. |
|
$reply{'middlename'}.' '. |
|
$reply{'lastname'}.' '. |
|
$reply{'generation'}. |
|
' ('.$_.') '.$section); |
|
} |
|
} |
|
} |
|
|
# ==================================================== Display Critical Message |
# ==================================================== Display Critical Message |
|
|
sub discrit { |
sub discrit { |
Line 214 sub discrit {
|
Line 307 sub discrit {
|
'<form action=/adm/email method=post>'. |
'<form action=/adm/email method=post>'. |
'<input type=hidden name=confirm value=true>'); |
'<input type=hidden name=confirm value=true>'); |
my %what=&Apache::lonnet::dump('critical'); |
my %what=&Apache::lonnet::dump('critical'); |
map { |
foreach (sort keys %what) { |
my %content=&unpackagemsg($what{$_}); |
my %content=&unpackagemsg($what{$_}); |
$content{'message'}=~s/\n/\<br\>/g; |
$content{'message'}=~s/\n/\<br\>/g; |
$r->print('<hr>From: <b>'.$content{'sendername'}.'@'. |
$r->print('<hr>From: <b>'.$content{'sendername'}.'@'. |
Line 222 sub discrit {
|
Line 315 sub discrit {
|
')<br><blockquote>'.$content{'message'}.'</blockquote>'. |
')<br><blockquote>'.$content{'message'}.'</blockquote>'. |
'<input type=submit name="rec_'.$_.'" value="Confirm Receipt">'. |
'<input type=submit name="rec_'.$_.'" value="Confirm Receipt">'. |
'<input type=submit name="reprec_'.$_.'" value="Confirm Receipt and Reply">'); |
'<input type=submit name="reprec_'.$_.'" value="Confirm Receipt and Reply">'); |
} sort keys %what; |
} |
$r->print( |
$r->print( |
'<input type=hidden name="displayedcrit" value="true"></form>'); |
'<input type=hidden name="displayedcrit" value="true"></form>'); |
} |
} |
Line 241 sub comprep {
|
Line 334 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> |
<input type=hidden name=sendreply value="$msgid"> |
<input type=hidden name=sendreply value="$msgid"> |
Subject: <input type=text size=50 name=subject value="$subject"><p> |
Subject: <input type=text size=50 name=subject value="$subject"><p> |
<textarea name=message cols=60 rows=10> |
<textarea name=message cols=64 rows=10 wrap=hard> |
$quotemsg |
$quotemsg |
</textarea><p> |
</textarea><p> |
$dispcrit |
$dispcrit |
Line 260 ENDREPLY
|
Line 355 ENDREPLY
|
|
|
sub disall { |
sub disall { |
my $r=shift; |
my $r=shift; |
$r->print('<h1>Display All Messages</h1>'. |
$r->print(<<ENDDISHEADER); |
|
<script> |
|
function checkall() { |
|
for (i=0; i<document.forms.disall.elements.length; i++) { |
|
if |
|
(document.forms.disall.elements[i].name.indexOf('delmark_')==0) { |
|
document.forms.disall.elements[i].checked=true; |
|
} |
|
} |
|
} |
|
|
|
function uncheckall() { |
|
for (i=0; i<document.forms.disall.elements.length; i++) { |
|
if |
|
(document.forms.disall.elements[i].name.indexOf('delmark_')==0) { |
|
document.forms.disall.elements[i].checked=false; |
|
} |
|
} |
|
} |
|
</script> |
|
ENDDISHEADER |
|
$r->print( |
|
'<h1>Display All Messages</h1><form method=post name=disall '. |
|
'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 { |
foreach (sort split(/\&/,&Apache::lonnet::reply('keys:'. |
|
$ENV{'user.domain'}.':'. |
|
$ENV{'user.name'}.':nohist_email', |
|
$ENV{'user.home'}))) { |
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)= |
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)= |
&Apache::lonmsg::unpackmsgid($_); |
&Apache::lonmsg::unpackmsgid($_); |
unless ($status eq 'deleted') { |
unless ($status eq 'deleted') { |
Line 278 sub disall {
|
Line 399 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>'); |
} |
} |
} sort split(/\&/,&Apache::lonnet::reply('keys:'. |
} |
$ENV{'user.domain'}.':'. |
$r->print('</table><p>'. |
$ENV{'user.name'}.':nohist_email', |
'<a href="javascript:checkall()">Check All</a> '. |
$ENV{'user.home'})); |
'<a href="javascript:uncheckall()">Uncheck All</a><p>'. |
$r->print('</table></body></html>'); |
'<input type=submit name="markeddel" value="Delete Checked">'. |
|
'</form></body></html>'); |
} |
} |
|
|
# ============================================================== Compose output |
# ============================================================== Compose output |
|
|
sub compout { |
sub compout { |
my ($r,$forwarding)=@_; |
my ($r,$forwarding,$broadcast)=@_; |
my $dispcrit=''; |
my $dispcrit=''; |
my $dissub=''; |
my $dissub=''; |
my $dismsg=''; |
my $dismsg=''; |
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 314 sub compout {
|
Line 439 sub compout {
|
$content{'sendername'}.' at '.$content{'senderdomain'}; |
$content{'sendername'}.' at '.$content{'senderdomain'}; |
} |
} |
my $defdom=$ENV{'user.domain'}; |
my $defdom=$ENV{'user.domain'}; |
$r->print(<<"ENDCOMP"); |
$r->print( |
<form action="/adm/email" method=post> |
'<form action="/adm/email" name="compemail" method=post'. |
<input type=hidden name=sendmail value=on> |
' enctype="multipart/form-data">'. |
|
'<input type=hidden name=sendmail value=on><table>'); |
|
unless (($broadcast eq 'group') || ($broadcast eq 'upload')) { |
|
$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> |
<tr><td>Domain:</td> |
<tr><td>Domain:</td> |
<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 |
|
} |
|
unless ($broadcast eq 'upload') { |
|
$r->print(<<"ENDCOMP"); |
|
<tr><td>Additional Recipients<br><tt>username\@domain,username\@domain, ... |
|
</tt></td><td> |
|
<input type=text size=50 name=additionalrec></td></tr> |
<tr><td>Subject:</td><td><input type=text size=50 name=subject value="$dissub"> |
<tr><td>Subject:</td><td><input type=text size=50 name=subject value="$dissub"> |
</td></tr></table> |
</td></tr></table> |
<textarea name=message cols=60 rows=10>$dismsg |
<textarea name=message cols=60 rows=10 wrap=hard>$dismsg |
</textarea><p> |
</textarea><p> |
$dispcrit |
$dispcrit |
<input type=submit value="$func Mail"> |
<input type=submit value="$func Mail"> |
</form> |
|
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 wrap=hard>$dismsg |
|
</textarea><p> |
|
$dispcrit |
|
<input type=submit value="Upload and send"> |
|
ENDUPLOAD |
|
} |
|
if ($broadcast eq 'group') { |
|
&discourse; |
|
} |
|
$r->print('</form>'); |
} |
} |
|
|
# ===================================================================== Handler |
# ===================================================================== Handler |
Line 345 sub handler {
|
Line 504 sub handler {
|
|
|
# --------------------------- Get query string for limited number of parameters |
# --------------------------- Get query string for limited number of parameters |
|
|
map { |
foreach (split(/&/,$ENV{'QUERY_STRING'})) { |
my ($name, $value) = split(/=/,$_); |
my ($name, $value) = split(/=/,$_); |
$value =~ tr/+/ /; |
$value =~ tr/+/ /; |
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; |
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; |
Line 358 sub handler {
|
Line 517 sub handler {
|
$ENV{'form.'.$name}=$value; |
$ENV{'form.'.$name}=$value; |
} |
} |
} |
} |
} (split(/&/,$ENV{'QUERY_STRING'})); |
} |
|
|
# --------------------------------------------------------------- Render Output |
# --------------------------------------------------------------- Render Output |
|
|
Line 392 sub handler {
|
Line 551 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 411 sub handler {
|
Line 571 sub handler {
|
&disall($r); |
&disall($r); |
} |
} |
} elsif ($ENV{'form.confirm'}) { |
} elsif ($ENV{'form.confirm'}) { |
map { |
foreach (keys %ENV) { |
if ($_=~/^form\.rec\_(.*)$/) { |
if ($_=~/^form\.rec\_(.*)$/) { |
$r->print('<b>Confirming Receipt:</b> '. |
$r->print('<b>Confirming Receipt:</b> '. |
&user_crit_received($1).'<br>'); |
&user_crit_received($1).'<br>'); |
Line 422 sub handler {
|
Line 582 sub handler {
|
&user_crit_received($msgid).'<br>'); |
&user_crit_received($msgid).'<br>'); |
&comprep($r,$msgid); |
&comprep($r,$msgid); |
} |
} |
} keys %ENV; |
} |
&discrit($r); |
&discrit($r); |
} elsif ($ENV{'form.critical'}) { |
} elsif ($ENV{'form.critical'}) { |
&discrit($r); |
&discrit($r); |
Line 432 sub handler {
|
Line 592 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; |
|
foreach (keys %ENV) { |
|
if ($_=~/^form\.delmark_(.*)$/) { |
|
&statuschange(&Apache::lonnet::unescape($1),'deleted'); |
|
$total++; |
|
} |
|
} |
|
$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); |
} elsif ($ENV{'form.compose'}) { |
} elsif ($ENV{'form.compose'}) { |
&compout($r); |
&compout($r,'',$ENV{'form.compose'}); |
} elsif ($ENV{'form.sendmail'}) { |
} elsif ($ENV{'form.sendmail'}) { |
my %content=(); |
my %content=(); |
undef %content; |
undef %content; |
Line 448 sub handler {
|
Line 618 sub handler {
|
$ENV{'form.message'}.="\n\n-- Forwarded message --\n\n". |
$ENV{'form.message'}.="\n\n-- Forwarded message --\n\n". |
$content{'message'}; |
$content{'message'}; |
} |
} |
if (($ENV{'form.critmsg'}) && |
my %toaddr=(); |
|
undef %toaddr; |
|
if ($ENV{'form.sendmode'} eq 'group') { |
|
foreach (keys %ENV) { |
|
if ($_=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) { |
|
$toaddr{$1}=''; |
|
} |
|
} |
|
} elsif ($ENV{'form.sendmode'} eq 'upload') { |
|
foreach (split(/[\n\r\f]+/,$ENV{'form.upfile'})) { |
|
my ($rec,$txt)=split(/\s*\:\s*/,$_); |
|
if ($txt) { |
|
$rec=~s/\@/\:/; |
|
$toaddr{$rec}.=$txt."\n"; |
|
} |
|
} |
|
} else { |
|
$toaddr{$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}}=''; |
|
} |
|
if ($ENV{'form.additionalrec'}) { |
|
foreach (split(/\,/,$ENV{'form.additionalrec'})) { |
|
my ($auname,$audom)=split(/\@/,$_); |
|
$toaddr{$auname.':'.$audom}=''; |
|
} |
|
} |
|
foreach (keys %toaddr) { |
|
my ($recuname,$recdomain)=split(/\:/,$_); |
|
my $msgtxt=$ENV{'form.message'}; |
|
if ($toaddr{$_}) { $msgtxt.='<hr>'.$toaddr{$_}; } |
|
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($ENV{'form.recuname'}, |
&user_crit_msg($recuname,$recdomain, |
$ENV{'form.recdomain'}, |
|
$ENV{'form.subject'}, |
$ENV{'form.subject'}, |
$ENV{'form.message'}, |
$msgtxt, |
$content{'citation'})); |
$ENV{'form.sendbck'})); |
} else { |
} else { |
$r->print('Sending: '.&user_normal_msg($ENV{'form.recuname'}, |
$r->print('Sending: '.&user_normal_msg($recuname,$recdomain, |
$ENV{'form.recdomain'}, |
|
$ENV{'form.subject'}, |
$ENV{'form.subject'}, |
$ENV{'form.message'}, |
$msgtxt, |
$content{'citation'})); |
$content{'citation'})); |
} |
} |
|
$r->print('<br>'); |
|
} |
if ($ENV{'form.displayedcrit'}) { |
if ($ENV{'form.displayedcrit'}) { |
&discrit($r); |
&discrit($r); |
} else { |
} else { |
Line 477 sub handler {
|
Line 676 sub handler {
|
} |
} |
# ================================================= Main program, reset counter |
# ================================================= Main program, reset counter |
|
|
sub BEGIN { |
BEGIN { |
$msgcount=0; |
$msgcount=0; |
} |
} |
|
|