--- loncom/interface/lonmsgdisplay.pm 2009/02/04 20:14:45 1.111
+++ loncom/interface/lonmsgdisplay.pm 2020/01/10 05:08:39 1.191
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.111 2009/02/04 20:14:45 weissno Exp $
+# $Id: lonmsgdisplay.pm,v 1.191 2020/01/10 05:08:39 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -102,6 +102,8 @@ use HTML::TokeParser();
use Apache::Constants qw(:common);
use Apache::loncommon();
use Apache::lonhtmlcommon();
+use Apache::longroup;
+use Apache::lonnavmaps;
use Apache::lontexconvert();
use HTML::Entities();
use Apache::lonlocal;
@@ -110,31 +112,36 @@ use Apache::lonfeedback;
use Apache::lonrss();
use Apache::lonselstudent();
use lib '/home/httpd/lib/perl/';
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
# Querystring component with sorting type
-my $sqs;
-my $startdis;
+my $sqs='';
+my $startdis='';
# ============================================================ List all folders
sub folderlist {
my ($folder,$msgstatus) = @_;
- my %lt = &Apache::lonlocal::texthash(
+ my %html_lt = &Apache::lonlocal::texthash(
actn => 'Action',
fold => 'Folder',
show => 'Show',
status => 'Message Status',
go => 'Go',
+
+ );
+ &html_escape(\%html_lt);
+ my %js_lt = &Apache::lonlocal::texthash(
nnff => 'New Name for Folder',
newn => 'New Name',
- thfm => 'The folder may not be renamed',
- fmnb => 'folder may not be renamed as it is a folder provided by the system.',
- asth => 'as this name is already in use for a system-provided or user-defined folder.',
- the => 'The',
- tnfm => 'The new folder may not be named',
+ fmnb => 'Folder may not be renamed as it is a folder provided by the system.',
+ asth => 'Requested name already in use for a system-provided or user-defined folder.',
);
+ &js_escape(\%js_lt);
+
+ # set se lastvisit for the new mail check in the toplevel menu
+ &Apache::lonnet::appenv({'user.mailcheck.lastvisit'=>time});
my %actions = &Apache::lonlocal::texthash(
view => 'View Folder',
@@ -143,7 +150,7 @@ sub folderlist {
);
$actions{'select_form_order'} = ['view','rename','delete'];
- my %statushash = &get_msgstatus_types();
+ my %statushash = &Apache::lonlocal::texthash(&get_msgstatus_types());
$statushash{'select_form_order'} = ['','new','read','replied','forwarded'];
@@ -170,6 +177,7 @@ sub folderlist {
$formhash{'select_form_order'} = ['','critical',@userorder,'sent','trash'];
my $output = qq||;
my %show = ('select_form_order' => [10,20,50,100,200],
map {$_=>$_} (10,20,50,100,200));
-
-
+
$output .= '
$lt->{'ad'} ($exmpl) :
+$lt->{'ad'} ($exmpl)
@@ -1757,8 +1906,10 @@ sub retrieve_instructor_comments {
}
sub disfacetoface {
- my ($r,$user,$domain)=@_;
- my $target=$env{'form.grade_target'};
+ my ($r,$user,$domain,$target)=@_;
+ if ($target eq '') {
+ $target=$env{'form.grade_target'};
+ }
unless ($env{'request.course.id'}) { return; }
if (!&Apache::lonnet::allowed('dff',$env{'request.course.id'})
&& ! &Apache::lonnet::allowed('dff',$env{'request.course.id'}.
@@ -1774,7 +1925,9 @@ sub disfacetoface {
foreach my $key (sort(keys(%records))) {
my %content=&Apache::lonmsg::unpackagemsg($records{$key});
next if ($content{'senderdomain'} eq '');
- &Apache::lonfeedback::newline_to_br(\$content{'message'});
+ if (!&Apache::lonfeedback::contains_block_html($content{'message'})) {
+ &Apache::lonfeedback::newline_to_br(\$content{'message'});
+ }
if ($content{'subject'}=~/^Record/) {
$result.=''.&mt('Record').' ';
} elsif ($content{'subject'}=~/^Broadcast/) {
@@ -1800,8 +1953,7 @@ sub disfacetoface {
} else {
%content=&Apache::lonmsg::unpackagemsg($content{'message'});
$content{'message'} =
- ''.&mt('Subject').': '.$content{'subject'}.' '.&mt('Subject').': '.$content{'subject'}.' '.
$content{'message'};
}
} else {
@@ -1822,7 +1974,7 @@ sub disfacetoface {
&Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('.
$content{'sendername'}.':'.
$content{'senderdomain'}.') '.$content{'time'}.
- ''.
+ ''.
&Apache::lontexconvert::msgtexconverted($content{'message'}).
' ';
}
@@ -1830,12 +1982,14 @@ $content{'sendername'}.':'.
if ($result eq '') {
my $lctype = &mt(lc(&Apache::loncommon::course_type()));
if ($target ne 'tex') {
- $r->print("".&mt('No notes, face-to-face discussion records, critical messages, or broadcast messages in this [_1].',$lctype)."
");
+ $r->print("".&mt('No notes, face-to-face discussion records, critical messages or broadcast messages in this '.$lctype.'.')."
");
} else {
- $r->print('\textbf{'.&mt('No notes, face-to-face discussion records, critical messages or broadcast messages in this [_1].',$lctype).'}\\\\');
+ $r->print('\textbf{'.&mt('No notes, face-to-face discussion records, critical messages or broadcast messages in this '.$lctype.'.').'}\\\\');
}
+ } elsif ($target eq 'tex') {
+ $r->print(&Apache::lonxml::xmlparse($r,$target,$result));
} else {
- $r->print($result);
+ $r->print(''.$result.'
');
}
}
@@ -1862,8 +2016,8 @@ sub facetoface {
return;
}
my $crstype = &Apache::loncommon::course_type();
- my $leaders = ($crstype eq 'Group') ? 'coordinators and leaders'
- : 'faculty and staff';
+ my $leaders = ($crstype eq 'Community') ? 'coordinators and leaders'
+ : 'faculty and staff';
&printheader($r,
'/adm/email?recordftf=query',
"User Notes, Face-to-Face, Critical Messages, Broadcast Messages, Archived Messages");
@@ -1885,21 +2039,24 @@ sub facetoface {
'subm' => 'Retrieve discussion and message records',
'newr' => 'New Record (record is visible to '.lc($crstype).' '.$leaders.')',
'post' => 'Post this Record');
- $r->print(<<"ENDTREC");
-$lt{'head'}
-
-ENDTREC
+
+ $r->print(''.$lt{'head'}.' '
+ .''
+ );
+
if (($stage ne 'query') &&
($env{'form.recdomain'}) && ($env{'form.recuname'})) {
chomp($env{'form.newrecord'});
@@ -1908,8 +2065,17 @@ ENDTREC
$env{'form.recuname'},
$env{'form.recdomain'});
}
- $r->print(''.&Apache::loncommon::plainname($env{'form.recuname'},
- $env{'form.recdomain'}).' ');
+ my $aboutmelink=&Apache::loncommon::aboutmewrapper(
+ &Apache::loncommon::plainname($env{'form.recuname'}
+ ,$env{'form.recdomain'})
+ ,$env{'form.recuname'},$env{'form.recdomain'});
+ $r->print(' '
+ .''
+ .&mt('Discussion and message records for [_1] ([_2])'
+ ,$aboutmelink
+ ,$env{'form.recuname'}.':'.$env{'form.recdomain'})
+ .' '
+ );
&disfacetoface($r,$env{'form.recuname'},$env{'form.recdomain'});
$r->print(<
@@ -1927,304 +2093,6 @@ ENDBFORM
}
}
-# ----------------------------------------------------------- Blocking during exams
-
-sub examblock {
- my ($r,$action) = @_;
- unless ($env{'request.course.id'}) { return;}
- if (!&Apache::lonnet::allowed('dcm',$env{'request.course.id'})
- && ! &Apache::lonnet::allowed('dcm',$env{'request.course.id'}.
- '/'.$env{'request.course.sec'})) {
- $r->print('Not allowed');
- return;
- }
- my $usertype = (&Apache::loncommon::course_type() eq 'Group') ? 'members'
- : 'students';
- my %lt=&Apache::lonlocal::texthash(
- 'comb' => 'Communication Blocking',
- 'cbds' => 'Communication blocking during scheduled exams',
- 'desc' => "You can use communication blocking to prevent $usertype enrolled in this course from displaying LON-CAPA messages sent by other $usertype during an online exam. As blocking of communication could potentially interrupt legitimate communication between $usertype who are also both enrolled in a different LON-CAPA course, please be careful that you select the correct start and end times for your scheduled exam when setting or modifying these parameters.",
- 'mecb' => 'Modify existing communication blocking periods',
- 'ncbc' => 'No communication blocks currently saved',
- 'stor' => 'Save',
- );
-
- my %ltext = &Apache::lonlocal::texthash(
- 'dura' => 'Duration',
- 'setb' => 'Set by',
- 'even' => 'Event',
- 'blck' => 'Blocked?',
- 'actn' => 'Action',
- 'star' => 'Start',
- 'endd' => 'End'
- );
-
- &printheader($r,'/adm/email?block=display',$lt{'comb'});
- $r->print(''.$lt{'cbds'}.' ');
-
- if ($action eq 'store') {
- &blockstore($r);
- }
-
- $r->print($lt{'desc'}.'
-
-$end_page
-END
- return;
-}
-
-sub blockstore {
- my $r = shift;
- my %lt=&Apache::lonlocal::texthash(
- 'tfcm' => 'The following changes were made',
- 'ncwm' => 'No changes were made.'
- );
- my %adds = ();
- my %removals = ();
- my %cancels = ();
- my $modtotal = 0;
- my $canceltotal = 0;
- my $addtotal = 0;
- my %blocking = ();
- $r->print(''.$lt{'head'}.' ');
- foreach my $envkey (keys(%env)) {
- if ($envkey =~ m/^form\.modify_(\d+)$/) {
- $adds{$1} = $1;
- $removals{$1} = $1;
- $modtotal ++;
- } elsif ($envkey =~ m/^form\.cancel_(\d+)$/) {
- $cancels{$1} = $1;
- unless ( defined($removals{$1}) ) {
- $removals{$1} = $1;
- $canceltotal ++;
- }
- } elsif ($envkey =~ m/^form\.add_(\d+)$/) {
- $adds{$1} = $1;
- $addtotal ++;
- }
- }
-
- foreach my $key (keys(%removals)) {
- my $hashkey = $env{'form.key_'.$key};
- &Apache::lonnet::del('comm_block',["$hashkey"],
- $env{'course.'.$env{'request.course.id'}.'.domain'},
- $env{'course.'.$env{'request.course.id'}.'.num'}
- );
- }
- foreach my $key (keys(%adds)) {
- unless ( defined($cancels{$key}) ) {
- my ($newstart,$newend) = &get_dates_from_form($key);
- my $newkey = $newstart.'____'.$newend;
- my $blocktypes = &get_block_choices($key);
- $blocking{$newkey} = {
- setter => $env{'user.name'}.':'.$env{'user.domain'},
- event => &escape($env{'form.title_'.$key}),
- blocks => $blocktypes,
- };
- }
- }
- if ($addtotal + $modtotal > 0) {
- &Apache::lonnet::put('comm_block',\%blocking,
- $env{'course.'.$env{'request.course.id'}.'.domain'},
- $env{'course.'.$env{'request.course.id'}.'.num'}
- );
- }
- my $chgestotal = $canceltotal + $modtotal + $addtotal;
- if ($chgestotal > 0) {
- $r->print($lt{'tfcm'}.'');
- if ($canceltotal > 0) {
- $r->print(''.&mt('[quant,_1,communication blocking period was,communication blocking periods were] removed.',$canceltotal).' ');
- }
- if ($modtotal > 0) {
- $r->print(''.&mt('[quant,_1,communication blocking period was,communication blocking periods were] modified.',$modtotal).' ');
- }
- if ($addtotal > 0) {
- $r->print(''.&mt('[quant,_1,communication blocking period was,communication blocking periods were] added.',$addtotal).' ');
- }
- $r->print(' ');
- } else {
- $r->print($lt{'ncwm'});
- }
- $r->print(' ');
- return;
-}
-
-sub get_dates_from_form {
- my $item = shift;
- my $startdate = &Apache::lonhtmlcommon::get_date_from_form('startdate_'.$item);
- my $enddate = &Apache::lonhtmlcommon::get_date_from_form('enddate_'.$item);
- return ($startdate,$enddate);
-}
-
-sub get_blockdates {
- my ($records,$blockcount) = @_;
- $$blockcount = 0;
- %{$records} = &Apache::lonnet::dump('comm_block',
- $env{'course.'.$env{'request.course.id'}.'.domain'},
- $env{'course.'.$env{'request.course.id'}.'.num'}
- );
- $$blockcount = keys(%{$records});
-
- if ((keys(%{$records}))[0] =~ /^error: 2 /) {
- $records = {};
- $$blockcount = 0;
- }
-}
-
-sub get_block_choices {
- my $item = shift;
- my $blocklist;
- my ($typeorder,$types) = &blocktype_text();
- foreach my $type (@{$typeorder}) {
- if ($env{'form.'.$type.'_'.$item}) {
- $blocklist->{$type} = 'on';
- } else {
- $blocklist->{$type} = 'off';
- }
- }
- return $blocklist;
-}
-
-sub display_blocker_status {
- my ($r,$records,$ltext) = @_;
- my $parmcount = 0;
-
- my %lt = &Apache::lonlocal::texthash(
- 'modi' => 'Modify',
- 'canc' => 'Cancel',
- );
- my ($typeorder,$types) = &blocktype_text();
- $r->print(&Apache::loncommon::start_data_table());
- $r->print(<<"END");
-
- $ltext->{'dura'}
- $ltext->{'setb'}
- $ltext->{'even'}
- $ltext->{'blck'}
- $ltext->{'actn'}?
-
-END
- foreach my $record (sort(keys(%{$records}))) {
- my $onchange = 'onFocus="javascript:window.document.forms['.
- "'blockform'].elements['modify_".$parmcount."'].".
- 'checked=true;"';
- my ($start,$end) = split(/____/,$record);
- my $startform = &Apache::lonhtmlcommon::date_setter('blockform','startdate_'.$parmcount,$start,$onchange);
- my $endform = &Apache::lonhtmlcommon::date_setter('blockform','enddate_'.$parmcount,$end,$onchange);
-
- my ($setuname,$setudom,$title,$blocks) =
- &Apache::loncommon::parse_block_record($$records{$record});
- $title = &HTML::Entities::encode($title,'"<>&');
- my $settername =
- &Apache::loncommon::aboutmewrapper(
- &Apache::loncommon::plainname($setuname,$setudom),
- $setuname,$setudom);
- $r->print(&Apache::loncommon::start_data_table_row());
- $r->print(<<"END");
- $ltext->{'star'}: $startform $ltext->{'endd'}: $endform
- $settername
-
-
-END
- foreach my $block (@{$typeorder}) {
- my $blockstatus = '';
- if ($blocks->{$block} eq 'on') {
- $blockstatus = 'checked="true"';
- }
- $r->print(' '.$types->{$block}.' ');
- }
- $r->print(<<"END");
-
- $lt{'modi'}? $lt{'canc'}?
-END
- $r->print(&Apache::loncommon::end_data_table_row());
- $parmcount++;
- }
- $r->print(<<"END");
-
-
-
-END
- return $parmcount;
-}
-
-sub display_addblocker_table {
- my ($r,$parmcount,$ltext) = @_;
- my $start = time;
- my $end = $start + (60 * 60 * 2); #Default is an exam of 2 hours duration.
- my $onchange = 'onFocus="javascript:window.document.forms['.
- "'blockform'].elements['add_".$parmcount."'].".
- 'checked=true;"';
- my $startform = &Apache::lonhtmlcommon::date_setter('blockform','startdate_'.$parmcount,$start,$onchange);
- my $endform = &Apache::lonhtmlcommon::date_setter('blockform','enddate_'.$parmcount,$end,$onchange);
- my %lt = &Apache::lonlocal::texthash(
- 'addb' => 'Add block',
- 'exam' => 'e.g., Exam 1',
- 'addn' => 'Add new communication blocking periods'
- );
- my ($typeorder,$types) = &blocktype_text();
- $r->print(<<"END");
-$lt{'addn'}
-END
- $r->print(&Apache::loncommon::start_data_table());
- $r->print(<<"END");
-
- $ltext->{'dura'}
- $ltext->{'even'} $lt{'exam'}
- $ltext->{'blck'}
- $ltext->{'actn'}?
-
-END
- $r->print(&Apache::loncommon::start_data_table_row());
- $r->print(<<"END");
- $ltext->{'star'}: $startform $ltext->{'endd'}: $endform
-
-
-END
- foreach my $block (@{$typeorder}) {
- $r->print(' '.$types->{$block}.' ');
- }
- $r->print(<<"END");
-
- $lt{'addb'}?
-END
- $r->print(&Apache::loncommon::end_data_table_row());
- $r->print(&Apache::loncommon::end_data_table());
- return;
-}
-
-sub blocktype_text {
- my %types = &Apache::lonlocal::texthash(
- 'com' => 'Messaging',
- 'chat' => 'Chat',
- 'boards' => 'Discussion',
- 'port' => 'Portfolio',
- 'groups' => 'Groups',
- 'blogs' => 'Blogs',
- );
- my $typeorder = ['com','chat','boards','port','groups','blogs'];
- return ($typeorder,\%types);
-}
-
# ----------------------------------------------------------- Display a message
sub displaymessage {
@@ -2240,8 +2108,9 @@ sub displaymessage {
my @messages=&sortedmessages(\%blocked,$startblock,$endblock,\$numblocked,$folder,$msgstatus);
if ( $blocked{$msgid} eq 'ON' ) {
&printheader($r,'/adm/email',&mt('Display a Message'));
- $r->print(&mt('You attempted to display a message that is currently blocked because you are enrolled in one or more courses for which there is an ongoing online exam.'));
- &build_block_table($r,$startblock,$endblock,\%setters);
+ #$r->print(&mt('You attempted to display a message that is currently blocked because you are enrolled in one or more courses for which there is an ongoing online exam.'));
+ my($blocked, $blocktext) = &Apache::loncommon::blocking_status("com");
+ $r->print(" ".$blocktext);
return;
}
if ($msgstatus eq '') {
@@ -2276,65 +2145,39 @@ sub displaymessage {
my $number_of_messages = scalar(@messages); #subtract 1 for last index
# start output
&printheader($r,'/adm/email?display='.&escape($msgid),'Display a Message','',$content{'baseurl'});
- my %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'});
-
-# Functions and Actions
- my $li_start='• ';
- my $li_end=' ';
# Prepare available functions
- my $functionlist='';
+ my @functionlist;
if (!$content{'noreplies'}) {
- $functionlist.=$li_start
- .''
+ push(@functionlist,' '
.&mt('Reply')
- .' '
- .$li_end;
+ .'');
}
- $functionlist.=$li_start
- .''
+ push(@functionlist,' '
.&mt('Forward')
- .' '
- .$li_end;
- $functionlist.=$li_start
- .''
+ .' ');
+ push(@functionlist,''
.&mt('Mark Unread')
- .' '
- .$li_end;
- $functionlist.=$li_start
- .''
+ .' ');
+ push(@functionlist,''
.&mt('Delete')
- .' '
- .$li_end;
- $functionlist.=$li_start
- .''
- .&mt('Back to Folder Display')
- .' '
- .$li_end;
+ .'');
+
+# Prepare available navigation
+ my @navigationlist;
if ($counter > 0){
- $functionlist.=$li_start
- .''
- .&mt('Previous')
- .' '
- .$li_end;
+ push(@navigationlist,''
+ .&mt('Previous')
+ .' ');
}
if ($counter < $number_of_messages - 1){
- $functionlist.=$li_start
- .''
- .&mt('Next')
- .' '
- .$li_end;
- }
-# Print functions
- $r->print(''
- .'
'
- .''
- .&mt('Functions')
- .' '
- .$functionlist
- .' '
- .''
- );
+ push(@navigationlist,''
+ .&mt('Next')
+ .' ');
+ }
+ push(@navigationlist,''
+ .&mt('Back to Folder Display')
+ .' ');
# Prepare available actions
my $symb;
@@ -2343,42 +2186,67 @@ sub displaymessage {
} elsif (defined($content{'baseurl'})) {
$symb=&Apache::lonnet::symbread($content{'baseurl'});
}
+ my @actionlist;
if ($env{'user.adv'}) {
- my $actionlist='';
- if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) {
- $actionlist.=$li_start
- .&Apache::loncommon::track_student_link(
- &mt('View recent activity'),$content{'sendername'},$content{'senderdomain'},'check')
- .$li_end;
+ if (($env{'request.course.id'}) && ($from_student) &&
+ (&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) {
+ push(@actionlist,&Apache::loncommon::track_student_link(
+ 'View recent activity'
+ ,$content{'sendername'}
+ ,$content{'senderdomain'}
+ ,'check'));
}
if (&Apache::lonnet::allowed('opa',$env{'request.course.id'}) && $symb) {
- $actionlist.=$li_start
- .&Apache::loncommon::pprmlink(
- &mt('Set/Change parameters'),$content{'sendername'},$content{'senderdomain'},$symb,'check')
- .$li_end;
+ push(@actionlist,&Apache::loncommon::pprmlink(
+ &mt('Set/Change parameters')
+ ,$content{'sendername'}
+ ,$content{'senderdomain'}
+ ,$symb
+ ,'check'));
}
if (&Apache::lonnet::allowed('mgr',$env{'request.course.id'}) && $symb) {
- $actionlist.=$li_start
- .&Apache::loncommon::pgrdlink(
- &mt('Set/Change grades'),$content{'sendername'},$content{'senderdomain'},$symb,'check')
- .$li_end;
- }
-
-# Print actions
- if ($actionlist) {
- $r->print(''
- .'
'
- .''
- .&mt('[_1]Currently available actions[_2] (will open extra window):','',' ')
- .' '
- .$actionlist
- .' '
- .''
- );
- }
+ push(@actionlist,&Apache::loncommon::pgrdlink(
+ &mt('Set/Change grades')
+ ,$content{'sendername'}
+ ,$content{'senderdomain'}
+ ,$symb
+ ,'check'));
+ }
}
+# Print functionlist, navigationlist, and actionlist in page header
+ my $functions='';
+
+ # Functionlist
+ $functions.=&Apache::lonhtmlcommon::start_funclist();
+ foreach my $item (@functionlist) {
+ $functions.=&Apache::lonhtmlcommon::add_item_funclist($item);
+ }
+ $functions .= &Apache::lonhtmlcommon::end_funclist();
+
+ # Navigationlist
+ $functions.=&Apache::lonhtmlcommon::start_funclist(
+ &mt('Navigation'));
+ foreach my $item (@navigationlist) {
+ $functions.=&Apache::lonhtmlcommon::add_item_funclist($item);
+ }
+ $functions .= &Apache::lonhtmlcommon::end_funclist();
+
+ # Actionlist
+ if (@actionlist) {
+ $functions.=&Apache::lonhtmlcommon::start_funclist(
+ &mt('Currently available actions (will open extra window)'));
+ foreach my $item (@actionlist) {
+ $functions.=&Apache::lonhtmlcommon::add_item_funclist($item);
+ }
+ $functions.=&Apache::lonhtmlcommon::end_funclist();
+ }
+
+ $functions.='
';
+ $r->print(&Apache::loncommon::head_subbox($functions));
+
+
my ($tonum,$tolist,$cclist,$bcclist,$groupcclist,%recipients);
if ($content{'recipid'}) {
$tonum = &retrieve_recips('display',\%content,\%recipients);
@@ -2532,12 +2400,14 @@ sub displaymessage {
}
if ($content{'group'} ne '') {
if (&check_group_priv($content{'group'})) {
- $groupcclist = join(', ',@{$recipients{'group_cc_broadcast'}});
- if ($groupcclist) {
- $r->print(&Apache::lonhtmlcommon::row_title(&mt('Group Cc'))
- .$groupcclist
- .&Apache::lonhtmlcommon::row_closure()
- );
+ if (ref($recipients{'group_cc_broadcast'}) eq 'ARRAY') {
+ $groupcclist = join(', ',@{$recipients{'group_cc_broadcast'}});
+ if ($groupcclist) {
+ $r->print(&Apache::lonhtmlcommon::row_title(&mt('Group Cc'))
+ .$groupcclist
+ .&Apache::lonhtmlcommon::row_closure()
+ );
+ }
}
}
}
@@ -2545,14 +2415,22 @@ sub displaymessage {
}
# Course
- if ($content{'courseid'}) {
- $r->print(&Apache::lonhtmlcommon::row_title(&mt($crstype))
- .$courseinfo{'description'}
- );
- if ($content{'coursesec'}) {
- $r->print(' ('.&mt('Section').': '.$content{'coursesec'}.')');
+ if ($content{'courseid'} ne '') {
+ if ($content{'courseid'} =~ m{^$match_domain\_$match_courseid$}) {
+ my %courseinfo;
+ %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'},
+ {'one_time' => 1});
+ my $description = $courseinfo{'description'};
+ if ($description ne '') {
+ $r->print(&Apache::lonhtmlcommon::row_title(&mt($crstype))
+ .$description
+ );
+ if ($content{'coursesec'}) {
+ $r->print(' ('.&mt('Section').': '.$content{'coursesec'}.')');
+ }
+ $r->print(&Apache::lonhtmlcommon::row_closure());
+ }
}
- $r->print(&Apache::lonhtmlcommon::row_closure());
}
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Time'))
.$content{'time'}
@@ -2615,7 +2493,7 @@ sub displaymessage {
# Message
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Message'))
- .''
+ .''
.&Apache::lontexconvert::msgtexconverted($content{'message'},1)
.' '
);
@@ -2724,6 +2602,7 @@ sub recipients_link {
$body =~ s{\n}{}g;
$r->print(<
+//
ENDJS
@@ -2774,6 +2653,13 @@ sub displayresource {
}
# Could not get a symb, give up
unless ($symb) { return $content{'citation'}; }
+ if ($symb =~ /ext\.tool$/) {
+ return ''.&mt('Current transactions for student (if applicable)').' '.
+ &Apache::loncommon::get_previous_attempt($symb,
+ $content{'sendername'},
+ $content{'senderdomain'},
+ $content{'courseid'});
+ }
# Have a symb, can render
return ''.&mt('Current attempts of student (if applicable)').' '.
&Apache::loncommon::get_previous_attempt($symb,
@@ -2800,15 +2686,16 @@ sub displayresource {
sub header {
my ($r,$title,$baseurl)=@_;
-
my $extra = &Apache::loncommon::studentbrowser_javascript();
if ($baseurl) {
$extra .= " ";
}
- $r->print(&Apache::loncommon::start_page('Communication and Messages',
+ $extra .= '';
+ $r->print(&Apache::loncommon::start_page('Messages',
$extra));
$r->print(&Apache::lonhtmlcommon::breadcrumbs
- (($title?$title:'Communication and Messages')));
+ (($title?$title:'Send and display messages')));
}
# ---------------------------------------------------------------- Print header
@@ -2842,7 +2729,7 @@ sub storedcommentlisting {
'^'.&escape(&escape($env{'form.showcommentbaseurl'})));
$r->print(&Apache::loncommon::start_page('Saved Comment Listing',undef,
{'onlybody' => 1}));
- if ((keys %msgs)[0]=~/^error\:/) {
+ if ((keys(%msgs))[0]=~/^error\:/) {
$r->print(&mt('No saved comments yet.'));
} else {
my $found=0;
@@ -2876,7 +2763,7 @@ sub sendoffmail {
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
}
if ($env{'form.send'}) {
- if (!$env{'form.multiforward'}) {
+ if (!$env{'form.multiforward'}) {
if ($group eq '') {
&printheader($r,'','Messages being sent.');
} else {
@@ -2906,6 +2793,8 @@ sub sendoffmail {
my $mode = $env{'form.sendmode'};
my (%toaddr,$tos,$cc,$bcc,$broadcast);
+ my (%willtrust,%trustchecked,%disallowed);
+ my $serverdefdom = &Apache::lonnet::default_login_domain();
if ($mode eq 'group') {
if (defined($env{'form.courserecips'})) {
@@ -2915,9 +2804,17 @@ sub sendoffmail {
foreach my $dest (@to) {
my ($user,$domain) = split(/:/, $dest);
if (($user ne '') && ($domain ne '')) {
- my $rec = $user.":".$domain;
- $toaddr{$rec} = '';
- $broadcast->{$rec} = '';
+ unless ($trustchecked{$domain}) {
+ $willtrust{$domain} = &Apache::lonnet::will_trust('msg',$serverdefdom,$domain);
+ $trustchecked{$domain} = 1;
+ }
+ if ($willtrust{$domain}) {
+ my $rec = $user.":".$domain;
+ $toaddr{$rec} = '';
+ $broadcast->{$rec} = '';
+ } else {
+ $disallowed{'to'}{$user.":".$domain} = 1;
+ }
}
}
}
@@ -2928,22 +2825,47 @@ sub sendoffmail {
if ($txt) {
$rec =~ s/^\s+//;
$rec =~ s/\s+$//;
- $toaddr{$rec}.=$txt."\n";
- $broadcast->{$rec} = '';
+ my ($recuname,$recudom) = split(/:/,$rec);
+ unless ($trustchecked{$recudom}) {
+ $willtrust{$recudom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$recudom);
+ $trustchecked{$recudom} = 1;
+ }
+ if ($willtrust{$recudom}) {
+ $toaddr{$rec}.=$txt."\n";
+ $broadcast->{$rec} = '';
+ } else {
+ $disallowed{'to'}{$rec} = 1;
+ }
}
}
} else {
if (($env{'form.recuname'} ne '') && ($env{'form.recdomain'} ne '')) {
- $toaddr{$env{'form.recuname'}.':'.$env{'form.recdomain'}}='';
- $tos->{$env{'form.recuname'}.':'.$env{'form.recdomain'}}='';
+ unless ($trustchecked{$env{'form.recdomain'}}) {
+ $willtrust{$env{'form.recdomain'}} = &Apache::lonnet::will_trust('msg',$serverdefdom,$env{'form.recdomain'});
+ $trustchecked{$env{'form.recdomain'}} = 1;
+ }
+ if ($willtrust{$env{'form.recdomain'}}) {
+ $toaddr{$env{'form.recuname'}.':'.$env{'form.recdomain'}}='';
+ $tos->{$env{'form.recuname'}.':'.$env{'form.recdomain'}}='';
+ } else {
+ $disallowed{'to'}{$env{'form.recuname'}.':'.$env{'form.recdomain'}};
+ }
}
}
if ($env{'form.additionalrec_to'}) {
foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec_to'})) {
my ($auname,$audom)=split(/:/,$rec);
if (($auname ne "") && ($audom ne "")) {
- $toaddr{$auname.':'.$audom}='';
- $tos->{$auname.':'.$audom}='';
+ unless ($trustchecked{$audom}) {
+ $willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom);
+ $trustchecked{$audom} = 1;
+ }
+ if ($willtrust{$audom}) {
+ $toaddr{$auname.':'.$audom}='';
+ $tos->{$auname.':'.$audom}='';
+ } else {
+ $disallowed{'to'}{$auname.':'.$audom};
+ }
}
}
}
@@ -2953,8 +2875,16 @@ sub sendoffmail {
foreach my $rec (@toreplies) {
my ($auname,$audom)=split(/:/,$rec);
if (($auname ne "") && ($audom ne "")) {
- $toaddr{$auname.':'.$audom}='';
- $tos->{$auname.':'.$audom}='';
+ unless ($trustchecked{$audom}) {
+ $willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom);
+ $trustchecked{$audom} = 1;
+ }
+ if ($willtrust{$audom}) {
+ $toaddr{$auname.':'.$audom}='';
+ $tos->{$auname.':'.$audom}='';
+ } else {
+ $disallowed{'to'}{$auname.':'.$audom};
+ }
}
}
}
@@ -2962,9 +2892,17 @@ sub sendoffmail {
foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec_cc'})) {
my ($auname,$audom)=split(/:/,$rec);
if (($auname ne "") && ($audom ne "")) {
- $toaddr{$auname.':'.$audom}='';
if (!defined($tos->{$auname.':'.$audom})) {
- $cc->{$auname.':'.$audom}='';
+ unless ($trustchecked{$audom}) {
+ $willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom);
+ $trustchecked{$audom} = 1;
+ }
+ if ($willtrust{$audom}) {
+ $toaddr{$auname.':'.$audom}='';
+ $cc->{$auname.':'.$audom}='';
+ } else {
+ $disallowed{'cc'}{$auname.':'.$audom};
+ }
}
}
}
@@ -2975,9 +2913,17 @@ sub sendoffmail {
foreach my $rec (@ccreplies) {
my ($auname,$audom)=split(/:/,$rec);
if (($auname ne "") && ($audom ne "")) {
- $toaddr{$auname.':'.$audom}='';
if (!defined($tos->{$auname.':'.$audom})) {
- $cc->{$auname.':'.$audom}='';
+ unless ($trustchecked{$audom}) {
+ $willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom);
+ $trustchecked{$audom} = 1;
+ }
+ if ($willtrust{$audom}) {
+ $toaddr{$auname.':'.$audom}='';
+ $cc->{$auname.':'.$audom}='';
+ } else {
+ $disallowed{'cc'}{$auname.':'.$audom} = 1;
+ }
}
}
}
@@ -2988,9 +2934,17 @@ sub sendoffmail {
foreach my $rec (@groupreplies) {
my ($auname,$audom)=split(/:/,$rec);
if (($auname ne "") && ($audom ne "")) {
- $toaddr{$auname.':'.$audom}='';
if (!defined($tos->{$auname.':'.$audom})) {
- $broadcast->{$auname.':'.$audom}='';
+ unless ($trustchecked{$audom}) {
+ $willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom);
+ $trustchecked{$audom} = 1;
+ }
+ if ($willtrust{$audom}) {
+ $toaddr{$auname.':'.$audom}='';
+ $broadcast->{$auname.':'.$audom}='';
+ } else {
+ $disallowed{'to'}{$auname.':'.$audom} = 1;
+ }
}
}
}
@@ -2999,10 +2953,18 @@ sub sendoffmail {
foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec_bcc'})) {
my ($auname,$audom)=split(/:/,$rec);
if (($auname ne "") && ($audom ne "")) {
- $toaddr{$auname.':'.$audom}='';
- if ((!defined($tos->{$auname.':'.$audom})) &&
+ if ((!defined($tos->{$auname.':'.$audom})) &&
(!defined($cc->{$auname.':'.$audom}))) {
- $bcc->{$auname.':'.$audom}='';
+ unless ($trustchecked{$audom}) {
+ $willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom);
+ $trustchecked{$audom} = 1;
+ }
+ if ($willtrust{$audom}) {
+ $toaddr{$auname.':'.$audom}='';
+ $bcc->{$auname.':'.$audom}='';
+ } else {
+ $disallowed{'bcc'}{$auname.':'.$audom} = 1;
+ }
}
}
}
@@ -3022,46 +2984,47 @@ sub sendoffmail {
} else {
$savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'});
}
- my %reciphash = (
- to => $tos,
- cc => $cc,
- bcc => $bcc,
- );
- if ($mode eq 'group') {
- if ($group eq '') {
- $reciphash{'course_broadcast'} = $broadcast;
- } else {
- if ($env{'form.groupmail'} eq 'cc') {
- $reciphash{'group_cc_broadcast'} = $broadcast;
+ my ($recipid, @recusers, @recudoms, %permresults);
+ if (keys(%toaddr) > 0) {
+ my %reciphash = (
+ to => $tos,
+ cc => $cc,
+ bcc => $bcc,
+ );
+ if ($mode eq 'group') {
+ if ($group eq '') {
+ $reciphash{'course_broadcast'} = $broadcast;
} else {
- $reciphash{'group_bcc_broadcast'} = $broadcast;
+ if ($env{'form.groupmail'} eq 'cc') {
+ $reciphash{'group_cc_broadcast'} = $broadcast;
+ } else {
+ $reciphash{'group_bcc_broadcast'} = $broadcast;
+ }
}
}
- }
- my ($recipid,$recipstatus) =
- &Apache::lonmsg::store_recipients($msgsubj,$env{'user.name'},
- $env{'user.domain'},\%reciphash);
- if ($recipstatus ne 'ok') {
- &Apache::lonnet::logthis('Failed to store To, Bcc and Cc recipients for '.$env{'user.name'}.':'.$env{'user.domain'});
- }
- if ($env{'form.attachment'}) {
- if (length($env{'form.attachment'})<131072) {
- $attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,'feedback/'.$now);
- } else {
- $r->print(''.&mt('Attachment not included - exceeded permitted length').'
');
- }
- } elsif ($env{'form.multiforward'}) {
- if ($env{'form.attachmenturl'} ne '') {
- $attachmenturl = $env{'form.attachmenturl'};
+ ($recipid,my $recipstatus) =
+ &Apache::lonmsg::store_recipients($msgsubj,$env{'user.name'},
+ $env{'user.domain'},\%reciphash);
+ if ($recipstatus ne 'ok') {
+ &Apache::lonnet::logthis('Failed to store To, Bcc and Cc recipients for '.$env{'user.name'}.':'.$env{'user.domain'});
+ }
+ if ($env{'form.attachment'}) {
+ if (length($env{'form.attachment'}) <= 1048576) {
+ $attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,'feedback/'.$now);
+ } else {
+ $r->print(''.&mt('Attachment not included - exceeded permitted length').'
');
+ }
+ } elsif ($env{'form.multiforward'}) {
+ if ($env{'form.attachmenturl'} ne '') {
+ $attachmenturl = $env{'form.attachmenturl'};
+ }
}
}
- my @recusers;
- my @recudoms;
foreach my $address (sort(keys(%toaddr))) {
my ($recuname,$recdomain)=split(/\:/,$address);
my $msgtxt = $savemsg;
if ($toaddr{$address}) {
- $msgtxt.=' '.$toaddr{$address};
+ $msgtxt.="\n".' '."\n".$toaddr{$address};
}
my @thismsg;
if ($msgtype eq 'critical') {
@@ -3073,7 +3036,8 @@ sub sendoffmail {
$env{'form.sendbck'},
$env{'form.permanent'},
\$sentmessage{$address},
- $nosentstore,$recipid);
+ $nosentstore,$recipid,
+ $attachmenturl,\%permresults);
} else {
$r->print(&mt('Sending').' '.$recuname.':'.$recdomain.': ');
@thismsg=
@@ -3084,13 +3048,20 @@ sub sendoffmail {
$env{'form.permanent'},
\$sentmessage{$address},
undef,undef,undef,
- $nosentstore,$recipid);
+ $nosentstore,$recipid,
+ \%permresults);
}
$msg_status{$recuname.':'.$recdomain}=join(' ',@thismsg);
if ($msg_status{$recuname.':'.$recdomain} =~ /(ok|con_delayed)/) {
$numsent++;
push(@recusers,$recuname);
push(@recudoms,$recdomain);
+ if ($1 eq 'ok') {
+ $r->print('ok ');
+ }
+ if ($permresults{$recuname.':'.$recdomain}) {
+ $r->print(' (email) ');
+ }
}
$sendstatus.=' '.join(' ',@thismsg);
}
@@ -3166,10 +3137,11 @@ sub sendoffmail {
'','','','',$recipid);
}
}
- if (!$env{'form.multiforward'}) {
+ if (!$env{'form.multiforward'}) {
if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) {
- $r->print(''.&mt('Completed.').
- ' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Completed.'));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
if ($env{'form.displayedcrit'}) {
&discrit($r);
}
@@ -3179,10 +3151,32 @@ sub sendoffmail {
&Apache::loncommunicate::menu($r);
}
} else {
- $r->print(''.&mt('Could not deliver message').' '.
- &mt('Please use the browser "Back" button and correct the recipient addresses ([_1]).',$sendstatus).'
');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Could not deliver message'),1);
+ $message .= ' '.&mt('Please use the browser "Back" button and correct the recipient addresses ([_1]).',$sendstatus);
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
}
}
+ if (keys(%disallowed)) {
+ if ((ref($disallowed{'to'}) eq 'HASH') && (keys(%{$disallowed{'to'}}) > 0)) {
+ $r->print(&mt("The following recipients were excluded because the user's domain does not accept messages from server's domain:").''.
+ join(" \n",sort(keys(%{$disallowed{'to'}}))).
+ ' ');
+ }
+ if (ref($disallowed{'cc'}) eq 'HASH') {
+ $r->print(&mt("The following CCs were excluded because the user's domain does not accept messages from server's domain:").''.
+ join(" \n",sort(keys(%{$disallowed{'cc'}}))).
+ ' ');
+ }
+ if (ref($disallowed{'bcc'}) eq 'HASH') {
+ $r->print(&mt("The following BCCs were excluded because the user's domain does not accept messages from server's domain:").''.
+ join(" \n",sort(keys(%{$disallowed{'bcc'}}))).
+ ' ');
+ }
+ }
+ } else {
+ &printheader($r,'','Messages cancelled.');
+ return 'cancelled';
}
return $sendstatus;
}
@@ -3203,22 +3197,20 @@ sub handler {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['display','replyto','forward','markread','markdel','markunread',
'sendreply','compose','sendmail','critical','recname','recdom',
- 'recordftf','sortedby','block','folder','startdis','interdis',
+ 'recordftf','sortedby','folder','startdis','interdis',
'showcommentbaseurl','dismode','group','subject','text','ref',
'msgstatus']);
- $sqs='&sortedby='.$env{'form.sortedby'};
+ $sqs='&sortedby='.$env{'form.sortedby'};
# ------------------------------------------------------ They checked for email
- unless ($env{'form.block'}) {
- &Apache::lonnet::put('email_status',{'recnewemail'=>0});
- }
+ &Apache::lonnet::put('email_status',{'recnewemail'=>0});
# ----------------------------------------------------------------- Breadcrumbs
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"/adm/communicate",
- text=>"Communication/Messages",
+ text=>"Messages",
faq=>12,bug=>'Communication Tools',});
# ------------------------------------------------------------------ Get Folder
@@ -3227,7 +3219,7 @@ sub handler {
unless ($folder) {
$folder='';
} else {
- $sqs.='&folder='.&escape($folder);
+ $sqs.='&folder='.&escape($folder);
}
# ------------------------------------------------------------ Get Display Mode
@@ -3259,7 +3251,7 @@ sub handler {
$startdis++;
}
my $postedstartdis=$startdis+1;
- $sqs.='&startdis='.$postedstartdis;
+ $sqs.='&startdis='.$postedstartdis;
# --------------------------------------------------------------- Render Output
@@ -3299,9 +3291,10 @@ sub handler {
my ($result,$msg) =
&statuschange($env{'form.markdel'},'deleted',$folder);
if (!$result) {
- $r->print(''.
- &mt('Failed to delete the message.').'
'.
- ''.$msg."
\n");
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Failed to delete the message.'),1);
+ $message .= ''.$msg.'
';
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
}
&Apache::loncommunicate::menu($r);
&disall($r,($folder?$folder:$dismode),$msgstatus);
@@ -3323,7 +3316,10 @@ sub handler {
$total ++;
}
&printheader($r,'','Marked Messages Read');
- $r->print(&mt('Marked [_1] message(s) read',$total).'');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Marked [quant,_1,message] read',$total));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
+ # $r->print('
');
&Apache::loncommunicate::menu($r);
&disall($r,($folder?$folder:$dismode),$msgstatus);
} elsif ($env{'form.markedaction'} eq 'markedunread') {
@@ -3334,7 +3330,10 @@ sub handler {
$total ++;
}
&printheader($r,'','Marked Messages Unread');
- $r->print(&mt('Marked [_1] message(s) unread',$total).'
');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Marked [quant,_1,message] unread',$total));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
+ # $r->print('
');
&Apache::loncommunicate::menu($r);
&disall($r,($folder?$folder:$dismode),$msgstatus);
} elsif ($env{'form.markedaction'} eq 'markedmove') {
@@ -3343,7 +3342,7 @@ sub handler {
&printheader($r,'','Moved Messages');
if (!defined($gotfolders{$destfolder})) {
$r->print(&mt('Destination folder [_1] is not a valid folder',
- $destfolder));
+ ''.$destfolder.' '));
} else {
my ($total,$failed,@failed_msg)=(0,0);
my @to_move = &Apache::loncommon::get_env_multiple('form.delmark');
@@ -3357,15 +3356,17 @@ sub handler {
push(@failed_msg,$msg);
}
}
- if ($failed) {
- $r->print('
- '.&mt('Failed to move [_1] message(s)',$failed).
- '
');
- $r->print(''.
- join("
\n",@failed_msg).
- "
\n");
- }
- $r->print(&mt('Moved [_1] message(s)',$total).'');
+ my $message = '';
+ if ($failed) {
+ $message .= &Apache::lonhtmlcommon::confirm_success(&mt('Failed to move [quant,_1,message]',$failed),1);
+ $message .= '
'.
+ join("
\n",@failed_msg).
+ "
\n";
+ }
+ $message .= &Apache::lonhtmlcommon::confirm_success(&mt('Moved [quant,_1,message]',$total));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
+ # $r->print('');
}
&Apache::loncommunicate::menu($r);
&disall($r,($folder?$folder:$dismode),$msgstatus);
@@ -3383,15 +3384,17 @@ sub handler {
}
}
&printheader($r,'','Deleted Messages');
+ my $message = '';
if ($failed) {
- $r->print('
- '.&mt('Failed to delete [_1] message(s)',$failed).
- '
');
- $r->print(''.
- join("
\n",@failed_msg).
- "
\n");
- }
- $r->print(&mt('Deleted [_1] message(s)',$total).'');
+ $message .= &Apache::lonhtmlcommon::confirm_success(&mt('Failed to delete [quant,_1,message]',$failed),1);
+ $message .= '
'.
+ join("
\n",@failed_msg).
+ "
\n";
+ }
+ $message .= &Apache::lonhtmlcommon::confirm_success(&mt('Deleted [quant,_1,message]',$total));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
+ # $r->print('');
&Apache::loncommunicate::menu($r);
&disall($r,($folder?$folder:$dismode),$msgstatus);
} elsif ($env{'form.markunread'}) {
@@ -3403,8 +3406,6 @@ sub handler {
&compout($r,'','',$env{'form.compose'});
} elsif ($env{'form.recordftf'}) {
&facetoface($r,$env{'form.recordftf'});
- } elsif ($env{'form.block'}) {
- &examblock($r,$env{'form.block'});
} elsif ($env{'form.sendmail'}) {
if ($env{'form.multiforward'}) {
&printheader($r,'','Messages being sent.');
@@ -3447,19 +3448,19 @@ sub handler {
}
if (keys(%forwardok) > 0) {
my $count = keys(%forwardok);
- $r->print(''.
- &mt('[quant,_1,message] forwarded.',$count).
- ' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('[quant,_1,message] forwarded.',$count));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
}
if (keys(%forwardfail) > 0) {
my $count = keys(%forwardfail);
- $r->print('
'.
- &mt('Could not forward [quant,_1,message].',$count).
- ' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Could not forward [quant,_1,message].',$count),1);
foreach my $key (keys(%forwardfail)) {
- $r->print(&mt('Could not deliver forwarded message.').' '.
- &mt('The recipient addresses may need to be corrected').' ('.$forwardfail{$key}.'). ');
+ $message .= ' '.&mt('Could not deliver forwarded message.').' '.
+ &mt('The recipient addresses may need to be corrected').' ('.$forwardfail{$key}.')';
}
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
}
&Apache::loncommunicate::menu($r);
} else {
@@ -3483,10 +3484,13 @@ sub handler {
my $showfolder = $env{'form.newfolder'};
my ($makeresult,$warning) = &makefolder($env{'form.newfolder'});
if ($makeresult eq 'ok') {
- $r->print(&mt('Mail folder "[_1]" created.',$showfolder).' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Folder "[_1]" created.',$showfolder));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
} else {
- $r->print(&mt('Creation failed.').' '.$makeresult.' '.
- $warning);
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Creation failed.').' '.$makeresult.' '.$warning,1);
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
$showfolder = $folder;
}
&Apache::loncommunicate::menu($r);
@@ -3498,10 +3502,14 @@ sub handler {
my $showfolder = '';
my $delresult = &deletefolder($folder);
if ($delresult eq 'ok') {
- $r->print(&mt('Mail folder "[_1]" deleted.',$folder).' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Folder "[_1]" deleted.',$folder));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
$env{'form.folder'} = '';
} else {
- $r->print(&mt('Deletion failed.').' '.$delresult.' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Deletion failed.').' '.$delresult,1);
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
$showfolder = $folder;
}
&Apache::loncommunicate::menu($r);
@@ -3511,15 +3519,19 @@ sub handler {
my $showfolder = $env{'form.renamed'};
my $renresult = &renamefolder($folder);
if ($renresult eq 'ok') {
- $r->print(&mt('Mail folder "[_1]" renamed "[_2]".',$folder,$showfolder).' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Folder "[_1]" renamed to "[_2]".',$folder,$showfolder));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
} else {
- $r->print(&mt('Renaming failed.').' '.$renresult.' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Renaming failed.').' '.$renresult,1);
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
$showfolder = $folder;
}
&Apache::loncommunicate::menu($r);
&disall($r,$showfolder,$msgstatus);
} else {
- &printheader($r,'','Display all Messages');
+ &printheader($r,'','Display All Messages');
&Apache::loncommunicate::menu($r);
&disall($r,($folder?$folder:$dismode),$msgstatus);
}