File:
[LON-CAPA] /
loncom /
publisher /
lonunauthorized.pm
Revision
1.1:
download - view:
text,
annotated -
select for diffs
Tue Sep 10 14:41:05 2002 UTC (21 years, 10 months ago) by
www
Branches:
MAIN
CVS tags:
version_1_0_3,
version_1_0_2,
version_1_0_1,
version_1_0_0,
version_0_99_5,
version_0_99_4,
version_0_99_3,
version_0_99_2,
version_0_99_1,
version_0_99_0,
version_0_6_2,
version_0_6,
conference_2003,
HEAD
And, yes, you also need this to get better construction space error messages
1: # The LearningOnline Network
2: # Unauthorized to access construction space
3: #
4: # $Id: lonunauthorized.pm,v 1.1 2002/09/10 14:41:05 www 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: package Apache::lonunauthorized;
30:
31: use strict;
32: use Apache::Constants qw(:common);
33: use Apache::loncommon;
34: use Apache::lonnet;
35: use Apache::loncacc;
36:
37: sub handler {
38: my $r = shift;
39: $r->content_type('text/html');
40: $r->send_http_header;
41: return OK if $r->header_only;
42:
43: # ------------------------------------------------------------ Print the screen
44: $r->print(<<ENDDOCUMENT);
45: <html>
46: <head>
47: <title>The LearningOnline Network with CAPA</title>
48: </head>
49: ENDDOCUMENT
50: # Figure out who the user is and what they wanted to access
51:
52: my ($ownername,$ownerdomain)=
53: &Apache::loncacc::constructaccess($ENV{'request.editurl'},$r->dir_config('lonDefDomain'));
54: # print header
55: $r->print(&Apache::loncommon::bodytag
56: ("Failed Access to Construction Space",'','','',$ownerdomain));
57: # figure out what went wrong
58:
59: if ($ownerdomain) {
60: $r->print('<h1>Choose another server</h1>'.
61: "<p>The constuction space for this resource is located on another server.</p>"
62: );
63: my $ownerhome=&Apache::lonnet::homeserver($ownername,$ownerdomain);
64: unless ($ownerhome eq 'no_host') {
65: $r->print(
66: "<p>Please log into <tt>".$Apache::lonnet::hostname{$ownerhome}.
67: "</tt> to edit.</p>");
68: }
69: } else {
70: $r->print(
71: "<h1>You do not have authoring privileges for this resource</h1>");
72: my ($realownername)=($ENV{'request.editurl'}=~/\/(?:\~|priv\/|home\/)(\w+)/);
73: my $realownerhome=
74: &Apache::lonnet::homeserver(
75: $realownername,$r->dir_config('lonDefDomain'));
76: unless ($realownerhome eq 'no_host') {
77: $r->print("<p>Contact ".
78: &Apache::loncommon::aboutmewrapper(
79: &Apache::loncommon::plainname($realownername,
80: $r->dir_config('lonDefDomain')).'('.
81: $realownername.' at '.
82: $r->dir_config('lonDefDomain').')',
83: $realownername,$r->dir_config('lonDefDomain')).
84: ' for access.');
85: }
86: }
87:
88: $r->print('</body></html>');
89: return OK;
90: }
91:
92: 1;
93: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>