X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;ds=sidebyside;f=yarrg%2Fweb%2Fquery_route;h=393e7a668755145d05262a56b56ed005330669c1;hb=9df0d91b280265faa669aea7d1501787eeb932da;hp=dd8644f1675694d200e28341d0b32bc5d6396422;hpb=b6d8c4a781c0bedf79a4b13af5afe9ad47de97ed;p=ypp-sc-tools.db-live.git
diff --git a/yarrg/web/query_route b/yarrg/web/query_route
index dd8644f..393e7a6 100644
--- a/yarrg/web/query_route
+++ b/yarrg/web/query_route
@@ -35,32 +35,64 @@
%doc>
<%args>
$quri
+$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 ==========
-
-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];
- }
- }
- }
+#========== results ==========
-} else { #---------- results - dropdowns ----------
+$emsgokorprint->($emsg) or @islandids=();
my $argorundef= sub {
my ($dd,$base) = @_;
@@ -204,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} %>
@@ -217,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
+ &>
+
% }