File:
[LON-CAPA] /
loncom /
publisher /
lonunauthorized.pm
Revision
1.8:
download - view:
text,
annotated -
select for diffs
Mon Aug 11 10:18:31 2008 UTC (16 years, 1 month ago) by
bisitz
Branches:
MAIN
CVS tags:
version_2_8_X,
version_2_8_2,
version_2_8_1,
version_2_8_0,
version_2_7_X,
version_2_7_99_1,
version_2_7_99_0,
version_2_7_1,
version_2_7_0,
HEAD,
GCI_1,
BZ5434-fox
Localization:
- Added missing &mt() calls
- Optimized &mt() calls and code
- typo
1: # The LearningOnline Network
2: # Unauthorized to access construction space
3: #
4: # $Id: lonunauthorized.pm,v 1.8 2008/08/11 10:18:31 bisitz 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: use Apache::lonlocal;
37: use LONCAPA();
38:
39: sub handler {
40: my $r = shift;
41: &Apache::loncommon::content_type($r,'text/html');
42: $r->send_http_header;
43: return OK if $r->header_only;
44:
45: # ------------------------------------------------------------ Print the screen
46: # Figure out who the user is and what they wanted to access
47:
48: my ($ownername,$ownerdomain)=
49: &Apache::loncacc::constructaccess($env{'request.editurl'},$r->dir_config('lonDefDomain'));
50: # print header
51: $r->print(&Apache::loncommon::start_page("Failed Access to Construction Space",
52: undef,
53: {'domain' => $ownerdomain,}));
54: # figure out what went wrong
55:
56: if ($ownerdomain) {
57: $r->print('<h1>'.&mt('Choose another server').'</h1><p>'
58: .&mt('The construction space for this resource is located on another server.')
59: .'</p>');
60: my $ownerhome=&Apache::lonnet::homeserver($ownername,$ownerdomain);
61: unless ($ownerhome eq 'no_host') {
62: $r->print('<p>'
63: .&mt('Please log into [_1] to edit.'
64: ,'<tt>'.&Apache::lonnet::hostname($ownerhome).'</tt>')
65: .'</p>');
66: }
67: } else {
68: $r->print('<h1>'
69: .&mt('You do not have authoring privileges for this resource')
70: .'</h1>');
71: my ($realownername)=
72: ($env{'request.editurl'}=~m{/(?:~|priv/|home/)($LONCAPA::username_re)});
73: my $realownerhome=
74: &Apache::lonnet::homeserver($realownername,
75: $r->dir_config('lonDefDomain'));
76: unless ($realownerhome eq 'no_host') {
77: my $plainname=&Apache::loncommon::plainname($realownername,$r->dir_config('lonDefDomain'));
78: my $user=&mt('[_1] at [_2]',$realownername,$r->dir_config('lonDefDomain'));
79: my $userlink=&Apache::loncommon::aboutmewrapper(
80: $plainname.' ('.$user.')'
81: ,$realownername
82: ,$r->dir_config('lonDefDomain'));
83: $r->print('<p>'
84: .&mt('Contact [_1] for access.',$userlink)
85: .'</p>');
86: }
87: }
88:
89: $r->print(&Apache::loncommon::end_page());
90: return OK;
91: }
92:
93: 1;
94: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>