X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Flookup;h=0106684af46e5ba515d69b9b3aa4a92be2fc9d19;hb=38e2919be138f8a77eef7a2fc93d34eff8897f5e;hp=9c00a65466481bd3e6e1633fa3fe0c7fbf418f9a;hpb=555fcf1a304c5f1aef9384c3c4d07d5255a0f05d;p=ypp-sc-tools.db-live.git diff --git a/yarrg/web/lookup b/yarrg/web/lookup old mode 100644 new mode 100755 index 9c00a65..0106684 --- a/yarrg/web/lookup +++ b/yarrg/web/lookup @@ -1,18 +1,44 @@ -
+ This is part of the YARRG website. YARRG is a tool and website
+ for assisting players of Yohoho Puzzle Pirates.
+
+ Copyright (C) 2009 Ian Jackson
+<%perl>
+
my %baseqf;
foreach my $var (@vars) {
my $lname= lc $var->{Name};
@@ -61,8 +105,11 @@ foreach my $var (keys %ARGS) {
$queryqf{$var}= $val;
}
-my $uri= URI->new($m->current_comp()->name());
-my $quri= sub { $uri->query_form(@_); $uri->path_query(); };
+my $quri= sub {
+ my $uri= URI->new('lookup');
+ $uri->query_form(@_);
+ $uri->path_query();
+};
foreach my $var (@vars) {
my $name= $var->{Name};
@@ -82,7 +129,9 @@ foreach my $var (@vars) {
my %qf= (%baseqf,%queryqf);
delete $qf{$lname};
$qf{$lname}= $value if $cvalix;
- print '';
+%perl>
+
+<%perl>
$after= '';
}
print $html, $after;
@@ -93,236 +142,20 @@ foreach my $var (@vars) {
#---------- initial checks, startup, main entry form ----------
+die if $a{Query} =~ m/[^a-z]/;
+
dbw_connect($a{Ocean});
%perl>
<%args>
$debug => 0
-$routestring => ''
%args>
-
%#---------- debugging and epilogue ----------
@@ -333,19 +166,20 @@ Debug log:
% }
-
+&script>
+
+<& footer &>
<%init>
use CommodsWeb;
use HTML::Entities;
use URI::Escape;
-use JSON;
%init>
Specify route
-
-
-<%perl>
-#========== result computations ==========
-
-my $results_head;
-$results_head= sub {
- print "Results
\n";
- $results_head= sub { };
-};
-
-#---------- result computation - textstring ----------
-if (!$a{Dropdowns}) {
- if (length $routestring) {
- $results_head->();
- my $rsr= $m->comp('routetextstring',
- ocean => $a{Ocean},
- string => $routestring,
- format => 'return'
- );
- if (length $rsr->{Error}) {
- print encode_entities($rsr->{Error});
- } else {
- foreach my $entry (@{ $rsr->{Results} }) {
- push @archipelagoes,
- defined $entry->[1] ? undef : $entry->[0];
- push @islandids, $entry->[1];
- }
- }
- }
-
-} else { #---------- results - dropdowns ----------
-
-my $argorundef= sub {
- my ($dd,$base) = @_;
- my $thing= $ARGS{"${base}${dd}"};
- $thing= undef if defined $thing and $thing eq 'none';
- return $thing;
-};
-
-for my $dd (0..$a{Dropdowns}-1) {
- my $arch= $argorundef->($dd,'archipelago');
- my $island= $argorundef->($dd,'islandid');
- next unless defined $arch or defined $island;
- if (defined $island and defined $arch) {
- my $ii= $islandid2{$island};
- my $iarch= $ii->{Arch};
- if ($iarch ne $arch) {
- $results_head->();
-%perl>
- Specified archipelago <% $arch %> but
- island <% $ii->{Name} %>
- which is in <% $iarch %>; using the island.
-<%perl>
- }
- $arch= undef;
- }
- push @archipelagoes, $arch;
- push @islandids, $island;
-}
-
-}#---------- result processing, common stuff
-%perl>
-
-% if (@islandids) {
-% $results_head->();
-
-<& routetrade, islandids => \@islandids, archipelagoes => \@archipelagoes &>
-
-% }
+