--- loncom/interface/lonmsgdisplay.pm 2010/01/25 21:08:48 1.124.4.7 +++ loncom/interface/lonmsgdisplay.pm 2023/09/15 22:32:46 1.200 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.124.4.7 2010/01/25 21:08:48 raeburn Exp $ +# $Id: lonmsgdisplay.pm,v 1.200 2023/09/15 22:32:46 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; @@ -109,32 +111,35 @@ use Apache::loncommunicate; use Apache::lonfeedback; use Apache::lonrss(); use Apache::lonselstudent(); +use Apache::lonenc(); 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}); @@ -182,16 +187,16 @@ function folder_choice(targetform,caller if (targetform.folderaction.options[targetform.folderaction.selectedIndex].value == 'rename') { for (var i=0; i + - - + - -
'.$lt{'fold'}.'
'."\n". - &Apache::loncommon::select_form($folder,'folder',%formhash).' +
'.$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).' + \%show).' +
'.$html_lt{'status'}.'
'."\n". + &Apache::loncommon::select_form($msgstatus,'msgstatus',\%statushash).'
'.$lt{'status'}.'
'."\n". - &Apache::loncommon::select_form($msgstatus,'msgstatus',%statushash).' +
+ '.$html_lt{'actn'}.'
'."\n".' + '. + &Apache::loncommon::select_form('view','folderaction',\%actions). + ' +
'.$lt{'actn'}.'
'. - &Apache::loncommon::select_form('view','folderaction',%actions).' -

'. - ' +
+ '.&mt('New Folder').'
'."\n".' + + + +
-      - - '. - '

-
'.&mt('Name').'
'. - ' -
- - -'."\n". + +'."\n". ''. ''. ($folder=~/^critical/?'':''); @@ -265,8 +271,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; } @@ -295,14 +301,27 @@ sub scrollbuttons { } else { $status = $statushash{$msgstatus}; } - return - ''.&mt('Page').': '. - ''. - ''. - ' of '.$maxdis. - ''. - '
'. - &mt('[_1] messages: showing messages [_2] through [_3] of [_4].',$status,$first,$finish,$total).''; + my $output = ''.&mt('Page:').' '; + if ($maxdis == 1) { + # No buttons if only one page is displayed + $output .= '1/1'; + } else { + $output .= + ''. + ''. + ' / '.$maxdis.' '. + ''. + ''; + } + $output .= + '

' + .''.&mt($status.' messages:').' ' + .&mt('showing messages [_1] through [_2] of [_3].', + $first,$finish,$total) + .'

' + .''; + + return $output; } # =============================================================== Status Change @@ -369,7 +388,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})) { @@ -525,20 +544,20 @@ sub discourse { \%defaultUsers, 1,"selectedusers",1,'email') ) { - my $bcc_curr_hdr; - if ($crstype eq 'Community') { - $bcc_curr_hdr = &mt('Bcc: community participants with current access'); - } else { - $bcc_curr_hdr = &mt('Bcc: course members with current access'); - } - $result .= '
' - .''.$bcc_curr_hdr.'' - .'' - .'
'; - $result .= $tmptext.'

'; - if (ref($statushash) eq 'HASH') { - $statushash->{'active'} = 1; - } + my $bcc_curr_hdr; + if ($crstype eq 'Community') { + $bcc_curr_hdr = &mt('Bcc: community participants with current access'); + } else { + $bcc_curr_hdr = &mt('Bcc: course members with current access'); + } + $result .= '
' + .$bcc_curr_hdr + .'' + .'
'; + $result .= $tmptext.'

'; + if (ref($statushash) eq 'HASH') { + $statushash->{'active'} = 1; + } } if ($tmptext = &Apache::lonselstudent::render_student_list($expired_members, "previoususers", @@ -546,20 +565,21 @@ sub discourse { \%defaultUsers, 1, "selectedusers",0,'email') ) { - my $bcc_prev_hdr; - if ($crstype eq 'Community') { - $bcc_prev_hdr = &mt('Bcc: community participants with expired access'); - } else { - $bcc_prev_hdr = &mt('Bcc: course members with expired access'); - } - $result .= '
' - .''.$bcc_prev_hdr.'' - .'' - .'
'; + my $bcc_prev_hdr; + if ($crstype eq 'Community') { + $bcc_prev_hdr = &mt('Bcc: community participants with expired access'); + } else { + $bcc_prev_hdr = &mt('Bcc: course members with expired access'); + } + $result .= '
' + .$bcc_prev_hdr + .'' + .''; $result .= $tmptext.'

'; if (ref($statushash) eq 'HASH') { $statushash->{'previous'} = 1; } + } if ($tmptext = &Apache::lonselstudent::render_student_list($future_members, "futureusers", @@ -567,20 +587,22 @@ sub discourse { \%defaultUsers, 1, "selectedusers",0,'email') ) { - my $bcc_future_hdr; - if ($crstype eq 'Community') { - $bcc_future_hdr = &mt('Bcc: community participants with future access'); - } else { - $bcc_future_hdr = &mt('Bcc: course members with future access'); - } - $result .= '
' - .''.$bcc_future_hdr.'' - .'' - .'
'; + my $bcc_future_hdr; + if ($crstype eq 'Community') { + $bcc_future_hdr = &mt('Bcc: community participants with future access'); + } else { + $bcc_future_hdr = &mt('Bcc: course members with future access'); + } + + $result .= '
' + .$bcc_future_hdr + .'' + .''; $result .= $tmptext.'
'; if (ref($statushash) eq 'HASH') { $statushash->{'future'} = 1; } + } return $result; } @@ -614,9 +636,7 @@ sub disgroup { return; } else { $hasfloat = 1; - unless($env{'environment.wysiwygeditor'} eq 'on') { - $r->print('
'); - } + $r->print('
'); my %Sortby = ( active => {}, previous => {}, @@ -650,8 +670,9 @@ sub disgroup { if (ref($access_status) eq 'HASH') { $access_status->{$status} = $$numitems{$status}; } - $r->print('
'.$lt{$status}. - '
'. + $r->print('
'. + ''.$lt{$status}.''. + ''. ''. ''. @@ -688,9 +709,7 @@ sub disgroup { } } } - unless($env{'environment.wysiwygeditor'} eq 'on') { - $r->print('
'); - } + $r->print('
'); } return $hasfloat; } @@ -698,7 +717,7 @@ sub disgroup { sub group_check_uncheck { my $output = qq| '; + if ($head_extra) { + $extra .= "\n$head_extra"; + } $r->print(&Apache::loncommon::start_page('Messages', $extra)); $r->print(&Apache::lonhtmlcommon::breadcrumbs @@ -2900,11 +2765,11 @@ sub header { # ---------------------------------------------------------------- Print header sub printheader { - my ($r,$url,$desc,$title,$baseurl)=@_; + my ($r,$url,$desc,$title,$baseurl,$head_extra)=@_; &Apache::lonhtmlcommon::add_breadcrumb ({href=>$url, text=>$desc}); - &header($r,$title,$baseurl); + &header($r,$title,$baseurl,$head_extra); } # ------------------------------------------------------------ Store the comment @@ -2928,7 +2793,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; @@ -2961,8 +2826,15 @@ sub sendoffmail { $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; } - if ($env{'form.send'}) { - if (!$env{'form.multiforward'}) { + my $clientip = &Apache::lonnet::get_requestor_ip($r); + my %setters; + my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) = + &Apache::loncommon::blockcheck(\%setters,'com',$clientip); + if ($by_ip) { + &printheader($r,'','Sending messages blocked from your location.'); + return 'blocked'; + } elsif ($env{'form.send'}) { + if (!$env{'form.multiforward'}) { if ($group eq '') { &printheader($r,'','Messages being sent.'); } else { @@ -2992,6 +2864,8 @@ sub sendoffmail { my $mode = $env{'form.sendmode'}; my (%toaddr,$tos,$cc,$bcc,$broadcast); + my (%willtrust,%trustchecked,%disallowed); + my $serverdefdom = &Apache::lonnet::default_login_domain(); if ($mode eq 'group') { if (defined($env{'form.courserecips'})) { @@ -3001,9 +2875,17 @@ sub sendoffmail { foreach my $dest (@to) { my ($user,$domain) = split(/:/, $dest); if (($user ne '') && ($domain ne '')) { - my $rec = $user.":".$domain; - $toaddr{$rec} = ''; - $broadcast->{$rec} = ''; + unless ($trustchecked{$domain}) { + $willtrust{$domain} = &Apache::lonnet::will_trust('msg',$serverdefdom,$domain); + $trustchecked{$domain} = 1; + } + if ($willtrust{$domain}) { + my $rec = $user.":".$domain; + $toaddr{$rec} = ''; + $broadcast->{$rec} = ''; + } else { + $disallowed{'to'}{$user.":".$domain} = 1; + } } } } @@ -3014,22 +2896,47 @@ sub sendoffmail { if ($txt) { $rec =~ s/^\s+//; $rec =~ s/\s+$//; - $toaddr{$rec}.=$txt."\n"; - $broadcast->{$rec} = ''; + my ($recuname,$recudom) = split(/:/,$rec); + unless ($trustchecked{$recudom}) { + $willtrust{$recudom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$recudom); + $trustchecked{$recudom} = 1; + } + if ($willtrust{$recudom}) { + $toaddr{$rec}.=$txt."\n"; + $broadcast->{$rec} = ''; + } else { + $disallowed{'to'}{$rec} = 1; + } } } } else { if (($env{'form.recuname'} ne '') && ($env{'form.recdomain'} ne '')) { - $toaddr{$env{'form.recuname'}.':'.$env{'form.recdomain'}}=''; - $tos->{$env{'form.recuname'}.':'.$env{'form.recdomain'}}=''; + unless ($trustchecked{$env{'form.recdomain'}}) { + $willtrust{$env{'form.recdomain'}} = &Apache::lonnet::will_trust('msg',$serverdefdom,$env{'form.recdomain'}); + $trustchecked{$env{'form.recdomain'}} = 1; + } + if ($willtrust{$env{'form.recdomain'}}) { + $toaddr{$env{'form.recuname'}.':'.$env{'form.recdomain'}}=''; + $tos->{$env{'form.recuname'}.':'.$env{'form.recdomain'}}=''; + } else { + $disallowed{'to'}{$env{'form.recuname'}.':'.$env{'form.recdomain'}}; + } } } if ($env{'form.additionalrec_to'}) { foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec_to'})) { my ($auname,$audom)=split(/:/,$rec); if (($auname ne "") && ($audom ne "")) { - $toaddr{$auname.':'.$audom}=''; - $tos->{$auname.':'.$audom}=''; + unless ($trustchecked{$audom}) { + $willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom); + $trustchecked{$audom} = 1; + } + if ($willtrust{$audom}) { + $toaddr{$auname.':'.$audom}=''; + $tos->{$auname.':'.$audom}=''; + } else { + $disallowed{'to'}{$auname.':'.$audom}; + } } } } @@ -3039,8 +2946,16 @@ sub sendoffmail { foreach my $rec (@toreplies) { my ($auname,$audom)=split(/:/,$rec); if (($auname ne "") && ($audom ne "")) { - $toaddr{$auname.':'.$audom}=''; - $tos->{$auname.':'.$audom}=''; + unless ($trustchecked{$audom}) { + $willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom); + $trustchecked{$audom} = 1; + } + if ($willtrust{$audom}) { + $toaddr{$auname.':'.$audom}=''; + $tos->{$auname.':'.$audom}=''; + } else { + $disallowed{'to'}{$auname.':'.$audom}; + } } } } @@ -3048,9 +2963,17 @@ sub sendoffmail { foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec_cc'})) { my ($auname,$audom)=split(/:/,$rec); if (($auname ne "") && ($audom ne "")) { - $toaddr{$auname.':'.$audom}=''; if (!defined($tos->{$auname.':'.$audom})) { - $cc->{$auname.':'.$audom}=''; + unless ($trustchecked{$audom}) { + $willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom); + $trustchecked{$audom} = 1; + } + if ($willtrust{$audom}) { + $toaddr{$auname.':'.$audom}=''; + $cc->{$auname.':'.$audom}=''; + } else { + $disallowed{'cc'}{$auname.':'.$audom}; + } } } } @@ -3061,9 +2984,17 @@ sub sendoffmail { foreach my $rec (@ccreplies) { my ($auname,$audom)=split(/:/,$rec); if (($auname ne "") && ($audom ne "")) { - $toaddr{$auname.':'.$audom}=''; if (!defined($tos->{$auname.':'.$audom})) { - $cc->{$auname.':'.$audom}=''; + unless ($trustchecked{$audom}) { + $willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom); + $trustchecked{$audom} = 1; + } + if ($willtrust{$audom}) { + $toaddr{$auname.':'.$audom}=''; + $cc->{$auname.':'.$audom}=''; + } else { + $disallowed{'cc'}{$auname.':'.$audom} = 1; + } } } } @@ -3074,9 +3005,17 @@ sub sendoffmail { foreach my $rec (@groupreplies) { my ($auname,$audom)=split(/:/,$rec); if (($auname ne "") && ($audom ne "")) { - $toaddr{$auname.':'.$audom}=''; if (!defined($tos->{$auname.':'.$audom})) { - $broadcast->{$auname.':'.$audom}=''; + unless ($trustchecked{$audom}) { + $willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom); + $trustchecked{$audom} = 1; + } + if ($willtrust{$audom}) { + $toaddr{$auname.':'.$audom}=''; + $broadcast->{$auname.':'.$audom}=''; + } else { + $disallowed{'to'}{$auname.':'.$audom} = 1; + } } } } @@ -3085,10 +3024,18 @@ sub sendoffmail { foreach my $rec (split(/\s*,\s*/,$env{'form.additionalrec_bcc'})) { my ($auname,$audom)=split(/:/,$rec); if (($auname ne "") && ($audom ne "")) { - $toaddr{$auname.':'.$audom}=''; - if ((!defined($tos->{$auname.':'.$audom})) && + if ((!defined($tos->{$auname.':'.$audom})) && (!defined($cc->{$auname.':'.$audom}))) { - $bcc->{$auname.':'.$audom}=''; + unless ($trustchecked{$audom}) { + $willtrust{$audom} = &Apache::lonnet::will_trust('msg',$serverdefdom,$audom); + $trustchecked{$audom} = 1; + } + if ($willtrust{$audom}) { + $toaddr{$auname.':'.$audom}=''; + $bcc->{$auname.':'.$audom}=''; + } else { + $disallowed{'bcc'}{$auname.':'.$audom} = 1; + } } } } @@ -3108,46 +3055,47 @@ sub sendoffmail { } else { $savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'}); } - my %reciphash = ( - to => $tos, - cc => $cc, - bcc => $bcc, - ); - if ($mode eq 'group') { - if ($group eq '') { - $reciphash{'course_broadcast'} = $broadcast; - } else { - if ($env{'form.groupmail'} eq 'cc') { - $reciphash{'group_cc_broadcast'} = $broadcast; + my ($recipid, @recusers, @recudoms, %permresults); + if (keys(%toaddr) > 0) { + my %reciphash = ( + to => $tos, + cc => $cc, + bcc => $bcc, + ); + if ($mode eq 'group') { + if ($group eq '') { + $reciphash{'course_broadcast'} = $broadcast; } else { - $reciphash{'group_bcc_broadcast'} = $broadcast; + if ($env{'form.groupmail'} eq 'cc') { + $reciphash{'group_cc_broadcast'} = $broadcast; + } else { + $reciphash{'group_bcc_broadcast'} = $broadcast; + } } } - } - my ($recipid,$recipstatus) = - &Apache::lonmsg::store_recipients($msgsubj,$env{'user.name'}, - $env{'user.domain'},\%reciphash); - if ($recipstatus ne 'ok') { - &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) { - $attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,'feedback/'.$now); - } else { - $r->print('

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

'); - } - } elsif ($env{'form.multiforward'}) { - if ($env{'form.attachmenturl'} ne '') { - $attachmenturl = $env{'form.attachmenturl'}; + ($recipid,my $recipstatus) = + &Apache::lonmsg::store_recipients($msgsubj,$env{'user.name'}, + $env{'user.domain'},\%reciphash); + if ($recipstatus ne 'ok') { + &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'}) <= 1048576) { + $attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,'feedback/'.$now); + } else { + $r->print('

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

'); + } + } elsif ($env{'form.multiforward'}) { + if ($env{'form.attachmenturl'} ne '') { + $attachmenturl = $env{'form.attachmenturl'}; + } } } - my @recusers; - my @recudoms; 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') { @@ -3159,7 +3107,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= @@ -3170,13 +3119,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); } @@ -3252,7 +3208,7 @@ sub sendoffmail { '','','','',$recipid); } } - if (!$env{'form.multiforward'}) { + if (!$env{'form.multiforward'}) { if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) { my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Completed.')); $message = &Apache::loncommon::confirmwrapper($message); @@ -3272,6 +3228,26 @@ sub sendoffmail { $r->print($message); } } + if (keys(%disallowed)) { + if ((ref($disallowed{'to'}) eq 'HASH') && (keys(%{$disallowed{'to'}}) > 0)) { + $r->print(&mt("The following recipients were excluded because the user's domain does not accept messages from server's domain:").'
  • '. + join("
  • \n",sort(keys(%{$disallowed{'to'}}))). + '

    • '); + } + if (ref($disallowed{'cc'}) eq 'HASH') { + $r->print(&mt("The following CCs were excluded because the user's domain does not accept messages from server's domain:").'
      • '. + join("
      • \n",sort(keys(%{$disallowed{'cc'}}))). + '

        • '); + } + if (ref($disallowed{'bcc'}) eq 'HASH') { + $r->print(&mt("The following BCCs were excluded because the user's domain does not accept messages from server's domain:").'
          • '. + join("
          • \n",sort(keys(%{$disallowed{'bcc'}}))). + '

            • '); + } + } + } else { + &printheader($r,'','Messages cancelled.'); + return 'cancelled'; } return $sendstatus; } @@ -3292,16 +3268,29 @@ 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']); + 'msgstatus','btoken']); $sqs='&sortedby='.$env{'form.sortedby'}; -# ------------------------------------------------------ They checked for email - unless ($env{'form.block'}) { - &Apache::lonnet::put('email_status',{'recnewemail'=>0}); +# ----------- Check if access was from balancer to server with existing session + + if ($env{'form.btoken'}) { + my %info = &Apache::lonnet::tmpget($env{'form.btoken'}); + &Apache::lonnet::tmpdel($env{'form.btoken'}); + delete($env{'form.btoken'}); + unless ($env{'form.display'}) { + if (($info{'display'}) && ($info{'mailrecip'})) { + if (&unescape($info{'mailrecip'}) eq $env{'user.name'}.':'.$env{'user.domain'}) { + $env{'form.display'} = &unescape($info{'display'}); + } + } + } } +# ------------------------------------------------------ They checked for email + &Apache::lonnet::put('email_status',{'recnewemail'=>0}); + # ----------------------------------------------------------------- Breadcrumbs &Apache::lonhtmlcommon::clear_breadcrumbs(); @@ -3389,7 +3378,7 @@ sub handler { &statuschange($env{'form.markdel'},'deleted',$folder); if (!$result) { my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Failed to delete the message.'),1); - $message .= '

              '.$msg.'

              '; + $message .= '

              '.$msg.'

              '; $message = &Apache::loncommon::confirmwrapper($message); $r->print($message); } @@ -3416,6 +3405,7 @@ sub handler { 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') { @@ -3429,6 +3419,7 @@ sub handler { 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') { @@ -3437,7 +3428,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'); @@ -3451,16 +3442,17 @@ sub handler { push(@failed_msg,$msg); } } - my $message; + my $message = ''; if ($failed) { - $message = &Apache::lonhtmlcommon::confirm_success(&mt('Failed to move [quant,_1,message]',$failed),1); - $message .= '

              '. - join("

              \n

              ",@failed_msg). + $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); @@ -3478,16 +3470,17 @@ sub handler { } } &printheader($r,'','Deleted Messages'); - my $message; + my $message = ''; if ($failed) { - $message = &Apache::lonhtmlcommon::confirm_success(&mt('Failed to delete [quant,_1,message]',$failed),1); - $message .= '

              '. - join("

              \n

              ",@failed_msg). + $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'}) { @@ -3499,8 +3492,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.'); @@ -3551,8 +3542,12 @@ sub handler { my $count = keys(%forwardfail); my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Could not forward [quant,_1,message].',$count),1); foreach my $key (keys(%forwardfail)) { - $message .= '
              '.&mt('Could not deliver forwarded message.').' '. - &mt('The recipient addresses may need to be corrected').' ('.$forwardfail{$key}.')'; + $message .= '
              '.&mt('Could not deliver forwarded message.').' '; + if ($forwardfail{$key} eq 'blocked') { + $message .= &mt('Sending messages is blocked from your IP address'); + } else { + $message .= &mt('The recipient addresses may need to be corrected').' ('.$forwardfail{$key}.')'; + } } $message = &Apache::loncommon::confirmwrapper($message); $r->print($message);