--- rat/lonpageflip.pm 2002/12/02 14:39:02 1.32 +++ rat/lonpageflip.pm 2003/03/01 15:13:59 1.35 @@ -2,7 +2,7 @@ # # Page flip handler # -# $Id: lonpageflip.pm,v 1.32 2002/12/02 14:39:02 bowersj2 Exp $ +# $Id: lonpageflip.pm,v 1.35 2003/03/01 15:13:59 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -50,6 +50,15 @@ use GDBM_File; my %hash; +sub cleanup { + if (tied(%hash)){ + &Apache::lonnet::logthis('Cleanup pageflip: hash'); + unless (untie(%hash)) { + &Apache::lonnet::logthis('Failed cleanup pageflip: hash'); + } + } +} + sub addrid { my ($current,$new,$condid)=@_; unless ($condid) { $condid=0; } @@ -83,8 +92,8 @@ sub move { my $posnext=''; if ($direction eq 'forward') { # --------------------------------------------------------------------- Forward - if ($hash{'type_'.$rid} eq 'finish') { - $rid=$hash{'ids_'.&Apache::lonnet::clutter($mapurl)}; + while ($hash{'type_'.$rid} eq 'finish') { + $rid=$hash{'ids_'.$hash{'map_id_'.(split(/\./,$rid))[0]}}; } map { my $thiscond= @@ -119,9 +128,9 @@ sub move { } } elsif ($direction eq 'back') { # ------------------------------------------------------------------- Backwards - if ($hash{'type_'.$rid} eq 'start') { - $rid=$hash{'ids_'.&Apache::lonnet::clutter($mapurl)}; - } + while ($hash{'type_'.$rid} eq 'start') { + $rid=$hash{'ids_'.$hash{'map_id_'.(split(/\./,$rid))[0]}}; + } map { my $thiscond= &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$_}}); @@ -202,7 +211,10 @@ sub handler { } $currenturl=~s/^http\:\/\///; $currenturl=~s/^[^\/]+//; - unless ($currenturl=~/^\/(res|adm\/wrapper|public|adm\/coursedocs)\//) { +# +# Is the current URL on the map? If not, start with last known URL +# + unless (&Apache::lonnet::is_on_map($currenturl)) { my $last; if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'_symb.db', &GDBM_READER(),0640)) {