From 7548896aab16af6ec42c6be252b7f5f876e2fea0 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 12 Aug 2009 20:44:40 +0100 Subject: [PATCH] Error handling and other cleanups --- yarrg/web/route | 25 ++++++++++++++++--------- yarrg/web/routetextstring | 1 - 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/yarrg/web/route b/yarrg/web/route index 595976f..74a5086 100644 --- a/yarrg/web/route +++ b/yarrg/web/route @@ -76,7 +76,7 @@ foreach my $var (@vars) { my %qf= (%baseqf,%queryqf); delete $qf{$lname}; $qf{$lname}= $value if $cvalix; - print ''; + print ''; $after= ''; } print $html, $after; @@ -100,7 +100,7 @@ $routestring => ''

Specify route

-
+ %#---------- textbox, user enters route as string ---------- % if (!$a{Dropdowns}) { @@ -201,7 +201,7 @@ while ($row=$sth->fetchrow_arrayref) { my %resetislandlistdata; foreach my $arch (keys %islandlistdata) { $resetislandlistdata{$arch}= - &$optionlistmap($islandlistdata{$arch}, ''); + $optionlistmap->($islandlistdata{$arch}, ''); } @@ -229,7 +229,7 @@ function ms_Setarch(dd) { +<% $optionlistmap->(\@archlistdata, $ARGS{"archipelago$dd"}) %> % } @@ -239,7 +239,7 @@ function ms_Setarch(dd) { % $arch= 'none' if !defined $arch; % } @@ -251,14 +251,19 @@ function ms_Setarch(dd) {
-

Results

- <%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, @@ -285,13 +290,14 @@ my $argorundef= sub { }; for my $dd (0..$a{Dropdowns}-1) { - my $arch= &$argorundef($dd,'archipelago'); - my $island= &$argorundef($dd,'islandid'); + 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->(); Specified archipelago <% $arch %> but island <% $ii->{Name} %> @@ -308,6 +314,7 @@ for my $dd (0..$a{Dropdowns}-1) { % if (@islandids) { +% $results_head->(); <& routetrade, islandids => \@islandids, archipelagoes => \@archipelagoes &> diff --git a/yarrg/web/routetextstring b/yarrg/web/routetextstring index 685b465..bf4a4a9 100644 --- a/yarrg/web/routetextstring +++ b/yarrg/web/routetextstring @@ -48,7 +48,6 @@ foreach my $each (split m#[/|,]#, $string) { my $err= sub { my $msg= sprintf $_[0], encode_entities($each); $output_wrong->($msg); - $m->abort(); }; my %m; my $results; -- 2.30.2