File:  [LON-CAPA] / loncom / interface / loncommunicate.pm
Revision 1.42: download - view: text, annotated - select for diffs
Tue Dec 9 17:59:51 2008 UTC (15 years, 5 months ago) by diwert
Branches: MAIN
CVS tags: HEAD
removed not used code fragments
CVS

    1: # The LearningOnline Network
    2: # Communicate
    3: #
    4: # $Id: loncommunicate.pm,v 1.42 2008/12/09 17:59:51 diwert 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: 	
   50: #    my %lt=&Apache::lonlocal::texthash(
   51: #        'vcm' => 'View Critical Messages',
   52: #        'smu' => 'Send Message to User(s)',
   53: #        'bmc' => "Broadcast Message to $crstype",
   54: #        'dmu' => "Distribute Messages from Uploaded File to $crstype",
   55: #        'unr' => 'User Notes, Records of Face-to-Face Discussions, and Critical Messages',
   56: #        'cbs' => "Configure Blocking of $usertype Communication during Exams",
   57: #    );
   58: 	
   59: #    my %help=();
   60: #    foreach ('Course_Face_To_Face_Records,Course_Critical_Message', 'Course_Broadcast_Message') {
   61: #	    $help{$_}=&Apache::loncommon::help_open_topic($_);
   62: #    }
   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: 
   84: 	my @reports = (
   85: 	    {categorytitle => 'Send Messages',
   86:          items => [
   87:             {url => '/adm/email?compose=individual',
   88: 			 permission => 'F',
   89: 			 icon => 'mail-reply-sender.png',
   90:              linktext => 'New Message',
   91:              linktitle => 'Send a message to users.'},
   92:        
   93:             {url => '/adm/email?compose=group',
   94: 			 permission => "$can_srm",
   95:              icon => 'mail-reply-all.png',
   96:              linktext => 'New Broadcast Message',
   97: 			 help => 'Course_Broadcast_Message',
   98:              linktitle => "Send a broadcast message to members of this $crstype and/or other users."},
   99: 			 
  100: 			{url => '/adm/email?compose=upload',
  101: 			 permission => "$can_srm",
  102:              icon => 'fromfile.png',
  103:              linktext => 'New Messages from Template',
  104: 			 linktitle => 'Create a message from template and send to users.'},
  105:          ]},
  106: 		);
  107: 		
  108: 		if ($can_dff || $can_dcm ){
  109: 		push(@reports,{categorytitle => 'Message Administration',
  110:          items => [
  111:             {url => '/adm/email?recordftf=query',
  112: 			 permission => "$can_dff",
  113:              icon => 'messalog.png',
  114:              linktext => 'Message Log for Selected Users',
  115: 			 help => 'Course_Face_To_Face_Records,Course_Critical_Message',
  116:              linktitle => "User notes, records of face-to-face discussions, critical messages, broadcast messages and archived messages in $crstype."},
  117:                     
  118:             {url => '/adm/email?block=display',
  119: 			 permission => "$can_dcm",
  120:              icon => 'comblock.png',
  121: 			 linktext => 'Communication Blocking',
  122:              linktitle => "Blocking of $usertype communication during exams."},
  123:          ]});
  124:         }
  125: $r->print(&Apache::lonhtmlcommon::generate_menu(@reports));
  126: 		 
  127: #    $r->print(<<END);
  128: #<table cellspacing="10" cellpadding="2">
  129: #<tr>
  130: #<td bgcolor="#FFFFAA">
  131: #  <b><a href="/adm/email?compose=individual">$lt{'smu'}</a></b>
  132: #</td>
  133: #<td></td>
  134: #</tr>
  135: #END
  136: 
  137: #    if ($can_srm) {
  138: #        $r->print(<<END);
  139: #<tr>
  140: #<td bgcolor="#FFFFAA">
  141: #    <b><a href="/adm/email?compose=group">$lt{'bmc'}</a></b>$help{'Course_Broadcast_Message'}
  142: #</td>
  143: #<td bgcolor="#FFFFAA">
  144: #  <b><a href="/adm/email?compose=upload">$lt{'dmu'}</a></b>
  145: #</td></tr>
  146: #END
  147: #    }
  148: 
  149: #    if ($can_dcm || $can_dff) {
  150: #        $r->print('<tr>');
  151: #    }
  152: 
  153: #    if ($can_dff) {
  154: #        $r->print(<<END);
  155: #<td bgcolor="#FFFFAA">
  156: #<b><a href="/adm/email?recordftf=query">$lt{'unr'}</a></b>$help{'Course_Face_To_Face_Records,Course_Critical_Message'}
  157: #</td>
  158: #END
  159: #    }
  160: 
  161: #    if ($can_dcm) {
  162: #        $r->print('
  163: #<td bgcolor="#FFFFAA">
  164: #  <b><a href="/adm/email?block=display">'.$lt{'cbs'}.'</a></b>
  165: #</td>');
  166: #    }
  167: 
  168: #    if ($can_dff || $can_dcm) {
  169: #        $r->print('</tr>');
  170: #    }
  171: 
  172: #    $r->print('</table>');
  173: 
  174: }
  175: 
  176: sub handler {
  177:     my $r = shift;
  178:     &Apache::loncommon::content_type($r,'text/html');
  179:     $r->send_http_header;
  180:     return OK if $r->header_only;
  181: #
  182: # Start document
  183: #
  184: 
  185: # ----------------------------------------------------------------- Breadcrumbs
  186:     &Apache::lonhtmlcommon::clear_breadcrumbs();
  187:     &Apache::lonhtmlcommon::add_breadcrumb
  188:         ({href=>"/adm/communicate",
  189:           text=>"Communication/Messages",
  190:           faq=>12,bug=>'Communication Tools',});
  191: 
  192: # ---------------------------------------------------------------------- Header
  193:     &Apache::lonmsgdisplay::header($r);
  194:     &menu($r);
  195:     &Apache::lonmsgdisplay::disall($r);
  196:     $r->print(&Apache::loncommon::end_page());
  197:     return OK;
  198: }
  199: 
  200: 1;
  201: __END__

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