--- loncom/interface/lonmsgdisplay.pm 2009/02/14 00:27:08 1.114
+++ loncom/interface/lonmsgdisplay.pm 2019/08/06 17:53:56 1.181.2.2
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.114 2009/02/14 00:27:08 raeburn Exp $
+# $Id: lonmsgdisplay.pm,v 1.181.2.2 2019/08/06 17:53:56 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)
@@ -1759,8 +1903,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'}.
@@ -1776,7 +1922,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/) {
@@ -1802,8 +1950,7 @@ sub disfacetoface {
} else {
%content=&Apache::lonmsg::unpackagemsg($content{'message'});
$content{'message'} =
- ''.&mt('Subject').': '.$content{'subject'}.' '.&mt('Subject').': '.$content{'subject'}.' '.
$content{'message'};
}
} else {
@@ -1832,12 +1979,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.'
');
}
}
@@ -1864,8 +2013,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");
@@ -1887,21 +2036,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'});
@@ -1910,8 +2062,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(<
@@ -1929,304 +2090,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 {
@@ -2242,8 +2105,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 '') {
@@ -2278,65 +2142,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;
@@ -2345,42 +2183,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);
@@ -2534,12 +2397,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()
+ );
+ }
}
}
}
@@ -2547,14 +2412,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'}
@@ -2726,6 +2599,7 @@ sub recipients_link {
$body =~ s{\n}{}g;
$r->print(<
+//
ENDJS
@@ -2802,15 +2676,14 @@ 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',
+ $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
@@ -2844,7 +2717,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;
@@ -3059,11 +2932,12 @@ sub sendoffmail {
}
my @recusers;
my @recudoms;
+ my %permresults;
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') {
@@ -3075,7 +2949,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=
@@ -3086,13 +2961,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);
}
@@ -3168,10 +3050,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);
}
@@ -3181,10 +3064,15 @@ 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);
}
}
+ } else {
+ &printheader($r,'','Messages cancelled.');
+ return 'cancelled';
}
return $sendstatus;
}
@@ -3205,22 +3093,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
@@ -3229,7 +3115,7 @@ sub handler {
unless ($folder) {
$folder='';
} else {
- $sqs.='&folder='.&escape($folder);
+ $sqs.='&folder='.&escape($folder);
}
# ------------------------------------------------------------ Get Display Mode
@@ -3261,7 +3147,7 @@ sub handler {
$startdis++;
}
my $postedstartdis=$startdis+1;
- $sqs.='&startdis='.$postedstartdis;
+ $sqs.='&startdis='.$postedstartdis;
# --------------------------------------------------------------- Render Output
@@ -3301,9 +3187,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);
@@ -3325,7 +3212,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') {
@@ -3336,7 +3226,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') {
@@ -3345,7 +3238,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');
@@ -3359,15 +3252,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);
@@ -3385,15 +3280,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'}) {
@@ -3405,8 +3302,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.');
@@ -3449,19 +3344,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 {
@@ -3485,10 +3380,13 @@ sub handler {
my $showfolder = $env{'form.newfolder'};
my ($makeresult,$warning) = &makefolder($env{'form.newfolder'});
if ($makeresult eq 'ok') {
- $r->print(&mt('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);
@@ -3500,10 +3398,14 @@ sub handler {
my $showfolder = '';
my $delresult = &deletefolder($folder);
if ($delresult eq 'ok') {
- $r->print(&mt('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);
@@ -3513,9 +3415,13 @@ sub handler {
my $showfolder = $env{'form.renamed'};
my $renresult = &renamefolder($folder);
if ($renresult eq 'ok') {
- $r->print(&mt('Folder "[_1]" renamed to "[_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);