Annotation of loncom/interface/lonmsg.pm, revision 1.20
1.1 www 1: # The LearningOnline Network with CAPA
2: #
3: # Routines for messaging
4: #
5: # (Routines to control the menu
6: #
7: # (TeX Conversion Module
8: #
9: # 05/29/00,05/30 Gerd Kortemeyer)
10: #
11: # 10/05 Gerd Kortemeyer)
12: #
1.6 www 13: # 10/19,10/20,10/30,
14: # 02/06/01 Gerd Kortemeyer
1.11 www 15: # 07/27 Guy Albertelli
1.20 ! www 16: # 07/27,07/28,07/30,08/03,08/06,08/08,08/09,08/10,8/13 Gerd Kortemeyer
1.1 www 17:
18: package Apache::lonmsg;
19:
20: use strict;
21: use Apache::lonnet();
1.2 www 22: use vars qw($msgcount);
23: use HTML::TokeParser;
1.5 www 24: use Apache::Constants qw(:common);
1.1 www 25:
26: # ===================================================================== Package
27:
1.3 www 28: sub packagemsg {
1.7 www 29: my ($subject,$message,$citation)=@_;
1.1 www 30: $message=~s/\</\<\;/g;
31: $message=~s/\>/\>\;/g;
1.7 www 32: $citation=~s/\</\<\;/g;
33: $citation=~s/\>/\>\;/g;
1.1 www 34: $subject=~s/\</\<\;/g;
35: $subject=~s/\>/\>\;/g;
1.2 www 36: my $now=time;
37: $msgcount++;
1.6 www 38: my $partsubj=$subject;
39: $partsubj=&Apache::lonnet::escape($partsubj);
40: $partsubj=substr($partsubj,0,50);
41: my $msgid=&Apache::lonnet::escape(
42: $now.':'.$partsubj.':'.$ENV{'user.name'}.':'.
43: $ENV{'user.domain'}.':'.$msgcount.':'.$$);
1.2 www 44: return $msgid,
45: '<sendername>'.$ENV{'user.name'}.'</sendername>'.
1.1 www 46: '<senderdomain>'.$ENV{'user.domain'}.'</senderdomain>'.
47: '<subject>'.$subject.'</subject>'.
1.2 www 48: '<time>'.localtime($now).'</time>'.
1.1 www 49: '<servername>'.$ENV{'SERVER_NAME'}.'</servername>'.
50: '<host>'.$ENV{'HTTP_HOST'}.'</host>'.
51: '<client>'.$ENV{'REMOTE_ADDR'}.'</client>'.
52: '<browsertype>'.$ENV{'browser.type'}.'</browsertype>'.
53: '<browseros>'.$ENV{'browser.os'}.'</browseros>'.
54: '<browserversion>'.$ENV{'browser.version'}.'</browserversion>'.
55: '<browsermathml>'.$ENV{'browser.mathml'}.'</browsermathml>'.
56: '<browserraw>'.$ENV{'HTTP_USER_AGENT'}.'</browserraw>'.
57: '<courseid>'.$ENV{'request.course.id'}.'</courseid>'.
58: '<role>'.$ENV{'request.role'}.'</role>'.
59: '<resource>'.$ENV{'request.filename'}.'</resource>'.
1.2 www 60: '<msgid>'.$msgid.'</msgid>'.
1.7 www 61: '<message>'.$message.'</message>'.
62: '<citation>'.$citation.'</citation>';
1.1 www 63: }
64:
1.2 www 65: # ================================================== Unpack message into a hash
66:
1.3 www 67: sub unpackagemsg {
1.2 www 68: my $message=shift;
69: my %content=();
70: my $parser=HTML::TokeParser->new(\$message);
71: my $token;
72: while ($token=$parser->get_token) {
73: if ($token->[0] eq 'S') {
74: my $entry=$token->[1];
75: my $value=$parser->get_text('/'.$entry);
76: $content{$entry}=$value;
77: }
78: }
79: return %content;
80: }
81:
1.6 www 82: # ======================================================= Get info out of msgid
83:
84: sub unpackmsgid {
1.7 www 85: my $msgid=&Apache::lonnet::unescape(shift);
1.6 www 86: my ($sendtime,$shortsubj,$fromname,$fromdomain)=split(/\:/,
1.7 www 87: &Apache::lonnet::unescape($msgid));
1.8 albertel 88: my %status=&Apache::lonnet::get('email_status',[$msgid]);
1.6 www 89: if ($status{$msgid}=~/^error\:/) { $status{$msgid}=''; }
90: unless ($status{$msgid}) { $status{$msgid}='new'; }
91: return ($sendtime,$shortsubj,$fromname,$fromdomain,$status{$msgid});
92: }
93:
1.1 www 94: # =============================== Automated message to the author of a resource
95:
96: sub author_res_msg {
97: my ($filename,$message)=@_;
1.2 www 98: unless ($message) { return 'empty'; }
1.1 www 99: $filename=&Apache::lonnet::declutter($filename);
100: my ($domain,$author,@dummy)=split(/\//,$filename);
101: my $homeserver=&Apache::lonnet::homeserver($author,$domain);
102: if ($homeserver ne 'no_host') {
103: my $id=unpack("%32C*",$message);
1.2 www 104: my $msgid;
1.3 www 105: ($msgid,$message)=&packagemsg($filename,$message);
106: return &Apache::lonnet::reply('put:'.$domain.':'.$author.
107: ':nohist_res_msgs:'.
108: &Apache::lonnet::escape($filename.'_'.$id).'='.
109: &Apache::lonnet::escape($message),$homeserver);
1.1 www 110: }
1.2 www 111: return 'no_host';
1.1 www 112: }
113:
114: # ================================================== Critical message to a user
115:
116: sub user_crit_msg {
117: my ($user,$domain,$subject,$message)=@_;
1.2 www 118: # Check if allowed missing
119: my $status='';
120: my $msgid='undefined';
121: unless (($message)&&($user)&&($domain)) { $status='empty'; };
122: my $homeserver=&Apache::lonnet::homeserver($user,$domain);
123: if ($homeserver ne 'no_host') {
124: my $msgid;
1.3 www 125: ($msgid,$message)=&packagemsg($subject,$message);
1.4 www 126: $status=&Apache::lonnet::critical(
127: 'put:'.$domain.':'.$user.':critical:'.
128: &Apache::lonnet::escape($msgid).'='.
129: &Apache::lonnet::escape($message),$homeserver);
1.2 www 130: } else {
131: $status='no_host';
132: }
133: &Apache::lonnet::logthis(
1.4 www 134: 'Sending critical email '.$msgid.
1.2 www 135: ', log status: '.
136: &Apache::lonnet::log($ENV{'user.domain'},$ENV{'user.name'},
137: $ENV{'user.home'},
138: 'Sending critical '.$msgid.' to '.$user.' at '.$domain.' with status: '
1.4 www 139: .$status));
1.2 www 140: return $status;
141: }
142:
143: # =================================================== Critical message received
144:
145: sub user_crit_received {
1.12 www 146: my $msgid=shift;
147: my %message=&Apache::lonnet::get('critical',[$msgid]);
148: my %contents=&unpackagemsg($message{$msgid});
1.5 www 149: my $status='rec: '.
150: &user_normal_msg($contents{'sendername'},$contents{'senderdomain'},
1.4 www 151: 'Receipt: '.$ENV{'user.name'}.' at '.$ENV{'user.domain'},
152: 'User '.$ENV{'user.name'}.' at '.$ENV{'user.domain'}.
153: ' acknowledged receipt of message "'.
154: $contents{'subject'}.'" dated '.$contents{'time'}.".\n\n"
155: .'Message ID: '.$contents{'msgid'});
1.5 www 156: $status.=' trans: '.
1.12 www 157: &Apache::lonnet::put(
158: 'nohist_email',{$contents{'msgid'} => $message{$msgid}});
1.5 www 159: $status.=' del: '.
1.9 albertel 160: &Apache::lonnet::del('critical',[$contents{'msgid'}]);
1.5 www 161: &Apache::lonnet::log($ENV{'user.domain'},$ENV{'user.name'},
162: $ENV{'user.home'},'Received critical message '.
163: $contents{'msgid'}.
164: ', '.$status);
1.12 www 165: return $status;
1.2 www 166: }
167:
168: # ======================================================== Normal communication
169:
170: sub user_normal_msg {
1.7 www 171: my ($user,$domain,$subject,$message,$citation)=@_;
1.2 www 172: # Check if allowed missing
173: my $status='';
174: my $msgid='undefined';
175: unless (($message)&&($user)&&($domain)) { $status='empty'; };
176: my $homeserver=&Apache::lonnet::homeserver($user,$domain);
177: if ($homeserver ne 'no_host') {
178: my $msgid;
1.7 www 179: ($msgid,$message)=&packagemsg($subject,$message,$citation);
1.4 www 180: $status=&Apache::lonnet::critical(
181: 'put:'.$domain.':'.$user.':nohist_email:'.
182: &Apache::lonnet::escape($msgid).'='.
183: &Apache::lonnet::escape($message),$homeserver);
1.2 www 184: } else {
185: $status='no_host';
186: }
187: &Apache::lonnet::log($ENV{'user.domain'},$ENV{'user.name'},
188: $ENV{'user.home'},
189: 'Sending '.$msgid.' to '.$user.' at '.$domain.' with status: '.$status);
190: return $status;
191: }
192:
1.7 www 193: # =============================================================== Status Change
194:
195: sub statuschange {
196: my ($msgid,$newstatus)=@_;
1.8 albertel 197: my %status=&Apache::lonnet::get('email_status',[$msgid]);
1.7 www 198: if ($status{$msgid}=~/^error\:/) { $status{$msgid}=''; }
199: unless ($status{$msgid}) { $status{$msgid}='new'; }
200: unless (($status{$msgid} eq 'replied') ||
201: ($status{$msgid} eq 'forwarded')) {
1.10 albertel 202: &Apache::lonnet::put('email_status',{$msgid => $newstatus});
1.7 www 203: }
1.14 www 204: if (($newstatus eq 'deleted') || ($newstatus eq 'new')) {
205: &Apache::lonnet::put('email_status',{$msgid => $newstatus});
206: }
1.7 www 207: }
1.14 www 208:
1.17 www 209: # ======================================================= Display a course list
210:
211: sub discourse {
212: my $r=shift;
213: my %courselist=&Apache::lonnet::dump(
214: 'classlist',
215: $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
216: $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
217: my $now=time;
218: $r->print(<<ENDDISHEADER);
219: <input type=hidden name=sendmode value=group>
220: <script>
221: function checkall() {
222: for (i=0; i<document.forms.compemail.elements.length; i++) {
223: if
224: (document.forms.compemail.elements[i].name.indexOf('send_to_')==0) {
225: document.forms.compemail.elements[i].checked=true;
226: }
227: }
228: }
229:
1.19 www 230: function checksec() {
231: for (i=0; i<document.forms.compemail.elements.length; i++) {
232: if
233: (document.forms.compemail.elements[i].name.indexOf
234: ('send_to_&&&'+document.forms.compemail.chksec.value)==0) {
235: document.forms.compemail.elements[i].checked=true;
236: }
237: }
238: }
239:
1.17 www 240: function uncheckall() {
241: for (i=0; i<document.forms.compemail.elements.length; i++) {
242: if
243: (document.forms.compemail.elements[i].name.indexOf('send_to_')==0) {
244: document.forms.compemail.elements[i].checked=false;
245: }
246: }
247: }
248: </script>
1.19 www 249: <input type=button onClick="checkall()" value="Check for All">
250: <input type=button onClick="checksec()" value="Check for Section/Group">
251: <input type=text size=5 name=chksec>
1.17 www 252: <input type=button onClick="uncheckall()" value="Check for None">
253: <p>
254: ENDDISHEADER
255: map {
256: my ($end,$start)=split(/\:/,$courselist{$_});
257: my $active=1;
258: if (($end) && ($now>$end)) { $active=0; }
259: if ($active) {
260: my ($sname,$sdom)=split(/\:/,$_);
261: my %reply=&Apache::lonnet::get('environment',
262: ['firstname','middlename','lastname','generation'],
263: $sdom,$sname);
1.19 www 264: my $section=&Apache::lonnet::usection
265: ($sdom,$sname,$ENV{'request.course.id'});
266: $r->print(
267: '<br><input type=checkbox name="send_to_&&&'.$section.'&&&_'.$_.'"> '.
1.17 www 268: $reply{'firstname'}.' '.
269: $reply{'middlename'}.' '.
270: $reply{'lastname'}.' '.
271: $reply{'generation'}.
1.19 www 272: ' ('.$_.') '.$section);
1.17 www 273: }
274: } sort keys %courselist;
275: }
276:
1.13 www 277: # ==================================================== Display Critical Message
1.5 www 278:
1.12 www 279: sub discrit {
280: my $r=shift;
281: $r->print('<h1><font color=red>Critical Messages</font></h1>'.
282: '<form action=/adm/email method=post>'.
283: '<input type=hidden name=confirm value=true>');
284: my %what=&Apache::lonnet::dump('critical');
285: map {
286: my %content=&unpackagemsg($what{$_});
287: $content{'message'}=~s/\n/\<br\>/g;
288: $r->print('<hr>From: <b>'.$content{'sendername'}.'@'.
289: $content{'senderdomain'}.'</b> ('.$content{'time'}.
290: ')<br><blockquote>'.$content{'message'}.'</blockquote>'.
1.13 www 291: '<input type=submit name="rec_'.$_.'" value="Confirm Receipt">'.
292: '<input type=submit name="reprec_'.$_.'" value="Confirm Receipt and Reply">');
1.12 www 293: } sort keys %what;
1.16 www 294: $r->print(
295: '<input type=hidden name="displayedcrit" value="true"></form>');
1.12 www 296: }
297:
1.13 www 298: # =============================================================== Compose reply
299:
300: sub comprep {
301: my ($r,$msgid)=@_;
302: my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
303: my %content=&unpackagemsg($message{$msgid});
304: my $quotemsg='> '.$content{'message'};
305: $quotemsg=~s/\r/\n/g;
306: $quotemsg=~s/\f/\n/g;
307: $quotemsg=~s/\n+/\n\> /g;
308: my $subject='Re: '.$content{'subject'};
309: my $dispcrit='';
310: if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
311: $dispcrit=
312: '<input type=checkbox name=critmsg> Send as critical message<p>';
313: }
314: $r->print(<<"ENDREPLY");
315: <form action="/adm/email" method=post>
316: <input type=hidden name=sendreply value="$msgid">
317: Subject: <input type=text size=50 name=subject value="$subject"><p>
318: <textarea name=message cols=60 rows=10>
319: $quotemsg
320: </textarea><p>
321: $dispcrit
322: <input type=submit value="Send Reply">
323: </form>
324: ENDREPLY
325: }
326:
1.15 www 327: # ======================================================== Display all messages
328:
1.14 www 329: sub disall {
330: my $r=shift;
331: $r->print('<h1>Display All Messages</h1>'.
332: '<table border=2><tr><th colspan=2> </th><th>Date</th>'.
333: '<th>Username</th><th>Domain</th><th>Subject</th><th>Status</th></tr>');
334: map {
335: my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)=
336: &Apache::lonmsg::unpackmsgid($_);
337: unless ($status eq 'deleted') {
338: if ($status eq 'new') {
339: $r->print('<tr bgcolor="#FFBB77">');
340: } elsif ($status eq 'read') {
341: $r->print('<tr bgcolor="#BBBB77">');
342: } elsif ($status eq 'replied') {
343: $r->print('<tr bgcolor="#AAAA88">');
344: } else {
345: $r->print('<tr bgcolor="#99BBBB">');
346: }
347: $r->print('<td><a href="/adm/email?display='.$_.
348: '">Open</a></td><td><a href="/adm/email?markdel='.$_.
349: '">Delete</a></td><td>'.localtime($sendtime).'</td><td>'.
350: $fromname.'</td><td>'.$fromdomain.'</td><td>'.
351: &Apache::lonnet::unescape($shortsubj).'</td><td>'.
352: $status.'</td></tr>');
353: }
354: } sort split(/\&/,&Apache::lonnet::reply('keys:'.
355: $ENV{'user.domain'}.':'.
356: $ENV{'user.name'}.':nohist_email',
357: $ENV{'user.home'}));
358: $r->print('</table></body></html>');
359: }
360:
1.15 www 361: # ============================================================== Compose output
362:
363: sub compout {
1.17 www 364: my ($r,$forwarding,$broadcast)=@_;
1.15 www 365: my $dispcrit='';
366: my $dissub='';
367: my $dismsg='';
368: my $func='Send New';
369: if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
370: $dispcrit=
371: '<input type=checkbox name=critmsg> Send as critical message<p>';
372: }
373: if ($forwarding) {
374: $dispcrit.='<input type=hidden name=forwid value="'.
375: $forwarding.'">';
376: $func='Forward';
377: my %message=&Apache::lonnet::get('nohist_email',[$forwarding]);
378: my %content=&unpackagemsg($message{$forwarding});
379:
380: $dissub='Forwarding: '.$content{'subject'};
381: $dismsg='Forwarded message from '.
382: $content{'sendername'}.' at '.$content{'senderdomain'};
383: }
384: my $defdom=$ENV{'user.domain'};
1.17 www 385: $r->print('<form action="/adm/email" name="compemail" method=post>'.
386: '<input type=hidden name=sendmail value=on><table>');
387: unless ($broadcast eq 'group') {
388: $r->print(<<"ENDREC");
1.15 www 389: <table>
390: <tr><td>Username:</td><td><input type=text size=12 name=recuname></td></tr>
391: <tr><td>Domain:</td>
392: <td><input type=text size=12 name=recdomain value="$defdom"></td></tr>
1.17 www 393: ENDREC
394: }
395: $r->print(<<"ENDCOMP");
1.20 ! www 396: <tr><td>Additional Recipients<br><tt>username\@domain,username\@domain, ...
! 397: </tt></td><td>
! 398: <input type=text size=50 name=additionalrec></td></tr>
1.15 www 399: <tr><td>Subject:</td><td><input type=text size=50 name=subject value="$dissub">
400: </td></tr></table>
401: <textarea name=message cols=60 rows=10>$dismsg
402: </textarea><p>
403: $dispcrit
404: <input type=submit value="$func Mail">
405: ENDCOMP
1.17 www 406: if ($broadcast eq 'group') {
407: &discourse;
408: }
409: $r->print('</form>');
1.15 www 410: }
411:
1.13 www 412: # ===================================================================== Handler
413:
1.5 www 414: sub handler {
415: my $r=shift;
416:
417: # ----------------------------------------------------------- Set document type
418:
419: $r->content_type('text/html');
420: $r->send_http_header;
421:
422: return OK if $r->header_only;
423:
1.6 www 424: # --------------------------- Get query string for limited number of parameters
425:
426: map {
427: my ($name, $value) = split(/=/,$_);
428: $value =~ tr/+/ /;
429: $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
430: if (($name eq 'display') || ($name eq 'replyto') ||
1.14 www 431: ($name eq 'forward') || ($name eq 'markread') ||
432: ($name eq 'markdel') || ($name eq 'markunread') ||
1.12 www 433: ($name eq 'sendreply') || ($name eq 'compose') ||
434: ($name eq 'sendmail') || ($name eq 'critical')) {
1.6 www 435: unless ($ENV{'form.'.$name}) {
436: $ENV{'form.'.$name}=$value;
437: }
438: }
439: } (split(/&/,$ENV{'QUERY_STRING'}));
440:
1.5 www 441: # --------------------------------------------------------------- Render Output
442:
443: $r->print('<html><head><title>EMail and Messaging</title></head>');
1.7 www 444: $r->print(
445: '<body bgcolor="#FFFFFF"><img align=right src=/adm/lonIcons/lonlogos.gif>');
1.5 www 446: $r->print('<h1>EMail</h1>');
1.6 www 447: if ($ENV{'form.display'}) {
1.7 www 448: my $msgid=$ENV{'form.display'};
449: &statuschange($msgid,'read');
1.8 albertel 450: my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
1.7 www 451: my %content=&unpackagemsg($message{$msgid});
452: $r->print('<b>Subject:</b> '.$content{'subject'}.
453: '<br><b>From:</b> '.$content{'sendername'}.' at '.
454: $content{'senderdomain'}.
1.14 www 455: '<br><b>Time:</b> '.$content{'time'}.'<p>'.
456: '<table border=2><tr bgcolor="#FFFFAA"><td>Functions:</td>'.
457: '<td><a href="/adm/email?replyto='.&Apache::lonnet::escape($msgid).
458: '"><b>Reply</b></a></td>'.
1.15 www 459: '<td><a href="/adm/email?forward='.&Apache::lonnet::escape($msgid).
1.14 www 460: '"><b>Forward</b></a></td>'.
1.15 www 461: '<td><a href="/adm/email?markunread='.&Apache::lonnet::escape($msgid).
462: '"><b>Mark Unread</b></a></td>'.
463: '<td><a href="/adm/email"><b>Display all Messages</b></a></td>'.
1.14 www 464: '</tr></table><p><pre>'.
1.7 www 465: $content{'message'}.'</pre><hr>'.$content{'citation'});
1.6 www 466: } elsif ($ENV{'form.replyto'}) {
1.13 www 467: &comprep($r,$ENV{'form.replyto'});
1.7 www 468: } elsif ($ENV{'form.sendreply'}) {
469: my $msgid=$ENV{'form.sendreply'};
1.8 albertel 470: my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
1.7 www 471: my %content=&unpackagemsg($message{$msgid});
472: &statuschange($msgid,'replied');
1.12 www 473: if (($ENV{'form.critmsg'}) &&
474: (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
475: $r->print('Sending critical: '.
476: &user_crit_msg($content{'sendername'},
1.7 www 477: $content{'senderdomain'},
478: $ENV{'form.subject'},
479: $ENV{'form.message'}));
1.12 www 480: } else {
481: $r->print('Sending: '.&user_normal_msg($content{'sendername'},
482: $content{'senderdomain'},
483: $ENV{'form.subject'},
484: $ENV{'form.message'}));
485: }
1.14 www 486: if ($ENV{'form.displayedcrit'}) {
487: &discrit($r);
488: } else {
489: &disall($r);
490: }
1.12 www 491: } elsif ($ENV{'form.confirm'}) {
492: map {
493: if ($_=~/^form\.rec\_(.*)$/) {
494: $r->print('<b>Confirming Receipt:</b> '.
495: &user_crit_received($1).'<br>');
1.13 www 496: }
497: if ($_=~/^form\.reprec\_(.*)$/) {
498: my $msgid=$1;
499: $r->print('<b>Confirming Receipt:</b> '.
500: &user_crit_received($msgid).'<br>');
501: &comprep($r,$msgid);
1.12 www 502: }
503: } keys %ENV;
504: &discrit($r);
505: } elsif ($ENV{'form.critical'}) {
506: &discrit($r);
1.6 www 507: } elsif ($ENV{'form.forward'}) {
1.15 www 508: &compout($r,$ENV{'form.forward'});
1.14 www 509: } elsif ($ENV{'form.markread'}) {
510: } elsif ($ENV{'form.markdel'}) {
511: &statuschange($ENV{'form.markdel'},'deleted');
512: &disall($r);
513: } elsif ($ENV{'form.markunread'}) {
1.15 www 514: &statuschange($ENV{'form.markunread'},'new');
515: &disall($r);
1.11 www 516: } elsif ($ENV{'form.compose'}) {
1.17 www 517: &compout($r,'',$ENV{'form.compose'});
1.11 www 518: } elsif ($ENV{'form.sendmail'}) {
1.16 www 519: my %content=();
520: undef %content;
521: if ($ENV{'form.forwid'}) {
522: my $msgid=$ENV{'form.forwid'};
523: my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
524: %content=&unpackagemsg($message{$msgid});
525: &statuschange($msgid,'forwarded');
526: $ENV{'form.message'}.="\n\n-- Forwarded message --\n\n".
527: $content{'message'};
528: }
1.18 www 529: my %toaddr=();
530: undef %toaddr;
531: if ($ENV{'form.sendmode'} eq 'group') {
532: map {
1.19 www 533: if ($_=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) {
1.18 www 534: $toaddr{$1}=1;
535: }
536: } keys %ENV;
537: } else {
538: $toaddr{$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}}=1;
1.20 ! www 539: }
! 540: if ($ENV{'form.additionalrec'}) {
! 541: map {
! 542: my ($auname,$audom)=split(/\@/,$_);
! 543: $toaddr{$auname.':'.$audom}=1;
! 544: } split(/\,/,$ENV{'form.additionalrec'});
1.18 www 545: }
546: map {
547: my ($recuname,$recdomain)=split(/\:/,$_);
1.16 www 548: if (($ENV{'form.critmsg'}) &&
549: (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
550: $r->print('Sending critical: '.
1.18 www 551: &user_crit_msg($recuname,$recdomain,
1.16 www 552: $ENV{'form.subject'},
553: $ENV{'form.message'},
554: $content{'citation'}));
555: } else {
1.18 www 556: $r->print('Sending: '.&user_normal_msg($recuname,$recdomain,
1.16 www 557: $ENV{'form.subject'},
558: $ENV{'form.message'},
559: $content{'citation'}));
560: }
1.18 www 561: $r->print('<br>');
562: } keys %toaddr;
1.16 www 563: if ($ENV{'form.displayedcrit'}) {
564: &discrit($r);
565: } else {
566: &disall($r);
567: }
1.6 www 568: } else {
1.14 www 569: &disall($r);
1.6 www 570: }
1.5 www 571: $r->print('</body></html>');
572: return OK;
573:
574: }
1.2 www 575: # ================================================= Main program, reset counter
576:
577: sub BEGIN {
578: $msgcount=0;
1.1 www 579: }
580:
581: 1;
582: __END__
583:
584:
585:
586:
587:
588:
589:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>