X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-live.git;a=blobdiff_plain;f=yarrg%2Fweb%2Fquery_route;h=393e7a668755145d05262a56b56ed005330669c1;hp=b91e55c461bf6e53bf4749ed79a9e6a83bd16960;hb=59bee7afb77216585b904bd20f17e71005e9778c;hpb=3766fb8d851fe463a5b8b469cf148c28efb1c578
diff --git a/yarrg/web/query_route b/yarrg/web/query_route
index b91e55c..393e7a6 100644
--- a/yarrg/web/query_route
+++ b/yarrg/web/query_route
@@ -35,32 +35,64 @@
%doc>
<%args>
$quri
-$qa
+$dbh
+$prselector
$routestring => '';
+$someresults
+$emsgokorprint
%args>
-<%perl>
+<%perl>
+my $emsg;
my @archipelagoes;
my @islandids;
my %islandid2;
+my $qa= \%ARGS;
+
+my $be_post;
+my $startform= sub {
+ ($be_post)= @_;
+%perl>
+
+
+% my $ours= sub { $_[0] =~ m/^island|^archipelago|^routestring|^[RT]/; };
+<& "lookup:formhidden", ours => $ours &>
<%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 $rsr= $m->comp('routetextstring',
- ocean => $qa->{Ocean},
- string => $routestring,
- format => 'return'
- );
- if (length $rsr->{Error}) {
- print encode_entities($rsr->{Error});
- } else {
- foreach my $entry (@{ $rsr->{Results} }) {
- push @archipelagoes,
- defined $entry->[1] ? undef : $entry->[0];
- push @islandids, $entry->[1];
- }
- }
- }
-
-} else { #---------- results - dropdowns ----------
+$emsgokorprint->($emsg) or @islandids=();
my $argorundef= sub {
my ($dd,$base) = @_;
@@ -201,7 +204,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} %>
@@ -214,12 +217,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
+ &>
+
% }