--- rat/lonpageflip.pm 2006/01/09 18:39:31 1.61 +++ rat/lonpageflip.pm 2006/01/09 18:51:26 1.62 @@ -2,7 +2,7 @@ # # Page flip handler # -# $Id: lonpageflip.pm,v 1.61 2006/01/09 18:39:31 albertel Exp $ +# $Id: lonpageflip.pm,v 1.62 2006/01/09 18:51:26 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -136,25 +136,25 @@ sub move { 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_'.$_}}); - if ($thiscond>=$mincond) { - if ($posnext) { - $posnext.=','.$_.':'.$thiscond; - } else { - $posnext=$_.':'.$thiscond; - } - if ($thiscond>$mincond) { $mincond=$thiscond; } - } - } split(/\,/,$hash{'from_'.$rid}); - map { - my ($linkid,$condval)=split(/\:/,$_); - if ($condval>=$mincond) { - $next=&addrid($next,$hash{'comesfrom_'.$linkid}, - $hash{'condid_'.$hash{'undercond_'.$linkid}}); - } - } split(/\,/,$posnext); + foreach my $id (split(/\,/,$hash{'from_'.$rid})) { + my $thiscond= + &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$id}}); + if ($thiscond>=$mincond) { + if ($posnext) { + $posnext.=','.$id.':'.$thiscond; + } else { + $posnext=$id.':'.$thiscond; + } + if ($thiscond>$mincond) { $mincond=$thiscond; } + } + } + foreach my $id (split(/\,/,$posnext)) { + my ($linkid,$condval)=split(/\:/,$id); + if ($condval>=$mincond) { + $next=&addrid($next,$hash{'comesfrom_'.$linkid}, + $hash{'condid_'.$hash{'undercond_'.$linkid}}); + } + } if ($hash{'is_map_'.$next}) { # This jumps to the end of a new map (going down one level) if ( @@ -338,21 +338,21 @@ sub handler { } else { # ------------------------ There are multiple possibilities for a next resource $multichoice=1; - map { - $multichoicehash{'src_'.$_}=$hash{'src_'.$_}; - $multichoicehash{'title_'.$_}=$hash{'title_'.$_}; - $multichoicehash{'type_'.$_}=$hash{'type_'.$_}; - (my $first, my $second) = $_ =~ /(\d+).(\d+)/; - my $symbSrc = Apache::lonnet::declutter($hash{'src_'.$_}); - $multichoicehash{'symb_'.$_} = + foreach my $id (@possibilities) { + $multichoicehash{'src_'.$id}=$hash{'src_'.$id}; + $multichoicehash{'title_'.$id}=$hash{'title_'.$id}; + $multichoicehash{'type_'.$id}=$hash{'type_'.$id}; + (my $first, my $second) = $id =~ /(\d+).(\d+)/; + my $symbSrc = Apache::lonnet::declutter($hash{'src_'.$id}); + $multichoicehash{'symb_'.$id} = Apache::lonnet::declutter($hash{'map_id_'.$first}.'___'. $second.'___'.$symbSrc); - my ($choicemap,$choiceres)=split(/\./,$_); + my ($choicemap,$choiceres)=split(/\./,$id); my $map=&Apache::lonnet::declutter($hash{'src_'.$choicemap}); - my $url=$multichoicehash{'src_'.$_}; + my $url=$multichoicehash{'src_'.$id}; $cachehash{$map}{$url}=[$url,$choiceres]; - } @possibilities; + } } } else { # -------------------------------------------------------------- No place to go @@ -425,13 +425,13 @@ $lt{'pick'}: ENDSTART - foreach (@possibilities) { + foreach my $id (@possibilities) { $r->print( ''); } $r->print('
$lt{'titleheader'}$lt{'type'}
'. - $multichoicehash{'title_'.$_}. - ''.$multichoicehash{'type_'.$_}. + $multichoicehash{'src_'.$id}.'?symb=' . + Apache::lonnet::escape($multichoicehash{'symb_'.$id}).'">'. + $multichoicehash{'title_'.$id}. + ''.$multichoicehash{'type_'.$id}. '
');