--- rat/lonpageflip.pm 2005/02/17 09:09:57 1.51 +++ rat/lonpageflip.pm 2005/03/01 00:22:57 1.52 @@ -2,7 +2,7 @@ # # Page flip handler # -# $Id: lonpageflip.pm,v 1.51 2005/02/17 09:09:57 albertel Exp $ +# $Id: lonpageflip.pm,v 1.52 2005/03/01 00:22:57 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -210,9 +210,7 @@ sub handler { my $newloc; if (($last) && (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'.db', &GDBM_READER(),0640))) { - my ($murl,$fn)=&Apache::lonnet::decode_symb($last); - my $id; - ($murl,$id,$fn)=&Apache::lonnet::decode_symb(&Apache::lonnet::symbread($fn)); + my ($murl,$id,$fn)=&Apache::lonnet::decode_symb($last); $id=$hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id; $newloc=$hash{'src_'.$id}; if ($newloc) { @@ -244,7 +242,7 @@ sub handler { untie(%hash); } if ($last) { - $currenturl=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($last))[1]); + $currenturl=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($last))[2]); } else { &Apache::loncommon::content_type($r,'text/html'); $r->header_out(Location => @@ -257,9 +255,9 @@ sub handler { if ($position=Apache::lonnet::symbread($currenturl)) { # ------------------------------------------------------------------------- Yes my ($startoutmap,$mapnum,$thisurl)=&Apache::lonnet::decode_symb($position); - $cachehash{$startoutmap}{$thisurl}=$mapnum; + $cachehash{$startoutmap}{$thisurl}=[$thisurl,$mapnum]; $cachehash{$startoutmap}{'last_known'}= - &Apache::lonnet::declutter($currenturl); + [&Apache::lonnet::declutter($currenturl),$mapnum]; # ============================================================ Tie the big hash if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'.db', @@ -286,9 +284,8 @@ sub handler { if ($#possibilities==0) { # ---------------------------------------------- Only one possibility, redirect $redirecturl=&hash_src($next); - $cachehash{$endupmap} - {&Apache::lonnet::declutter($redirecturl)} - =(split(/\./,$next))[1]; + $cachehash{$endupmap}{$redirecturl}= + [$redirecturl,(split(/\./,$next))[1]]; } else { # ------------------------ There are multiple possibilities for a next resource $multichoice=1; @@ -303,13 +300,9 @@ sub handler { $second.'___'.$symbSrc); my ($choicemap,$choiceres)=split(/\./,$_); - $cachehash - {&Apache::lonnet::declutter($hash{'src_'.$choicemap})} - {&Apache::lonnet::declutter( - $multichoicehash - {'src_'.$_} - )} - =$choiceres; + my $map=&Apache::lonnet::declutter($hash{'src_'.$choicemap}); + my $url=$multichoicehash{'src_'.$_}; + $cachehash{$map}{$url}=[$url,$choiceres]; } @possibilities; } } else { @@ -319,9 +312,12 @@ sub handler { # ----------------- The program must come past this point to untie the big hash untie(%hash); # --------------------------------------------------------- Store position info - $cachehash{$startoutmap}{'last_direction'}=$direction; + $cachehash{$startoutmap}{'last_direction'}=[$direction,'notasymb']; foreach my $thismap (keys %cachehash) { - &Apache::lonnet::symblist($thismap,%{$cachehash{$thismap}}); + my $mapnum=$cachehash{$thismap}->{'mapnum'}; + delete($cachehash{$thismap}->{'mapnum'}); + &Apache::lonnet::symblist($thismap, + %{$cachehash{$thismap}}); } # ============================================== Do not return before this line if ($redirecturl) {