--- loncom/interface/lonmsgdisplay.pm 2010/02/12 15:21:37 1.148
+++ loncom/interface/lonmsgdisplay.pm 2014/04/25 17:56:42 1.174
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.148 2010/02/12 15:21:37 bisitz Exp $
+# $Id: lonmsgdisplay.pm,v 1.174 2014/04/25 17:56:42 bisitz 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';
@@ -1645,8 +1678,7 @@ ENDREPSCRIPT
'.$lt{'fold'}.'
'."\n".
- &Apache::loncommon::select_form($folder,'folder',%formhash).'
+ &Apache::loncommon::select_form($folder,'folder',\%formhash).'
'.$lt{'show'}.'
'."\n".
&Apache::loncommon::select_form($env{'form.interdis'},'interdis',
- %show).'
+ \%show).'
'.$lt{'status'}.'
-
'."\n".
- &Apache::loncommon::select_form($msgstatus,'msgstatus',%statushash).'
+ &Apache::loncommon::select_form($msgstatus,'msgstatus',\%statushash).'
'.$lt{'actn'}.'
'."\n".'
+
+ '.$lt{'actn'}.'
-
'."\n".'
'.
- &Apache::loncommon::select_form('view','folderaction',%actions).
+ &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 +879,9 @@ sub discrit {
'
'.
- ''.&mt('Communicate').'';
+ &Apache::lonhtmlcommon::actionbox(
+ [''.&mt('Select a course').'',
+ ''.&mt('Communicate').'']);
} else {
$r->print($header);
}
@@ -985,10 +998,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;
}
@@ -1098,7 +1116,9 @@ ENDDISHEADER
if ($lastdis>$#temp) { $lastdis=$#temp; }
$r->print(&scrollbuttons($startdis,$number,$firstdis,$lastdis,$totalnumber,$msgstatus));
$r->print('');
if ($numblocked > 0) {
@@ -1409,11 +1443,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('');
@@ -1666,8 +1698,9 @@ $wysiwyglink);
$attachrow
$latexHelp
-$wysiwyglink
+
+
$sendmode
$dispcrit
$disbase
@@ -1692,8 +1725,8 @@ ENDCOMP
Subject:
$lt{'gmt'}:
-$wysiwyglink
$lt{'tff'}: ENDBLOCK @@ -1705,7 +1738,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.','
@@ -1719,9 +1752,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 {
@@ -1923,9 +1953,9 @@ $content{'sendername'}.':'.
if ($result eq '') {
my $lctype = &mt(lc(&Apache::loncommon::course_type()));
if ($target ne 'tex') {
- $r->print("
'
.''
+ .''
);
if (($stage ne 'query') &&
@@ -2014,7 +2045,7 @@ sub facetoface {
.&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(<'.$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 {
@@ -2360,7 +2080,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;
@@ -2397,7 +2116,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;
@@ -2415,19 +2133,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;
@@ -2436,12 +2157,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'));
@@ -2464,7 +2185,7 @@ sub displaymessage {
}
}
-# Print functionlist and actionlist in page header
+# Print functionlist, navigationlist, and actionlist in page header
my $functions='
'.$toaddr{$address};
+ $msgtxt.="\n".'
'."\n".$toaddr{$address};
}
my @thismsg;
if ($msgtype eq 'critical') {
@@ -3295,6 +3034,9 @@ sub sendoffmail {
$r->print($message);
}
}
+ } else {
+ &printheader($r,'','Messages cancelled.');
+ return 'cancelled';
}
return $sendstatus;
}
@@ -3315,15 +3057,13 @@ 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'};
# ------------------------------------------------------ They checked for email
- unless ($env{'form.block'}) {
- &Apache::lonnet::put('email_status',{'recnewemail'=>0});
- }
+ &Apache::lonnet::put('email_status',{'recnewemail'=>0});
# ----------------------------------------------------------------- Breadcrumbs
@@ -3526,8 +3266,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.');