chiark / gitweb /
query_routesearch: Properly propagate %baseqf (so we don't reset ocean etc.)
[ypp-sc-tools.db-test.git] / yarrg / web / query_routesearch
index fadc20ed8db5d0b5b12e6942ba09742c9fa3854b..89a81371845c06069fe43b197a6ad8d945e89abb 100644 (file)
 <%args>
 $quri
 $dbh
+$baseqf
 $queryqf
 $islandstring => '';
 $capacitystring => '';
 $lossperleague => '';
 $capitalstring => '';
 $distance => '';
+$prselector
 $someresults
 $emsgokorprint
+$allargs
 </%args>
 
 <%perl>
@@ -70,6 +73,8 @@ my $maxcountea=15;
 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,
@@ -106,6 +111,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 +143,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 +207,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);