--- loncom/publisher/lonunauthorized.pm 2011/11/14 15:51:55 1.13 +++ loncom/publisher/lonunauthorized.pm 2011/11/30 18:38:58 1.13.2.2 @@ -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.2 2011/11/30 18:38:58 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,$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 @@ sub handler { 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 @@ 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]', @@ -86,8 +87,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 a different server: [_1]', - ''.&Apache::lonnet::hostname($ownerhome).''). + &mt('The construction space for this resource is located on another server.'). + ' '.&Apache::lonnet::hostname($ownerhome).''. '

'. '

'. &mt('Switch Server').''. @@ -122,7 +123,7 @@ sub handler { $option = 'decompress'; } elsif ($name eq 'qualifiedfilename') { $qualifiedfilename = $value; - } elsif ($name = 'versionone') { + } elsif ($name eq 'versionone') { if ($value eq 'priv') { $option = 'cstr'; } @@ -161,7 +162,7 @@ sub handler { '

'); } 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('

'. $deniedactions{$action}.'

'. @@ -199,17 +200,18 @@ sub handler { .&mt('You do not have authoring privileges for this resource').' ' .''.$env{'request.editurl'}.'' .'

'); - 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('

' .&mt('Contact [_1] for access.',$userlink) .'

');