From: Ian Jackson Date: Sat, 17 Oct 2009 17:05:01 +0000 (+0100) Subject: routesearch: link to full voyage plans X-Git-Tag: 5.0^2~21 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=commitdiff_plain;h=b003b70daab49984677a1cfadced9da9ee9be19a routesearch: link to full voyage plans --- diff --git a/yarrg/TODO b/yarrg/TODO index fd10cc5..0600873 100644 --- a/yarrg/TODO +++ b/yarrg/TODO @@ -1,7 +1,5 @@ query_routesearch: - links to per-route pages - nice routesearch sort arrows on table diff --git a/yarrg/web/lookup b/yarrg/web/lookup index 9f74f33..15f341a 100755 --- a/yarrg/web/lookup +++ b/yarrg/web/lookup @@ -248,7 +248,7 @@ $debug => 0
<& "query_$styles{Query}", %baseqf, %queryqf, %styles, - quri => $quri, dbh => $dbh, + quri => $quri, dbh => $dbh, queryqf => \%queryqf, prselector => $prselector, someresults => $someresults, emsgokorprint => sub { diff --git a/yarrg/web/query_routesearch b/yarrg/web/query_routesearch index e5e7c6b..c45b56a 100644 --- a/yarrg/web/query_routesearch +++ b/yarrg/web/query_routesearch @@ -36,12 +36,12 @@ <%args> $quri $dbh +$queryqf $islandstring => ''; $capacitystring => ''; $lossperleague => ''; $capitalstring => ''; $distance => ''; -$someresults $emsgokorprint @@ -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. <% $item->{A} |h %> <% $item->{P} |h %> <% $item->{Leagues} |h %> -<% join ', ', @{ $item->{Archs} } |h %> +<% join ', ', @{ $item->{Archs} } |h %> <% $item->{Start} |h %>, <% join ' ', map { $_.',' } @{ $item->{Vias} } |h %> <% $item->{Finish} |h %>