--- loncom/publisher/lonunauthorized.pm 2011/11/30 18:38:58 1.13.2.2 +++ loncom/publisher/lonunauthorized.pm 2011/11/30 18:32:23 1.14 @@ -1,7 +1,7 @@ # The LearningOnline Network # Unauthorized to access construction space # -# $Id: lonunauthorized.pm,v 1.13.2.2 2011/11/30 18:38:58 raeburn Exp $ +# $Id: lonunauthorized.pm,v 1.14 2011/11/30 18:32:23 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -46,10 +46,10 @@ sub handler { # ------------------------------------------------------------ Print the screen # Figure out who the user is and what they wanted to access - my ($ownername,$ownerdomain); + my ($ownername,$ownerdomain,$ownerhome); if ($env{'request.editurl'} ne '') { - ($ownername,$ownerdomain) = - &Apache::loncacc::constructaccess($env{'request.editurl'},$r->dir_config('lonDefDomain')); + ($ownername,$ownerdomain,$ownerhome) = + &Apache::loncacc::constructaccess($env{'request.editurl'}); } # Breadcrumbs @@ -57,7 +57,7 @@ sub handler { if ($env{'request.role'} =~ /^(au|ca|aa)/) { &Apache::lonhtmlcommon::add_breadcrumb({ 'text' => 'Construction Space', - 'href' => &Apache::loncommon::authorspace(), + 'href' => &Apache::loncommon::authorspace($env{'request.editurl'}), }); } elsif (($env{'request.course.id'}) && (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) { @@ -75,7 +75,6 @@ sub handler { # figure out what went wrong if ($ownerdomain) { - my $ownerhome=&Apache::lonnet::homeserver($ownername,$ownerdomain); if ($ownerhome eq 'no_host') { $r->print('
'. &mt('Unable to determine home server for this resource: [_1]', @@ -87,8 +86,8 @@ sub handler { my $switchlink = '/adm/switchserver?otherserver='.$ownerhome. '&origurl='.&HTML::Entities::encode($env{'request.editurl'},'<>&"'); $r->print('
'. - &mt('The construction space for this resource is located on another server.'). - ' '.&Apache::lonnet::hostname($ownerhome).''. + &mt('The construction space for this resource is located on a different server: [_1]', + ''.&Apache::lonnet::hostname($ownerhome).''). '
'. ''. &mt('Switch Server').''. @@ -162,7 +161,7 @@ sub handler { '
'); } else { if (($action eq 'diff') && ($option eq 'cstr')) { - $filename =~ s{^/res/$LONCAPA::domain_re/($LONCAPA::username_re)}{/priv/$1}; + $filename =~ s{^/res/}{/priv/}; } $r->print(''. $deniedactions{$action}.'
'. @@ -200,18 +199,17 @@ sub handler { .&mt('You do not have authoring privileges for this resource').' ' .''.$env{'request.editurl'}.'' .'
'); - my ($realownername) = - ($env{'request.editurl'}=~m{(?:~|priv/|home/)($LONCAPA::username_re)}); + my ($realownerdom,$realownername) = + ($env{'request.editurl'}=~m{^/priv/($LONCAPA::domain_re)/($LONCAPA::username_re)}); my $realownerhome= - &Apache::lonnet::homeserver($realownername, - $r->dir_config('lonDefDomain')); + &Apache::lonnet::homeserver($realownername,$realownerdom); unless ($realownerhome eq 'no_host') { - my $plainname=&Apache::loncommon::plainname($realownername,$r->dir_config('lonDefDomain')); - my $user=$realownername.':'.$r->dir_config('lonDefDomain'); + my $plainname=&Apache::loncommon::plainname($realownername,$realownerdom); + my $user=$realownername.':'.$realownerdom; my $userlink=&Apache::loncommon::aboutmewrapper( $plainname.' ('.$user.')' ,$realownername - ,$r->dir_config('lonDefDomain')); + ,$realownerdom); $r->print('' .&mt('Contact [_1] for access.',$userlink) .'
');