X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.web-live.git;a=blobdiff_plain;f=yarrg%2Fweb%2Fpirate-route;h=9dfab7e37309726a924f70d4f42a47cf4e86ab09;hp=42de303d16caf9bc960077596de6be4ba38d709c;hb=43f6ebdd538a6e75b3d6c43d0ce18b81c972ffd7;hpb=2839e990a1173a3b7e9d8ba3c662405ed25ba1b2 diff --git a/yarrg/web/pirate-route b/yarrg/web/pirate-route index 42de303..9dfab7e 100644 --- a/yarrg/web/pirate-route +++ b/yarrg/web/pirate-route @@ -1,5 +1,14 @@ Specify route + + <%perl> my %a; my @vars; @@ -7,7 +16,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 +64,8 @@ foreach my $var (@vars) { $qf{$n}= $value; } } - my $uri= URI->new($self_url); + my $uri= URI->new($m->current_comp()->name()); + $qf{'debug'}=1 if $debug; $uri->query_form(%qf); print ''; $after= ''; @@ -63,84 +73,218 @@ foreach my $var (@vars) { print $html, $after; $cvalix++; } - print '

'; + print "

\n\n"; } -db_setocean($a{'ocean'}); +die "unknown ocean $a{Ocean} ?" + unless grep { $_ eq $a{Ocean} } ocean_list(); + +db_setocean($a{Ocean}); db_connect(); +<%args> +$debug => 0 +

Specify route

% 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):
-
-

- +
+
 

% } else { <%perl> -my $sth=$dbh->prepare("SELECT islandid,islandname - FROM islands - ORDER BY islandname;"); +my ($sth,$row);; +my $archlistdata=''; +my %islandlistdata; +$islandlistdata{'none'}= <Select island... +END + +$sth= $dbh->prepare("SELECT DISTINCT archipelago FROM islands + ORDER BY archipelago;"); $sth->execute(); -my $row; -my $islandlistdata=''; + while ($row=$sth->fetchrow_arrayref) { - $islandlistdata.= + my ($arch)= @$row; + $archlistdata.= sprintf('', - map { encode_entities($_) } @$row); + map { encode_entities($_) } ($arch,$arch)); + $islandlistdata{$arch}= <Whole arch +END +} + +$sth= $dbh->prepare("SELECT islandid,islandname,archipelago + FROM islands + ORDER BY islandname;"); +$sth->execute(); + +while ($row=$sth->fetchrow_arrayref) { + my $arch= $row->[2]; + my $here= sprintf('', + map { encode_entities($_) } @$row[0..1]); + $islandlistdata{'none'} .= $here; + $islandlistdata{$arch} .= $here; } + - + + +% if (0) { + var nodes= select.getElementsByTagName('option'); +alert(ms_lists[dd]); + for (var i=0; i +table +{ +table-layout: fixed; +color: red; +} +pre +{ +color:yellow; +} + +% } + +
+ + +% for my $dd (0..$a{Dropdowns}-1) { + +% } + + % for my $dd (0..$a{Dropdowns}-1) { + +<% $islandlistdata{'none'} %> % } -% } +
+
+ + +% if (0) { + +% } + +% } + +% if ($debug) { +

+

+Debug log:
+
+% } + + <%init> use CommodsWeb; use HTML::Entities; +use URI::Escape;