--- loncom/interface/loncommunicate.pm 2008/12/10 14:36:36 1.44 +++ loncom/interface/loncommunicate.pm 2022/01/18 17:33:13 1.48 @@ -1,7 +1,7 @@ # The LearningOnline Network # Communicate # -# $Id: loncommunicate.pm,v 1.44 2008/12/10 14:36:36 diwert Exp $ +# $Id: loncommunicate.pm,v 1.48 2022/01/18 17:33:13 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,11 +42,27 @@ sub menu { my $usertype = 'student'; if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) { $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; - if ($crstype eq 'Group') { + if ($crstype eq 'Community') { $usertype = 'member'; } } - + + 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) { + my $showdom = &Apache::lonnet::domain($blockdom); + if ($showdom eq '') { + $showdom = $blockdom; + } + $r->print('

'. + &mt('Sending of LON-CAPA messages is blocked for your current IP address: [_1].',$clientip).'

'. + '
'); + } # ------------------------------------------------------------------------ Menu my ($can_srm,$can_dcm,$can_dff); @@ -66,14 +82,16 @@ sub menu { $env{'request.course.sec'}))) { $can_dff = 1; } - } + } - my @reports = ( - {categorytitle => 'Send Messages', - items => [ + my @reports; + unless ($by_ip) { + @reports = ( + {categorytitle => 'Send Messages', + items => [ {url => '/adm/email?compose=individual', permission => 'F', - icon => 'mail-reply-sender.png', + icon => 'mail-message-new.png', linktext => 'New Message', linktitle => 'Send a message to users.'}, @@ -89,12 +107,13 @@ sub menu { icon => 'fromfile.png', linktext => 'New Messages from File', linktitle => 'Create a message from file and send to users.'}, - ]}, - ); + ]}, + ); + } - if ($can_dff || $can_dcm ){ - push(@reports,{categorytitle => 'Message Administration', - items => [ + if ($can_dff || $can_dcm ){ + push(@reports,{categorytitle => 'Message Administration', + items => [ {url => '/adm/email?recordftf=query', permission => "$can_dff", icon => 'messalog.png', @@ -102,15 +121,17 @@ sub menu { help => 'Course_Face_To_Face_Records,Course_Critical_Message', linktitle => "User notes, records of face-to-face discussions, critical messages, broadcast messages and archived messages in $crstype."}, - {url => '/adm/email?block=display', + {url => '/adm/setblock?caller=email', permission => "$can_dcm", icon => 'comblock.png', linktext => 'Communication Blocking', linktitle => "Blocking of $usertype communication during exams."}, - ]}); - } -$r->print(&Apache::lonhtmlcommon::generate_menu(@reports)); - + ]}); + } + if (@reports) { + $r->print(&Apache::lonhtmlcommon::generate_menu(@reports)); + } + return; } sub handler {