3 This is part of the YARRG website. YARRG is a tool and website
4 for assisting players of Yohoho Puzzle Pirates.
6 Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
7 Copyright (C) 2009 Clare Boothby
9 YARRG's client code etc. is covered by the ordinary GNU GPL (v3 or later).
10 The YARRG website is covered by the GNU Affero GPL v3 or later, which
11 basically means that every installation of the website will let you
14 This program is free software: you can redistribute it and/or modify
15 it under the terms of the GNU Affero General Public License as
16 published by the Free Software Foundation, either version 3 of the
17 License, or (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU Affero General Public License for more details.
24 You should have received a copy of the GNU Affero General Public License
25 along with this program. If not, see <http://www.gnu.org/licenses/>.
27 Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
28 are used without permission. This program is not endorsed or
29 sponsored by Three Rings.
32 This Mason component generates the core of the `trade route' query.
41 $capacitystring => '';
60 <form action="<% $quri->() |h %>" method="<% $be_post ? 'post' : 'get' %>">
63 my $goupdate= sub { $be_post ? 'Update' : 'Go' };
67 <h1>Specify route</h1>
69 % # Sadly we need to do this rather hacky thing to make it be a POST
70 % # form if the user has already selected some thing(s)
71 % if (!$qa->{Dropdowns}) {
72 % $startform->($routestring =~ m/\S/);
75 % defined $qa->{"archipelago$_"} ||
76 % defined $qa->{"islandid$_"}
77 % } (0..$qa->{Dropdowns}-1));
80 % $prselector->('ShowStalls');
82 <& enter_route, qa => $qa, dbh => $dbh, emsg_r => \$emsg,
83 warningfs_r => \@warningfs,
84 enterwhat => 'Enter route',
85 islandids_r => \@islandids,
86 archipelagoes_r => \@archipelagoes
89 %#---------- textboxes, user enters details as strings ----------
90 % my $routeparams= { EmsgRef => \$emsg };
91 % if (!$qa->{Dropdowns}) {
93 <strong>Advanced options - you may leave these blank:</strong>
96 <& enter_advrouteopts, qa=>$qa, dbh=>$dbh, routeparams=>$routeparams &>
98 % } #---------- end of dropdowns, now common middle of page code ----------
100 <input type=submit name=submit value="<% $goupdate->() %>">
101 % my $ours= sub { $_[0] =~
102 % m/^island|^archipelago|^routestring|^capacitystring|^lossperleague|^capitalstring|^[RT]/;
104 <& "lookup:formhidden", ours => $ours &>
107 #========== results ==========
109 $emsgokorprint->($emsg) or @islandids=();
111 foreach my $warningf (@warningfs) {
119 % $someresults->('Relevant trades');
122 islandids => \@islandids,
123 archipelagoes => \@archipelagoes,
125 routeparams => $routeparams