chiark / gitweb /
Much tidying; preserve query type etc. in query_commod
[ypp-sc-tools.web-live.git] / yarrg / web / query_route
index dc1ebc9917608eaf7a596e7d3eaf95e58165676a..8f6d99c49d29ed353f5f2fcdf6d88dc55180afac 100644 (file)
@@ -35,7 +35,6 @@
 </%doc>
 <%args>
 $quri
-$qa
 $routestring => '';
 </%args>
 <%perl>
@@ -44,6 +43,7 @@ my @archipelagoes;
 my @islandids;
 my %islandid2;
 
+my $qa= \%ARGS;
 </%perl>
 
 %#---------- textbox, user enters route as string ----------
@@ -51,6 +51,9 @@ my %islandid2;
 
 <h1>Specify route</h1>
 
+Enter route (islands, or archipelagoes, separated by |s or commas;
+ abbreviations are OK):<br>
+
 <form action="<% $quri->() |h %>" method="get">
 
 <&| qtextstring, qa => $qa, thingstring => 'routestring' &>
@@ -108,9 +111,9 @@ foreach my $arch (keys %islandlistdata) {
                $optionlistmap->($islandlistdata{$arch}, '');
 }
 
-</%perl>
+$dbh->rollback();
 
-<input type=hidden name=dropdowns value="<% $qa->{Dropdowns} |h %>">
+</%perl>
 
 <&| script &>
 ms_lists= <% to_json_protecttags(\%resetislandlistdata) %>;
@@ -153,6 +156,8 @@ function ms_Setarch(dd) {
 % } #---------- end of dropdowns, now common middle of page code ----------
 
 <input type=submit name=submit value="Go">
+% my $ours= sub { $_[0] =~ m/^island|^archipelago|^routestring/; };
+<& "lookup:formhidden", ours => $ours &>
 </form>
 
 <%perl>
@@ -168,7 +173,8 @@ $results_head= sub {
 if (!$qa->{Dropdowns}) {
   if (length $routestring) {
        $results_head->();
-       my ($emsg,$canonstring,$results)= $m->comp('check_routestring',
+       my ($emsg,$canonstring,$results)= $m->comp('qtextstringcheck',
+               what => 'routestring',
                ocean => $qa->{Ocean},
                string => $routestring,
                format => 'return'
@@ -177,9 +183,9 @@ if (!$qa->{Dropdowns}) {
                print encode_entities($emsg);
        } else {
                foreach my $entry (@$results) {
-                       push @archipelagoes,
-                               defined $entry->[1] ? undef : $entry->[0];
                        push @islandids, $entry->[1];
+                       push @archipelagoes,
+                               defined $entry->[1] ? undef : $entry->[2];
                } 
        }
   }