Annotation of loncom/interface/loncommunicate.pm, revision 1.43

1.1       www         1: # The LearningOnline Network
                      2: # Communicate
                      3: #
1.43    ! diwert      4: # $Id: loncommunicate.pm,v 1.42 2008/12/09 17:59:51 diwert Exp $
1.7       albertel    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: #
1.20      www        28: ###
                     29: 
1.1       www        30: package Apache::loncommunicate;
                     31: 
                     32: use strict;
                     33: use Apache::Constants qw(:common);
1.31      albertel   34: use Apache::lonmsgdisplay();
1.11      www        35: use Apache::loncommon;
1.16      www        36: use Apache::lonlocal;
1.28      albertel   37: use Apache::lonnet;
1.1       www        38: 
1.21      www        39: sub menu {
                     40:     my $r=shift;
1.42      diwert     41:     my $crstype = 'course';
                     42:     my $usertype = 'student';
1.34      raeburn    43:     if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
                     44:         $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
                     45:         if ($crstype eq 'Group') {
1.42      diwert     46:             $usertype = 'member';
1.34      raeburn    47:         }   
                     48:     }
1.42      diwert     49: 	
                     50: 
1.20      www        51: # ------------------------------------------------------------------------ Menu
1.38      albertel   52:     my ($can_srm,$can_dcm,$can_dff);
1.35      raeburn    53:     if ($env{'request.course.id'}) {
                     54:         if ((&Apache::lonnet::allowed('srm',$env{'request.course.id'})) ||
                     55:             (&Apache::lonnet::allowed('srm',$env{'request.course.id'}.'/'.
                     56:                                            $env{'request.course.sec'}))) {
                     57:             $can_srm = 1;
                     58:         }
                     59:         if ((&Apache::lonnet::allowed('dcm',$env{'request.course.id'})) ||
                     60:             (&Apache::lonnet::allowed('dcm',$env{'request.course.id'}.'/'.
                     61:                                            $env{'request.course.sec'}))) {
                     62:             $can_dcm = 1;
                     63:         }
1.38      albertel   64:         if ((&Apache::lonnet::allowed('dff',$env{'request.course.id'})) ||
                     65:             (&Apache::lonnet::allowed('dff',$env{'request.course.id'}.'/'.
                     66:                                            $env{'request.course.sec'}))) {
                     67:             $can_dff = 1;
                     68:         }
1.35      raeburn    69:     }   
1.42      diwert     70: 
                     71: 	my @reports = (
                     72: 	    {categorytitle => 'Send Messages',
                     73:          items => [
                     74:             {url => '/adm/email?compose=individual',
                     75: 			 permission => 'F',
                     76: 			 icon => 'mail-reply-sender.png',
                     77:              linktext => 'New Message',
                     78:              linktitle => 'Send a message to users.'},
                     79:        
                     80:             {url => '/adm/email?compose=group',
                     81: 			 permission => "$can_srm",
                     82:              icon => 'mail-reply-all.png',
                     83:              linktext => 'New Broadcast Message',
                     84: 			 help => 'Course_Broadcast_Message',
                     85:              linktitle => "Send a broadcast message to members of this $crstype and/or other users."},
                     86: 			 
                     87: 			{url => '/adm/email?compose=upload',
                     88: 			 permission => "$can_srm",
                     89:              icon => 'fromfile.png',
                     90:              linktext => 'New Messages from Template',
                     91: 			 linktitle => 'Create a message from template and send to users.'},
                     92:          ]},
                     93: 		);
                     94: 		
                     95: 		if ($can_dff || $can_dcm ){
                     96: 		push(@reports,{categorytitle => 'Message Administration',
                     97:          items => [
                     98:             {url => '/adm/email?recordftf=query',
                     99: 			 permission => "$can_dff",
                    100:              icon => 'messalog.png',
                    101:              linktext => 'Message Log for Selected Users',
                    102: 			 help => 'Course_Face_To_Face_Records,Course_Critical_Message',
                    103:              linktitle => "User notes, records of face-to-face discussions, critical messages, broadcast messages and archived messages in $crstype."},
                    104:                     
                    105:             {url => '/adm/email?block=display',
                    106: 			 permission => "$can_dcm",
                    107:              icon => 'comblock.png',
                    108: 			 linktext => 'Communication Blocking',
                    109:              linktitle => "Blocking of $usertype communication during exams."},
                    110:          ]});
                    111:         }
                    112: $r->print(&Apache::lonhtmlcommon::generate_menu(@reports));
                    113: 
1.21      www       114: }
                    115: 
                    116: sub handler {
                    117:     my $r = shift;
                    118:     &Apache::loncommon::content_type($r,'text/html');
                    119:     $r->send_http_header;
                    120:     return OK if $r->header_only;
                    121: #
                    122: # Start document
                    123: #
                    124: 
                    125: # ----------------------------------------------------------------- Breadcrumbs
                    126:     &Apache::lonhtmlcommon::clear_breadcrumbs();
                    127:     &Apache::lonhtmlcommon::add_breadcrumb
                    128:         ({href=>"/adm/communicate",
                    129:           text=>"Communication/Messages",
                    130:           faq=>12,bug=>'Communication Tools',});
                    131: 
                    132: # ---------------------------------------------------------------------- Header
1.31      albertel  133:     &Apache::lonmsgdisplay::header($r);
1.21      www       134:     &menu($r);
1.40      raeburn   135:     &Apache::lonmsgdisplay::disall($r);
1.30      albertel  136:     $r->print(&Apache::loncommon::end_page());
1.1       www       137:     return OK;
1.2       www       138: }
1.1       www       139: 
                    140: 1;
                    141: __END__

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