--- loncom/interface/lonmsgdisplay.pm 2024/07/05 18:06:47 1.181.2.11 +++ loncom/interface/lonmsgdisplay.pm 2015/06/18 20:19:06 1.182 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.181.2.11 2024/07/05 18:06:47 raeburn Exp $ +# $Id: lonmsgdisplay.pm,v 1.182 2015/06/18 20:19:06 musolffc Exp $ # # Copyright Michigan State University Board of Trustees # @@ -102,8 +102,6 @@ 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; @@ -111,7 +109,6 @@ use Apache::loncommunicate; use Apache::lonfeedback; use Apache::lonrss(); use Apache::lonselstudent(); -use Apache::lonenc(); use lib '/home/httpd/lib/perl/'; use LONCAPA qw(:DEFAULT :match); @@ -776,36 +773,22 @@ 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=>&mt('Group').": $description", - title=>&mt("Go to group's home page"), - no_mt=>1, - },); - } else { - &Apache::lonhtmlcommon::add_breadcrumb - ({text=>&mt('Group').": $description", - no_mt=>1,}); - } &Apache::lonhtmlcommon::add_breadcrumb - ({href=>"/adm/email?compose=group&group=". - "$env{'form.group'}&$refarg", - text=>"Send a Message in a Group", - title=>"Compose Group Message"},); + ({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"},); if ($action eq 'sending') { &Apache::lonhtmlcommon::add_breadcrumb ({text=>"Messages being sent.", title=>"E-mails sent"},); } my $groupheader = &Apache::loncommon::start_page('Group Message'); - $groupheader .= &Apache::lonhtmlcommon::breadcrumbs( - &mt('Group messages - [_1]',$description), - undef,undef,undef,undef,1); + $groupheader .= &Apache::lonhtmlcommon::breadcrumbs + ('Group - '.$env{'form.group'}.' Email'); return $groupheader; } @@ -866,7 +849,7 @@ sub discrit { .&Apache::lonhtmlcommon::row_closure(1); } $result .= &Apache::lonhtmlcommon::row_title(&mt('Message'),undef,'LC_evenrow_value') - .'
'.&Apache::lontexconvert::msgtexconverted($content{'message'}).'' + .'
'.&Apache::lontexconvert::msgtexconverted($content{'message'}).'' .&Apache::lonhtmlcommon::row_closure() .&Apache::lonhtmlcommon::row_title('',undef,'LC_oddrow_value') .'
'); @@ -1132,7 +1112,7 @@ ENDDISHEADER } $r->print('
'); if ($numblocked > 0) { - $r->print(&blocked_in_folder($numblocked,$startblock,$endblock,$by_ip,$clientip,$blockdom, + $r->print(&blocked_in_folder($numblocked,$startblock,$endblock, \%setters)); } return; @@ -1322,26 +1302,20 @@ ENDDISHEADER $r->print(''); if ($numblocked > 0) { $r->print(&blocked_in_folder($numblocked,$startblock,$endblock, - $by_ip,$clientip,$blockdom,\%setters)); + \%setters)); } } sub blocked_in_folder { - my ($numblocked,$startblock,$endblock,$by_ip,$clientip,$blockdom,$setters) = @_; - my $output; - if ($by_ip) { - $output = ''. - &mt('Sending of LON-CAPA messages is blocked for your current IP address: [_1].',$clientip).'
'. - ''. + ''. &Apache::lontexconvert::msgtexconverted($content{'message'}). ''; } @@ -2136,16 +2090,14 @@ sub displaymessage { my %setters = (); my $numblocked = 0; my $crstype = &Apache::loncommon::course_type(); - my $clientip = &Apache::lonnet::get_requestor_ip($r); # info to generate "next" and "previous" buttons and check if message is blocked - my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) = - &Apache::loncommon::blockcheck(\%setters,'com',$clientip); - my @messages=&sortedmessages(\%blocked,$startblock,$endblock,$by_ip,\$numblocked,$folder,$msgstatus); + my ($startblock,$endblock) = &Apache::loncommon::blockcheck(\%setters,'com'); + my @messages=&sortedmessages(\%blocked,$startblock,$endblock,\$numblocked,$folder,$msgstatus); 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.')); - my($blocked, $blocktext) = &Apache::loncommon::blocking_status("com",$clientip); + my($blocked, $blocktext) = &Apache::loncommon::blocking_status("com"); $r->print("
".$blocktext); return; } @@ -2179,28 +2131,8 @@ sub displaymessage { my $number_of_messages = scalar(@messages); #subtract 1 for last index - my $head_extra; - -# if student's view of resource will be included -# get tag(s) for css file(s) in use, and pass to &header to include -# in call to loncommon::start_page() - - if (($env{'request.course.id'} eq $content{'courseid'}) && - (&Apache::lonnet::allowed('vgr',$content{'courseid'}))) { - my $symb; - if (defined($content{'symb'})) { - $symb = $content{'symb'}; - } elsif (defined($content{'baseurl'})) { - $symb=&Apache::lonnet::symbread($content{'baseurl'}); - } - if ($symb) { - $head_extra = &Apache::loncommon::css_links($symb); - } - } - # start output - &printheader($r,'/adm/email?display='.&escape($msgid),'Display a Message','', - $content{'baseurl'},$head_extra); + &printheader($r,'/adm/email?display='.&escape($msgid),'Display a Message','',$content{'baseurl'}); # Prepare available functions my @functionlist; @@ -2245,8 +2177,7 @@ sub displaymessage { my @actionlist; if ($env{'user.adv'}) { - if (($env{'request.course.id'}) && ($from_student) && - (&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) { + if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) { push(@actionlist,&Apache::loncommon::track_student_link( 'View recent activity' ,$content{'sendername'} @@ -2504,16 +2435,12 @@ sub displaymessage { $showsymb,$env{'user.domain'},$env{'user.name'}); if ($symb) { if ($encrypturl =~ /^yes$/i && !$env{'request.role.adv'}) { - unless ($showsymb =~ m{^/enc/}) { - $showsymb = &Apache::lonenc::encrypted($showsymb); - } + $showsymb = &Apache::lonenc::check_encrypt($symb); } $symblink = '?symb='.$showsymb; } if ($encrypturl =~ /^yes$/i && !$env{'request.role.adv'}) { - unless ($showurl =~ m{^/enc/}) { - $showurl = &Apache::lonenc::encrypted($showurl); - } + $showurl = $baseurl; } $r->print(&Apache::lonhtmlcommon::row_title(&mt('Refers to')) .''.$restitle.'' @@ -2553,7 +2480,7 @@ sub displaymessage { # Message $r->print(&Apache::lonhtmlcommon::row_title(&mt('Message')) - .'' + .'' .&Apache::lontexconvert::msgtexconverted($content{'message'},1) .'' ); @@ -2707,10 +2634,9 @@ sub displayresource { && (&Apache::lonnet::allowed('vgr',$content{'courseid'}))) { my $symb; if (defined($content{'symb'})) { - $symb = &Apache::lonenc::check_decrypt($content{'symb'}); - } elsif (defined($content{'baseurl'})) { - $symb = - &Apache::lonnet::symbread(&Apache::lonenc::check_decrypt($content{'baseurl'})); + $symb = $content{'symb'}; + } else { + $symb=&Apache::lonnet::symbread($content{'baseurl'}); } # Could not get a symb, give up unless ($symb) { return $content{'citation'}; } @@ -2739,16 +2665,13 @@ sub displayresource { # ================================================================== The Header sub header { - my ($r,$title,$baseurl,$head_extra)=@_; + my ($r,$title,$baseurl)=@_; my $extra = &Apache::loncommon::studentbrowser_javascript(); if ($baseurl) { $extra .= ""; } $extra .= ''; - if ($head_extra) { - $extra .= "\n$head_extra"; - } $r->print(&Apache::loncommon::start_page('Messages', $extra)); $r->print(&Apache::lonhtmlcommon::breadcrumbs @@ -2758,11 +2681,11 @@ sub header { # ---------------------------------------------------------------- Print header sub printheader { - my ($r,$url,$desc,$title,$baseurl,$head_extra)=@_; + my ($r,$url,$desc,$title,$baseurl)=@_; &Apache::lonhtmlcommon::add_breadcrumb ({href=>$url, text=>$desc}); - &header($r,$title,$baseurl,$head_extra); + &header($r,$title,$baseurl); } # ------------------------------------------------------------ Store the comment @@ -2819,14 +2742,7 @@ sub sendoffmail { $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; } - 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.send'}) { if (!$env{'form.multiforward'}) { if ($group eq '') { &printheader($r,'','Messages being sent.'); @@ -2996,7 +2912,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'}) <= 1048576) { + if (length($env{'form.attachment'})<131072) { $attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,'feedback/'.$now); } else { $r->print(' '.&mt('Attachment not included - exceeded permitted length').'
'); @@ -3428,12 +3344,8 @@ 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.').' '; - 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 .= '
'.&mt('Could not deliver forwarded message.').' '. + &mt('The recipient addresses may need to be corrected').' ('.$forwardfail{$key}.')'; } $message = &Apache::loncommon::confirmwrapper($message); $r->print($message);