chiark / gitweb /
Support Specific Destination route search
[ypp-sc-tools.db-test.git] / yarrg / web / query_routesearch
index 3f65fc3ca0aff7f15a35581c4e34fe9a38edb0c0..f8a697ac902df640c63bb7b7cd026169014014a6 100644 (file)
@@ -57,6 +57,8 @@ my $emsg;
 my @warningfs;
 my @islandids;
 
+my $destspec;
+
 my $maxmaxdist=35;
 my $maxcpu=90;
 my $concur_lim=5;
@@ -84,6 +86,30 @@ This feature is not available from the "drop down menus" interface.
        islandids_r => \@islandids, archipelagoes_r => undef
  &>
 
+% my $searchtype= $ARGS{RouteSearchType};
+% if ($searchtype == 0) {
+%      $destspec= 'any';
+% } elsif ($searchtype == 1) {
+%      $destspec= 'circ';
+% } elsif ($searchtype == 2) {
+
+Destination (one island only):
+<& qtextstring, qa => $qa, dbh => $dbh, emsgstore => \$emsg,
+    thingstring => 'deststring',
+    prefix => 'ds', boxopts => 'size=40',
+    onresults => sub {
+print STDERR "ONRESULTS @_\n";
+       return unless @_;
+       my ($canonname, $island, $arch) = @{ $_[0] };
+       die unless defined $island;
+       $destspec= $island;
+    }
+ &>
+
+% } else {
+%      die "$destspec ?";
+% }
+
 <&| enter_advrouteopts, qa=>$qa, dbh=>$dbh, routeparams=>$routeparams &>
 <td>
 &nbsp;
@@ -116,6 +142,7 @@ print("</div>"), return
      unless $emsgokorprint->($emsg)
        and @islandids
        and $allargs->{'submit'}
+       and defined $destspec
        and (defined $routeparams->{MaxMass} or
             defined $routeparams->{MaxVolume});
 
@@ -149,7 +176,7 @@ push @rsargs, defined $routeparams->{LossPerLeaguePct}
        ? $routeparams->{LossPerLeaguePct}*0.01 : 1e-9;
 push @rsargs, 0; #$routeparams->{MinProfit};
 push @rsargs, 'search',$maxdist, $maxcountea,$maxcountea;
-push @rsargs, $ARGS{RouteSearchType} ? 'circ' : 'any';
+push @rsargs, $destspec;
 push @rsargs, @islandids;
 
 m/[^-.0-9a-zA-Z]/ and die "$_ $& ?" foreach @rsargs;