X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Fpirate-route;h=c80bacffa25b280d6edd666c51d80c2c6f9ab13f;hb=f97853ce6dc9df1caedecd2dac9530d53fdb844d;hp=58f8f28ae7d8d147a03c0d6fc4e9c3e93d99c492;hpb=7031695ce7767c196f2ef0f279bf4e3c7931c211;p=ypp-sc-tools.web-live.git diff --git a/yarrg/web/pirate-route b/yarrg/web/pirate-route index 58f8f28..c80bacf 100644 --- a/yarrg/web/pirate-route +++ b/yarrg/web/pirate-route @@ -7,7 +7,7 @@ my @vars; @vars= ({ Name => 'Ocean', Before => 'Ocean: ', CmpCanon => sub { ucfirst lc $_[0] }, - Values => [ qw(Midnight Ice) ] + Values => [ ocean_list() ] }, { Name => 'Dropdowns', Before => 'Interface: ', CmpCanon => sub { !!$_[0] }, @@ -55,7 +55,7 @@ foreach my $var (@vars) { $qf{$n}= $value; } } - my $uri= URI->new($self_url); + my $uri= URI->new($m->current_comp()->name()); $uri->query_form(%qf); print ''; $after= ''; @@ -66,6 +66,9 @@ foreach my $var (@vars) { print '

'; } +die "unknown ocean $a{Ocean} ?" + unless grep { $_ eq $a{Ocean} } ocean_list(); + db_setocean($a{Ocean}); db_connect(); @@ -75,73 +78,117 @@ db_connect();

% if (!$a{Dropdowns}) { -Enter route (islands, or archipelagoes, separated by commas; +Enter route (islands, or archipelagoes, separated by |s or commas; abbreviations are OK):
-
-
 

- +
+
 

% } else { <%perl> -my $sth=$dbh->prepare("SELECT islandid,islandname +my $sth=$dbh->prepare("SELECT islandid,islandname,archipelago FROM islands ORDER BY islandname;"); $sth->execute(); my $row; my $islandlistdata=''; +my %archmap=(); while ($row=$sth->fetchrow_arrayref) { $islandlistdata.= sprintf('', - map { encode_entities($_) } @$row); + map { encode_entities($_) } @$row[0..1]); + $archmap{$row->[0]}= $row->[2]; +} + +$sth=$dbh->prepare("SELECT DISTINCT archipelago FROM islands + ORDER BY archipelago;"); +$sth->execute(); +my $archlistdata=''; + +while ($row=$sth->fetchrow_arrayref) { + $archlistdata.= + sprintf('', + map { encode_entities($_) } (@$row, @$row)); } + + + + +% for my $dd (0..$a{Dropdowns}-1) { + +% } + + % for my $dd (0..$a{Dropdowns}-1) { % } +
% }