X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=blobdiff_plain;f=yarrg%2Fweb%2Flookup;h=b99cf0ae32f90c5b1d8060d68e44b35b32781084;hp=9206d4b536b68629c6cd93f9bc928fdffe2e4eeb;hb=43454422b2df5e0dcfe144fcb871a2b6f9c1a3d0;hpb=1e054798d3b98978221871919c52af06464d48f2 diff --git a/yarrg/web/lookup b/yarrg/web/lookup index 9206d4b..b99cf0a 100755 --- a/yarrg/web/lookup +++ b/yarrg/web/lookup @@ -35,14 +35,9 @@ <%perl> -my %a; my %ahtml; my @vars; - -# for output: -my @archipelagoes; -my @islandids; -my %islandid2; +my %styles; #---------- "mode" argument parsing and mode menu at top of page ---------- @@ -61,7 +56,39 @@ my %islandid2; }, { Name => 'Query', Before => 'Query: ', Values => [ [ 'route', 'Trades for route' ], + [ 'commod', 'Prices for commodity' ], + [ 'offers', 'Offers at location' ], + [ 'routesearch', 'Find profitable route' ], [ 'age', 'Data age' ] ] + }, { Name => 'BuySell', + Before => '', + Values => [ [ 'buy_sell', 'Buy and sell' ], + [ 'sell_buy', 'Sell and buy' ], + [ 'buy', 'Buy offers only' ], + [ 'sell', 'Sell offers only' ], + ], + QuerySpecific => 1, + }, { Name => 'ShowBlank', + Before => '', + Values => [ [ 0, 'Omit islands with no offers' ], + [ 'show', 'Show all islands' ], + ], + QuerySpecific => 1, + }, { Name => 'ShowStalls', + Before => '', + Values => [ [ 0, 'Show total quantity at each price' ], + [ 1, 'Show individual stalls' ], + [ 2, "Also be cautious about stalls'". + " poe reserves", + '[?]' ] + ], + QuerySpecific => 1, + }, { Name => 'RouteSearchType', + Before => 'Type of routes to search for: ', + Values => [ [ 0, 'Open-ended' ], + [ 1, 'Circular' ], + ], + QuerySpecific => 1, }); foreach my $var (@vars) { @@ -74,37 +101,79 @@ foreach my $var (@vars) { $val= [ $val, encode_entities($val) ]; } if (exists $ARGS{$lname}) { - $a{$name}= $ARGS{$lname}; - my @html= grep { $_->[0] eq $a{$name} } @{ $var->{Values} }; + $styles{$name}= $ARGS{$lname}; + my @html= grep { $_->[0] eq $styles{$name} } + @{ $var->{Values} }; $ahtml{$name}= @html==1 ? $html[0][1] : '???'; } else { - $a{$name}= $var->{Values}[0][0]; + $styles{$name}= $var->{Values}[0][0]; $ahtml{$name}= $var->{Values}[0][1]; } } -<% ucfirst $ahtml{Query} %> - YARRG -<& webcopyright &> -YARRG - - Yet Another Revenue Research Gatherer -| -documentation +<%shared> +my %baseqf; +my %queryqf; + + +<%method formhidden> +<%args> +$ours + +% foreach my $n (keys %baseqf, keys %queryqf) { +% next if $ours->($n); +% my $v= exists $baseqf{$n} ? $baseqf{$n} : $queryqf{$n}; + value="<% $v |h %>"> +% } + + +<% ucfirst $ahtml{Query} %> - YARRG + +<&| script &> + function register_onload(f) { + var previous_onload= window.onload; + window.onload= function() { + if (previous_onload) previous_onload(); + f(); + }; + } + + + +% if (!printable($m)) { + +
% } -% } elsif ($a{Query} eq 'age') { -% ########### query `age' ########## - -

Market data age

-<& dataage, %baseqf, %queryqf &> - -% } ########## end of `age' query ########## +<& "query_$styles{Query}", %baseqf, %queryqf, %styles, + quri => $quri, dbh => $dbh, + baseqf => \%baseqf, queryqf => \%queryqf, allargs => \%ARGS, + prselector => $prselector, + someresults => $someresults, + emsgokorprint => sub { + my ($emsg) = @_; + return 1 unless defined $emsg and length $emsg; + $someresults->(); + print $emsg; + return 0; + } + &> %#---------- debugging and epilogue ---------- % if ($debug) { -

+

 Debug log:
 
+
% } - + <& footer &> @@ -413,6 +299,10 @@ function debug (m) { use CommodsWeb; use HTML::Entities; use URI::Escape; -use JSON; +<%cleanup> + +$mydbh->rollback() if $mydbh; + +