[LON-CAPA-cvs] cvs: loncom / lonencurl.pm /interface lonnavmaps.pm rat lonpageflip.pm lonwrapper.pm
raeburn
raeburn at source.lon-capa.org
Sun Feb 21 22:37:02 EST 2016
raeburn Mon Feb 22 03:37:02 2016 EDT
Modified files:
/rat lonwrapper.pm lonpageflip.pm
/loncom lonencurl.pm
/loncom/interface lonnavmaps.pm
Log:
- Bug 6806. Support anchor in URL set for an external resource.
Index: rat/lonwrapper.pm
diff -u rat/lonwrapper.pm:1.50 rat/lonwrapper.pm:1.51
--- rat/lonwrapper.pm:1.50 Tue Jan 26 14:30:40 2016
+++ rat/lonwrapper.pm Mon Feb 22 03:36:52 2016
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Wrapper for external and binary files as standalone resources
#
-# $Id: lonwrapper.pm,v 1.50 2016/01/26 14:30:40 raeburn Exp $
+# $Id: lonwrapper.pm,v 1.51 2016/02/22 03:36:52 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -53,7 +53,15 @@
'show' => 'Show content in pop-up window',
);
- my $noiframe = &Apache::loncommon::modal_link($url,$lt{'show'},500,400);
+ my $anchor;
+ if (($is_ext) && ($env{'form.symb'})) {
+ (undef,undef,my $res) = &Apache::lonnet::decode_symb($env{'form.symb'});
+ if ($res =~ /(\#.+)$/) {
+ $anchor = $1;
+ }
+ }
+
+ my $noiframe = &Apache::loncommon::modal_link($url.$anchor,$lt{'show'},500,400);
my $args = {'bgcolor' => '#FFFFFF'};
if ($forcereg) {
$args->{'force_register'} = $forcereg;
@@ -91,7 +99,7 @@
'</div>';
} else {
$output .= '<div style="overflow:scroll; -webkit-overflow-scrolling:touch;">'."\n".
- '<iframe src="'.$url.'" height="100%" width="100%" frameborder="0">'."\n".
+ '<iframe src="'.$url.$anchor.'" height="100%" width="100%" frameborder="0">'."\n".
"$lt{'noif'} $noiframe\n".
"</iframe>\n".
"</div>\n";
@@ -129,7 +137,7 @@
$startpage
$script
<div class="LC_iframecontainer">
- <iframe src="$url">$lt{'noif'} $noiframe</iframe>
+ <iframe src="$url$anchor">$lt{'noif'} $noiframe</iframe>
</div>
$endpage
ENDFRAME
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.89 rat/lonpageflip.pm:1.90
--- rat/lonpageflip.pm:1.89 Mon Mar 23 00:03:16 2015
+++ rat/lonpageflip.pm Mon Feb 22 03:36:52 2016
@@ -2,7 +2,7 @@
#
# Page flip handler
#
-# $Id: lonpageflip.pm,v 1.89 2015/03/23 00:03:16 raeburn Exp $
+# $Id: lonpageflip.pm,v 1.90 2016/02/22 03:36:52 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -83,11 +83,18 @@
my ($mapid,$resid)=split(/\./,$id);
my $symb=&Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},
$resid,$hash{'src_'.$id});
+ my $anchor;
+ if ($hash{'ext_'.$id} eq 'true:') {
+ if ($hash{'src_'.$id} =~ /(\#.+)$/) {
+ $anchor = $1;
+ }
+ }
if ($hash{'encrypted_'.$id}) {
return (&Apache::lonenc::encrypted($hash{'src_'.$id}),
- &Apache::lonenc::encrypted($symb));
+ &Apache::lonenc::encrypted($symb),
+ $hash{'encrypted_'.$id},$anchor);
}
- return ($hash{'src_'.$id},$symb);
+ return ($hash{'src_'.$id},$symb,$hash{'encrypted_'.$id},$anchor);
}
sub move {
@@ -264,7 +271,7 @@
my %cachehash=();
my $multichoice=0;
my %multichoicehash=();
- my ($redirecturl,$redirectsymb);
+ my ($redirecturl,$redirectsymb,$enc,$anchor);
my $next='';
my @possibilities=();
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['postdata']);
@@ -404,7 +411,7 @@
@possibilities=split(/\,/,$next);
if ($#possibilities==0) {
# ---------------------------------------------- Only one possibility, redirect
- ($redirecturl,$redirectsymb)=&hash_src($next);
+ ($redirecturl,$redirectsymb,$enc,$anchor)=&hash_src($next);
$cachehash{$endupmap}{$redirecturl}=
[$redirecturl,(split(/\./,$next))[1]];
} else {
@@ -453,7 +460,15 @@
my ($redirect, $url) = &Apache::loncommon::critical_redirect(300);
unless ($redirect) {
$url=&Apache::lonnet::absolute_url().$redirecturl;
+ my $addanchor;
+ if (($anchor ne '') && (!$enc || $env{'request.role.adv'})) {
+ $addanchor = 1;
+ $url =~ s/\#.+$//;
+ }
$url = &add_get_param($url, { 'symb' => $redirectsymb});
+ if ($addanchor) {
+ $url .= $anchor;
+ }
}
&Apache::loncommon::content_type($r,'text/html');
$r->header_out(Location => $url);
Index: loncom/lonencurl.pm
diff -u loncom/lonencurl.pm:1.5 loncom/lonencurl.pm:1.6
--- loncom/lonencurl.pm:1.5 Sat Oct 1 03:18:57 2011
+++ loncom/lonencurl.pm Mon Feb 22 03:36:57 2016
@@ -2,7 +2,7 @@
# The LearningOnline Network
# URL translation for encrypted filenames
#
-# $Id: lonencurl.pm,v 1.5 2011/10/01 03:18:57 raeburn Exp $
+# $Id: lonencurl.pm,v 1.6 2016/02/22 03:36:57 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -76,11 +76,16 @@
}
}
}
+ my $anchor;
if ($redirect eq '') {
$redirect=&Apache::lonenc::unencrypted($r->uri);
+ if ($redirect =~ m{^/adm/wrapper/ext/[^\#]+(\#.+)$}) {
+ $anchor = $1;
+ $redirect =~ s/\#.+$//;
+ }
}
if ($r->args) { $redirect.='?'.$r->args; }
- $r->internal_redirect($redirect);
+ $r->internal_redirect($redirect.$anchor);
return OK;
}
return FORBIDDEN;
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.511 loncom/interface/lonnavmaps.pm:1.512
--- loncom/interface/lonnavmaps.pm:1.511 Mon Oct 5 16:23:49 2015
+++ loncom/interface/lonnavmaps.pm Mon Feb 22 03:37:02 2016
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.511 2015/10/05 16:23:49 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.512 2016/02/22 03:37:02 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -914,6 +914,9 @@
my $nonLinkedText = ''; # stuff after resource title not in link
my $link = $params->{"resourceLink"};
+ if ($resource->ext()) {
+ $link =~ s/\#.+(\?)/$1/g;
+ }
# The URL part is not escaped at this point, but the symb is...
More information about the LON-CAPA-cvs
mailing list