X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Fquery_route;h=8b491d93a99aca47c41b8a77306648c10975acf1;hb=5d41f4f9fd6a3f188bba831a1a8902f7890cef8f;hp=b2c52b158f3b7c6531b48fbf9b0b34677ed56df8;hpb=2007f48bd68be9218b8f41acd9ba32d378a1b22c;p=ypp-sc-tools.web-live.git diff --git a/yarrg/web/query_route b/yarrg/web/query_route index b2c52b1..8b491d9 100644 --- a/yarrg/web/query_route +++ b/yarrg/web/query_route @@ -38,6 +38,9 @@ $quri $dbh $prselector $routestring => ''; +$capacitystring => ''; +$lossperleague => ''; +$capitalstring => ''; $someresults $emsgokorprint @@ -47,8 +50,21 @@ my $emsg; my @archipelagoes; my @islandids; my %islandid2; +my ($max_volume, $max_mass); +my $lossperleaguepct; +my $capital; my $qa= \%ARGS; + +my $be_post; +my $startform= sub { + ($be_post)= @_; + +
+<%perl> +}; +my $goupdate= sub { $be_post ? 'Update' : 'Go' }; +

Specify route

@@ -61,21 +77,73 @@ my $qa= \%ARGS; 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, - perresult => sub { - my ($canonname, $island, $arch) = @_; - push @islandids, $island; - push @archipelagoes, defined $island ? undef : $arch; + onresults => sub { + foreach (@_) { + my ($canonname, $island, $arch) = @$_; + push @islandids, $island; + push @archipelagoes, defined $island ? undef : $arch; + } } &> 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', + onresults => sub { ($max_mass,$max_volume) = @_; } + &> + size=40 + + + +  +  + + +Expected losses: + +<&| qtextstring, qa => $qa, dbh => $dbh, prefix => 'll', + thingstring => 'lossperleague', emsgstore => \$emsg, + helpref => 'losses', + onresults => sub { ($lossperleaguepct)= @_; } + &> + size=9 + +
Available capital: + +<&| qtextstring, qa => $qa, dbh => $dbh, prefix => 'ac', + thingstring => 'capitalstring', emsgstore => \$emsg, + helpref => 'capital', + onresults => sub { ($capital)= @_; } + &> + 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; @@ -165,10 +233,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|^capitalstring|^[RT]/; +% }; <& "lookup:formhidden", ours => $ours &> -

<%perl> #========== results ========== @@ -206,11 +275,16 @@ 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, + max_capital => $capital &> % } +