'.&mt('Functions').': | '.
- ''.&mt('Reply').' | '.
- ''.&mt('Forward').' | '.
- ''.&mt('Mark Unread').' | '.
- ''.&mt('Delete').' | '.
''.
$content{'baseurl'}.' ('.&Apache::lonnet::gettitle($content{'baseurl'}).')':'').
@@ -1652,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
@@ -1682,14 +1819,14 @@ sub storecomment {
$cleanmsgtxt.=$_."\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\:/) {
@@ -1714,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;
@@ -1734,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 my $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);
@@ -1750,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}='';
+ if (($auname ne "") && ($audom ne "")) {
+ $toaddr{$auname.':'.$audom}='';
+ }
}
}
@@ -1822,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') {
@@ -1879,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)").'');
}
}
@@ -1905,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','group']);
+ 'showcommentbaseurl','dismode','group','subject','text','ref']);
$sqs='&sortedby='.$env{'form.sortedby'};
# ------------------------------------------------------ They checked for email
@@ -1927,7 +2095,7 @@ sub handler {
unless ($folder) {
$folder='';
} else {
- $sqs.='&folder='.&Apache::lonnet::escape($folder);
+ $sqs.='&folder='.&escape($folder);
}
# ------------------------------------------------------------ Get Display Mode
@@ -1935,7 +2103,7 @@ sub handler {
unless ($dismode) {
$dismode='';
} else {
- $sqs.='&dismode='.&Apache::lonnet::escape($dismode);
+ $sqs.='&dismode='.&escape($dismode);
}
# --------------------------------------------------------------------- Display
@@ -1971,6 +2139,7 @@ sub handler {
&compout($r,'',$env{'form.replyto'},undef,undef,$folder,$dismode);
} elsif ($env{'form.confirm'}) {
&printheader($r,'','Confirmed Receipt');
+ my $replying = 0;
foreach (keys %env) {
if ($_=~/^form\.rec\_(.*)$/) {
$r->print(''.&mt('Confirming Receipt').': '.
@@ -1981,9 +2150,12 @@ sub handler {
$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);
@@ -2005,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++;
@@ -2032,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++;
@@ -2069,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'});
@@ -2105,9 +2279,3 @@ sub handler {
__END__
-
-
-
-
-
-
|