[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonhtmlcommon.pm
raeburn
raeburn at source.lon-capa.org
Fri Jul 26 20:38:33 EDT 2019
raeburn Sat Jul 27 00:38:33 2019 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface lonhtmlcommon.pm
Log:
- For 2.11
Backport 1.380, 1.381, 1.382 (part), 1.383, 1.384, 1.394, 1.395
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.358.2.14 loncom/interface/lonhtmlcommon.pm:1.358.2.15
--- loncom/interface/lonhtmlcommon.pm:1.358.2.14 Sun Sep 9 21:16:34 2018
+++ loncom/interface/lonhtmlcommon.pm Sat Jul 27 00:38:33 2019
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.358.2.14 2018/09/09 21:16:34 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.358.2.15 2019/07/27 00:38:33 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2110,11 +2110,11 @@
my $foldername=shift(@folders);
if ($folderpath) {$folderpath.='&';}
$folderpath.=$folder.'&'.$foldername;
- my $url;
+ my $url = $env{'request.use_absolute'};
if ($allowed) {
- $url = '/adm/coursedocs?folderpath=';
+ $url .= '/adm/coursedocs?folderpath=';
} else {
- $url = '/adm/supplemental?folderpath=';
+ $url .= '/adm/supplemental?folderpath=';
}
$url .= &escape($folderpath);
my $name=&unescape($foldername);
@@ -3386,7 +3386,17 @@
if (url!='' && url!= null) {
currentURL = null;
currentSymb= null;
- window.location.href=url;
+ var lcHostname = setLCHost();
+ if (lcHostname!='' && lcHostname!= null) {
+ var RegExp = /^https?\:/;
+ if (RegExp.test(url)) {
+ window.location.href=url;
+ } else {
+ window.location.href=lcHostname+url;
+ }
+ } else {
+ window.location.href=url;
+ }
}
}
@@ -3406,7 +3416,7 @@
sub jump_to_editres {
my ($cfile,$home,$switchserver,$forceedit,$forcereg,$symb,$folderpath,
$title,$idx,$suppurl,$todocs,$suppanchor) = @_;
- my ($jscall,$anchor);
+ my ($jscall,$anchor,$usehttp,$usehttps,$is_ext);
if ($switchserver) {
if ($home) {
$cfile = '/adm/switchserver?otherserver='.$home.'&role='.
@@ -3426,9 +3436,37 @@
}
} 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)) {
+ unless (&Apache::lonnet::uses_sts()) {
+ $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);
+ if (($env{'request.course.id'}) &&
+ ($env{'course.'.$env{'request.course.id'}.'.num'} eq $cnum) &&
+ ($env{'course.'.$env{'request.course.id'}.'.domain'} eq $cdom)) {
+ if ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://}) {
+ unless (&Apache::lonnet::uses_sts()) {
+ $usehttp = 1;
+ }
+ }
+ }
+ } elsif ($env{'request.use_absolute'}) {
+ if ($env{'request.use_absolute'} =~ m{^https://}) {
+ $usehttps = 1;
+ }
+ }
}
if ($symb) {
if ($anchor ne '') {
@@ -3454,6 +3492,16 @@
}
if ($forceedit) {
$cfile .= (($cfile=~/\?/)?'&':'?').'forceedit=1';
+ if ($usehttps) {
+ $cfile = $env{'request.use_absolute'}.(($cfile =~ /^\//)? '':'/').$cfile;
+ }
+ } elsif ($usehttp) {
+ if ($hostname ne '') {
+ $cfile = 'http://'.$hostname.(($cfile =~ /^\//)? '':'/').$cfile;
+ }
+ $cfile .= (($cfile=~/\?/)?'&':'?').'usehttp=1';
+ } elsif ($usehttps) {
+ $cfile = $env{'request.use_absolute'}.(($cfile =~ /^\//)? '':'/').$cfile;
}
if ($forcereg) {
$cfile .= (($cfile=~/\?/)?'&':'?').'register=1';
More information about the LON-CAPA-cvs
mailing list