X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;ds=sidebyside;f=yarrg%2Fweb%2Fquery_route;h=fb32bcdd705017d6ad82f7da4a3344c55b44b47e;hb=c9225ff45ee5e69855cb24cfb648d903dbba54a7;hp=b91e55c461bf6e53bf4749ed79a9e6a83bd16960;hpb=3766fb8d851fe463a5b8b469cf148c28efb1c578;p=ypp-sc-tools.main.git
diff --git a/yarrg/web/query_route b/yarrg/web/query_route
index b91e55c..fb32bcd 100644
--- a/yarrg/web/query_route
+++ b/yarrg/web/query_route
@@ -35,191 +35,91 @@
%doc>
<%args>
$quri
-$qa
+$dbh
+$prselector
$routestring => '';
+$capacitystring => '';
+$lossperleague => '';
+$capitalstring => '';
+$someresults
+$emsgokorprint
%args>
-<%perl>
+<%perl>
+my $emsg;
+my @warningfs;
my @archipelagoes;
my @islandids;
-my %islandid2;
-
-%perl>
-
-%#---------- textbox, user enters route as string ----------
-% if (!$qa->{Dropdowns}) {
-
-
Specify route
-
+
+% my $ours= sub { $_[0] =~
+% m/^island|^archipelago|^routestring|^capacitystring|^lossperleague|^capitalstring|^[RT]/;
+% };
+<& "lookup:formhidden", ours => $ours &>
<%perl>
-#========== result computations ==========
+#========== results ==========
-my $results_head;
-$results_head= sub {
- print "Results
\n";
- $results_head= sub { };
-};
+$emsgokorprint->($emsg) or @islandids=();
-#---------- 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 ----------
-
-my $argorundef= sub {
- my ($dd,$base) = @_;
- my $thing= $ARGS{"${base}${dd}"};
- $thing= undef if defined $thing and $thing eq 'none';
- return $thing;
-};
-
-for my $dd (0..$qa->{Dropdowns}-1) {
- my $arch= $argorundef->($dd,'archipelago');
- my $island= $argorundef->($dd,'islandid');
- next unless defined $arch or defined $island;
- if (defined $island and defined $arch) {
- my $ii= $islandid2{$island};
- my $iarch= $ii->{Arch};
- if ($iarch ne $arch) {
- $results_head->();
-%perl>
- Specified archipelago <% $arch %> but
- island <% $ii->{Name} %>
- which is in <% $iarch %>; using the island.
-<%perl>
- }
- $arch= undef;
- }
- push @archipelagoes, $arch;
- push @islandids, $island;
+foreach my $warningf (@warningfs) {
+ $someresults->();
+ $warningf->();
}
-}#---------- result processing, common stuff
%perl>
% if (@islandids) {
-% $results_head->();
-
-<& routetrade, islandids => \@islandids, archipelagoes => \@archipelagoes &>
-
+% $someresults->();
+<& routetrade,
+ dbh => $dbh,
+ islandids => \@islandids,
+ archipelagoes => \@archipelagoes,
+ qa => $qa,
+ routeparams => $routeparams
+ &>
% }
+