Diff for /loncom/interface/loncommunicate.pm between versions 1.36 and 1.48

version 1.36, 2006/12/06 23:44:33 version 1.48, 2022/01/18 17:33:13
Line 38  use Apache::lonnet; Line 38  use Apache::lonnet;
   
 sub menu {  sub menu {
     my $r=shift;      my $r=shift;
     my $crstype = 'Course';      my $crstype = 'course';
     my $usertype = 'Student';      my $usertype = 'student';
     if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {      if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
         $crstype = $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';              $usertype = 'member';
         }             }   
     }      }
     my %lt=&Apache::lonlocal::texthash(  
 'vcm' => 'View Critical Messages',      my $clientip = &Apache::lonnet::get_requestor_ip($r);
 'smu' => 'Send Message to User(s)',      my %setters;
 'bmc' => "Broadcast Message to $crstype",      my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) =
 'dmu' => "Distribute Messages from Uploaded File to $crstype",          &Apache::loncommon::blockcheck(\%setters,'com',$clientip);
 'unr' =>       if ($by_ip) {
      'User Notes, Records of Face-to-Face Discussions, and Critical Messages',          my $showdom = &Apache::lonnet::domain($blockdom);
           if ($showdom eq '') {
 'cbs' => "Configure Blocking of $usertype Communication during Exams",              $showdom = $blockdom;
 'blog' => 'Add or Edit Blog Entries'           }
           $r->print('<p class="LC_warning">'.
 );                    &mt('Sending of LON-CAPA messages is blocked for your current IP address: [_1].',$clientip).'</p>'.
     my %help=();                    '<ul><li>'.&mt('Note: communication is being blocked for certain IP address(es).').
     foreach ('Course_Face_To_Face_Records,Course_Critical_Message',                    '</li><li>'.
      'Course_Broadcast_Message') {                    &mt('This restriction was set by an administrator in the [_1] LON-CAPA domain.',$showdom).
  $help{$_}=&Apache::loncommon::help_open_topic($_);                    '</li></ul><br />');
     }      }
   
 # ------------------------------------------------------------------------ Menu  # ------------------------------------------------------------------------ Menu
     my ($can_srm,$can_dcm);      my ($can_srm,$can_dcm,$can_dff);
     if ($env{'request.course.id'}) {      if ($env{'request.course.id'}) {
         if ((&Apache::lonnet::allowed('srm',$env{'request.course.id'})) ||          if ((&Apache::lonnet::allowed('srm',$env{'request.course.id'})) ||
             (&Apache::lonnet::allowed('srm',$env{'request.course.id'}.'/'.              (&Apache::lonnet::allowed('srm',$env{'request.course.id'}.'/'.
Line 76  sub menu { Line 77  sub menu {
                                            $env{'request.course.sec'}))) {                                             $env{'request.course.sec'}))) {
             $can_dcm = 1;              $can_dcm = 1;
         }          }
     }             if ((&Apache::lonnet::allowed('dff',$env{'request.course.id'})) ||
     $r->print(<<END);              (&Apache::lonnet::allowed('dff',$env{'request.course.id'}.'/'.
 <table cellspacing="10" cellpadding="2">                                             $env{'request.course.sec'}))) {
 <tr>              $can_dff = 1;
 <td bgcolor="#FFFFAA">          }
   <b><a href="/adm/email?compose=individual">$lt{'smu'}</a></b>      }
 </td>  
 <td bgcolor="#FFFFAA">      my @reports;
   <b><a href="/adm/$env{'user.domain'}/$env{'user.name'}/_rss.html">$lt{'blog'}</a></b>      unless ($by_ip) {
 </td>          @reports = (
 </tr>              {categorytitle => 'Send Messages',
 END               items => [
     if ($can_srm || !$can_dcm) {              {url => '/adm/email?compose=individual',
         $r->print('<tr>');   permission => 'F',
     }   icon => 'mail-message-new.png',
     if ($can_srm) {               linktext => 'New Message',
         $r->print(<<END);               linktitle => 'Send a message to users.'},
 <td bgcolor="#FFFFAA">         
     <b><a href="/adm/email?compose=group">$lt{'bmc'}</a></b>$help{'Course_Broadcast_Message'}              {url => '/adm/email?compose=group',
 </td>   permission => "$can_srm",
 <td bgcolor="#FFFFAA">               icon => 'mail-reply-all.png',
   <b><a href="/adm/email?compose=upload">$lt{'dmu'}</a></b>               linktext => 'New Broadcast Message',
 </td></tr>   help => 'Course_Broadcast_Message',
 <tr><td bgcolor="#FFFFAA">               linktitle => "Send a broadcast message to members of this $crstype and/or other users."},
 <b><a href="/adm/email?recordftf=query">$lt{'unr'}</a></b>$help{'Course_Face_To_Face_Records,Course_Critical_Message'}    
 </td>   {url => '/adm/email?compose=upload',
 END   permission => "$can_srm",
     }               icon => 'fromfile.png',
     if ($can_dcm) {               linktext => 'New Messages from File',
         $r->print('   linktitle => 'Create a message from file and send to users.'},
 <td bgcolor="#FFFFAA">               ]},
   <b><a href="/adm/email?block=display">'.$lt{'cbs'}.'</a>          );
 </td>');      }
   
       if ($can_dff || $can_dcm ){
           push(@reports,{categorytitle => 'Message Administration',
                items => [
               {url => '/adm/email?recordftf=query',
    permission => "$can_dff",
                icon => 'messalog.png',
                linktext => 'Message Log for Selected Users',
    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/setblock?caller=email',
    permission => "$can_dcm",
                icon => 'comblock.png',
    linktext => 'Communication Blocking',
                linktitle => "Blocking of $usertype communication during exams."},
                ]});
     }      }
     if ($can_srm || $can_dcm) {      if (@reports) {
         $r->print('</tr>');          $r->print(&Apache::lonhtmlcommon::generate_menu(@reports));
     }      }
     $r->print('</table>');      return;
 }  }
   
 sub handler {  sub handler {
Line 135  sub handler { Line 153  sub handler {
 # ---------------------------------------------------------------------- Header  # ---------------------------------------------------------------------- Header
     &Apache::lonmsgdisplay::header($r);      &Apache::lonmsgdisplay::header($r);
     &menu($r);      &menu($r);
     &Apache::lonmsgdisplay::disall($r,'new');      &Apache::lonmsgdisplay::disall($r);
     $r->print(&Apache::loncommon::end_page());      $r->print(&Apache::loncommon::end_page());
     return OK;      return OK;
 }  }

Removed from v.1.36  
changed lines
  Added in v.1.48


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>