chiark / gitweb /
Stripey tables
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Mon, 24 Aug 2009 02:22:52 +0000 (03:22 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Mon, 24 Aug 2009 02:22:52 +0000 (03:22 +0100)
yarrg/web/query_age
yarrg/web/query_commod

index a90ca3469811b249d5d9c3cde0364d63a136662b..fc7999341fee3451976280d98faa00d2770aa1b1 100644 (file)
@@ -69,6 +69,7 @@ $sth->execute();
 % my %da_ages;
 % my %ts_sortkeys;
 % $da_ages{'id_loaded'}= 0;
+% my $rowix= 0;
 % while ($row=$sth->fetchrow_hashref) {
 %      my $rowid= "id_$row->{'islandid'}";
 %      my $cellid= "c$rowid";
@@ -76,14 +77,15 @@ $sth->execute();
 %      $ts_sortkeys{'0'}{$rowid}= $row->{'archipelago'};
 %      $ts_sortkeys{'1'}{$rowid}= $row->{'islandname'};
 %      $da_ages{$rowid}= $age;
-<tr id=<% $rowid %>
+<tr id=<% $rowid %> class="<% 'datarow'.($rowix & 1) %>"
    > <td><% $row->{'archipelago'} |h
   %> <td><% $row->{'islandname'} |h
   %> <td id="<% $cellid %>"><% prettyprint_age($age) %> </tr>
+%      $rowix++;
 % }
 </table>
 
-<& tabsort, table => 'ts_table', cols => [
+<& tabsort, table => 'ts_table', rowclass => 'datarow', cols => [
        {}, {},
        { DoReverse => 1,
          Numeric => 1,
index ee4c9f3177aad6eb311bcb11ecb7e2b5234ca173..34b1347f20f5034315a1821d535cd6de40f8f8e2 100644 (file)
@@ -137,6 +137,7 @@ foreach my $bs (split /_/, $ARGS{BuySell}) {
 %      $islands->execute($commodid);
 %      my $island;
 %      my %ts_sortkeys;
+%      my $rowix= 0;
 %      while ($island= $islands->fetchrow_hashref) {
 %              my $islandid= $island->{'islandid'};
 %              $offers->execute($commodid, $islandid);
@@ -179,7 +180,7 @@ foreach my $bs (split /_/, $ARGS{BuySell}) {
 %              }
 %
 %              $cqty == $tqty or die "$bs $cqty $tqty $commodid $islandid ";
-<tr id=<% $rowid %> >
+<tr id=<% $rowid %> class="<% 'datarow'.($rowix & 1) %>">
      <td><% $s->[0]= $island->{'archipelago'} |h %>
      <td><% $s->[1]= $island->{'islandname'} |h %>
      <td><%          $stallname |h %>
@@ -192,11 +193,12 @@ foreach my $bs (split /_/, $ARGS{BuySell}) {
 %              for my $cix (0..$#$s) {
 %                      $ts_sortkeys{$cix}{$rowid}= $s->[$cix];
 %              }
+%              $rowix++;
 %      }
 </table>
 
 <& tabsort,    table => "${bs}_table", sortkeys => "${bs}_sortkeys",
-               throw => "${bs}_table_thr", cols => [
+               throw => "${bs}_table_thr", rowclass => 'datarow', cols => [
        {}, {},
        { DoReverse => 1 },
        { DoReverse => 1, Numeric => 1, MapFn => "ts_Pricemap_${bs}" },