X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.web-live.git;a=blobdiff_plain;f=yarrg%2Fweb%2Fquery_route;h=9a6ca0829114c622552209991c1fb6e1901094f4;hp=ee726a9ced8d0a6c024c6d83bc3aaa95a7966882;hb=4c6a28f4cbed2ed351697f63f30fb4827259f6a9;hpb=e05f0567ea23491da8e48f892a3337f37139628f diff --git a/yarrg/web/query_route b/yarrg/web/query_route index ee726a9..9a6ca08 100644 --- a/yarrg/web/query_route +++ b/yarrg/web/query_route @@ -36,7 +36,10 @@ <%args> $quri $dbh +$prselector $routestring => ''; +$capacitystring => ''; +$lossperleague => ''; $someresults $emsgokorprint @@ -46,19 +49,33 @@ my $emsg; my @archipelagoes; my @islandids; my %islandid2; +my ($max_volume, $max_mass); +my $lossperleaguepct; 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, dbh => $dbh, thingstring => 'routestring', emsgstore => \$emsg, @@ -71,8 +88,47 @@ Enter route (islands, or archipelagoes, separated by |s or commas; size=80 +Advanced options - you may leave these blank: +

+ + +
+ +Vessel or capacity: +<&| qtextstring, qa => $qa, dbh => $dbh, prefix => 'cs', + thingstring => 'capacitystring', emsgstore => \$emsg, + helpref => 'capacity', + perresult => sub { + ($max_mass,$max_volume) = @_; + } + &> + size=40 + + + +  +  + + +Expected losses: + +<&| qtextstring, qa => $qa, dbh => $dbh, prefix => 'll', + thingstring => 'lossperleague', emsgstore => \$emsg, + helpref => 'losses', + perresult => sub { ($lossperleaguepct)= @_; } + &> + size=9 + + +
+ % } else { #---------- dropdowns, user selects from menus ---------- +% $startform->(grep { +% defined $ARGS{"archipelago$_"} || +% defined $ARGS{"islandid$_"} +% } (0..$qa->{Dropdowns}-1)); + <%perl> my ($sth,$row); my @archlistdata; @@ -162,10 +218,11 @@ 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|^capacitystring|^lossperleague|^[RT]/; +% }; <& "lookup:formhidden", ours => $ours &> -

<%perl> #========== results ========== @@ -203,11 +260,15 @@ for my $dd (0..$qa->{Dropdowns}-1) { % if (@islandids) { -% $someresults->(); +% $someresults->('Relevant trades'); <& routetrade, dbh => $dbh, islandids => \@islandids, archipelagoes => \@archipelagoes, - qa => $qa + qa => $qa, + max_mass => $max_mass, + max_volume => $max_volume, + lossperleaguepct => $lossperleaguepct &> + % }