--- rat/lonpageflip.pm 2015/03/23 12:49:10 1.80.8.8 +++ rat/lonpageflip.pm 2016/08/05 21:48:38 1.80.8.9 @@ -2,7 +2,7 @@ # # Page flip handler # -# $Id: lonpageflip.pm,v 1.80.8.8 2015/03/23 12:49:10 raeburn Exp $ +# $Id: lonpageflip.pm,v 1.80.8.9 2016/08/05 21:48:38 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -83,11 +83,18 @@ sub hash_src { 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 @@ sub handler { 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 @@ sub handler { @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 @@ sub handler { 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);