[LON-CAPA-cvs] cvs: rat(version_2_11_X) / lonpageflip.pm

raeburn raeburn at source.lon-capa.org
Fri Aug 5 17:48:38 EDT 2016


raeburn		Fri Aug  5 21:48:38 2016 EDT

  Modified files:              (Branch: version_2_11_X)
    /rat	lonpageflip.pm 
  Log:
  - For 2.11
    - Backport 1.90
  
  
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.80.8.8 rat/lonpageflip.pm:1.80.8.9
--- rat/lonpageflip.pm:1.80.8.8	Mon Mar 23 12:49:10 2015
+++ rat/lonpageflip.pm	Fri Aug  5 21:48:38 2016
@@ -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 @@
     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);




More information about the LON-CAPA-cvs mailing list