'.&mt('Functions').': | '.
- ''.&mt('Reply').' | '.
- ''.&mt('Forward').' | '.
- ''.&mt('Mark Unread').' | '.
- ''.&mt('Delete').' | '.
''.
$content{'baseurl'}.' ('.&Apache::lonnet::gettitle($content{'baseurl'}).')':'').
@@ -1638,13 +1790,12 @@ sub header {
my $extra = &Apache::loncommon::studentbrowser_javascript();
if ($baseurl) {
- $extra .= "";
+ $extra .= "";
}
$r->print(&Apache::loncommon::start_page('Communication and Messages',
- $extra));
+ $extra));
$r->print(&Apache::lonhtmlcommon::breadcrumbs
- (undef,($title?$title:'Communication and Messages')));
-
+ (($title?$title:'Communication and Messages')));
}
# ---------------------------------------------------------------- Print header
@@ -1663,27 +1814,27 @@ sub storecomment {
my ($r)=@_;
my $msgtxt=&Apache::lonfeedback::clear_out_html($env{'form.message'});
my $cleanmsgtxt='';
- foreach (split(/[\n\r]/,$msgtxt)) {
- unless ($_=~/^\s*(\>|\>\;)/) {
- $cleanmsgtxt.=$_."\n";
+ foreach my $line (split(/[\n\r]/,$msgtxt)) {
+ unless ($line=~/^\s*(\>|\>\;)/) {
+ $cleanmsgtxt.=$line."\n";
}
}
- my $key=&Apache::lonnet::escape($env{'form.baseurl'}).'___'.time;
+ my $key=&escape($env{'form.baseurl'}).'___'.time;
&Apache::lonnet::put('nohist_stored_comments',{ $key => $cleanmsgtxt });
}
sub storedcommentlisting {
my ($r)=@_;
my %msgs=&Apache::lonnet::dump('nohist_stored_comments',undef,undef,
- '^'.&Apache::lonnet::escape(&Apache::lonnet::escape($env{'form.showcommentbaseurl'})));
+ '^'.&escape(&escape($env{'form.showcommentbaseurl'})));
$r->print(&Apache::loncommon::start_page('Stored Comment Listing',undef,
{'onlybody' => 1}));
if ((keys %msgs)[0]=~/^error\:/) {
$r->print(&mt('No stored comments yet.'));
} else {
my $found=0;
- foreach (sort keys %msgs) {
- $r->print("\n".$msgs{$_}." ");
+ foreach my $key (sort(keys(%msgs))) {
+ $r->print("\n".$msgs{$key}." ");
$found=1;
}
unless ($found) {
@@ -1700,8 +1851,20 @@ sub sendoffmail {
my $sendstatus='';
my %specialmsg_status;
my $numspecial = 0;
+ my ($cdom,$cnum,$group);
+ if (exists($env{'form.group'})) {
+ $group = $env{'form.group'};
+ }
+ if (exists($env{'request.course.id'})) {
+ $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ }
if ($env{'form.send'}) {
- &printheader($r,'','Messages being sent.');
+ if ($group eq '') {
+ &printheader($r,'','Messages being sent.');
+ } else {
+ $r->print(&groupmail_header('sending',$group));
+ }
$r->rflush();
my %content=();
undef %content;
@@ -1720,13 +1883,27 @@ sub sendoffmail {
&statuschange($msgid,'replied',$folder);
}
+ my @to =
+ &Apache::loncommon::get_env_multiple('form.selectedusers_forminput');
+ my $mode = $env{'form.sendmode'};
+
my %toaddr;
- if ($env{'form.sendmode'} eq 'group') {
- foreach $address (keys(%env)) {
- if ($address=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) {
- $toaddr{$1}='';
+ if (@to) {
+ foreach my $dest (@to) {
+ my ($user,$domain) = split(/:/, $dest);
+ if (($user ne '') && ($domain ne '')) {
+ my $address = $user.":".$domain; # How the code below expects it.
+ $toaddr{$address} = '';
}
}
+ }
+
+ if ($env{'form.sendmode'} eq 'group') {
+ foreach my $address (keys(%env)) {
+ if ($address=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) {
+ $toaddr{$1}='';
+ }
+ }
} elsif ($env{'form.sendmode'} eq 'upload') {
foreach my $line (split(/[\n\r\f]+/,$env{'form.upfile'})) {
my ($rec,$txt)=split(/\s*\:\s*/,$line);
@@ -1736,12 +1913,16 @@ sub sendoffmail {
}
}
} else {
- $toaddr{$env{'form.recuname'}.':'.$env{'form.recdomain'}}='';
+ if (($env{'form.recuname'} ne '') && ($env{'form.recdomain'} ne '')) {
+ $toaddr{$env{'form.recuname'}.':'.$env{'form.recdomain'}}='';
+ }
}
if ($env{'form.additionalrec'}) {
- foreach (split(/\,/,$env{'form.additionalrec'})) {
- my ($auname,$audom)=split(/\@/,$_);
- $toaddr{$auname.':'.$audom}='';
+ foreach my $rec (split(/\,/,$env{'form.additionalrec'})) {
+ my ($auname,$audom)=split(/\@/,$rec);
+ if (($auname ne "") && ($audom ne "")) {
+ $toaddr{$auname.':'.$audom}='';
+ }
}
}
@@ -1778,7 +1959,7 @@ sub sendoffmail {
$env{'form.permanent'},
\$sentmessage{$address});
} else {
- $r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': ');
+ $r->print(&mt('Sending').' '.$recuname.':'.$recdomain.': ');
@thismsg=
&Apache::lonmsg::user_normal_msg($recuname,$recdomain,
$msgsubj,$msgtxt,
@@ -1808,22 +1989,20 @@ sub sendoffmail {
$subj_prefix = 'Broadcast.';
}
my ($specialmsgid,$specialresult);
- my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
- my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
- my $course_str = &Apache::lonnet::escape('['.$cnum.':'.$cdom.']');
+ my $course_str = &escape('['.$cnum.':'.$cdom.']');
if ($numspecial) {
$specialresult = &Apache::lonmsg::user_normal_msg_raw($cnum,$cdom,$subj_prefix.
' '.$course_str,$savemsg,undef,undef,undef,
undef,undef,\$specialmsgid);
- $specialmsgid = &Apache::lonnet::unescape($specialmsgid);
+ $specialmsgid = &unescape($specialmsgid);
}
if ($specialresult eq 'ok') {
my $record_sent;
my @recusers;
my @recudoms;
my ($stamp,$crssubj,$msgname,$msgdom,$msgcount,$context,$pid) =
- split(/\:/,&Apache::lonnet::unescape($specialmsgid));
+ split(/\:/,&unescape($specialmsgid));
foreach my $recipient (sort(keys(%toaddr))) {
if ($specialmsg_status{$recipient} eq 'ok') {
@@ -1865,12 +2044,15 @@ sub sendoffmail {
$r->print(' '.&mt('Completed.').'');
if ($env{'form.displayedcrit'}) {
&discrit($r);
+ }
+ if ($group ne '') {
+ $r->print(&groupmail_sent($group,$cdom,$cnum));
} else {
&Apache::loncommunicate::menu($r);
}
} else {
$r->print(''.&mt('Could not deliver message').' '.
- &mt('Please use the browser "Back" button and correct the recipient addresses').' ');
+ &mt('Please use the browser "Back" button and correct the recipient addresses '."($sendstatus)").'');
}
}
@@ -1891,7 +2073,7 @@ sub handler {
['display','replyto','forward','markread','markdel','markunread',
'sendreply','compose','sendmail','critical','recname','recdom',
'recordftf','sortedby','block','folder','startdis','interdis',
- 'showcommentbaseurl','dismode']);
+ 'showcommentbaseurl','dismode','group','subject','text','ref']);
$sqs='&sortedby='.$env{'form.sortedby'};
# ------------------------------------------------------ They checked for email
@@ -1913,7 +2095,7 @@ sub handler {
unless ($folder) {
$folder='';
} else {
- $sqs.='&folder='.&Apache::lonnet::escape($folder);
+ $sqs.='&folder='.&escape($folder);
}
# ------------------------------------------------------------ Get Display Mode
@@ -1921,7 +2103,7 @@ sub handler {
unless ($dismode) {
$dismode='';
} else {
- $sqs.='&dismode='.&Apache::lonnet::escape($dismode);
+ $sqs.='&dismode='.&escape($dismode);
}
# --------------------------------------------------------------------- Display
@@ -1957,19 +2139,23 @@ sub handler {
&compout($r,'',$env{'form.replyto'},undef,undef,$folder,$dismode);
} elsif ($env{'form.confirm'}) {
&printheader($r,'','Confirmed Receipt');
- foreach (keys %env) {
- if ($_=~/^form\.rec\_(.*)$/) {
+ my $replying = 0;
+ foreach my $envkey (keys(%env)) {
+ if ($envkey=~/^form\.rec\_(.*)$/) {
$r->print(''.&mt('Confirming Receipt').': '.
&Apache::lonmsg::user_crit_received($1).' ');
}
- if ($_=~/^form\.reprec\_(.*)$/) {
+ if ($envkey=~/^form\.reprec\_(.*)$/) {
my $msgid=$1;
$r->print(''.&mt('Confirming Receipt').': '.
&Apache::lonmsg::user_crit_received($msgid).' ');
&compout($r,'','','',$msgid);
+ $replying = 1;
}
}
- &discrit($r);
+ if (!$replying) {
+ &discrit($r);
+ }
} elsif ($env{'form.critical'}) {
&printheader($r,'','Displaying Critical Messages');
&discrit($r);
@@ -1991,7 +2177,7 @@ sub handler {
foreach my $key (keys(%env)) {
if ($key=~/^form\.delmark_(.*)$/) {
my ($result,$msg) =
- &movemsg(&Apache::lonnet::unescape($1),$folder,
+ &movemsg(&unescape($1),$folder,
$env{'form.movetofolder'});
if ($result) {
$total++;
@@ -2018,7 +2204,7 @@ sub handler {
foreach my $key (keys(%env)) {
if ($key=~/^form\.delmark_(.*)$/) {
my ($result,$msg) =
- &statuschange(&Apache::lonnet::unescape($1),'deleted',
+ &statuschange(&unescape($1),'deleted',
$folder);
if ($result) {
$total++;
@@ -2055,15 +2241,17 @@ sub handler {
&sendoffmail($r,$folder);
if ($env{'form.storebasecomment'}) {
&storecomment($r);
- }
+ }
if (($env{'form.rsspost'}) && ($env{'request.course.id'})) {
- &Apache::lonrss::addentry($env{'course.'.$env{'request.course.id'}.'.num'},
+ &Apache::lonrss::addentry($env{'course.'.$env{'request.course.id'}.'.num'},
$env{'course.'.$env{'request.course.id'}.'.domain'},
'Course_Announcements',
$env{'form.subject'},
$env{'form.message'},'/adm/communicate','public');
}
- &disall($r,($folder?$folder:$dismode));
+ if ((!exists($env{'form.group'})) && (!$env{'form.displayedcrit'})) {
+ &disall($r,($folder?$folder:$dismode));
+ }
} elsif ($env{'form.newfolder'}) {
&printheader($r,'','New Folder');
&makefolder($env{'form.newfolder'});
@@ -2091,9 +2279,3 @@ sub handler {
__END__
-
-
-
-
-
-
|