#---------- actually compute the results and print them ----------
-my $onloads= "";
-
foreach my $bs (split /_/, $ARGS{BuySell}) {
$bs =~ m/^(buy|sell)$/ or die;
$bs= $1;
my ($ascdesc) = ($bs eq 'buy')
? ('DESC')
: ('ASC');
- my $joinkind= $ARGS{ShowBlank} eq 'show'
- ? 'LEFT OUTER JOIN' : 'INNER JOIN';
+ my $joinkind= $ARGS{ShowBlank} ? 'LEFT OUTER JOIN' : 'INNER JOIN';
my $islands= $dbh->prepare(
"SELECT islands.islandid AS islandid, archipelago, islandname,
sum(qty) as tqty
FROM islands $joinkind $bs offers
ON islands.islandid == offers.islandid AND commodid == ?
- GROUP BY islands.islandid,
+ GROUP BY islands.islandid
ORDER BY archipelago, islandname"
);
% $islands->execute($commodid);
% my $island;
% my %ts_sortkeys;
+% my $rowix= 0;
% while ($island= $islands->fetchrow_hashref) {
% my $islandid= $island->{'islandid'};
% $offers->execute($commodid, $islandid);
% }
%
% $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 %>
% 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 => [
+<&| tabsort, table => "${bs}_table", sortkeys => "${bs}_sortkeys",
+ throw => "${bs}_table_thr", rowclass => 'datarow', cols => [
{}, {},
{ DoReverse => 1 },
{ DoReverse => 1, Numeric => 1, MapFn => "ts_Pricemap_${bs}" },
{ 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";
+</&tabsort>
<%perl>
}
</%perl>
-
-<&| script &>
- function all_onload() {
-<% $onloads %>
- }
- window.onload= all_onload;
-</&>