[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonnavmaps.pm
raeburn
raeburn at source.lon-capa.org
Sat Jul 27 12:44:31 EDT 2019
raeburn Sat Jul 27 16:44:31 2019 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface lonnavmaps.pm
Log:
- For 2.11
Backport 1.527, 1.528, 1.529, 1.530, 1.544, 1.545
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.509.2.10 loncom/interface/lonnavmaps.pm:1.509.2.11
--- loncom/interface/lonnavmaps.pm:1.509.2.10 Thu Feb 7 00:49:53 2019
+++ loncom/interface/lonnavmaps.pm Sat Jul 27 16:44:31 2019
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.509.2.10 2019/02/07 00:49:53 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.509.2.11 2019/07/27 16:44:31 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
@@ -1726,6 +1726,23 @@
undef($args->{'sort'});
}
+ # Determine if page will be served with https in case
+ # it contains a syllabus which uses an external URL
+ # which points at an http site.
+
+ my ($is_ssl,$cdom,$cnum,$hostname);
+ if ($ENV{'SERVER_PORT'} == 443) {
+ $is_ssl = 1;
+ if ($r) {
+ $hostname = $r->hostname();
+ } else {
+ $hostname = $ENV{'SERVER_NAME'};
+ }
+ }
+ if ($env{'request.course.id'}) {
+ $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ }
my $inhibitmenu;
if ($args->{'modalLink'}) {
@@ -1864,7 +1881,27 @@
$stack=$it->getStack();
}
($src,$symb,$anchor)=getLinkForResource($stack);
- my $srcHasQuestion = $src =~ /\?/;
+ my $srcHasQuestion = $src =~ /\?/;
+ if ($env{'request.course.id'}) {
+ if (($is_ssl) && ($src =~ m{^\Q/public/$cdom/$cnum/syllabus\E($|\?)}) &&
+ ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
+ unless (&Apache::lonnet::uses_sts()) {
+ if ($hostname ne '') {
+ $src = 'http://'.$hostname.$src;
+ }
+ $src .= ($srcHasQuestion? '&' : '?') . 'usehttp=1';
+ $srcHasQuestion = 1;
+ }
+ } elsif (($is_ssl) && ($src =~ m{^\Q/adm/wrapper/ext/\E(?!https:)})) {
+ unless (&Apache::lonnet::uses_sts()) {
+ if ($hostname ne '') {
+ $src = 'http://'.$hostname.$src;
+ }
+ $src .= ($srcHasQuestion? '&' : '?') . 'usehttp=1';
+ $srcHasQuestion = 1;
+ }
+ }
+ }
if (defined($anchor)) { $anchor='#'.$anchor; }
if (($args->{'caller'} eq 'sequence') && ($curRes->is_map())) {
$args->{"resourceLink"} = $src.($srcHasQuestion?'&':'?') .'navmap=1';
@@ -2825,7 +2862,7 @@
my $pc = $map->map_pc();
next if ((!$pc) || ($pc == 1));
push(@links,$map);
- push(@revmapinfo,{'href' => $map->link().'?navmap=1','text' => $map->title(),'no_mt' => 1,});
+ push(@revmapinfo,{'href' => $env{'request.use_absolute'}.$map->link().'?navmap=1','text' => $map->title(),'no_mt' => 1,});
$totallength += length($map->title());
}
my $numlinks = scalar(@links);
@@ -2840,7 +2877,7 @@
foreach my $map (@links) {
my $showntitle = &truncate_crumb_text($map->title(),$avg);
if ($showntitle ne '') {
- push(@revmapinfo,{'href' => $map->link().'?navmap=1','text' => $showntitle,'no_mt' => 1,});
+ push(@revmapinfo,{'href' => $env{'request.use_absolute'}.$map->link().'?navmap=1','text' => $showntitle,'no_mt' => 1,});
}
}
}
More information about the LON-CAPA-cvs
mailing list