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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 09 Jan 2006 18:51:27 -0000


albertel		Mon Jan  9 13:51:27 2006 EDT

  Modified files:              
    /rat	lonpageflip.pm 
  Log:
  - eliminating more $_
  
  
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.61 rat/lonpageflip.pm:1.62
--- rat/lonpageflip.pm:1.61	Mon Jan  9 13:39:31 2006
+++ rat/lonpageflip.pm	Mon Jan  9 13:51:26 2006
@@ -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 @@
                  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 @@
                   } 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 @@
 <table border=2>
 <tr><th>$lt{'titleheader'}</th><th>$lt{'type'}</th></tr>
 ENDSTART
-                     foreach (@possibilities) {
+                     foreach my $id (@possibilities) {
                         $r->print(
                               '<tr><td><a href="'.
-                              $multichoicehash{'src_'.$_}.'?symb=' .
-                                  Apache::lonnet::escape($multichoicehash{'symb_'.$_}).'">'.
-                              $multichoicehash{'title_'.$_}.
-                              '</a></td><td>'.$multichoicehash{'type_'.$_}.
+                              $multichoicehash{'src_'.$id}.'?symb=' .
+                                  Apache::lonnet::escape($multichoicehash{'symb_'.$id}).'">'.
+                              $multichoicehash{'title_'.$id}.
+                              '</a></td><td>'.$multichoicehash{'type_'.$id}.
 			      '</td></tr>');
                      }
                      $r->print('</table>');