chiark / gitweb /
routesearch: link to full voyage plans
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 17 Oct 2009 17:05:01 +0000 (18:05 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 17 Oct 2009 17:05:01 +0000 (18:05 +0100)
yarrg/TODO
yarrg/web/lookup
yarrg/web/query_routesearch

index fd10cc582d945a82499cd392751fe7535bdca0be..0600873ede819cadeaa3d7da3bfadd0a2f082041 100644 (file)
@@ -1,7 +1,5 @@
 query_routesearch:
 
-       links to per-route pages
-
        nice routesearch
 
        sort arrows on table
index 9f74f3369bb8e7bcf33601c73c8eca3831997114..15f341adc3cf8131fc41ae91b8ebd16abc450af2 100755 (executable)
@@ -248,7 +248,7 @@ $debug => 0
 <hr>
 
 <& "query_$styles{Query}", %baseqf, %queryqf, %styles,
-    quri => $quri, dbh => $dbh,
+    quri => $quri, dbh => $dbh, queryqf => \%queryqf,
     prselector => $prselector,
     someresults => $someresults,
     emsgokorprint => sub {
index e5e7c6b98619c48174328badb9e501623113df47..c45b56a06690f51173d15a918b17121c8dc647ea 100644 (file)
 <%args>
 $quri
 $dbh
+$queryqf
 $islandstring => '';
 $capacitystring => '';
 $lossperleague => '';
 $capitalstring => '';
 $distance => '';
-$someresults
 $emsgokorprint
 </%args>
 
@@ -121,7 +121,7 @@ my $isleinfo = sub {
        my $row= $islandname_stmt->fetchrow_hashref();
        local $_= $row->{'islandname'};
        s/ Island$//;
-       return $_, $row->{'archipelago'};
+       return $_, $row->{'islandname'}, $row->{'archipelago'};
 };
 
 #---------- compute the results ----------
@@ -182,10 +182,11 @@ while (<$fh>) {
        my ($ap,$isles) = (uc $1,$5);
        next if $results{$ap} && %{$results{$ap}} >= $maxcountea;
        my $item= { A => $3, P => $4, Leagues => $2 };
-       my (@i, @a);
+       my (@i, @fi, @a);
        foreach (split / /, $isles) {
-               my ($name,$arch)= $isleinfo->($_);
+               my ($name,$fullname,$arch)= $isleinfo->($_);
                push @i, $name;
+               push @fi, $fullname;
                push @a, $arch unless @a && $a[-1] eq $arch;
        }
        $item->{Isles}= [ @i ];
@@ -197,6 +198,10 @@ while (<$fh>) {
        for ($i=1; $i < @i-1; $i++) {
                push @{ $item->{Vias} }, $i[$i];
        }
+       my %linkqf= %$queryqf;
+       delete $linkqf{'query'};
+       $linkqf{'routestring'}= join ', ', @fi;
+       $item->{Url}= $quri->(%linkqf);
        $results{$ap}{$isles}= $item;
 }
 
@@ -284,7 +289,7 @@ seconds of CPU time so more processing resources should be available soon.
 <td align=right><% $item->{A} |h %>
 <td align=right><% $item->{P} |h %>
 <td align=right><% $item->{Leagues} |h %>
-<td align=left><% join ', ', @{ $item->{Archs} } |h %>
+<td align=left><a href="<% $item->{Url} |h %>"><% join ', ', @{ $item->{Archs} } |h %></a>
 <td align=left><% $item->{Start} |h %>,
 <td align=left><% join ' ', map { $_.',' } @{ $item->{Vias} } |h %>
 <td align=left><% $item->{Finish} |h %>