--- loncom/auth/blockedaccess.pm 2012/03/31 23:10:47 1.4 +++ loncom/auth/blockedaccess.pm 2020/09/28 00:10:27 1.5 @@ -1,7 +1,7 @@ # The LearningOnline Network # Information about blocking status for Portfolio files # -# $Id: blockedaccess.pm,v 1.4 2012/03/31 23:10:47 raeburn Exp $ +# $Id: blockedaccess.pm,v 1.5 2020/09/28 00:10:27 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -29,10 +29,11 @@ package Apache::blockedaccess; use strict; -use Apache::Constants qw(:common :http REDIRECT); +use Apache::Constants qw(:common); use Apache::lonnet; use Apache::loncommon(); use Apache::lonlocal; +use HTML::Entities(); sub handler { my $r = shift; @@ -41,7 +42,7 @@ sub handler { return OK if $r->header_only; &Apache::lonlocal::get_language_handle($r); - my $origurl = $r->uri; + my $origurl = &Apache::lonnet::deversion($r->uri); my ($blocked,$blocktext); if (&Apache::lonnet::is_portfolio_url($origurl)) { @@ -53,17 +54,33 @@ sub handler { if ($env{'request.course.id'}) { my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $symb = $env{'request.symb'}; ($blocked,$blocktext) = - &Apache::loncommon::blocking_status('docs',$cnum,$cdom,$origurl); + &Apache::loncommon::blocking_status('docs',$cnum,$cdom,$origurl,1,$symb,'blockedaccess'); } } if ($blocked) { $r->print(&Apache::loncommon::start_page('Access Temporarily Blocked')); $r->print($blocktext); + } elsif ($origurl eq '/adm/blockedaccess') { + $r->print(&Apache::loncommon::start_page('Access Blocking Information')); + $r->print('

'.&mt('Could not determine which page had access blocked.').'

'); } else { - my $server = &Apache::lonnet::absolute_url(); - $r->header_out(Location => $server.$origurl); - return REDIRECT; + $r->print(&Apache::loncommon::start_page('Access Blocking Information')); + my $link; + if ($origurl ne '') { + my $showurl = &Apache::lonenc::check_encrypt($origurl); + $link = &Apache::lonnet::absolute_url().$showurl; + if ($r->args ne '') { + $link .= '?'.$r->args; + } + } + $r->print('

'. + &mt('The page you are trying to reach was reported as having access blocked, but the reason is not available.'). + '

'); + if ($link) { + $r->print('

&').'">'.&mt('Try again?').'

'); + } } $r->print(&Apache::loncommon::end_page()); return OK;