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=393e7a668755145d05262a56b56ed005330669c1;hp=66dee1dd08135de011871b15d71d963f7db235af;hb=59bee7afb77216585b904bd20f17e71005e9778c;hpb=72587d0d7358ca77ecd0ede859abba7f89b1d9d2 diff --git a/yarrg/web/query_route b/yarrg/web/query_route index 66dee1d..393e7a6 100644 --- a/yarrg/web/query_route +++ b/yarrg/web/query_route @@ -35,6 +35,8 @@ <%args> $quri +$dbh +$prselector $routestring => ''; $someresults $emsgokorprint @@ -47,19 +49,32 @@ my @islandids; my %islandid2; my $qa= \%ARGS; + +my $be_post; +my $startform= sub { + ($be_post)= @_; +
+<%perl> +}; +my $goupdate= sub { $be_post ? 'Update' : 'Go' }; -%#---------- textbox, user enters route as string ---------- -% if (!$qa->{Dropdowns}) { +

Specify route

+% $prselector->('ShowStalls'); + +%#---------- textbox, user enters route as string ---------- +% if (!$qa->{Dropdowns}) { + Enter route (islands, or archipelagoes, separated by |s or commas; abbreviations are OK):
- +% $startform->($routestring =~ m/\S/); -<&| qtextstring, qa => $qa, thingstring => 'routestring', emsgstore => \$emsg, +<&| qtextstring, qa => $qa, dbh => $dbh, + thingstring => 'routestring', emsgstore => \$emsg, perresult => sub { my ($canonname, $island, $arch) = @_; push @islandids, $island; @@ -71,6 +86,11 @@ Enter route (islands, or archipelagoes, separated by |s or commas; % } else { #---------- dropdowns, user selects from menus ---------- +% $startform->(grep { +% defined $ARGS{"archipelago$_"} || +% defined $ARGS{"islandid$_"} +% } (0..$qa->{Dropdowns}-1)); + <%perl> my ($sth,$row); my @archlistdata; @@ -90,8 +110,6 @@ my $optionlistmap= sub { return $out; }; -my $dbh= dbw_connect($qa->{Ocean}); - $sth= $dbh->prepare("SELECT DISTINCT archipelago FROM islands ORDER BY archipelago;"); $sth->execute(); @@ -120,8 +138,6 @@ foreach my $arch (keys %islandlistdata) { $optionlistmap->($islandlistdata{$arch}, ''); } -$dbh->rollback(); - <&| script &> @@ -164,10 +180,9 @@ function ms_Setarch(dd) { % } #---------- end of dropdowns, now common middle of page code ---------- - -% my $ours= sub { $_[0] =~ m/^island|^archipelago|^routestring/; }; + +% my $ours= sub { $_[0] =~ m/^island|^archipelago|^routestring|^[RT]/; }; <& "lookup:formhidden", ours => $ours &> -
<%perl> #========== results ========== @@ -205,6 +220,12 @@ for my $dd (0..$qa->{Dropdowns}-1) { % if (@islandids) { -% $someresults->(); -<& routetrade, islandids => \@islandids, archipelagoes => \@archipelagoes &> +% $someresults->('Relevant trades'); +<& routetrade, + dbh => $dbh, + islandids => \@islandids, + archipelagoes => \@archipelagoes, + qa => $qa + &> + % }