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

1.1       www         1: # The LearningOnline Network
                      2: # Unauthorized to access construction space
                      3: #
1.5     ! albertel    4: # $Id: lonunauthorized.pm,v 1.4 2005/04/07 06:56:27 albertel 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: # Figure out who the user is and what they wanted to access
                     46: 
                     47:     my ($ownername,$ownerdomain)=
1.4       albertel   48:      &Apache::loncacc::constructaccess($env{'request.editurl'},$r->dir_config('lonDefDomain'));
1.1       www        49: # print header
1.5     ! albertel   50:     $r->print(&Apache::loncommon::start_page("Failed Access to Construction Space",
        !            51: 					     undef,
        !            52: 					     {'domain' => $ownerdomain,}));
1.1       www        53: # figure out what went wrong
                     54: 
                     55:     if ($ownerdomain) {
1.2       www        56: 	$r->print('<h1>'.&mt('Choose another server').'</h1><p>'.
                     57: &mt('The constuction space for this resource is located on another server.').
                     58: '</p>');
1.1       www        59:         my $ownerhome=&Apache::lonnet::homeserver($ownername,$ownerdomain);
                     60:         unless ($ownerhome eq 'no_host') {
                     61: 	    $r->print(
1.2       www        62:  "<p>".&mt('Please log into')." <tt>".$Apache::lonnet::hostname{$ownerhome}.
                     63:  "</tt> ".&mt('to edit.')."</p>");
1.1       www        64:         }
                     65:     } else {
                     66:         $r->print(
1.2       www        67:             "<h1>".
                     68: 	&mt("You do not have authoring privileges for this resource")."</h1>");
1.4       albertel   69:         my ($realownername)=($env{'request.editurl'}=~/\/(?:\~|priv\/|home\/)(\w+)/);
1.1       www        70:         my $realownerhome=
                     71:       &Apache::lonnet::homeserver(
                     72:         $realownername,$r->dir_config('lonDefDomain'));
                     73:         unless ($realownerhome eq 'no_host') {
1.2       www        74:            $r->print("<p>".&mt('Contact')." ".
1.1       www        75:     &Apache::loncommon::aboutmewrapper(
                     76:      &Apache::loncommon::plainname($realownername,
1.3       www        77:                                $r->dir_config('lonDefDomain')).' ('.
1.2       www        78:                                $realownername.&mt(' at ').
1.1       www        79:                                $r->dir_config('lonDefDomain').')',
                     80: 			       $realownername,$r->dir_config('lonDefDomain')).
                     81:            ' for access.');
                     82:         }
                     83:     }
                     84:     
1.5     ! albertel   85:     $r->print(&Apache::loncommon::end_page());
1.1       www        86:     return OK;
                     87: } 
                     88: 
                     89: 1;
                     90: __END__

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