--- loncom/interface/lonmsg.pm 2001/08/09 14:57:33 1.17 +++ loncom/interface/lonmsg.pm 2001/10/01 19:24:49 1.23 @@ -13,7 +13,8 @@ # 10/19,10/20,10/30, # 02/06/01 Gerd Kortemeyer # 07/27 Guy Albertelli -# 07/27,07/28,07/30,08/03,08/06,08/08,08/09 Gerd Kortemeyer +# 07/27,07/28,07/30,08/03,08/06,08/08,08/09,08/10,8/13,8/15, +# 10/1 Gerd Kortemeyer package Apache::lonmsg; @@ -121,7 +122,6 @@ sub user_crit_msg { unless (($message)&&($user)&&($domain)) { $status='empty'; }; my $homeserver=&Apache::lonnet::homeserver($user,$domain); if ($homeserver ne 'no_host') { - my $msgid; ($msgid,$message)=&packagemsg($subject,$message); $status=&Apache::lonnet::critical( 'put:'.$domain.':'.$user.':critical:'. @@ -175,7 +175,6 @@ sub user_normal_msg { unless (($message)&&($user)&&($domain)) { $status='empty'; }; my $homeserver=&Apache::lonnet::homeserver($user,$domain); if ($homeserver ne 'no_host') { - my $msgid; ($msgid,$message)=&packagemsg($subject,$message,$citation); $status=&Apache::lonnet::critical( 'put:'.$domain.':'.$user.':nohist_email:'. @@ -227,6 +226,16 @@ sub discourse { } } + function checksec() { + for (i=0; i - +  + + 

ENDDISHEADER @@ -249,12 +260,15 @@ ENDDISHEADER my %reply=&Apache::lonnet::get('environment', ['firstname','middlename','lastname','generation'], $sdom,$sname); - $r->print('
'. + my $section=&Apache::lonnet::usection + ($sdom,$sname,$ENV{'request.course.id'}); + $r->print( + '
'. $reply{'firstname'}.' '. $reply{'middlename'}.' '. $reply{'lastname'}.' '. $reply{'generation'}. - ' ('.$_.')'); + ' ('.$_.') '.$section); } } sort keys %courselist; } @@ -300,7 +314,7 @@ sub comprep {

Subject:

-

$dispcrit @@ -367,9 +381,11 @@ sub compout { $content{'sendername'}.' at '.$content{'senderdomain'}; } my $defdom=$ENV{'user.domain'}; - $r->print(''. + $r->print( + ''. ''); - unless ($broadcast eq 'group') { + unless (($broadcast eq 'group') || ($broadcast eq 'upload')) { $r->print(<<"ENDREC");
@@ -377,14 +393,39 @@ sub compout { ENDREC } - $r->print(<<"ENDCOMP"); + unless ($broadcast eq 'upload') { + $r->print(<<"ENDCOMP"); +
Username:
Additional Recipients
username\@domain,username\@domain, ... +
+
Subject:
-

$dispcrit ENDCOMP + } + if ($broadcast eq 'upload') { + $r->print(< +

Generate messages from a file

+Subject: +
+username1\@domain1: text
+username2\@domain2: text
+username1\@domain1: text
+
+The messages will be assembled from all lines with the respective +username\@domain, and appended to the general message text.

+

+General message text:

+

+$dispcrit + +ENDUPLOAD + } if ($broadcast eq 'group') { &discourse; } @@ -508,21 +549,50 @@ sub handler { $ENV{'form.message'}.="\n\n-- Forwarded message --\n\n". $content{'message'}; } + my %toaddr=(); + undef %toaddr; + if ($ENV{'form.sendmode'} eq 'group') { + map { + if ($_=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) { + $toaddr{$1}=''; + } + } 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 { + $toaddr{$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}}=''; + } + if ($ENV{'form.additionalrec'}) { + map { + my ($auname,$audom)=split(/\@/,$_); + $toaddr{$auname.':'.$audom}=''; + } split(/\,/,$ENV{'form.additionalrec'}); + } + map { + my ($recuname,$recdomain)=split(/\:/,$_); + my $msgtxt=$ENV{'form.message'}; + if ($toaddr{$_}) { $msgtxt.='


'.$toaddr{$_}; } if (($ENV{'form.critmsg'}) && (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { $r->print('Sending critical: '. - &user_crit_msg($ENV{'form.recuname'}, - $ENV{'form.recdomain'}, + &user_crit_msg($recuname,$recdomain, $ENV{'form.subject'}, - $ENV{'form.message'}, + $msgtxt, $content{'citation'})); } else { - $r->print('Sending: '.&user_normal_msg($ENV{'form.recuname'}, - $ENV{'form.recdomain'}, + $r->print('Sending: '.&user_normal_msg($recuname,$recdomain, $ENV{'form.subject'}, - $ENV{'form.message'}, + $msgtxt, $content{'citation'})); } + $r->print('
'); + } keys %toaddr; if ($ENV{'form.displayedcrit'}) { &discrit($r); } else {