File:
[LON-CAPA] /
loncom /
interface /
loncommunicate.pm
Revision
1.48:
download - view:
text,
annotated -
select for diffs
Tue Jan 18 17:33:13 2022 UTC (2 years, 7 months ago) by
raeburn
Branches:
MAIN
CVS tags:
version_2_12_X,
version_2_11_X,
version_2_11_5_msu,
version_2_11_5,
version_2_11_4_uiuc,
version_2_11_4_msu,
version_2_11_4,
HEAD
Bug 6955
- If IP-based blocking set in domain config is in effect for user's
current IP address, and 'Messaging 'is among blocked functions:
(a) 'Send Feedback' (in course context), for resource(s) which allow it
is only messaging mechanism available to users with out 'evb' priv.
(b) Subject and Content for messages sent to instructor(s) via 'Send Feedback'
are replaced in user's Sent Folder with: "Not shown due to IP block".
1: # The LearningOnline Network
2: # Communicate
3: #
4: # $Id: loncommunicate.pm,v 1.48 2022/01/18 17:33:13 raeburn 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 'Community') {
46: $usertype = 'member';
47: }
48: }
49:
50: my $clientip = &Apache::lonnet::get_requestor_ip($r);
51: my %setters;
52: my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) =
53: &Apache::loncommon::blockcheck(\%setters,'com',$clientip);
54: if ($by_ip) {
55: my $showdom = &Apache::lonnet::domain($blockdom);
56: if ($showdom eq '') {
57: $showdom = $blockdom;
58: }
59: $r->print('<p class="LC_warning">'.
60: &mt('Sending of LON-CAPA messages is blocked for your current IP address: [_1].',$clientip).'</p>'.
61: '<ul><li>'.&mt('Note: communication is being blocked for certain IP address(es).').
62: '</li><li>'.
63: &mt('This restriction was set by an administrator in the [_1] LON-CAPA domain.',$showdom).
64: '</li></ul><br />');
65: }
66:
67: # ------------------------------------------------------------------------ Menu
68: my ($can_srm,$can_dcm,$can_dff);
69: if ($env{'request.course.id'}) {
70: if ((&Apache::lonnet::allowed('srm',$env{'request.course.id'})) ||
71: (&Apache::lonnet::allowed('srm',$env{'request.course.id'}.'/'.
72: $env{'request.course.sec'}))) {
73: $can_srm = 1;
74: }
75: if ((&Apache::lonnet::allowed('dcm',$env{'request.course.id'})) ||
76: (&Apache::lonnet::allowed('dcm',$env{'request.course.id'}.'/'.
77: $env{'request.course.sec'}))) {
78: $can_dcm = 1;
79: }
80: if ((&Apache::lonnet::allowed('dff',$env{'request.course.id'})) ||
81: (&Apache::lonnet::allowed('dff',$env{'request.course.id'}.'/'.
82: $env{'request.course.sec'}))) {
83: $can_dff = 1;
84: }
85: }
86:
87: my @reports;
88: unless ($by_ip) {
89: @reports = (
90: {categorytitle => 'Send Messages',
91: items => [
92: {url => '/adm/email?compose=individual',
93: permission => 'F',
94: icon => 'mail-message-new.png',
95: linktext => 'New Message',
96: linktitle => 'Send a message to users.'},
97:
98: {url => '/adm/email?compose=group',
99: permission => "$can_srm",
100: icon => 'mail-reply-all.png',
101: linktext => 'New Broadcast Message',
102: help => 'Course_Broadcast_Message',
103: linktitle => "Send a broadcast message to members of this $crstype and/or other users."},
104:
105: {url => '/adm/email?compose=upload',
106: permission => "$can_srm",
107: icon => 'fromfile.png',
108: linktext => 'New Messages from File',
109: linktitle => 'Create a message from file and send to users.'},
110: ]},
111: );
112: }
113:
114: if ($can_dff || $can_dcm ){
115: push(@reports,{categorytitle => 'Message Administration',
116: items => [
117: {url => '/adm/email?recordftf=query',
118: permission => "$can_dff",
119: icon => 'messalog.png',
120: linktext => 'Message Log for Selected Users',
121: help => 'Course_Face_To_Face_Records,Course_Critical_Message',
122: linktitle => "User notes, records of face-to-face discussions, critical messages, broadcast messages and archived messages in $crstype."},
123:
124: {url => '/adm/setblock?caller=email',
125: permission => "$can_dcm",
126: icon => 'comblock.png',
127: linktext => 'Communication Blocking',
128: linktitle => "Blocking of $usertype communication during exams."},
129: ]});
130: }
131: if (@reports) {
132: $r->print(&Apache::lonhtmlcommon::generate_menu(@reports));
133: }
134: return;
135: }
136:
137: sub handler {
138: my $r = shift;
139: &Apache::loncommon::content_type($r,'text/html');
140: $r->send_http_header;
141: return OK if $r->header_only;
142: #
143: # Start document
144: #
145:
146: # ----------------------------------------------------------------- Breadcrumbs
147: &Apache::lonhtmlcommon::clear_breadcrumbs();
148: &Apache::lonhtmlcommon::add_breadcrumb
149: ({href=>"/adm/communicate",
150: text=>"Communication/Messages",
151: faq=>12,bug=>'Communication Tools',});
152:
153: # ---------------------------------------------------------------------- Header
154: &Apache::lonmsgdisplay::header($r);
155: &menu($r);
156: &Apache::lonmsgdisplay::disall($r);
157: $r->print(&Apache::loncommon::end_page());
158: return OK;
159: }
160:
161: 1;
162: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>