Annotation of loncom/interface/loncommunicate.pm, revision 1.38
1.1 www 1: # The LearningOnline Network
2: # Communicate
3: #
1.38 ! albertel 4: # $Id: loncommunicate.pm,v 1.37 2006/12/07 21:06:57 albertel 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.34 raeburn 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: }
1.21 www 49: my %lt=&Apache::lonlocal::texthash(
1.16 www 50: 'vcm' => 'View Critical Messages',
51: 'smu' => 'Send Message to User(s)',
1.34 raeburn 52: 'bmc' => "Broadcast Message to $crstype",
53: 'dmu' => "Distribute Messages from Uploaded File to $crstype",
1.16 www 54: 'unr' =>
55: 'User Notes, Records of Face-to-Face Discussions, and Critical Messages',
1.24 www 56:
1.34 raeburn 57: 'cbs' => "Configure Blocking of $usertype Communication during Exams",
1.33 albertel 58: 'blog' => 'Add or Edit Blog Entries'
1.22 raeburn 59:
1.16 www 60: );
1.18 www 61: my %help=();
62: foreach ('Course_Face_To_Face_Records,Course_Critical_Message',
63: 'Course_Broadcast_Message') {
64: $help{$_}=&Apache::loncommon::help_open_topic($_);
65: }
1.20 www 66: # ------------------------------------------------------------------------ Menu
1.38 ! albertel 67: my ($can_srm,$can_dcm,$can_dff);
1.35 raeburn 68: if ($env{'request.course.id'}) {
69: if ((&Apache::lonnet::allowed('srm',$env{'request.course.id'})) ||
70: (&Apache::lonnet::allowed('srm',$env{'request.course.id'}.'/'.
71: $env{'request.course.sec'}))) {
72: $can_srm = 1;
73: }
74: if ((&Apache::lonnet::allowed('dcm',$env{'request.course.id'})) ||
75: (&Apache::lonnet::allowed('dcm',$env{'request.course.id'}.'/'.
76: $env{'request.course.sec'}))) {
77: $can_dcm = 1;
78: }
1.38 ! albertel 79: if ((&Apache::lonnet::allowed('dff',$env{'request.course.id'})) ||
! 80: (&Apache::lonnet::allowed('dff',$env{'request.course.id'}.'/'.
! 81: $env{'request.course.sec'}))) {
! 82: $can_dff = 1;
! 83: }
1.35 raeburn 84: }
85: $r->print(<<END);
1.26 www 86: <table cellspacing="10" cellpadding="2">
1.36 raeburn 87: <tr>
1.26 www 88: <td bgcolor="#FFFFAA">
1.16 www 89: <b><a href="/adm/email?compose=individual">$lt{'smu'}</a></b>
1.36 raeburn 90: </td>
91: <td bgcolor="#FFFFAA">
1.32 www 92: <b><a href="/adm/$env{'user.domain'}/$env{'user.name'}/_rss.html">$lt{'blog'}</a></b>
1.35 raeburn 93: </td>
1.36 raeburn 94: </tr>
1.9 matthew 95: END
1.35 raeburn 96: if ($can_srm) {
1.9 matthew 97: $r->print(<<END);
1.38 ! albertel 98: <tr>
1.36 raeburn 99: <td bgcolor="#FFFFAA">
1.18 www 100: <b><a href="/adm/email?compose=group">$lt{'bmc'}</a></b>$help{'Course_Broadcast_Message'}
1.26 www 101: </td>
102: <td bgcolor="#FFFFAA">
1.16 www 103: <b><a href="/adm/email?compose=upload">$lt{'dmu'}</a></b>
1.9 matthew 104: </td></tr>
1.38 ! albertel 105: END
! 106: }
! 107: if ($can_dcm || $can_dff) {
! 108: $r->print('<tr>');
! 109: }
! 110: if ($can_dff) {
! 111: $r->print(<<END);
! 112: <td bgcolor="#FFFFAA">
1.18 www 113: <b><a href="/adm/email?recordftf=query">$lt{'unr'}</a></b>$help{'Course_Face_To_Face_Records,Course_Critical_Message'}
1.26 www 114: </td>
1.35 raeburn 115: END
116: }
117: if ($can_dcm) {
118: $r->print('
1.26 www 119: <td bgcolor="#FFFFAA">
1.37 albertel 120: <b><a href="/adm/email?block=display">'.$lt{'cbs'}.'</a></b>
1.35 raeburn 121: </td>');
122: }
1.38 ! albertel 123: if ($can_dff || $can_dcm) {
1.35 raeburn 124: $r->print('</tr>');
1.4 www 125: }
1.9 matthew 126: $r->print('</table>');
1.21 www 127: }
128:
129: sub handler {
130: my $r = shift;
131: &Apache::loncommon::content_type($r,'text/html');
132: $r->send_http_header;
133: return OK if $r->header_only;
134: #
135: # Start document
136: #
137:
138: # ----------------------------------------------------------------- Breadcrumbs
139: &Apache::lonhtmlcommon::clear_breadcrumbs();
140: &Apache::lonhtmlcommon::add_breadcrumb
141: ({href=>"/adm/communicate",
142: text=>"Communication/Messages",
143: faq=>12,bug=>'Communication Tools',});
144:
145: # ---------------------------------------------------------------------- Header
1.31 albertel 146: &Apache::lonmsgdisplay::header($r);
1.21 www 147: &menu($r);
1.31 albertel 148: &Apache::lonmsgdisplay::disall($r,'new');
1.30 albertel 149: $r->print(&Apache::loncommon::end_page());
1.1 www 150: return OK;
1.2 www 151: }
1.1 www 152:
153: 1;
154: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>