Annotation of loncom/auth/blockedaccess.pm, revision 1.2
1.1 raeburn 1: # The LearningOnline Network
2: # Information about blocking status for Portfolio files
3: #
4: # Copyright Michigan State University Board of Trustees
5: #
6: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
7: #
8: # LON-CAPA is free software; you can redistribute it and/or modify
9: # it under the terms of the GNU General Public License as published by
10: # the Free Software Foundation; either version 2 of the License, or
11: # (at your option) any later version.
12: #
13: # LON-CAPA is distributed in the hope that it will be useful,
14: # but WITHOUT ANY WARRANTY; without even the implied warranty of
15: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: # GNU General Public License for more details.
17: #
18: # You should have received a copy of the GNU General Public License
19: # along with LON-CAPA; if not, write to the Free Software
20: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21: #
22: # /home/httpd/html/adm/gpl.txt
23: #
24: # http://www.lon-capa.org/
25: #
26:
27: package Apache::blockedaccess;
28:
29: use strict;
30: use Apache::Constants qw(:common :http REDIRECT);
31: use Apache::lonnet;
32: use Apache::loncommon();
33: use Apache::lonlocal;
34:
35: sub handler {
36: my $r = shift;
37: my $origurl = $r->uri;
38: my ($type,$udom,$uname,$file_name,$group) =
1.2 ! albertel 39: &Apache::lonnet::parse_portfolio_url($origurl);
1.1 raeburn 40: &Apache::loncommon::content_type($r,'text/html');
41: $r->send_http_header;
42: return OK if $r->header_only;
43:
44: &Apache::lonlocal::get_language_handle($r);
45: my ($blocked,$blocktext) =
46: &Apache::loncommon::blocking_status('port',$uname,$udom);
47: if ($blocked) {
48: $r->print(&Apache::loncommon::start_page('Access Temporarily Blocked'));
49: $r->print($blocktext);
50: } else {
51: my $server = &Apache::lonnet::absolute_url();
52: $r->header_out(Location => $server.$origurl);
53: return REDIRECT;
54: }
55: $r->print(&Apache::loncommon::end_page());
56: return OK;
57: }
58:
59: sub setup_handler {
60: my ($r) = @_;
61: $r->set_handlers('PerlHandler'=>
62: [\&Apache::blockedaccess::handler]);
63: $r->handler('perl-script');
64: }
65:
66: 1;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>