X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Fpirate-route;h=612c577287615e9f7aa99a56e5f6dcdc196b477b;hb=9ad85b94399ad653e1d10fd18500a9e2205f032d;hp=42de303d16caf9bc960077596de6be4ba38d709c;hpb=2839e990a1173a3b7e9d8ba3c662405ed25ba1b2;p=ypp-sc-tools.web-live.git diff --git a/yarrg/web/pirate-route b/yarrg/web/pirate-route index 42de303..612c577 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,7 +66,10 @@ foreach my $var (@vars) { print '

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

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

-

+ onchange="tr_element= event.currentTarget; tr_Needed();" + onkeyup="tr_element= event.currentTarget; tr_Later();">
+
 

% } 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) { % } -% } +
+% }
@@ -142,5 +207,6 @@ while ($row=$sth->fetchrow_arrayref) { <%init> use CommodsWeb; use HTML::Entities; +use URI::Escape;