version 1.93, 2017/02/20 18:29:33
|
version 1.95, 2017/03/08 02:51:18
|
Line 279 sub first_answerable_ressymb {
|
Line 279 sub first_answerable_ressymb {
|
} |
} |
} |
} |
|
|
sub check_for_syllabus { |
sub check_http_req { |
my ($srcref) = @_; |
my ($srcref) = @_; |
return unless (ref($srcref) eq 'SCALAR'); |
return unless (ref($srcref) eq 'SCALAR'); |
my $usehttp; |
my $usehttp; |
Line 291 sub check_for_syllabus {
|
Line 291 sub check_for_syllabus {
|
($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) { |
($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) { |
$$srcref .= (($$srcref =~/\?/)? '&':'?') . 'usehttp=1'; |
$$srcref .= (($$srcref =~/\?/)? '&':'?') . 'usehttp=1'; |
$usehttp = 1; |
$usehttp = 1; |
|
} elsif (($$srcref =~ m{^\Q/adm/wrapper/ext/\E(?!https:)}) && |
|
($ENV{'SERVER_PORT'} == 443)) { |
|
$usehttp = 1; |
} |
} |
} |
} |
return $usehttp; |
return $usehttp; |
Line 314 sub handler {
|
Line 317 sub handler {
|
my %multichoicehash=(); |
my %multichoicehash=(); |
my ($redirecturl,$redirectsymb,$enc,$anchor); |
my ($redirecturl,$redirectsymb,$enc,$anchor); |
my $next=''; |
my $next=''; |
|
my $hostname = $r->hostname(); |
my @possibilities=(); |
my @possibilities=(); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['postdata']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['postdata']); |
if (($env{'form.postdata'})&&($env{'request.course.fn'})) { |
if (($env{'form.postdata'})&&($env{'request.course.fn'})) { |
Line 333 sub handler {
|
Line 337 sub handler {
|
} |
} |
} elsif ($direction eq 'firstanswerable') { |
} elsif ($direction eq 'firstanswerable') { |
my $furl = &first_answerable_ressymb(); |
my $furl = &first_answerable_ressymb(); |
my $usehttp = &check_for_syllabus(\$furl); |
my $usehttp = &check_http_req(\$furl); |
if ($usehttp) { |
if (($usehttp) && ($hostname ne '')) { |
$furl='http://'.$ENV{'SERVER_NAME'}.$furl; |
$furl='http://'.$hostname.$furl; |
} else { |
} else { |
$furl=&Apache::lonnet::absolute_url().$furl; |
$furl=&Apache::lonnet::absolute_url().$furl; |
} |
} |
Line 386 sub handler {
|
Line 390 sub handler {
|
} |
} |
if ($direction eq 'firstres') { |
if ($direction eq 'firstres') { |
my $furl=&first_accessible_resource(); |
my $furl=&first_accessible_resource(); |
my $usehttp = &check_for_syllabus(\$furl); |
my $usehttp = &check_http_req(\$furl); |
if ($usehttp) { |
if (($usehttp) && ($hostname ne '')) { |
$furl='http://'.$ENV{'SERVER_NAME'}.$furl; |
$furl='http://'.$hostname.$furl; |
} else { |
} else { |
$furl=&Apache::lonnet::absolute_url().$furl; |
$furl=&Apache::lonnet::absolute_url().$furl; |
} |
} |
Line 405 sub handler {
|
Line 409 sub handler {
|
$id=$hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id; |
$id=$hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id; |
$newloc=$hash{'src_'.$id}; |
$newloc=$hash{'src_'.$id}; |
if ($newloc) { |
if ($newloc) { |
$usehttp = &check_for_syllabus(\$newloc); |
$usehttp = &check_http_req(\$newloc); |
if ($hash{'encrypted_'.$id}) { |
if ($hash{'encrypted_'.$id}) { |
$newloc=&Apache::lonenc::encrypted($newloc); |
$newloc=&Apache::lonenc::encrypted($newloc); |
} elsif ($newloc =~ m{^(/adm/wrapper/ext/[^\#]+)\#([^\#]+)$}) { |
} elsif ($newloc =~ m{^(/adm/wrapper/ext/[^\#]+)\#([^\#]+)$}) { |
Line 418 sub handler {
|
Line 422 sub handler {
|
} else { |
} else { |
$newloc='/adm/navmaps'; |
$newloc='/adm/navmaps'; |
} |
} |
if ($usehttp) { |
if (($usehttp) && ($hostname ne '')) { |
$newloc='http://'.$ENV{'SERVER_NAME'}.$newloc; |
$newloc='http://'.$hostname.$newloc; |
} else { |
} else { |
$newloc=&Apache::lonnet::absolute_url().$newloc |
$newloc=&Apache::lonnet::absolute_url().$newloc |
} |
} |
Line 528 sub handler {
|
Line 532 sub handler {
|
# ------------------------------------- Check for and display critical messages |
# ------------------------------------- Check for and display critical messages |
my ($redirect, $url) = &Apache::loncommon::critical_redirect(300); |
my ($redirect, $url) = &Apache::loncommon::critical_redirect(300); |
unless ($redirect) { |
unless ($redirect) { |
my $usehttp = &check_for_syllabus(\$redirecturl); |
my $usehttp = &check_http_req(\$redirecturl); |
if ($usehttp) { |
if (($usehttp) && ($hostname ne '')) { |
$url='http://'.$ENV{'SERVER_NAME'}.$redirecturl; |
$url='http://'.$hostname.$redirecturl; |
} else { |
} else { |
$url=&Apache::lonnet::absolute_url().$redirecturl; |
$url=&Apache::lonnet::absolute_url().$redirecturl; |
} |
} |
Line 583 $lt{'pick'}:
|
Line 587 $lt{'pick'}:
|
ENDSTART |
ENDSTART |
foreach my $id (@possibilities) { |
foreach my $id (@possibilities) { |
my $src = $multichoicehash{'src_'.$id}; |
my $src = $multichoicehash{'src_'.$id}; |
my $usehttp = &check_for_syllabus(\$src); |
my $usehttp = &check_http_req(\$src); |
if ($usehttp) { |
if (($usehttp) && ($hostname ne '')) { |
$src = 'http://'.$ENV{'SERVER_NAME'}.$src; |
$src = 'http://'.$hostname.$src; |
} |
} |
$r->print( |
$r->print( |
'<tr><td><a href="'. |
'<tr><td><a href="'. |