1 <html><head><title>Specify route</title></head><body>
7 @vars= ({ Name => 'Ocean',
9 CmpCanon => sub { ucfirst lc $_[0] },
10 Values => [ qw(Midnight Ice) ]
11 }, { Name => 'Dropdowns',
12 Before => 'Interface: ',
13 CmpCanon => sub { !!$_[0] },
14 Values => [ [ 0, 'Type in names' ],
15 [ 4, 'Select from menus' ] ]
18 foreach my $var (@vars) {
19 my $name= $var->{Name};
20 $var->{Before}= '' unless exists $var->{Before};
21 $var->{CmpCanon}= sub { $_[0]; } unless exists $var->{CmpCanon};
22 foreach my $val (@{ $var->{Values} }) {
24 $val= [ $val, encode_entities($val) ];
26 if (exists $ARGS{lc $name}) {
27 $a{$name}= $ARGS{lc $name};
29 $a{$name}= $var->{Values}[0][0];
33 foreach my $var (@vars) {
34 my $name= $var->{Name};
35 my $delim= $var->{Before};
36 my $canon= &{$var->{CmpCanon}}($a{$name});
38 foreach my $valr (@{ $var->{Values} }) {
39 print $delim; $delim= "\n|\n";
40 my ($value,$html) = @$valr;
41 my $iscurrent= &{$var->{CmpCanon}}($value) eq $canon;
48 foreach my $innerr (@vars) {
49 my $n= lc $innerr->{Name};
51 next unless exists $ARGS{$n};
58 my $uri= URI->new($self_url);
59 $uri->query_form(%qf);
60 print '<a href="', $uri->path_query(), '">';
69 db_setocean($a{'ocean'});
74 <h1>Specify route</h1>
75 <form action="/ucgi/~clareb/mason/something" method="get">
77 % if (!$a{Dropdowns}) {
78 Enter route (islands, or archipelagoes, separated by commas;
79 abbreviations are OK):<br>
80 <input type="text" name="routestring" size=80><br>
81 <div name="results"></div></br>
85 my $sth=$dbh->prepare("SELECT islandid,islandname
87 ORDER BY islandname;");
90 my $islandlistdata='';
91 while ($row=$sth->fetchrow_arrayref) {
93 sprintf('<option value="%s">%s</option>',
94 map { encode_entities($_) } @$row);
100 % for my $dd (0..$a{Dropdowns}-1) {
101 <td><select name="islandid<% $dd %>">
102 <option name="none">Select island...</option>
103 <% $islandlistdata %></select></td>
109 <input type=submit name=submit value="Go">