--- loncom/interface/londocs.pm 2017/01/24 15:52:58 1.619
+++ loncom/interface/londocs.pm 2017/05/10 20:32:27 1.629
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.619 2017/01/24 15:52:58 raeburn Exp $
+# $Id: londocs.pm,v 1.629 2017/05/10 20:32:27 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -654,11 +654,12 @@ sub group_import {
}
}
if ($url) {
- if ($url =~ m{^(/adm/$coursedom/$coursenum/(\d+)/exttool)s?\:?(.*)$}) {
+ if ($url =~ m{^(/adm/$coursedom/$coursenum/(\d+)/ext\.tool)\:?(.*)$}) {
$url = $1;
my $marker = $2;
my $info = $3;
my ($toolid,%toolhash,%toolsettings);
+ my @extras = ('linktext','explanation','crslabel','crstitle');
my @toolinfo = split(/:/,$info);
if ($residx) {
%toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$coursedom,$coursenum);
@@ -668,28 +669,37 @@ sub group_import {
}
$toolid =~ s/\D//g;
($toolhash{'target'},$toolhash{'width'},$toolhash{'height'},
+ $toolhash{'linktext'},$toolhash{'explanation'},
$toolhash{'crslabel'},$toolhash{'crstitle'}) = @toolinfo;
- $toolhash{'crslabel'} = &unescape($toolhash{'crslabel'});
- $toolhash{'crstitle'} = &unescape($toolhash{'crstitle'});
+ foreach my $item (@extras) {
+ $toolhash{$item} = &unescape($toolhash{$item});
+ }
if (ref($ltitoolsref) eq 'HASH') {
my @deleted;
if (ref($ltitoolsref->{$toolid}) eq 'HASH') {
- if ($ltitoolsref->{$toolid}->{'url'} =~ m{^https://}) {
- $url =~ s/exttool$/exttools/;
- }
$toolhash{'id'} = $toolid;
- if (($toolhash{'target'} eq 'iframe') || ($toolhash{'target'} eq 'window')) {
+ if (($toolhash{'target'} eq 'iframe') || ($toolhash{'target'} eq 'tab') ||
+ ($toolhash{'target'} eq 'window')) {
if ($toolhash{'target'} eq 'window') {
foreach my $item ('width','height') {
$toolhash{$item} =~ s/^\s+//;
$toolhash{$item} =~ s/\s+$//;
+ if ($toolhash{$item} =~ /\D/) {
+ delete($toolhash{$item});
+ if ($residx) {
+ if ($toolsettings{$item}) {
+ push(@deleted,$item);
+ }
+ }
+ }
}
}
} elsif ($residx) {
$toolhash{'target'} = $toolsettings{'target'};
if ($toolhash{'target'} eq 'window') {
- $toolhash{'width'} = $toolsettings{'width'};
- $toolhash{'height'} = $toolsettings{'height'};
+ foreach my $item ('width','height') {
+ $toolhash{$item} = $toolsettings{$item};
+ }
}
} elsif (ref($ltitoolsref->{$toolid}->{'display'}) eq 'HASH') {
$toolhash{'target'} = $ltitoolsref->{$toolid}->{'display'}->{'target'};
@@ -699,31 +709,44 @@ sub group_import {
}
}
if ($toolhash{'target'} eq 'iframe') {
- delete($toolhash{'width'});
- delete($toolhash{'height'});
- if ($residx) {
- if ($toolsettings{'width'}) {
- push(@deleted,'width');
+ foreach my $item ('width','height','linktext','explanation') {
+ delete($toolhash{$item});
+ if ($residx) {
+ if ($toolsettings{$item}) {
+ push(@deleted,$item);
+ }
}
- if ($toolsettings{'height'}) {
- push(@deleted,'height');
+ }
+ } elsif ($toolhash{'target'} eq 'tab') {
+ foreach my $item ('width','height') {
+ delete($toolhash{$item});
+ if ($residx) {
+ if ($toolsettings{$item}) {
+ push(@deleted,$item);
+ }
}
}
}
if (ref($ltitoolsref->{$toolid}->{'crsconf'}) eq 'HASH') {
- foreach my $item ('label','title') {
+ foreach my $item ('label','title','linktext','explanation') {
+ my $crsitem;
+ if (($item eq 'label') || ($item eq 'title')) {
+ $crsitem = 'crs'.$item;
+ } else {
+ $crsitem = $item;
+ }
if ($ltitoolsref->{$toolid}->{'crsconf'}->{$item}) {
- $toolhash{'crs'.$item} =~ s/^\s+//;
- $toolhash{'crs'.$item} =~ s/\s+$//;
- if ($toolhash{'crs'.$item} eq '') {
- delete($toolhash{'crs'.$item});
+ $toolhash{$crsitem} =~ s/^\s+//;
+ $toolhash{$crsitem} =~ s/\s+$//;
+ if ($toolhash{$crsitem} eq '') {
+ delete($toolhash{$crsitem});
}
} else {
- delete($toolhash{'crs'.$item});
+ delete($toolhash{$crsitem});
}
- if (($residx) && (exists($toolsettings{'crs'.$item}))) {
- unless (exists($toolhash{'crs'.$item})) {
- push(@deleted,'crs'.$item);
+ if (($residx) && (exists($toolsettings{$crsitem}))) {
+ unless (exists($toolhash{$crsitem})) {
+ push(@deleted,$crsitem);
}
}
}
@@ -748,8 +771,8 @@ sub group_import {
$donechk = 1;
}
if ($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) {
- &contained_map_check($url,$folder,\%removefrommap,\%removeparam,
- \%addedmaps,\%hierarchy,\%titles,$allmaps);
+ &contained_map_check($url,$folder,$coursenum,$coursedom,\%removefrommap,
+ \%removeparam,\%addedmaps,\%hierarchy,\%titles,$allmaps);
$importuploaded = 1;
} elsif ($url =~ m{^/res/.+\.(page|sequence)$}) {
next if ($allmaps->{$url});
@@ -920,7 +943,7 @@ sub docs_change_log {
'// '."\n".
@@ -1200,8 +1223,8 @@ sub update_paste_buffer {
$subdir = $prefix;
}
my (%addedmaps,%removefrommap,%removeparam,%hierarchy,%titles,%allmaps);
- &contained_map_check($url,$folder,\%removefrommap,\%removeparam,\%addedmaps,
- \%hierarchy,\%titles,\%allmaps);
+ &contained_map_check($url,$folder,$coursenum,$coursedom,\%removefrommap,
+ \%removeparam,\%addedmaps,\%hierarchy,\%titles,\%allmaps);
if (ref($hierarchy{$url}) eq 'HASH') {
my ($nested,$nestednames);
&recurse_uploaded_maps($url,$subdir,\%hierarchy,\%titles,\$nested,\$nestednames);
@@ -1279,7 +1302,7 @@ sub print_paste_buffer {
my $extension = (split(/\./,$env{'docs.markedcopy_url_'.$suffix}))[-1];
if ($url =~ m{^(?:/adm/wrapper/ext|(?:http|https)(?::|:))//} ) {
$is_external = 1;
- } elsif ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/exttools?$}) {
+ } elsif ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/ext\.tool$}) {
$is_exttool = 1;
}
if ($folder =~ /^supplemental/) {
@@ -1313,26 +1336,34 @@ sub print_paste_buffer {
$is_uploaded_map = 1;
}
} elsif (($url =~ m{^/res/lib/templates/\w+\.problem$}) ||
- ($url =~ m{^/adm/($match_domain)/($match_username)/\d+/(bulletinboard|smppg)$})) {
+ ($url =~ m{^/adm/($match_domain)/($match_username)/\d+/(bulletinboard|smppg|ext\.tool)$})) {
if ($cid ne $env{'request.course.id'}) {
my ($srcdom,$srcnum) = split(/_/,$cid);
if ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) {
- $othercrs = '
'.&mt('(from another course)');
+ if (($is_exttool) && ($srcdom ne $coursedom)) {
+ $canpaste = 0;
+ $nopaste = &mt('Paste from another domain unavailable.');
+ } else {
+ $othercrs = '
'.&mt('(from another course)');
+ }
} else {
$canpaste = 0;
$nopaste = &mt('Paste from another course unavailable.');
- }
+ }
}
}
if ($canpaste) {
push(@pasteable,$suffix);
- }
+ }
}
my $buffer;
- if (($is_external) || ($is_exttool)) {
+ if ($is_external) {
$buffer = &mt('External Resource').': '.
&LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix}).' ('.
&LONCAPA::map::qtescape($url).')';
+ } elsif ($is_exttool) {
+ $buffer = &mt('External Tool').': '.
+ &LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix});
} else {
my $icon = &Apache::loncommon::icon($extension);
if ($extension eq 'sequence' &&
@@ -1490,7 +1521,7 @@ sub supp_pasteable {
($url =~ m{^/uploaded/$match_domain/$match_courseid/(docs|supplemental)/(default|\d+)/\d+/}) ||
($url =~ m{^/adm/$match_domain/$match_username/aboutme}) ||
($url =~ m{^/public/$match_domain/$match_courseid/syllabus}) ||
- ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/exttools?$})) {
+ ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/ext\.tool$})) {
return 1;
}
return;
@@ -1612,7 +1643,7 @@ sub do_paste_from_buffer {
return();
}
- my (%msgs,%before,%after,@dopaste,%is_map,%notinsupp,%notincrs,%duplicate,
+ my (%msgs,%before,%after,@dopaste,%is_map,%notinsupp,%notincrs,%notindom,%duplicate,
%prefixchg,%srcdom,%srcnum,%srcmapidx,%marktomove,$save_err,$lockerrors,$allresult);
foreach my $suffix (@topaste) {
@@ -1641,7 +1672,8 @@ sub do_paste_from_buffer {
$srcdom{$suffix} = $srcd;
$srcnum{$suffix} = $srcn;
} elsif (($url =~ m{^/res/lib/templates/\w+\.problem$}) ||
- ($url =~ m{^/adm/$match_domain/$match_username/\d+/(bulletinboard|smppg)$})) {
+ ($url =~ m{^/adm/$match_domain/$match_username/\d+/(bulletinboard|smppg|ext\.tool)$})) {
+ my $srctype= $1;
my ($srcd,$srcn) = split(/_/,$cid);
# When paste buffer was populated using an active role in a different course
# check for mdc privilege in the course from which the resource was pasted
@@ -1651,6 +1683,10 @@ sub do_paste_from_buffer {
next;
}
}
+ if (($srctype eq 'ext.tool') && ($srcd ne $coursedom)) {
+ $notindom{$suffix} = 1;
+ next;
+ }
$srcdom{$suffix} = $srcd;
$srcnum{$suffix} = $srcn;
}
@@ -1659,7 +1695,6 @@ sub do_paste_from_buffer {
if ($url=~/\.(page|sequence)$/) {
$is_map{$suffix} = 1;
}
-
if ($url =~ m{^/uploaded/$match_domain/$match_courseid/([^/]+)}) {
my $oldprefix = $1;
# When pasting content from Main Content to Supplemental Content and vice versa
@@ -1704,6 +1739,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.',
duplicate => 'Paste failed: only one instance of a particular published sequence or page is allowed within each course.',
);
@@ -1757,8 +1793,9 @@ sub do_paste_from_buffer {
if ($is_map{$suffix}) {
# If pasting a map, check if map contains other maps
my (%hierarchy,%titles);
- &contained_map_check($url,$folder,\%removefrommap,\%removeparam,
- \%addedmaps,\%hierarchy,\%titles,$allmaps);
+ &contained_map_check($url,$folder,$coursenum,$coursedom,
+ \%removefrommap,\%removeparam,\%addedmaps,
+ \%hierarchy,\%titles,$allmaps);
if ($url=~ m{^/uploaded/}) {
my $newurl;
unless ($env{'form.docs.markedcopy_options_'.$suffix} eq 'move') {
@@ -1811,7 +1848,7 @@ sub do_paste_from_buffer {
}
}
}
- if ($url=~ m{/(bulletinboard|smppg)$}) {
+ if ($url=~ m{/(bulletinboard|smppg|ext\.tool)$}) {
my $prefix = $1;
my $fromothercrs;
#need to copy the db contents to a new one, unless this is a move.
@@ -1839,6 +1876,8 @@ sub do_paste_from_buffer {
$msg = &mt('Paste failed: An error occurred when copying the simple page.').' '.$errtext;
} elsif ($prefix eq 'bulletinboard') {
$msg = &mt('Paste failed: An error occurred when copying the discussion board.').' '.$errtext;
+ } elsif ($prefix eq 'ext.tool') {
+ $msg = &mt('Paste failed: An error occurred when copying the external tool.').' '.$errtext;
}
$results{$suffix} = $result;
$msgerrs{$suffix} = $msg;
@@ -2098,8 +2137,11 @@ sub dbcopy {
my ($url,$result,$errtext);
if (ref($dbref) eq 'HASH') {
$url = $dbref->{'src'};
- if ($url =~ m{/(smppg|bulletinboard)$}) {
+ if ($url =~ m{/(smppg|bulletinboard|ext\.tool)$}) {
my $prefix = $1;
+ if ($prefix eq 'ext.tool') {
+ $prefix = 'exttool';
+ }
if (($dbref->{'cdom'} =~ /^$match_domain$/) &&
($dbref->{'cnum'} =~ /^$match_courseid$/)) {
my $db_name;
@@ -2110,6 +2152,8 @@ sub dbcopy {
&Apache::lonsimplepage::get_db_name($url,$marker,
$dbref->{'cdom'},
$dbref->{'cnum'});
+ } elsif ($dbref->{'src'} =~ m{/ext\.tool$}) {
+ $db_name = 'exttool_'.$marker;
} else {
$db_name = 'bulletinpage_'.$marker;
}
@@ -2153,7 +2197,7 @@ sub dbcopy {
$result=&Apache::lonnet::put($db_name,\%contents,
$coursedom,$coursenum);
if ($result eq 'ok') {
- $url =~ s{/(\d*)/(smppg|bulletinboard)$}{/$suffix/$2}x;
+ $url =~ s{/(\d*)/(smppg|bulletinboard|ext\.tool)$}{/$suffix/$2}x;
}
}
if (($freedlock ne 'ok') && (ref($lockerrorsref) eq 'HASH')) {
@@ -2163,6 +2207,9 @@ sub dbcopy {
if ($prefix eq 'smppg') {
$lockerrorsref->{$prefix} .=
' '.&mt('This will prevent creation of additional simple pages in this course.');
+ } elsif ($prefix eq 'exttool') {
+ $lockerrorsref->{$prefix} .=
+ ' '.&mt('This will prevent addition of more external tools to this course.');
} else {
$lockerrorsref->{$prefix} .= ' '.&mt('This will prevent creation of additional discussion boards in this course.');
}
@@ -2292,8 +2339,8 @@ sub uniqueness_check {
}
sub contained_map_check {
- my ($url,$folder,$removefrommap,$removeparam,$addedmaps,$hierarchy,$titles,
- $allmaps) = @_;
+ my ($url,$folder,$coursenum,$coursedom,$removefrommap,$removeparam,$addedmaps,
+ $hierarchy,$titles,$allmaps) = @_;
my $content = &Apache::lonnet::getfile($url);
unless ($content eq '-1') {
my $parser = HTML::TokeParser->new(\$content);
@@ -2303,7 +2350,13 @@ sub contained_map_check {
if ($token->[1] eq 'resource') {
next if ($token->[2]->{'type'} eq 'zombie');
my $ressrc = $token->[2]->{'src'};
- if ($folder =~ /^supplemental/) {
+ if ($ressrc =~ m{^/adm/($match_domain)/$match_courseid/\d+/ext\.tool$}) {
+ my $srcdom = $1;
+ unless ($srcdom eq $coursedom) {
+ $removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc;
+ next;
+ }
+ } elsif ($folder =~ /^supplemental/) {
unless (&supp_pasteable($ressrc)) {
$removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc;
next;
@@ -2322,8 +2375,8 @@ sub contained_map_check {
$addedmaps->{$ressrc} = [$url];
}
}
- &contained_map_check($ressrc,$folder,$removefrommap,$removeparam,
- $addedmaps,$hierarchy,$titles,$allmaps);
+ &contained_map_check($ressrc,$folder,$coursenum,$coursedom,$removefrommap,
+ $removeparam,$addedmaps,$hierarchy,$titles,$allmaps);
}
} elsif ($token->[1] eq 'param') {
if ($folder =~ /^supplemental/) {
@@ -3009,7 +3062,7 @@ sub handle_edit_cmd {
sub editor {
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype,
$supplementalflag,$orderhash,$iconpath,$pathitem,$ltitoolsref,
- $canedit,$navmapref,$hiddentop)=@_;
+ $canedit,$hostname,$navmapref,$hiddentop)=@_;
my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container);
if ($allowed) {
(my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,
@@ -3220,7 +3273,7 @@ sub editor {
} else {
return $errortxt;
}
- } elsif ($url =~ m{^/adm/$coursedom/$coursenum/new/exttool}) {
+ } elsif ($url =~ m{^/adm/$coursedom/$coursenum/new/ext\.tool}) {
my ($suffix,$errortxt,$locknotfreed) =
&new_timebased_suffix($coursedom,$coursenum,'exttool');
if ($locknotfreed) {
@@ -3339,7 +3392,8 @@ sub editor {
$output .= &entryline($idx,$name,$url,$folder,$allowed,$res,
$coursenum,$coursedom,$crstype,
$pathitem,$supplementalflag,$container,
- \%filters,\%curr_groups,$ltitoolsref,$canedit,$isencrypted,$navmapref);
+ \%filters,\%curr_groups,$ltitoolsref,$canedit,
+ $isencrypted,$navmapref,$hostname);
$idx++;
$shown++;
}
@@ -3720,7 +3774,7 @@ sub is_supplemental_title {
sub entryline {
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,
$crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups,
- $ltitoolsref,$canedit,$isencrypted,$navmapref)=@_;
+ $ltitoolsref,$canedit,$isencrypted,$navmapref,$hostname)=@_;
my ($foldertitle,$renametitle,$oldtitle);
if (&is_supplemental_title($title)) {
($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);
@@ -3837,7 +3891,7 @@ END
|/aboutme$
|/navmaps$
|/bulletinboard$
- |/exttools?$
+ |/ext\.tool$
|\.html$)}x)
|| $isexternal) {
$skip_confirm = 1;
@@ -3969,7 +4023,7 @@ END
}
}
- my ($editlink,$extresform,$anchor,$hiddenres);
+ my ($editlink,$extresform,$anchor,$hiddenres,$nomodal);
my $orig_url = $url;
$orig_url=~s{http(:|:)//https(:|:)//}{https$2//};
$url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/};
@@ -3987,10 +4041,23 @@ END
} elsif ($url!~/\.(sequence|page)$/) {
$url='/adm/coursedocs/showdoc'.$url;
}
- } elsif ($url=~m|^/ext/|) {
- $url='/adm/wrapper'.$url;
- } elsif ($url=~m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {
+ } 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+/ext\.tool$}) {
$url='/adm/wrapper'.$url;
+ } elsif ($url eq "/public/$coursedom/$coursenum/syllabus") {
+ if (($ENV{'SERVER_PORT'} == 443) &&
+ ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
+ $url .= '?usehttp=1';
+ $nomodal = 1;
+ }
}
if (&Apache::lonnet::symbverify($symb,$url)) {
my $shownsymb = $symb;
@@ -4020,7 +4087,7 @@ END
if (((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i) ||
$isencrypted || (&Apache::lonnet::EXT('resource.0.encrypturl',$symb) =~ /^yes$/i)) {
$checkencrypt = 1;
- } else {
+ } elsif (ref($navmapref)) {
unless (ref($$navmapref)) {
$$navmapref = Apache::lonnavmaps::navmap->new();
}
@@ -4048,11 +4115,26 @@ END
$url='';
}
}
- } elsif ($supplementalflag) {
+ } elsif ($supplementalflag) {
if ($isexternal) {
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) &&
+ ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
+ if ($hostname ne '') {
+ $url = 'http://'.$hostname.$url;
+ }
+ $url .= (($url =~ /\?/) ? '&':'?').'usehttp=1';
+ $nomodal = 1;
}
}
}
@@ -4075,25 +4157,29 @@ END
my $encryptmap = ((&LONCAPA::map::getparameter($orderidx,
'parameter_encrypturl'))[0]=~/^yes$/i);
unless ($hiddenmap) {
- unless (ref($$navmapref)) {
- $$navmapref = Apache::lonnavmaps::navmap->new();
- }
- if (ref($$navmapref)) {
- if (lc($$navmapref->get_mapparam(undef,$folderurl,"0.hiddenresource")) eq 'yes') {
- my @resources = $$navmapref->retrieveResources($folderurl,$filterFunc,1,1);
- unless (@resources) {
- $hiddenmap = 1;
- unless ($env{'request.role.adv'}) {
- $url = '';
- $hiddenfolder = 1;
+ if (ref($navmapref)) {
+ unless (ref($$navmapref)) {
+ $$navmapref = Apache::lonnavmaps::navmap->new();
+ }
+ if (ref($$navmapref)) {
+ if (lc($$navmapref->get_mapparam(undef,$folderurl,"0.hiddenresource")) eq 'yes') {
+ my @resources = $$navmapref->retrieveResources($folderurl,$filterFunc,1,1);
+ unless (@resources) {
+ $hiddenmap = 1;
+ unless ($env{'request.role.adv'}) {
+ $url = '';
+ $hiddenfolder = 1;
+ }
}
}
}
}
}
unless ($encryptmap) {
- if (lc($$navmapref->get_mapparam(undef,$folderurl,"0.encrypturl")) eq 'yes') {
- $encryptmap = 1;
+ if ((ref($navmapref)) && (ref($$navmapref))) {
+ if (lc($$navmapref->get_mapparam(undef,$folderurl,"0.encrypturl")) eq 'yes') {
+ $encryptmap = 1;
+ }
}
}
@@ -4139,7 +4225,7 @@ $form_end;
}
} elsif ($supplementalflag && !$allowed) {
my $isexttool;
- if ($url=~m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {
+ if ($url=~m{^/adm/$coursedom/$coursenum/\d+/ext\.tool$}) {
$url='/adm/wrapper'.$url;
$isexttool = 1;
}
@@ -4164,7 +4250,7 @@ $form_end;
&Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem,
undef,undef,undef,undef,undef,undef,
undef,$disabled);
- } elsif ($orig_url =~ m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {
+ } elsif ($orig_url =~ m{^/adm/$coursedom/$coursenum/\d+/ext\.tool$}) {
($editlink,$extresform) =
&Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem,
undef,undef,undef,'tool',$coursedom,
@@ -4183,7 +4269,8 @@ $form_end;
$forceedit,
undef,$symb,
&escape($env{'form.folderpath'}),
- $renametitle,'','',1,$suppanchor);
+ $renametitle,$hostname,
+ '','',1,$suppanchor);
if ($jscall) {
$editlink = ''.&mt('Edit').' '."\n";
@@ -4200,6 +4287,7 @@ $form_end;
$reinit = &mt('(re-initialize course to access)');
}
$line.='
'.$error.'
'); @@ -6348,7 +6456,7 @@ my @supimportdoc = ( =>$supextform}); if (keys(%ltitools)) { push(@supimportdoc, - {''.$error.'
'); } else { @@ -6385,7 +6493,7 @@ my %suporderhash = ( } } elsif ($supplementalflag) { my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, - $supplementalflag,'',$iconpath,$pathitem); + $supplementalflag,'',$iconpath,$pathitem,'','',$hostname); if ($error) { $r->print(''.$error.'
'); } @@ -6759,7 +6867,8 @@ END } sub editing_js { - my ($udom,$uname,$supplementalflag,$coursedom,$coursenum,$posslti,$londocroot,$canedit,$navmapref) = @_; + my ($udom,$uname,$supplementalflag,$coursedom,$coursenum,$posslti, + $londocroot,$canedit,$hostname,$navmapref) = @_; my %js_lt = &Apache::lonlocal::texthash( p_mnf => 'Name of New Folder', t_mnf => 'New Folder', @@ -6836,6 +6945,19 @@ sub editing_js { } $backtourl = &HTML::Entities::encode(&Apache::lonnet::clutter($url),'<>&"').'?symb='. &HTML::Entities::encode($caller,'<>&"'); + if ($backtourl =~ m{^\Q/public/$coursedom/$coursenum/syllabus\E}) { + if (($ENV{'SERVER_PORT'} == 443) && + ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) { + if ($hostname ne '') { + $backtourl = 'http://'.$hostname.$backtourl; + } + $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,'<>&"'); }