From: Ian Jackson Date: Mon, 24 Aug 2009 02:22:52 +0000 (+0100) Subject: Stripey tables X-Git-Tag: 3.4~113 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.web-live.git;a=commitdiff_plain;h=f6d7a4d627f3ecc0624649bb895dbf8e59afcf47 Stripey tables --- diff --git a/yarrg/web/query_age b/yarrg/web/query_age index a90ca34..fc79993 100644 --- a/yarrg/web/query_age +++ b/yarrg/web/query_age @@ -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; - + class="<% 'datarow'.($rowix & 1) %>" > <% $row->{'archipelago'} |h %> <% $row->{'islandname'} |h %> <% prettyprint_age($age) %> +% $rowix++; % } -<& tabsort, table => 'ts_table', cols => [ +<& tabsort, table => 'ts_table', rowclass => 'datarow', cols => [ {}, {}, { DoReverse => 1, Numeric => 1, diff --git a/yarrg/web/query_commod b/yarrg/web/query_commod index ee4c9f3..34b1347 100644 --- a/yarrg/web/query_commod +++ b/yarrg/web/query_commod @@ -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 "; - > + class="<% 'datarow'.($rowix & 1) %>"> <% $s->[0]= $island->{'archipelago'} |h %> <% $s->[1]= $island->{'islandname'} |h %> <% $stallname |h %> @@ -192,11 +193,12 @@ foreach my $bs (split /_/, $ARGS{BuySell}) { % for my $cix (0..$#$s) { % $ts_sortkeys{$cix}{$rowid}= $s->[$cix]; % } +% $rowix++; % } <& 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}" },