chiark / gitweb /
Break out code for dbw_lookup_string; support capacity adjustments in terms of commod...
[ypp-sc-tools.web-live.git] / yarrg / web / query_route
index 9a6ca0829114c622552209991c1fb6e1901094f4..8b491d93a99aca47c41b8a77306648c10975acf1 100644 (file)
@@ -40,6 +40,7 @@ $prselector
 $routestring => '';
 $capacitystring => '';
 $lossperleague => '';
+$capitalstring => '';
 $someresults
 $emsgokorprint
 </%args>
@@ -51,6 +52,7 @@ my @islandids;
 my %islandid2;
 my ($max_volume, $max_mass);
 my $lossperleaguepct;
+my $capital;
 
 my $qa= \%ARGS;
 
@@ -79,10 +81,12 @@ Enter route (islands, or archipelagoes, separated by |s or commas;
 
 <&| 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
@@ -98,9 +102,7 @@ Vessel or capacity:
 <&| qtextstring, qa => $qa, dbh => $dbh, prefix => 'cs',
     thingstring => 'capacitystring', emsgstore => \$emsg,
     helpref => 'capacity',
-    perresult => sub {
-        ($max_mass,$max_volume) = @_;
-    }
+    onresults => sub { ($max_mass,$max_volume) = @_; }
  &>
  size=40
 </&>
@@ -115,11 +117,24 @@ Expected losses:
 <&| qtextstring, qa => $qa, dbh => $dbh, prefix => 'll',
     thingstring => 'lossperleague', emsgstore => \$emsg,
     helpref => 'losses',
-    perresult => sub { ($lossperleaguepct)= @_; }
+    onresults => sub { ($lossperleaguepct)= @_; }
  &>
  size=9
 </&>
+</tr>
+<tr>
+
+<td>Available capital:
 
+<&| qtextstring, qa => $qa, dbh => $dbh, prefix => 'ac',
+    thingstring => 'capitalstring', emsgstore => \$emsg,
+    helpref => 'capital',
+    onresults => sub { ($capital)= @_; }
+ &>
+ size=9
+</&>
+</td>
+</tr>
 </table>
 
 % } else { #---------- dropdowns, user selects from menus ----------
@@ -220,7 +235,7 @@ function ms_Setarch(dd) {
 
 <input type=submit name=submit value="<% $goupdate->() %>">
 % my $ours= sub { $_[0] =~
-%  m/^island|^archipelago|^routestring|^capacitystring|^lossperleague|^[RT]/;
+%  m/^island|^archipelago|^routestring|^capacitystring|^lossperleague|^capitalstring|^[RT]/;
 % };
 <& "lookup:formhidden", ours => $ours &>
 
@@ -268,7 +283,8 @@ for my $dd (0..$qa->{Dropdowns}-1) {
    qa => $qa,
    max_mass => $max_mass,
    max_volume => $max_volume,
-   lossperleaguepct => $lossperleaguepct
+   lossperleaguepct => $lossperleaguepct,
+   max_capital => $capital
  &>
-</form>
 % }
+</form>