chiark / gitweb /
WIP colouring in
[ypp-sc-tools.main.git] / yarrg / web / query_routesearch
index fadc20ed8db5d0b5b12e6942ba09742c9fa3854b..2816086c068c9ed39a92e2e0221c649048f3dee9 100644 (file)
 <%args>
 $quri
 $dbh
+$baseqf
 $queryqf
 $islandstring => '';
 $capacitystring => '';
 $lossperleague => '';
 $capitalstring => '';
 $distance => '';
+$prselector
 $someresults
 $emsgokorprint
+$allargs
 </%args>
 
 <%perl>
@@ -64,12 +67,15 @@ my $maxcountea=15;
 
 </%perl>
 
+<div class="query">
 <h1>Find most profitable routes and trades</h1>
 
 % if ($qa->{Dropdowns}) {
 This feature is not available from the "drop down menus" interface.
 % } else {
 
+% $prselector->('RouteSearchType');
+
 <form action="<% $quri->() |h %>" method="get">
 
 <& enter_route, qa=>$qa, dbh=>$dbh, emsg_r=>\$emsg, warningfs_r=>\@warningfs,
@@ -97,6 +103,8 @@ This feature is not available from the "drop down menus" interface.
 % }
 
 </form>
+</div>
+<div class="results">
 <%perl>
 
 if (!$emsg && $maxdist > $maxmaxdist) {
@@ -106,6 +114,7 @@ if (!$emsg && $maxdist > $maxmaxdist) {
 
 $emsgokorprint->($emsg) or return;
 @islandids or return;
+$allargs->{'submit'} or return;
 defined $routeparams->{MaxMass} or defined $routeparams->{MaxVolume} or return;
 
 #---------- prepare island names ----------
@@ -137,7 +146,9 @@ foreach my $k (qw(MaxMass MaxVolume MaxCapital)) {
 push @rsargs, defined $routeparams->{LossPerLeaguePct}
        ? $routeparams->{LossPerLeaguePct}*0.01 : 1e-9;
 push @rsargs, '0';
-push @rsargs, 'search',$maxdist, $maxcountea,$maxcountea, 'any', @islandids;
+push @rsargs, 'search',$maxdist, $maxcountea,$maxcountea;
+push @rsargs, $ARGS{RouteSearchType} ? 'circ' : 'any';
+push @rsargs, @islandids;
 
 m/[^-.0-9a-zA-Z]/ and die "$_ $& ?" foreach @rsargs;
 
@@ -199,7 +210,7 @@ while (<$fh>) {
        for ($i=1; $i < @i-1; $i++) {
                push @{ $item->{Vias} }, $i[$i];
        }
-       my %linkqf= %$queryqf;
+       my %linkqf= (%$baseqf, %$queryqf);
        delete $linkqf{'query'};
        $linkqf{'routestring'}= join ', ', @fi;
        $item->{Url}= $quri->(%linkqf);
@@ -265,7 +276,7 @@ $someresults->();
 %      } else {
 <h2>Best routes for profit per league</h2>
 %      }
-<table rules=groups id="ap<% $ap %>_table">
+<table class="data" rules=groups id="ap<% $ap %>_table">
 <colgroup span=2>
 <colgroup span=1>
 <colgroup span=1>
@@ -336,8 +347,3 @@ Per league values count each island visited as one
 (additional) league; the `Dist.' column is however the actual distance
 to be sailed.  All profit figures are somewhat approximate; get a
 complete trading plan for a route for accurate information.
-
-<%perl>
-
-
-</%perl>