--- loncom/interface/londocs.pm 2018/07/04 13:55:27 1.656
+++ loncom/interface/londocs.pm 2019/08/16 14:21:43 1.664
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.656 2018/07/04 13:55:27 raeburn Exp $
+# $Id: londocs.pm,v 1.664 2019/08/16 14:21:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1790,7 +1790,7 @@ sub do_paste_from_buffer {
%msgs = &Apache::lonlocal::texthash (
notinsupp => 'Paste failed: content type is not supported within Supplemental Content',
notincrs => 'Paste failed: Item is from a different course which you do not have rights to edit.',
- notindom => 'Paste failed: Item is an external tool from a course in a different donain.',
+ notindom => 'Paste failed: Item is an external tool from a course in a different domain.',
duplicate => 'Paste failed: only one instance of a particular published sequence or page is allowed within each course.',
);
@@ -1819,14 +1819,7 @@ sub do_paste_from_buffer {
# Retrieve information about all course maps in main content area
my $allmaps = {};
- if ($folder =~ /^default/) {
- $allmaps =
- &Apache::loncommon::allmaps_incourse($coursedom,$coursenum,
- $env{"course.$env{'request.course.id'}.home"},
- $env{'request.course.id'});
- }
-
- my (@toclear,%mapurls,%lockerrs,%msgerrs,%results);
+ my (@toclear,%mapurls,%lockerrs,%msgerrs,%results,$donechk);
# Loop over the items to paste
foreach my $suffix (@dopaste) {
@@ -1844,6 +1837,13 @@ sub do_paste_from_buffer {
if ($is_map{$suffix}) {
# If pasting a map, check if map contains other maps
my (%hierarchy,%titles);
+ if (($folder =~ /^default/) && (!$donechk)) {
+ $allmaps =
+ &Apache::loncommon::allmaps_incourse($coursedom,$coursenum,
+ $env{"course.$env{'request.course.id'}.home"},
+ $env{'request.course.id'});
+ $donechk = 1;
+ }
&contained_map_check($url,$folder,$coursenum,$coursedom,
\%removefrommap,\%removeparam,\%addedmaps,
\%hierarchy,\%titles,$allmaps);
@@ -2803,9 +2803,7 @@ sub apply_fixups {
}
}
if (ref($resdatacopy{$key}) eq 'HASH') {
- if ($newsubdir{$key}) {
-
- }
+ my ($gotnewmapname,$newmapname,$srcfolder,$srccontainer);
foreach my $idx (keys(%{$resdatacopy{$key}})) {
if (ref($resdatacopy{$key}{$idx}) eq 'HASH') {
my $srcurl = $resdatacopy{$key}{$idx}{'src'};
@@ -2815,15 +2813,18 @@ sub apply_fixups {
($resdatacopy{$key}{$idx}{'cnum'} =~ /^$match_courseid$/)) {
my $srcdom = $resdatacopy{$key}{$idx}{'cdom'};
my $srcnum = $resdatacopy{$key}{$idx}{'cnum'};
- my ($newmapname) = ($key =~ m{/([^/]+)$});
- my ($srcfolder,$srccontainer) = split(/\./,$newmapname);
+ unless ($gotnewmapname) {
+ ($newmapname) = ($key =~ m{/([^/]+)$});
+ ($srcfolder,$srccontainer) = split(/\./,$newmapname);
+ if ($newsubdir{$key}) {
+ $newmapname =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir{$key}/;
+ }
+ $gotnewmapname = 1;
+ }
my $srcmapinfo = $srcfolder.':'.$idx;
if ($srccontainer eq 'page') {
$srcmapinfo .= ':1';
}
- if ($newsubdir{$key}) {
- $newmapname =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir{$key}/;
- }
©_templated_files($srcurl,$srcdom,$srcnum,$srcmapinfo,$cdom,
$cnum,$template,$idx,$newmapname);
}
@@ -4171,7 +4172,9 @@ END
} elsif ($url eq "/public/$coursedom/$coursenum/syllabus") {
if (($ENV{'SERVER_PORT'} == 443) &&
($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
- $url .= '?usehttp=1';
+ unless (&Apache::lonnet::uses_sts()) {
+ $url .= '?usehttp=1';
+ }
$nomodal = 1;
}
}
@@ -4181,9 +4184,8 @@ END
if ($url =~ /^([^#]+)#([^#]+)$/) {
$url = $1;
$anchor = $2;
- if ($symb =~ m{^([^#]+)\Q#$anchor\E$}) {
- $shownsymb = $1.&escape('#').$anchor;
- }
+ my $escan = &escape('#');
+ $shownsymb =~ s/^([^\#]+)#([^\#]+)$/$1$escan$2/;
}
}
unless ($env{'request.role.adv'}) {
@@ -4237,8 +4239,11 @@ END
$url = $1;
$anchor = $2;
if (($url =~ m{^(|/adm/wrapper)/ext/(?!https:)}) && ($ENV{'SERVER_PORT'} == 443)) {
- if ($hostname ne '') {
- $url = 'http://'.$hostname.$url;
+ unless (&Apache::lonnet::uses_sts()) {
+ if ($hostname ne '') {
+ $url = 'http://'.$hostname.$url;
+ }
+ $url .= (($url =~ /\?/) ? '&':'?').'usehttp=1';
}
$nomodal = 1;
}
@@ -4246,10 +4251,12 @@ END
} elsif ($url =~ m{^\Q/public/$coursedom/$coursenum/syllabus\E}) {
if (($ENV{'SERVER_PORT'} == 443) &&
($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
- if ($hostname ne '') {
- $url = 'http://'.$hostname.$url;
+ unless (&Apache::lonnet::uses_sts()) {
+ if ($hostname ne '') {
+ $url = 'http://'.$hostname.$url;
+ }
+ $url .= (($url =~ /\?/) ? '&':'?').'usehttp=1';
}
- $url .= (($url =~ /\?/) ? '&':'?').'usehttp=1';
$nomodal = 1;
}
}
@@ -4430,8 +4437,7 @@ $form_end;
} else {
$link = $url;
}
- $link = &js_escape($link.(($url=~/\?/)?'&':'?').'inhibitmenu=yes'.
- (($anchor ne '')?$anchor:''));
+ $link = &js_escape($link.(($url=~/\?/)?'&':'?').'inhibitmenu=yes'.$anchor);
if ($nomodal) {
$line.=''.
'';
@@ -5962,8 +5968,8 @@ sub handler {
my $fileupload=(<
-
-
+
+
FIUP
my $checkbox=(<