File:  [LON-CAPA] / loncom / interface / loncommunicate.pm
Revision 1.41: download - view: text, annotated - select for diffs
Wed Jan 31 16:02:49 2007 UTC (17 years, 3 months ago) by www
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_1, version_2_9_0, version_2_8_X, version_2_8_99_1, version_2_8_99_0, version_2_8_2, version_2_8_1, version_2_8_0, version_2_7_X, version_2_7_99_1, version_2_7_99_0, version_2_7_1, version_2_7_0, version_2_6_X, version_2_6_99_1, version_2_6_99_0, version_2_6_3, version_2_6_2, version_2_6_1, version_2_6_0, version_2_5_X, version_2_5_99_1, version_2_5_99_0, version_2_5_2, version_2_5_1, version_2_5_0, version_2_4_X, version_2_4_99_0, version_2_4_2, version_2_4_1, version_2_4_0, version_2_3_99_0, HEAD, GCI_2, GCI_1
More direct access to blog editor

    1: # The LearningOnline Network
    2: # Communicate
    3: #
    4: # $Id: loncommunicate.pm,v 1.41 2007/01/31 16:02:49 www Exp $
    5: #
    6: # Copyright Michigan State University Board of Trustees
    7: #
    8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    9: #
   10: # LON-CAPA is free software; you can redistribute it and/or modify
   11: # it under the terms of the GNU General Public License as published by
   12: # the Free Software Foundation; either version 2 of the License, or
   13: # (at your option) any later version.
   14: #
   15: # LON-CAPA is distributed in the hope that it will be useful,
   16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   18: # GNU General Public License for more details.
   19: #
   20: # You should have received a copy of the GNU General Public License
   21: # along with LON-CAPA; if not, write to the Free Software
   22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   23: #
   24: # /home/httpd/html/adm/gpl.txt
   25: #
   26: # http://www.lon-capa.org/
   27: #
   28: ###
   29: 
   30: package Apache::loncommunicate;
   31: 
   32: use strict;
   33: use Apache::Constants qw(:common);
   34: use Apache::lonmsgdisplay();
   35: use Apache::loncommon;
   36: use Apache::lonlocal;
   37: use Apache::lonnet;
   38: 
   39: sub menu {
   40:     my $r=shift;
   41:     my $crstype = 'Course';
   42:     my $usertype = 'Student';
   43:     if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
   44:         $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
   45:         if ($crstype eq 'Group') {
   46:             $usertype = 'Member';
   47:         }   
   48:     }
   49:     my %lt=&Apache::lonlocal::texthash(
   50: 'vcm' => 'View Critical Messages',
   51: 'smu' => 'Send Message to User(s)',
   52: 'bmc' => "Broadcast Message to $crstype",
   53: 'dmu' => "Distribute Messages from Uploaded File to $crstype",
   54: 'unr' => 
   55:      'User Notes, Records of Face-to-Face Discussions, and Critical Messages',
   56: 
   57: 'cbs' => "Configure Blocking of $usertype Communication during Exams",
   58: );
   59:     my %help=();
   60:     foreach ('Course_Face_To_Face_Records,Course_Critical_Message',
   61: 	     'Course_Broadcast_Message') {
   62: 	$help{$_}=&Apache::loncommon::help_open_topic($_);
   63:     }
   64: # ------------------------------------------------------------------------ Menu
   65:     my ($can_srm,$can_dcm,$can_dff);
   66:     if ($env{'request.course.id'}) {
   67:         if ((&Apache::lonnet::allowed('srm',$env{'request.course.id'})) ||
   68:             (&Apache::lonnet::allowed('srm',$env{'request.course.id'}.'/'.
   69:                                            $env{'request.course.sec'}))) {
   70:             $can_srm = 1;
   71:         }
   72:         if ((&Apache::lonnet::allowed('dcm',$env{'request.course.id'})) ||
   73:             (&Apache::lonnet::allowed('dcm',$env{'request.course.id'}.'/'.
   74:                                            $env{'request.course.sec'}))) {
   75:             $can_dcm = 1;
   76:         }
   77:         if ((&Apache::lonnet::allowed('dff',$env{'request.course.id'})) ||
   78:             (&Apache::lonnet::allowed('dff',$env{'request.course.id'}.'/'.
   79:                                            $env{'request.course.sec'}))) {
   80:             $can_dff = 1;
   81:         }
   82:     }   
   83:     $r->print(<<END);
   84: <table cellspacing="10" cellpadding="2">
   85: <tr>
   86: <td bgcolor="#FFFFAA">
   87:   <b><a href="/adm/email?compose=individual">$lt{'smu'}</a></b>
   88: </td>
   89: <td></td>
   90: </tr>
   91: END
   92:     if ($can_srm) {
   93:         $r->print(<<END);
   94: <tr>
   95: <td bgcolor="#FFFFAA">
   96:     <b><a href="/adm/email?compose=group">$lt{'bmc'}</a></b>$help{'Course_Broadcast_Message'}
   97: </td>
   98: <td bgcolor="#FFFFAA">
   99:   <b><a href="/adm/email?compose=upload">$lt{'dmu'}</a></b>
  100: </td></tr>
  101: END
  102:     }
  103:     if ($can_dcm || $can_dff) {
  104:         $r->print('<tr>');
  105:     }
  106:     if ($can_dff) {
  107:         $r->print(<<END);
  108: <td bgcolor="#FFFFAA">
  109: <b><a href="/adm/email?recordftf=query">$lt{'unr'}</a></b>$help{'Course_Face_To_Face_Records,Course_Critical_Message'}
  110: </td>
  111: END
  112:     }
  113:     if ($can_dcm) {
  114:         $r->print('
  115: <td bgcolor="#FFFFAA">
  116:   <b><a href="/adm/email?block=display">'.$lt{'cbs'}.'</a></b>
  117: </td>');
  118:     }
  119:     if ($can_dff || $can_dcm) {
  120:         $r->print('</tr>');
  121:     }
  122:     $r->print('</table>');
  123: }
  124: 
  125: sub handler {
  126:     my $r = shift;
  127:     &Apache::loncommon::content_type($r,'text/html');
  128:     $r->send_http_header;
  129:     return OK if $r->header_only;
  130: #
  131: # Start document
  132: #
  133: 
  134: # ----------------------------------------------------------------- Breadcrumbs
  135:     &Apache::lonhtmlcommon::clear_breadcrumbs();
  136:     &Apache::lonhtmlcommon::add_breadcrumb
  137:         ({href=>"/adm/communicate",
  138:           text=>"Communication/Messages",
  139:           faq=>12,bug=>'Communication Tools',});
  140: 
  141: # ---------------------------------------------------------------------- Header
  142:     &Apache::lonmsgdisplay::header($r);
  143:     &menu($r);
  144:     &Apache::lonmsgdisplay::disall($r);
  145:     $r->print(&Apache::loncommon::end_page());
  146:     return OK;
  147: }
  148: 
  149: 1;
  150: __END__

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