--- loncom/interface/lonmsgdisplay.pm 2013/09/04 14:21:30 1.169 +++ loncom/interface/lonmsgdisplay.pm 2014/05/21 17:36:58 1.175 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.169 2013/09/04 14:21:30 bisitz Exp $ +# $Id: lonmsgdisplay.pm,v 1.175 2014/05/21 17:36:58 musolffc Exp $ # # Copyright Michigan State University Board of Trustees # @@ -263,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; } @@ -380,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})) { @@ -813,7 +813,9 @@ sub discrit { .''; my %what=&Apache::lonnet::dump('critical'); my $result = ''; - foreach my $key (sort(keys(%what))) { + # Sort by date in descending order + foreach my $key (sort{$b <=> $a}(keys(%what))) { + print STDERR "key = ||$key||\n"; my %content=&Apache::lonmsg::unpackagemsg($what{$key}); next if ($content{'senderdomain'} eq ''); my $description; @@ -1023,6 +1025,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; @@ -1204,7 +1213,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; @@ -1254,7 +1263,7 @@ ENDDISHEADER $r->print(' '."\n"); } if ($msgstatus ne 'read') { - $r->print(' ."\n"'); + $r->print(' '."\n"); } if ($msgstatus ne 'unread') { $r->print(' '."\n"); @@ -1924,8 +1933,7 @@ sub disfacetoface { } else { %content=&Apache::lonmsg::unpackagemsg($content{'message'}); $content{'message'} = - ''.&mt('Subject').': '.$content{'subject'}.'
'.&mt('Subject').': '.$content{'subject'}.'
'. $content{'message'}; } } else { @@ -1954,9 +1962,9 @@ $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 ne 'tex') { $r->print($result.''); @@ -2163,7 +2171,7 @@ sub displaymessage { 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'));