[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface londocs.pm
raeburn
raeburn at source.lon-capa.org
Tue Mar 14 22:05:21 EDT 2017
raeburn Wed Mar 15 02:05:21 2017 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface londocs.pm
Log:
- For 2.11
- Backport 1.620, 1.621 (part), 1.623 (part).
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.484.2.69 loncom/interface/londocs.pm:1.484.2.70
--- loncom/interface/londocs.pm:1.484.2.69 Tue Jan 24 15:54:02 2017
+++ loncom/interface/londocs.pm Wed Mar 15 02:05:20 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.484.2.69 2017/01/24 15:54:02 raeburn Exp $
+# $Id: londocs.pm,v 1.484.2.70 2017/03/15 02:05:20 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3065,7 +3065,8 @@
$output .= &entryline($idx,$name,$url,$folder,$allowed,$res,
$coursenum,$coursedom,$crstype,
$pathitem,$supplementalflag,$container,
- \%filters,\%curr_groups,$canedit,$isencrypted,$navmapref);
+ \%filters,\%curr_groups,$canedit,
+ $isencrypted,$navmapref);
$idx++;
$shown++;
}
@@ -3691,7 +3692,7 @@
}
}
- 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/};
@@ -3709,8 +3710,20 @@
} 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 eq "/public/$coursedom/$coursenum/syllabus") {
+ if (($ENV{'SERVER_PORT'} == 443) &&
+ ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
+ $nomodal = 1;
+ }
}
if (&Apache::lonnet::symbverify($symb,$url)) {
my $shownsymb = $symb;
@@ -3740,7 +3753,7 @@
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();
}
@@ -3773,6 +3786,14 @@
if ($url =~ /^([^#]+)#([^#]+)$/) {
$url = $1;
$anchor = $2;
+ if (($url =~ m{^(|/adm/wrapper)/ext/(?!https:)}) && ($ENV{'SERVER_PORT'} == 443)) {
+ $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://})) {
+ $nomodal = 1;
}
}
}
@@ -3795,25 +3816,29 @@
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;
+ }
}
}
@@ -3909,6 +3934,7 @@
$reinit = &mt('(re-initialize course to access)');
}
$line.='<td class="LC_docs_entry_commands"'.$tdalign.'><span class="LC_nobreak">'.$editlink.$renamelink;
+ my $link;
if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
$line.='<a href="'.$url.'"><img src="'.$icon.'" alt="" class="LC_icon" /></a>';
} elsif ($url) {
@@ -3919,9 +3945,15 @@
$anchor = '#'.&HTML::Entities::encode($anchor,'"<>&');
}
}
- $line.=&Apache::loncommon::modal_link(&js_escape($url.(($url=~/\?/)?'&':'?').'inhibitmenu=yes'.
- (($anchor ne '')?$anchor:'')),
- '<img src="'.$icon.'" alt="" class="LC_icon" />',600,500);
+ $link = &js_escape($url.(($url=~/\?/)?'&':'?').'inhibitmenu=yes'.
+ (($anchor ne '')?$anchor:''));
+ if ($nomodal) {
+ $line.='<a href="#" onclick="javascript:window.open('."'$link','syllabuspreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1')".'; return false;" />'.
+ '<img src="'.$icon.'" alt="" class="LC_icon" border="0" /></a>';
+ } else {
+ $line.=&Apache::loncommon::modal_link($link,
+ '<img src="'.$icon.'" alt="" class="LC_icon" />',600,500);
+ }
} else {
$line.='<img src="'.$icon.'" alt="" class="LC_icon" />';
}
@@ -3929,9 +3961,12 @@
if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
$line.='<a href="'.$url.'">'.$title.'</a>';
} elsif ($url) {
- $line.=&Apache::loncommon::modal_link(&js_escape($url.(($url=~/\?/)?'&':'?').'inhibitmenu=yes'.
- (($anchor ne '')?$anchor:'')),
- $title,600,500);
+ if ($nomodal) {
+ $line.='<a href="#" onclick="javascript:window.open('."'$link','syllabuspreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1')".'; return false;" />'.
+ $title.'</a>';
+ } else {
+ $line.=&Apache::loncommon::modal_link($link,$title,600,500);
+ }
} elsif (($hiddenfolder) || ($hiddenres)) {
$line.=$title.' <span class="LC_warning LC_docs_reinit_warn">'.&mt('(Hidden)').'</span>';
} else {
More information about the LON-CAPA-cvs
mailing list