[LON-CAPA-cvs] cvs: loncom(version_2_10_X) /publisher lonunauthorized.pm
raeburn
raeburn at source.lon-capa.org
Mon Nov 14 11:05:44 EST 2011
raeburn Mon Nov 14 16:05:44 2011 EDT
Modified files: (Branch: version_2_10_X)
/loncom/publisher lonunauthorized.pm
Log:
- For 2_10_X branch reverse changes made in 1.11 to support Construction Space
location in /home/httpd/html/priv.
Index: loncom/publisher/lonunauthorized.pm
diff -u loncom/publisher/lonunauthorized.pm:1.13 loncom/publisher/lonunauthorized.pm:1.13.2.1
--- loncom/publisher/lonunauthorized.pm:1.13 Mon Nov 14 15:51:55 2011
+++ loncom/publisher/lonunauthorized.pm Mon Nov 14 16:05:44 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Unauthorized to access construction space
#
-# $Id: lonunauthorized.pm,v 1.13 2011/11/14 15:51:55 raeburn Exp $
+# $Id: lonunauthorized.pm,v 1.13.2.1 2011/11/14 16:05:44 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -46,10 +46,10 @@
# ------------------------------------------------------------ Print the screen
# Figure out who the user is and what they wanted to access
- my ($ownername,$ownerdomain,$ownerhome);
+ my ($ownername,$ownerdomain);
if ($env{'request.editurl'} ne '') {
- ($ownername,$ownerdomain,$ownerhome) =
- &Apache::loncacc::constructaccess($env{'request.editurl'});
+ ($ownername,$ownerdomain) =
+ &Apache::loncacc::constructaccess($env{'request.editurl'},$r->dir_config('lonDefDomain'));
}
# Breadcrumbs
@@ -57,7 +57,7 @@
if ($env{'request.role'} =~ /^(au|ca|aa)/) {
&Apache::lonhtmlcommon::add_breadcrumb({
'text' => 'Construction Space',
- 'href' => &Apache::loncommon::authorspace($env{'request.editurl'}),
+ 'href' => &Apache::loncommon::authorspace(),
});
} elsif (($env{'request.course.id'}) &&
(&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) {
@@ -75,6 +75,7 @@
# figure out what went wrong
if ($ownerdomain) {
+ my $ownerhome=&Apache::lonnet::homeserver($ownername,$ownerdomain);
if ($ownerhome eq 'no_host') {
$r->print('<p class="LC_error">'.
&mt('Unable to determine home server for this resource: [_1]',
@@ -86,8 +87,8 @@
my $switchlink = '/adm/switchserver?otherserver='.$ownerhome.
'&origurl='.&HTML::Entities::encode($env{'request.editurl'},'<>&"');
$r->print('<p class="LC_warning">'.
- &mt('The construction space for this resource is located on a different server: [_1]',
- '<b><tt>'.&Apache::lonnet::hostname($ownerhome).'</b></tt>').
+ &mt('The construction space for this resource is located on another server.').
+ ' <b><tt>'.&Apache::lonnet::hostname($ownerhome).'</b></tt>'.
'</p>'.
'<p class="LC_error"><a href="'.$switchlink.'">'.
&mt('Switch Server').'</a>'.
@@ -161,7 +162,7 @@
'</p>');
} else {
if (($action eq 'diff') && ($option eq 'cstr')) {
- $filename =~ s{^/res/}{/priv/};
+ $filename =~ s{^/res/$LONCAPA::domain_re/($LONCAPA::username_re)}{/priv/$1};
}
$r->print('<p class="LC_error">'.
$deniedactions{$action}.'</p><p class="LC_warning">'.
@@ -199,17 +200,18 @@
.&mt('You do not have authoring privileges for this resource').' '
.'<span class="LC_filename">'.$env{'request.editurl'}.'</span>'
.'</p>');
- my ($realownerdom,$realownername) =
- ($env{'request.editurl'}=~m{^/priv/($LONCAPA::domain_re)/($LONCAPA::username_re)});
+ my ($realownername) =
+ ($env{'request.editurl'}=~m{(?:~|priv/|home/)($LONCAPA::username_re)});
my $realownerhome=
- &Apache::lonnet::homeserver($realownername,$realownerdom);
+ &Apache::lonnet::homeserver($realownername,
+ $r->dir_config('lonDefDomain'));
unless ($realownerhome eq 'no_host') {
- my $plainname=&Apache::loncommon::plainname($realownername,$realownerdom);
- my $user=$realownername.':'.$realownerdom;
+ my $plainname=&Apache::loncommon::plainname($realownername,$r->dir_config('lonDefDomain'));
+ my $user=$realownername.':'.$r->dir_config('lonDefDomain');
my $userlink=&Apache::loncommon::aboutmewrapper(
$plainname.' ('.$user.')'
,$realownername
- ,$realownerdom);
+ ,$r->dir_config('lonDefDomain'));
$r->print('<p>'
.&mt('Contact [_1] for access.',$userlink)
.'</p>');
More information about the LON-CAPA-cvs
mailing list