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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 31 Aug 2005 07:38:31 -0000


albertel		Wed Aug 31 03:38:31 2005 EDT

  Modified files:              
    /rat	lonpageflip.pm 
  Log:
  - BUG#4259, forward/backward didn't work when the same resource occured in a row (now send symb along so as to get correct resource)
  
  
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.55 rat/lonpageflip.pm:1.56
--- rat/lonpageflip.pm:1.55	Tue Aug  2 17:15:52 2005
+++ rat/lonpageflip.pm	Wed Aug 31 03:38:29 2005
@@ -2,7 +2,7 @@
 #
 # Page flip handler
 #
-# $Id: lonpageflip.pm,v 1.55 2005/08/02 21:15:52 albertel Exp $
+# $Id: lonpageflip.pm,v 1.56 2005/08/31 07:38:29 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -73,10 +73,14 @@
 
 sub hash_src {
     my ($id)=@_;
+    my ($mapid,$resid)=split(/\./,$id);
+    my $symb=&Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},
+					  $resid,$hash{'src_'.$id});
     if ($hash{'encrypted_'.$id}) {
-	return &Apache::lonenc::encrypted($hash{'src_'.$id});
+	return (&Apache::lonenc::encrypted($hash{'src_'.$id}),
+		&Apache::lonenc::encrypted($symb));
     }
-    return $hash{'src_'.$id};
+    return ($hash{'src_'.$id},$symb);
 }
 
 sub move {
@@ -209,7 +213,7 @@
   my %cachehash=(); 
   my $multichoice=0;
   my %multichoicehash=();
-  my $redirecturl='';
+  my ($redirecturl,$redirectsymb);
   my $next='';
   my @possibilities=();
    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['postdata']);
@@ -328,7 +332,7 @@
                   @possibilities=split(/\,/,$next);
                   if ($#possibilities==0) {
 # ---------------------------------------------- Only one possibility, redirect
-	              $redirecturl=&hash_src($next);
+	              ($redirecturl,$redirectsymb)=&hash_src($next);
                       $cachehash{$endupmap}{$redirecturl}=
 			  [$redirecturl,(split(/\./,$next))[1]];
                   } else {
@@ -382,14 +386,16 @@
 	                if (($what[0] ne 'con_lost') && 
                             ($what[0]!~/^error\:/)) {
 	                   $redirecturl='/adm/email?critical=display';
+			   $redirectsymb='';
                         }
                      }
                      &Apache::lonnet::appenv('user.criticalcheck.time'=>time);
 		  }
 
 		  &Apache::loncommon::content_type($r,'text/html');
-                  $r->header_out(Location => 
-                                'http://'.$ENV{'HTTP_HOST'}.$redirecturl);
+		  my $url='http://'.$ENV{'HTTP_HOST'}.$redirecturl;
+		  if ($redirectsymb ne '') { $url.='?symb='.$redirectsymb; }
+                  $r->header_out(Location => $url);
                   return REDIRECT;
 	      } else {
 # --------------------------------------------------------- There was a problem