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%2Fquery_route;h=d4a3bd15e4c06cd362765852d3e63bcc8c6284fd;hp=8f6d99c49d29ed353f5f2fcdf6d88dc55180afac;hb=70f23c42b325a1463fe8a9d76cb967b7df1260df;hpb=9d01242d0991d15f7ea84454264c868e1c4ed8ad
diff --git a/yarrg/web/query_route b/yarrg/web/query_route
index 8f6d99c..d4a3bd1 100644
--- a/yarrg/web/query_route
+++ b/yarrg/web/query_route
@@ -35,35 +35,75 @@
%doc>
<%args>
$quri
+$dbh
+$prselector
$routestring => '';
+$capacitystring => '';
+$someresults
+$emsgokorprint
%args>
-<%perl>
+<%perl>
+my $emsg;
my @archipelagoes;
my @islandids;
my %islandid2;
+my ($max_volume, $max_mass);
my $qa= \%ARGS;
+
+my $be_post;
+my $startform= sub {
+ ($be_post)= @_;
%perl>
+
<%perl>
-#========== result computations ==========
+#========== results ==========
-my $results_head;
-$results_head= sub {
- print "Results
\n";
- $results_head= sub { };
-};
-
-#---------- result computation - textstring ----------
-if (!$qa->{Dropdowns}) {
- if (length $routestring) {
- $results_head->();
- my ($emsg,$canonstring,$results)= $m->comp('qtextstringcheck',
- what => 'routestring',
- ocean => $qa->{Ocean},
- string => $routestring,
- format => 'return'
- );
- if (length $emsg) {
- print encode_entities($emsg);
- } else {
- foreach my $entry (@$results) {
- push @islandids, $entry->[1];
- push @archipelagoes,
- defined $entry->[1] ? undef : $entry->[2];
- }
- }
- }
-
-} else { #---------- results - dropdowns ----------
+$emsgokorprint->($emsg) or @islandids=();
my $argorundef= sub {
my ($dd,$base) = @_;
@@ -207,7 +217,7 @@ for my $dd (0..$qa->{Dropdowns}-1) {
my $ii= $islandid2{$island};
my $iarch= $ii->{Arch};
if ($iarch ne $arch) {
- $results_head->();
+ $someresults->();
%perl>
Specified archipelago <% $arch %> but
island <% $ii->{Name} %>
@@ -220,12 +230,15 @@ for my $dd (0..$qa->{Dropdowns}-1) {
push @islandids, $island;
}
-}#---------- result processing, common stuff
%perl>
% if (@islandids) {
-% $results_head->();
-
-<& routetrade, islandids => \@islandids, archipelagoes => \@archipelagoes &>
-
+% $someresults->('Relevant trades');
+<& routetrade,
+ dbh => $dbh,
+ islandids => \@islandids,
+ archipelagoes => \@archipelagoes,
+ qa => $qa
+ &>
+
% }