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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 11 Nov 2004 19:43:22 -0000


albertel		Thu Nov 11 14:43:22 2004 EDT

  Modified files:              
    /rat	lonpageflip.pm 
  Log:
  - back/forward work
  
  
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.49 rat/lonpageflip.pm:1.50
--- rat/lonpageflip.pm:1.49	Tue Oct 19 11:26:53 2004
+++ rat/lonpageflip.pm	Thu Nov 11 14:43:22 2004
@@ -2,7 +2,7 @@
 #
 # Page flip handler
 #
-# $Id: lonpageflip.pm,v 1.49 2004/10/19 15:26:53 albertel Exp $
+# $Id: lonpageflip.pm,v 1.50 2004/11/11 19:43:22 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -82,6 +82,14 @@
     return($rid,$mapurl);
 }
 
+sub hash_src {
+    my ($id)=@_;
+    if ($hash{'encrypted_'.$id}) {
+	return &Apache::lonenc::encrypted($hash{'src_'.$id});
+    }
+    return $hash{'src_'.$id};
+}
+
 sub move {
     my ($rid,$mapurl,$direction)=@_;
     my $startoutrid=$rid;
@@ -198,6 +206,9 @@
       $ENV{'form.postdata'}=~/(\w+)\:(.*)/;
       my $direction=$1;
       my $currenturl=$2;
+      if ($currenturl=~m|^/enc/|) {
+	  $currenturl=&Apache::lonenc::unencrypted($currenturl);
+      }
       $currenturl=~s/\.\d+\.(\w+)$/\.$1/;
       if ($direction eq 'return') {
 # -------------------------------------------------------- Return to last known
@@ -213,9 +224,15 @@
             my ($murl,$fn)=&Apache::lonnet::decode_symb($last);
             my $id;
             ($murl,$id,$fn)=&Apache::lonnet::decode_symb(&Apache::lonnet::symbread($fn));
-	    $newloc=$hash{'src_'.
-                $hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id};
-            unless ($newloc) { $newloc='/adm/noidea.html'; }
+	    $id=$hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id;
+	    $newloc=$hash{'src_'.$id};
+	    &Apache::lonnet::logthis(" hrrm 1 ");
+	    if ($newloc) {
+		if ($hash{'encrypted_'.$id}) { $newloc=&Apache::lonenc::encrypted($newloc); }
+			      
+	    } else {
+		$newloc='/adm/noidea.html';
+	    }
             untie %hash;
          } else {
 	    $newloc='/adm/noidea.html';
@@ -280,7 +297,7 @@
                   @possibilities=split(/\,/,$next);
                   if ($#possibilities==0) {
 # ---------------------------------------------- Only one possibility, redirect
-	              $redirecturl=$hash{'src_'.$next};
+	              $redirecturl=&hash_src($next);
                       $cachehash{$endupmap}
                                 {&Apache::lonnet::declutter($redirecturl)}
 		                                 =(split(/\./,$next))[1];