--- loncom/interface/lonmsgdisplay.pm 2014/05/21 17:36:58 1.175 +++ loncom/interface/lonmsgdisplay.pm 2019/08/13 21:03:34 1.181.2.4 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.175 2014/05/21 17:36:58 musolffc Exp $ +# $Id: lonmsgdisplay.pm,v 1.181.2.4 2019/08/13 21:03:34 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; @@ -120,18 +122,23 @@ my $startdis=''; 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', 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}); @@ -179,16 +186,16 @@ function folder_choice(targetform,caller if (targetform.folderaction.options[targetform.folderaction.selectedIndex].value == 'rename') { for (var i=0; i'.&mt('Folder Actions').' - - - @@ -245,7 +252,7 @@ function folder_choice(targetform,caller '.&mt('New Folder').'
'."\n".' - @@ -768,14 +775,24 @@ sub groupmail_header { text=>"Groups", title=>$brtitle}); } + my $view_permission = + &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')); + my $navmap=Apache::lonnavmaps::navmap->new(); + my $grouppagelink = &Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap,$view_permission,$refarg); + if ($grouppagelink) { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>$grouppagelink, + text=>"Group: $description", + title=>"Go to group's home page"},); + } else { + &Apache::lonhtmlcommon::add_breadcrumb + ({text=>"Group: $description",}); + } &Apache::lonhtmlcommon::add_breadcrumb - ({href=>"/adm/$cdom/$cnum/$group/smppg?$refarg", - text=>"Group: $description", - title=>"Go to group's home page"}, - {href=>"/adm/email?compose=group&group=". - "$env{'form.group'}&$refarg", - text=>"Send a Message in a Group", - title=>"Compose Group Message"},); + ({href=>"/adm/email?compose=group&group=". + "$env{'form.group'}&$refarg", + text=>"Send a Message in a Group", + title=>"Compose Group Message"},); if ($action eq 'sending') { &Apache::lonhtmlcommon::add_breadcrumb ({text=>"Messages being sent.", @@ -815,7 +832,6 @@ sub discrit { my $result = ''; # 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; @@ -1052,11 +1068,12 @@ sub disfolder { my %setters = (); my $numblocked = 0; my ($startblock,$endblock) = &Apache::loncommon::blockcheck(\%setters,'com'); - my %lt = &Apache::lonlocal::texthash( + my %js_lt = &Apache::lonlocal::texthash( sede => 'Select a destination folder to which the messages will be moved.', nome => 'No messages have been selected to apply this action to.', chec => 'Check the checkbox for at least one message.', ); + &js_escape(\%js_lt); my $jscript = &Apache::loncommon::check_uncheck_jscript(); $r->print(< @@ -1067,7 +1084,7 @@ sub disfolder { document.disall.markedaction.value = document.disall.checkedaction.options[document.disall.checkedaction.selectedIndex].value; if (document.disall.checkedaction.options[document.disall.checkedaction.selectedIndex].value == 'markedmove') { if (document.disall.movetofolder.options[document.disall.movetofolder.selectedIndex].value == "") { - alert("$lt{'sede'}"); + alert("$js_lt{'sede'}"); return; } } @@ -1084,7 +1101,7 @@ sub disfolder { } } if (checktotal == 0) { - alert("$lt{'nome'}\\n$lt{'chec'}"); + alert("$js_lt{'nome'}\\n$js_lt{'chec'}"); return; } document.disall.submit(); @@ -1395,11 +1412,14 @@ sub compout { 'to' => 'To:', ); my %attachmax = ( - text => &mt('(128 KB max size)'), - num => 131072, + text => &mt('(1 MB max size)'), + num => 1048576, ); if (!$forwarding && !$multiforward) { - $attachrow = ''; + $attachrow = ''; } if (&Apache::lonnet::allowed('srm',$env{'request.course.id'}) || &Apache::lonnet::allowed('srm',$env{'request.course.id'}. @@ -1901,7 +1921,7 @@ sub disfacetoface { $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}, '%255b'.$user.'%253a'.$domain.'%255d'); - my $result='
'; + my $result=''; foreach my $key (sort(keys(%records))) { my %content=&Apache::lonmsg::unpackagemsg($records{$key}); next if ($content{'senderdomain'} eq ''); @@ -1966,11 +1986,11 @@ $content{'sendername'}.':'. } else { $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.'
'); + } elsif ($target eq 'tex') { + $r->print(&Apache::lonxml::xmlparse($r,$target,$result)); } else { - $r->print(&Apache::lonxml::xmlparse($r, 'tex', $result)); - } + $r->print('
'.$result.'
'); + } } sub general_message { @@ -2169,7 +2189,8 @@ sub displaymessage { my @actionlist; if ($env{'user.adv'}) { - if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) { + 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'} @@ -2662,6 +2683,8 @@ sub header { if ($baseurl) { $extra .= ""; } + $extra .= ''; $r->print(&Apache::loncommon::start_page('Messages', $extra)); $r->print(&Apache::lonhtmlcommon::breadcrumbs @@ -2699,7 +2722,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; @@ -2902,7 +2925,7 @@ sub sendoffmail { &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) { + if (length($env{'form.attachment'}) <= 1048576) { $attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,'feedback/'.$now); } else { $r->print('

'.&mt('Attachment not included - exceeded permitted length').'

'); @@ -2914,6 +2937,7 @@ sub sendoffmail { } my @recusers; my @recudoms; + my %permresults; foreach my $address (sort(keys(%toaddr))) { my ($recuname,$recdomain)=split(/\:/,$address); my $msgtxt = $savemsg; @@ -2930,7 +2954,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= @@ -2941,13 +2966,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); }
'.$lt{'fold'}.'
'."\n". +
'.$html_lt{'fold'}.'
'."\n". &Apache::loncommon::select_form($folder,'folder',\%formhash).'
'.$lt{'show'}.'
'."\n". +
'.$html_lt{'show'}.'
'."\n". &Apache::loncommon::select_form($env{'form.interdis'},'interdis', \%show).'
'.$lt{'status'}.'
'."\n". +
'.$html_lt{'status'}.'
'."\n". &Apache::loncommon::select_form($msgstatus,'msgstatus',\%statushash).'
- '.$lt{'actn'}.'
'."\n".' + '.$html_lt{'actn'}.'
'."\n".' '. &Apache::loncommon::select_form('view','folderaction',\%actions). - '
'.$lt{'atta'}.' '.$attachmax{'text'}.':
'.$lt{'atta'}.' '.$attachmax{'text'} + .': ' + .'' + .'