File:  [LON-CAPA] / loncom / publisher / lonunauthorized.pm
Revision 1.5: download - view: text, annotated - select for diffs
Thu Apr 6 22:15:19 2006 UTC (18 years, 1 month ago) by albertel
Branches: MAIN
CVS tags: version_2_2_X, version_2_2_2, version_2_2_1, version_2_2_0, version_2_1_99_3, version_2_1_99_2, version_2_1_99_1, version_2_1_99_0, HEAD
- start_page

    1: # The LearningOnline Network
    2: # Unauthorized to access construction space
    3: #
    4: # $Id: lonunauthorized.pm,v 1.5 2006/04/06 22:15:19 albertel 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: 
   38: sub handler {
   39:     my $r = shift;
   40:     &Apache::loncommon::content_type($r,'text/html');
   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)=
   48:      &Apache::loncacc::constructaccess($env{'request.editurl'},$r->dir_config('lonDefDomain'));
   49: # print header
   50:     $r->print(&Apache::loncommon::start_page("Failed Access to Construction Space",
   51: 					     undef,
   52: 					     {'domain' => $ownerdomain,}));
   53: # figure out what went wrong
   54: 
   55:     if ($ownerdomain) {
   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>');
   59:         my $ownerhome=&Apache::lonnet::homeserver($ownername,$ownerdomain);
   60:         unless ($ownerhome eq 'no_host') {
   61: 	    $r->print(
   62:  "<p>".&mt('Please log into')." <tt>".$Apache::lonnet::hostname{$ownerhome}.
   63:  "</tt> ".&mt('to edit.')."</p>");
   64:         }
   65:     } else {
   66:         $r->print(
   67:             "<h1>".
   68: 	&mt("You do not have authoring privileges for this resource")."</h1>");
   69:         my ($realownername)=($env{'request.editurl'}=~/\/(?:\~|priv\/|home\/)(\w+)/);
   70:         my $realownerhome=
   71:       &Apache::lonnet::homeserver(
   72:         $realownername,$r->dir_config('lonDefDomain'));
   73:         unless ($realownerhome eq 'no_host') {
   74:            $r->print("<p>".&mt('Contact')." ".
   75:     &Apache::loncommon::aboutmewrapper(
   76:      &Apache::loncommon::plainname($realownername,
   77:                                $r->dir_config('lonDefDomain')).' ('.
   78:                                $realownername.&mt(' at ').
   79:                                $r->dir_config('lonDefDomain').')',
   80: 			       $realownername,$r->dir_config('lonDefDomain')).
   81:            ' for access.');
   82:         }
   83:     }
   84:     
   85:     $r->print(&Apache::loncommon::end_page());
   86:     return OK;
   87: } 
   88: 
   89: 1;
   90: __END__

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