--- loncom/interface/lonmsgdisplay.pm 2010/06/06 02:40:30 1.153
+++ loncom/interface/lonmsgdisplay.pm 2014/12/11 01:52:30 1.178
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.153 2010/06/06 02:40:30 raeburn Exp $
+# $Id: lonmsgdisplay.pm,v 1.178 2014/12/11 01:52:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -110,7 +110,7 @@ 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='';
@@ -128,11 +128,8 @@ sub folderlist {
go => 'Go',
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.',
);
@@ -182,7 +179,7 @@ function folder_choice(targetform,caller
if (targetform.folderaction.options[targetform.folderaction.selectedIndex].value == 'rename') {
for (var i=0; i '.
&mt('You have no critical messages.').
'
');
$func1='Forward'; # do not translate here!
$dissub = &mt('Forwarding').': ';
$subj_size = '10';
@@ -1659,8 +1686,7 @@ ENDREPSCRIPT
'.$lt{'fold'}.'
'."\n".
@@ -234,14 +233,16 @@ function folder_choice(targetform,caller
'.$lt{'status'}.'
-
'."\n".
&Apache::loncommon::select_form($msgstatus,'msgstatus',\%statushash).'
'.$lt{'actn'}.'
'."\n".'
+
+ '.$lt{'actn'}.'
-
'."\n".'
'.
&Apache::loncommon::select_form('view','folderaction',\%actions).
'
'.&mt('New Folder').'
'."\n".'
+
+ '.&mt('New Folder').'
'."\n".'
'.
''.
@@ -261,8 +263,8 @@ sub get_permanent_folders {
my %permfolders =
&Apache::lonlocal::texthash('' => 'INBOX',
'trash' => 'TRASH',
- 'critical' => 'Critical',
- 'sent' => 'Sent Messages',
+ 'critical' => 'CRITICAL',
+ 'sent' => 'SENT MESSAGES',
);
return %permfolders;
}
@@ -378,7 +380,7 @@ sub deletefolder {
my ($folder)=@_;
my %permfolders = &get_permanent_folders();
if (defined($permfolders{$folder})) {
- return &mt('The folder "[_1]" may not be deleted.',$folder);
+ return &mt('The folder "[_1]" may not be deleted.',$permfolders{$folder});
}
my %userfolders = &Apache::lonmsg::get_user_folders();
if (!defined($userfolders{$folder})) {
@@ -543,7 +545,7 @@ sub discourse {
$result .= '
';
if (ref($statushash) eq 'HASH') {
$statushash->{'active'} = 1;
@@ -564,7 +566,7 @@ sub discourse {
$result .= '
';
if (ref($statushash) eq 'HASH') {
$statushash->{'previous'} = 1;
@@ -587,7 +589,7 @@ sub discourse {
$result .= '';
if (ref($statushash) eq 'HASH') {
$statushash->{'future'} = 1;
@@ -626,9 +628,7 @@ sub disgroup {
return;
} else {
$hasfloat = 1;
- unless($env{'environment.wysiwygeditor'} eq 'on') {
- $r->print(''.&Apache::lontexconvert::msgtexconverted($content{'message'}).'
'
.&Apache::lonhtmlcommon::row_closure()
.&Apache::lonhtmlcommon::row_title('',undef,'LC_oddrow_value')
@@ -867,8 +880,9 @@ sub discrit {
'
'.
- ''.&mt('Communicate').'';
+ &Apache::lonhtmlcommon::actionbox(
+ [''.&mt('Select a course').'',
+ ''.&mt('Communicate').'']);
} else {
$r->print($header);
}
@@ -985,10 +999,15 @@ sub get_course_desc {
if (defined($env{'course.'.$fromcid.'.description'})) {
$description = $env{'course.'.$fromcid.'.description'};
} else {
- my %courseinfo=&Apache::lonnet::coursedescription($fromcid);
- $description = $courseinfo{'description'};
+ if ($fromcid =~ m{/^$match_domain\_$match_courseid$}) {
+ my %courseinfo=&Apache::lonnet::coursedescription($fromcid,
+ {'one_time' => 1});
+ $description = $courseinfo{'description'};
+ }
+ }
+ if ($description ne '') {
+ $$descriptions{$fromcid} = $description;
}
- $$descriptions{$fromcid} = $description;
}
return $description;
}
@@ -1005,6 +1024,13 @@ sub disall {
&Apache::loncommon::store_settings('user','mail',\%saveable);
&Apache::loncommon::restore_settings('user','mail',\%saveable);
$folder ||= $env{'form.folder'};
+ # Always show critical messages if present
+ my @what=&Apache::lonnet::dump('critical',$env{'user.domain'},$env{'user.name'});
+ if ($what[0]) {
+ if (($what[0] ne 'con_lost') && ($what[0]!~/^error\:/)) {
+ $folder = 'critical';
+ }
+ }
$msgstatus ||= $env{'form.msgstatus'};
$env{'form.interdis'} ||= 20;
@@ -1186,7 +1212,7 @@ ENDDISHEADER
foreach my $item ($localsenttime,$dis_name,$dis_domain,$shortsubj) {
$r->print(''.(($status eq 'new')?'':'').
''.
- $item.(($status eq 'new')?'':'').' ');
+ $item.''.(($status eq 'new')?'':'').'');
}
# Description and Status
my $showstatus;
@@ -1217,17 +1243,17 @@ ENDDISHEADER
# Bottom Functions
- $r->print('
+ $r->print('
+
'."\n".
+ ''."\n"
+ );
my $postedstartdis=$startdis+1;
$r->print('');
if ($numblocked > 0) {
@@ -1423,11 +1451,7 @@ sub compout {
if ($group eq '') {
my $studentsel = &discourse(\%access_status);
if ($studentsel) {
- if ($env{'environment.wysiwygeditor'} eq 'on') {
- $r->print($studentsel);
- } else {
- $r->print('
';
+ my $textareaclass;
+ if (&Apache::lonhtmlcommon::htmlareabrowser()) {
+ $r->print(&Apache::lonhtmlcommon::htmlareaselectactive());
+ $textareaclass = 'class="LC_richDefaultOff"';
+ }
my $subj_size;
if ($multiforward) {
$r->print(&additional_rec_row(\%lt));
$r->print(' ');
+ &mt("The subject in each forwarded message will be [_1]'Forwarding:'[_2] followed by the original subject.",'','').''.
&mt('Unless you choose otherwise:').' '."\n".
$latexHelp."
\n".
&mt("Any new text to display before the text of the original messages:").'
'."\n".
-''.
-$wysiwyglink);
+'');
my @to_forward = &Apache::loncommon::get_env_multiple('form.delmark');
foreach my $msg (@to_forward) {
$r->print('');
@@ -1680,8 +1706,9 @@ $wysiwyglink);
$attachrow
$latexHelp
-$wysiwyglink
+
+
$sendmode
$dispcrit
$disbase
@@ -1706,8 +1733,8 @@ ENDCOMP
Subject:
$lt{'gmt'}:
-$wysiwyglink
$lt{'tff'}: ENDBLOCK @@ -1719,7 +1746,7 @@ ENDBLOCK '
-'.&mt('The messages will be assembled from all lines with the respective'."\n".'username:domain, and appended to the general message text.'));
+'.&mt('The messages will be assembled from all lines with the respective [_1][_2]username:domain[_3], and appended to the general message text.','
@@ -1733,9 +1760,7 @@ ENDUPLOAD
}
$r->print('');
if ($hasfloat) {
- unless($env{'environment.wysiwygeditor'} eq 'on') {
- $r->print(' ".&mt('No notes, face-to-face discussion records, critical messages, or broadcast messages in this [_1].',$lctype)." ".&mt('No notes, face-to-face discussion records, critical messages or broadcast messages in this '.$lctype.'.')."
','',''));
$r->print(<
'.&mt('Subject').': '.$content{'subject'}.'
'.
$content{'message'};
}
} else {
@@ -1937,15 +1961,15 @@ $content{'sendername'}.':'.
if ($result eq '') {
my $lctype = &mt(lc(&Apache::loncommon::course_type()));
if ($target ne 'tex') {
- $r->print("'
+ .'
'
);
&disfacetoface($r,$env{'form.recuname'},$env{'form.recdomain'});
$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('
');
- } 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");
-
-
-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->{'dura'}
- $ltext->{'setb'}
- $ltext->{'even'}
- $ltext->{'blck'}
- $ltext->{'actn'}
- $ltext->{'star'}: $startform
-
$ltext->{'endd'}: $endform$settername
-
-
-END
- foreach my $block (@{$typeorder}) {
- my $blockstatus = '';
- if ($blocks->{$block} eq 'on') {
- $blockstatus = 'checked="checked"';
- }
- $r->print('
-
');
- }
- $r->print(<<"END");
-
-
-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");
-
-
-END
- $r->print(&Apache::loncommon::start_data_table_row());
- $r->print(<<"END");
- $ltext->{'dura'}
- $ltext->{'even'} $lt{'exam'}
- $ltext->{'blck'}
- $ltext->{'actn'}
- $ltext->{'star'}: $startform
-
$ltext->{'endd'}: $endform
-
-END
- foreach my $block (@{$typeorder}) {
- $r->print('
-
');
- }
- $r->print(<<"END");
-
-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 Room',
- 'boards' => 'Discussion',
- 'port' => 'Portfolio',
- 'groups' => 'Groups',
- 'blogs' => 'Blogs',
- );
- my $typeorder = ['com','chat','boards','port','groups','blogs'];
- return ($typeorder,\%types);
-}
-
# ----------------------------------------------------------- Display a message
sub displaymessage {
@@ -2375,7 +2088,6 @@ sub displaymessage {
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);
my($blocked, $blocktext) = &Apache::loncommon::blocking_status("com");
$r->print("
".$blocktext);
return;
@@ -2412,7 +2124,6 @@ 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'});
# Prepare available functions
my @functionlist;
@@ -2430,19 +2141,22 @@ sub displaymessage {
push(@functionlist,''
.&mt('Delete')
.'');
- push(@functionlist,''
- .&mt('Back to Folder Display')
- .'');
+
+# Prepare available navigation
+ my @navigationlist;
if ($counter > 0){
- push(@functionlist,''
+ push(@navigationlist,''
.&mt('Previous')
.'');
}
if ($counter < $number_of_messages - 1){
- push(@functionlist,''
+ push(@navigationlist,''
.&mt('Next')
.'');
}
+ push(@navigationlist,''
+ .&mt('Back to Folder Display')
+ .'');
# Prepare available actions
my $symb;
@@ -2451,12 +2165,12 @@ sub displaymessage {
} elsif (defined($content{'baseurl'})) {
$symb=&Apache::lonnet::symbread($content{'baseurl'});
}
- my @actionlist;
+ my @actionlist;
if ($env{'user.adv'}) {
if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) {
push(@actionlist,&Apache::loncommon::track_student_link(
- &mt('View recent activity')
+ 'View recent activity'
,$content{'sendername'}
,$content{'senderdomain'}
,'check'));
@@ -2479,7 +2193,7 @@ sub displaymessage {
}
}
-# Print functionlist and actionlist in page header
+# Print functionlist, navigationlist, and actionlist in page header
my $functions='