Annotation of loncom/publisher/lonunauthorized.pm, revision 1.3

1.1       www         1: # The LearningOnline Network
                      2: # Unauthorized to access construction space
                      3: #
1.3     ! www         4: # $Id: lonunauthorized.pm,v 1.2 2003/09/22 15:39:53 www Exp $
1.1       www         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;
1.2       www        36: use Apache::lonlocal;
1.1       www        37: 
                     38: sub handler {
                     39:     my $r = shift;
1.2       www        40:     &Apache::loncommon::content_type($r,'text/html');
1.1       www        41:     $r->send_http_header;
                     42:     return OK if $r->header_only;
                     43: 
                     44: # ------------------------------------------------------------ Print the screen
                     45:     $r->print(<<ENDDOCUMENT);
                     46: <html>
                     47: <head>
                     48: <title>The LearningOnline Network with CAPA</title>
                     49: </head>
                     50: ENDDOCUMENT
                     51: # Figure out who the user is and what they wanted to access
                     52: 
                     53:     my ($ownername,$ownerdomain)=
                     54:      &Apache::loncacc::constructaccess($ENV{'request.editurl'},$r->dir_config('lonDefDomain'));
                     55: # print header
                     56:     $r->print(&Apache::loncommon::bodytag
                     57:            ("Failed Access to Construction Space",'','','',$ownerdomain));
                     58: # figure out what went wrong
                     59: 
                     60:     if ($ownerdomain) {
1.2       www        61: 	$r->print('<h1>'.&mt('Choose another server').'</h1><p>'.
                     62: &mt('The constuction space for this resource is located on another server.').
                     63: '</p>');
1.1       www        64:         my $ownerhome=&Apache::lonnet::homeserver($ownername,$ownerdomain);
                     65:         unless ($ownerhome eq 'no_host') {
                     66: 	    $r->print(
1.2       www        67:  "<p>".&mt('Please log into')." <tt>".$Apache::lonnet::hostname{$ownerhome}.
                     68:  "</tt> ".&mt('to edit.')."</p>");
1.1       www        69:         }
                     70:     } else {
                     71:         $r->print(
1.2       www        72:             "<h1>".
                     73: 	&mt("You do not have authoring privileges for this resource")."</h1>");
1.1       www        74:         my ($realownername)=($ENV{'request.editurl'}=~/\/(?:\~|priv\/|home\/)(\w+)/);
                     75:         my $realownerhome=
                     76:       &Apache::lonnet::homeserver(
                     77:         $realownername,$r->dir_config('lonDefDomain'));
                     78:         unless ($realownerhome eq 'no_host') {
1.2       www        79:            $r->print("<p>".&mt('Contact')." ".
1.1       www        80:     &Apache::loncommon::aboutmewrapper(
                     81:      &Apache::loncommon::plainname($realownername,
1.3     ! www        82:                                $r->dir_config('lonDefDomain')).' ('.
1.2       www        83:                                $realownername.&mt(' at ').
1.1       www        84:                                $r->dir_config('lonDefDomain').')',
                     85: 			       $realownername,$r->dir_config('lonDefDomain')).
                     86:            ' for access.');
                     87:         }
                     88:     }
                     89:     
                     90:     $r->print('</body></html>');
                     91:     return OK;
                     92: } 
                     93: 
                     94: 1;
                     95: __END__

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>