--- rat/lonpageflip.pm 2002/04/12 13:47:21 1.23 +++ rat/lonpageflip.pm 2002/07/08 20:10:40 1.27 @@ -2,7 +2,7 @@ # # Page flip handler # -# $Id: lonpageflip.pm,v 1.23 2002/04/12 13:47:21 www Exp $ +# $Id: lonpageflip.pm,v 1.27 2002/07/08 20:10:40 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -53,16 +53,26 @@ my %hash; sub addrid { my ($current,$new,$condid)=@_; unless ($condid) { $condid=0; } - if (&Apache::lonnet::allowed('bre',$hash{'src_'.$new})) { + if ($current) { $current.=','.$new; } else { $current=''.$new; } - } + return $current; } +sub fullmove { + my ($rid,$mapurl,$direction)=@_; + if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'.db', + &GDBM_READER,0640)) { + ($rid,$mapurl)=&move($rid,$mapurl,$direction); + untie(%hash); + } + return($rid,$mapurl); +} + sub move { my ($rid,$mapurl,$direction)=@_; my $startoutrid=$rid; @@ -132,11 +142,16 @@ sub move { } } split(/\,/,$posnext); if ($hash{'is_map_'.$next}) { +# This jumps to the end of a new map (going down one level) if ( $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'sequence') { $mapurl=$hash{'src_'.$next}; $next=$hash{'map_finish_'.$hash{'src_'.$next}}; } + } elsif + ((split(/\./,$startoutrid))[0]!=(split(/\./,$next))[0]) { +# This comes back up from a map (going up one level); + $mapurl=$hash{'map_id_'.(split(/\./,$next))[0]}; } } return ($next,$mapurl); @@ -223,8 +238,9 @@ sub handler { ($next,$endupmap)=&move($rid,$startoutmap,$direction); # -------------------------------------- Do we have one and only one empty URL? my $safecount=0; - while (($next) && ($next!~/\,/) && (!$hash{'src_'.$next}) - && ($safecount<25)) { + while (($next) && ($next!~/\,/) && + ((!$hash{'src_'.$next}) || ($hash{'randomout_'.$next})) + && ($safecount<10000)) { ($next,$endupmap)=&move($next,$endupmap,$direction); $safecount++; } @@ -289,14 +305,14 @@ Please click on the the resource you int ENDSTART - map { + foreach (@possibilities) { $r->print( ''); - } @possibilities; + } $r->print('
TitleType
'. $multichoicehash{'title_'.$_}. ''.$multichoicehash{'type_'.$_}. '
'); return OK; } else {