[LON-CAPA-cvs] cvs: rat / lonpageflip.pm lonwrapper.pm loncom/auth lonroles.pm loncom/interface londocs.pm lonextresedit.pm lonhtmlcommon.pm lonnavmaps.pm
raeburn
raeburn at source.lon-capa.org
Tue Mar 7 21:51:18 EST 2017
raeburn Wed Mar 8 02:51:18 2017 EDT
Modified files:
/loncom/interface londocs.pm lonextresedit.pm lonhtmlcommon.pm
lonnavmaps.pm
/loncom/auth lonroles.pm
/rat lonpageflip.pm lonwrapper.pm
Log:
- For servers using Apache/SSL where an External Resource points at an
http:// URL, links to display the page use http:// to avoid mixed active
content issue, unless editing the resource (when https:// is used).
-------------- next part --------------
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.622 loncom/interface/londocs.pm:1.623
--- loncom/interface/londocs.pm:1.622 Mon Feb 20 18:29:22 2017
+++ loncom/interface/londocs.pm Wed Mar 8 02:51:07 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.622 2017/02/20 18:29:22 raeburn Exp $
+# $Id: londocs.pm,v 1.623 2017/03/08 02:51:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3988,8 +3988,15 @@
} elsif ($url!~/\.(sequence|page)$/) {
$url='/adm/coursedocs/showdoc'.$url;
}
- } elsif ($url=~m|^/ext/|) {
- $url='/adm/wrapper'.$url;
+ } elsif ($url=~m{^(|/adm/wrapper)/ext/([^#]+)}) {
+ my $wrapped = $1;
+ my $exturl = $2;
+ if ($wrapped eq '') {
+ $url='/adm/wrapper'.$url;
+ }
+ if (($ENV{'SERVER_PORT'} == 443) && ($exturl !~ /^https:/)) {
+ $nomodal = 1;
+ }
} elsif ($url=~m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {
$url='/adm/wrapper'.$url;
} elsif ($url eq "/public/$coursedom/$coursenum/syllabus") {
@@ -4060,6 +4067,12 @@
if ($url =~ /^([^#]+)#([^#]+)$/) {
$url = $1;
$anchor = $2;
+ if (($url =~ m{^(|/adm/wrapper)/ext/(?!https:)}) && ($ENV{'SERVER_PORT'} == 443)) {
+ if ($hostname ne '') {
+ $url = 'http://'.$hostname.$url;
+ }
+ $nomodal = 1;
+ }
}
} elsif ($url =~ m{^\Q/public/$coursedom/$coursenum/syllabus\E}) {
if (($ENV{'SERVER_PORT'} == 443) &&
@@ -6882,6 +6895,10 @@
}
$backtourl .= (($backtourl =~ /\?/) ? '&':'?').'usehttp=1';
}
+ } elsif ($backtourl =~ m{^/adm/wrapper/ext/(?!https:)}) {
+ if (($ENV{'SERVER_PORT'} == 443) && ($hostname ne '')) {
+ $backtourl = 'http://'.$hostname.$backtourl;
+ }
}
if ($anchor ne '') {
$backtourl .= '#'.&HTML::Entities::encode($anchor,'<>&"');
Index: loncom/interface/lonextresedit.pm
diff -u loncom/interface/lonextresedit.pm:1.14 loncom/interface/lonextresedit.pm:1.15
--- loncom/interface/lonextresedit.pm:1.14 Sun Feb 19 00:15:51 2017
+++ loncom/interface/lonextresedit.pm Wed Mar 8 02:51:08 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: lonextresedit.pm,v 1.14 2017/02/19 00:15:51 raeburn Exp $
+# $Id: lonextresedit.pm,v 1.15 2017/03/08 02:51:08 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -543,7 +543,7 @@
}
sub display_editor {
- my ($url,$folderpath,$symb,$idx,$type,$cdom,$cnum) = @_;
+ my ($url,$folderpath,$symb,$idx,$type,$cdom,$cnum,$hostname) = @_;
my ($residx,$supplementalflag,$title,$pathitem,$output,$js,$navmap);
if ($folderpath =~ /^supplemental/) {
$supplementalflag = 1;
@@ -563,6 +563,9 @@
}
$js = &Apache::lonhtmlcommon::scripttag(&extedit_javascript());
my $args = { 'force_register' => $env{'form.register'} };
+ if ($hostname) {
+ $args->{'hostname'} = $hostname;
+ }
my $description = 'External Resource Editor';
if ($type eq 'tool') {
$description = 'External Tool Editor';
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.382 loncom/interface/lonhtmlcommon.pm:1.383
--- loncom/interface/lonhtmlcommon.pm:1.382 Sat Feb 25 19:48:33 2017
+++ loncom/interface/lonhtmlcommon.pm Wed Mar 8 02:51:08 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.382 2017/02/25 19:48:33 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.383 2017/03/08 02:51:08 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3497,7 +3497,7 @@
sub jump_to_editres {
my ($cfile,$home,$switchserver,$forceedit,$forcereg,$symb,$folderpath,
$title,$hostname,$idx,$suppurl,$todocs,$suppanchor) = @_;
- my ($jscall,$anchor,$usehttp,$usehttps);
+ my ($jscall,$anchor,$usehttp,$usehttps,$is_ext);
if ($switchserver) {
if ($home) {
$cfile = '/adm/switchserver?otherserver='.$home.'&role='.
@@ -3517,9 +3517,18 @@
}
} else {
unless ($cfile =~ m{^/priv/}) {
- if ($cfile =~ m{^(/adm/wrapper/ext/[^#]+)#([^#]+)$}) {
+ if ($cfile =~ m{^(/adm/wrapper/ext/([^#]+))#([^#]+)$}) {
$cfile = $1;
- $anchor = $2;
+ my $extlink = $2;
+ $anchor = $3;
+ $is_ext = 1;
+ if (($extlink !~ /^https:/) && ($ENV{'SERVER_PORT'} == 443)) {
+ $usehttp = 1;
+ } elsif ($env{'request.use_absolute'}) {
+ if ($env{'request.use_absolute'} =~ m{^https://}) {
+ $usehttps = 1;
+ }
+ }
} elsif ($cfile =~ m{^/?public/($match_domain)/($match_courseid)/syllabus}) {
if ($ENV{'SERVER_PORT'} == 443) {
my ($cdom,$cnum) = ($1,$2);
@@ -3567,7 +3576,9 @@
if ($hostname ne '') {
$cfile = 'http://'.$hostname.(($cfile =~ /^\//)? '':'/').$cfile;
}
- $cfile .= (($cfile=~/\?/)?'&':'?').'usehttp=1';
+ unless ($is_ext) {
+ $cfile .= (($cfile=~/\?/)?'&':'?').'usehttp=1';
+ }
} elsif ($usehttps) {
$cfile = $env{'request.use_absolute'}.(($cfile =~ /^\//)? '':'/').$cfile;
}
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.528 loncom/interface/lonnavmaps.pm:1.529
--- loncom/interface/lonnavmaps.pm:1.528 Mon Feb 20 18:29:22 2017
+++ loncom/interface/lonnavmaps.pm Wed Mar 8 02:51:08 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.528 2017/02/20 18:29:22 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.529 2017/03/08 02:51:08 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1688,9 +1688,10 @@
# it contains a syllabus which uses an external URL
# which points at an http site.
- my ($is_ssl,$cdom,$cnum);
+ my ($is_ssl,$cdom,$cnum,$hostname);
if ($ENV{'SERVER_PORT'} == 443) {
$is_ssl = 1;
+ $hostname = $r->hostname();
}
if ($env{'request.course.id'}) {
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
@@ -1831,14 +1832,17 @@
($src,$symb,$anchor)=getLinkForResource($stack);
my $srcHasQuestion = $src =~ /\?/;
if ($env{'request.course.id'}) {
- if (($src =~ m{^\Q/public/$cdom/$cnum/syllabus\E($|\?)}) && ($is_ssl) &&
+ if (($is_ssl) && ($src =~ m{^\Q/public/$cdom/$cnum/syllabus\E($|\?)}) &&
($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
- my $hostname = $r->hostname();
if ($hostname ne '') {
$src = 'http://'.$hostname.$src;
}
$src .= ($srcHasQuestion? '&' : '?') . 'usehttp=1';
$srcHasQuestion = 1;
+ } elsif (($is_ssl) && ($src =~ m{^\Q/adm/wrapper/ext/\E(?!https:)})) {
+ if ($hostname ne '') {
+ $src = 'http://'.$hostname.$src;
+ }
}
}
if (defined($anchor)) { $anchor='#'.$anchor; }
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.326 loncom/auth/lonroles.pm:1.327
--- loncom/auth/lonroles.pm:1.326 Mon Feb 20 18:29:28 2017
+++ loncom/auth/lonroles.pm Wed Mar 8 02:51:13 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.326 2017/02/20 18:29:28 raeburn Exp $
+# $Id: lonroles.pm,v 1.327 2017/03/08 02:51:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -674,7 +674,8 @@
}
}
}
- if ($dest =~ m{^\Q/public/$cdom/$cnum/syllabus\E.*(\?|\&)usehttp=1}) {
+ if (($dest =~ m{^\Q/public/$cdom/$cnum/syllabus\E.*(\?|\&)usehttp=1}) ||
+ ($dest =~ m{^\Q/adm/wrapper/ext/\E(?!https:)})) {
if ($ENV{'SERVER_PORT'} == 443) {
my $hostname = $r->hostname();
if ($hostname ne '') {
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.94 rat/lonpageflip.pm:1.95
--- rat/lonpageflip.pm:1.94 Sat Feb 25 19:40:29 2017
+++ rat/lonpageflip.pm Wed Mar 8 02:51:18 2017
@@ -2,7 +2,7 @@
#
# Page flip handler
#
-# $Id: lonpageflip.pm,v 1.94 2017/02/25 19:40:29 raeburn Exp $
+# $Id: lonpageflip.pm,v 1.95 2017/03/08 02:51:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -279,7 +279,7 @@
}
}
-sub check_for_syllabus {
+sub check_http_req {
my ($srcref) = @_;
return unless (ref($srcref) eq 'SCALAR');
my $usehttp;
@@ -291,6 +291,9 @@
($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
$$srcref .= (($$srcref =~/\?/)? '&':'?') . 'usehttp=1';
$usehttp = 1;
+ } elsif (($$srcref =~ m{^\Q/adm/wrapper/ext/\E(?!https:)}) &&
+ ($ENV{'SERVER_PORT'} == 443)) {
+ $usehttp = 1;
}
}
return $usehttp;
@@ -334,7 +337,7 @@
}
} elsif ($direction eq 'firstanswerable') {
my $furl = &first_answerable_ressymb();
- my $usehttp = &check_for_syllabus(\$furl);
+ my $usehttp = &check_http_req(\$furl);
if (($usehttp) && ($hostname ne '')) {
$furl='http://'.$hostname.$furl;
} else {
@@ -387,7 +390,7 @@
}
if ($direction eq 'firstres') {
my $furl=&first_accessible_resource();
- my $usehttp = &check_for_syllabus(\$furl);
+ my $usehttp = &check_http_req(\$furl);
if (($usehttp) && ($hostname ne '')) {
$furl='http://'.$hostname.$furl;
} else {
@@ -406,7 +409,7 @@
$id=$hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id;
$newloc=$hash{'src_'.$id};
if ($newloc) {
- $usehttp = &check_for_syllabus(\$newloc);
+ $usehttp = &check_http_req(\$newloc);
if ($hash{'encrypted_'.$id}) {
$newloc=&Apache::lonenc::encrypted($newloc);
} elsif ($newloc =~ m{^(/adm/wrapper/ext/[^\#]+)\#([^\#]+)$}) {
@@ -529,7 +532,7 @@
# ------------------------------------- Check for and display critical messages
my ($redirect, $url) = &Apache::loncommon::critical_redirect(300);
unless ($redirect) {
- my $usehttp = &check_for_syllabus(\$redirecturl);
+ my $usehttp = &check_http_req(\$redirecturl);
if (($usehttp) && ($hostname ne '')) {
$url='http://'.$hostname.$redirecturl;
} else {
@@ -584,7 +587,7 @@
ENDSTART
foreach my $id (@possibilities) {
my $src = $multichoicehash{'src_'.$id};
- my $usehttp = &check_for_syllabus(\$src);
+ my $usehttp = &check_http_req(\$src);
if (($usehttp) && ($hostname ne '')) {
$src = 'http://'.$hostname.$src;
}
Index: rat/lonwrapper.pm
diff -u rat/lonwrapper.pm:1.57 rat/lonwrapper.pm:1.58
--- rat/lonwrapper.pm:1.57 Sat Feb 25 19:39:10 2017
+++ rat/lonwrapper.pm Wed Mar 8 02:51:18 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Wrapper for external and binary files as standalone resources
#
-# $Id: lonwrapper.pm,v 1.57 2017/02/25 19:39:10 raeburn Exp $
+# $Id: lonwrapper.pm,v 1.58 2017/03/08 02:51:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -164,7 +164,7 @@
return OK if $r->header_only;
my $url = $r->uri;
- my ($is_ext,$brcrum,$absolute,$is_pdf,$exttool,$cdom,$cnum);
+ my ($is_ext,$brcrum,$absolute,$is_pdf,$exttool,$cdom,$cnum,$hostname);
for ($url){
s|^/adm/wrapper||;
@@ -204,16 +204,16 @@
}
}
my $type = 'ext';
- my %ltitools;
if ($exttool) {
$type = 'tool';
- %ltitools = &Apache::lonnet::get_domain_ltitools($cdom);
+ } elsif (($url =~ /^http:/) && ($ENV{'SERVER_PORT'} == 443)) {
+ $hostname = $r->hostname();
}
$r->print(
&Apache::lonextresedit::display_editor($url,$env{'form.folderpath'},
$env{'form.symb'},
$env{'form.idx'},$type,$cdom,
- $cnum,\%ltitools));
+ $cnum,$hostname));
return OK;
} elsif ($env{'form.folderpath'} =~ /^supplemental/) {
my $crstype = &Apache::loncommon::course_type();
More information about the LON-CAPA-cvs
mailing list