X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Fquery_commod;h=3c2049ca3a509af276a9c28b9c59dbdf463667f5;hb=767e625796d67e5f5cc94d7e1949b1389f753764;hp=ee4c9f3177aad6eb311bcb11ecb7e2b5234ca173;hpb=ee80b1ab92305277d07d99faea8682aea690b59a;p=ypp-sc-tools.db-test.git diff --git a/yarrg/web/query_commod b/yarrg/web/query_commod index ee4c9f3..3c2049c 100644 --- a/yarrg/web/query_commod +++ b/yarrg/web/query_commod @@ -89,8 +89,6 @@ $someresults->(); #---------- actually compute the results and print them ---------- -my $onloads= ""; - foreach my $bs (split /_/, $ARGS{BuySell}) { $bs =~ m/^(buy|sell)$/ or die; $bs= $1; @@ -137,6 +135,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 +178,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 +191,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 => [ +<&| tabsort, table => "${bs}_table", sortkeys => "${bs}_sortkeys", + throw => "${bs}_table_thr", rowclass => 'datarow', cols => [ {}, {}, { DoReverse => 1 }, { DoReverse => 1, Numeric => 1, MapFn => "ts_Pricemap_${bs}" }, @@ -205,22 +205,13 @@ foreach my $bs (split /_/, $ARGS{BuySell}) { { DoReverse => 1, Numeric => 1 }, { DoReverse => 1, Numeric => 1 }, ] &> -<&| script &> <% $bs %>_sortkeys= <% to_json_protecttags(\%ts_sortkeys) %>; function ts_Pricemap_<% $bs %>(price) { if (price=='-') { return <% $bs eq 'buy' ? '-1' : '99999999' %>; } return price; } - -% $onloads .= " ts_onload__${bs}_table();\n"; + <%perl> } - -<&| script &> - function all_onload() { -<% $onloads %> - } - window.onload= all_onload; -