From ea35c3e59168d937ba97e9e76b79918936fbaa6d Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 14 Aug 2009 15:02:36 +0100 Subject: [PATCH] Make it pass W3C validator: add DTD, work around crazy javascript escaping, etc --- yarrg/CommodsWeb.pm | 11 ++++++++++- yarrg/web/dataage | 10 +++++----- yarrg/web/lookup | 21 +++++++++++---------- yarrg/web/source.tar.gz | 4 +++- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/yarrg/CommodsWeb.pm b/yarrg/CommodsWeb.pm index 0c86e6c..46b32e6 100644 --- a/yarrg/CommodsWeb.pm +++ b/yarrg/CommodsWeb.pm @@ -38,6 +38,7 @@ use warnings; use DBI; use POSIX; +use JSON; use Commods; use CommodsDatabase; @@ -50,7 +51,8 @@ BEGIN { our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); $VERSION = 1.00; @ISA = qw(Exporter); - @EXPORT = qw(&dbw_connect &ocean_list $sourcebasedir); + @EXPORT = qw(&dbw_connect &ocean_list $sourcebasedir + to_json to_json_protecttags); %EXPORT_TAGS = ( ); @EXPORT_OK = qw(); @@ -100,4 +102,11 @@ sub dbw_connect ($) { return dbr_connect($datadir, $ocean); } +sub to_json_protecttags ($) { + my ($v) = @_; + my $j= to_json($v); + $j =~ s,/,\\/,g; + return $j; +} + 1; diff --git a/yarrg/web/dataage b/yarrg/web/dataage index 313f892..6ca9444 100644 --- a/yarrg/web/dataage +++ b/yarrg/web/dataage @@ -67,7 +67,7 @@ $sth->execute(); - + @@ -99,7 +99,7 @@ function da_Refresh() { - +<&| script &> da_ages['<% $elid %>']= <% $age %>; % }
<% $row->{'archipelago'} |h %> <% $row->{'islandname'} |h %> <% $prettyprint_age->($age) %>
@@ -114,11 +114,11 @@ Time since this page loaded: - + <%init> use POSIX; diff --git a/yarrg/web/lookup b/yarrg/web/lookup index 9206d4b..5a441b3 100755 --- a/yarrg/web/lookup +++ b/yarrg/web/lookup @@ -134,7 +134,9 @@ foreach my $var (@vars) { my %qf= (%baseqf,%queryqf); delete $qf{$lname}; $qf{$lname}= $value if $cvalix; - print ''; + + +<%perl> $after= ''; } print $html, $after; @@ -159,7 +161,7 @@ $routestring => '' % if ($a{Query} eq 'route') {

Specify route

-
+ %#---------- textbox, user enters route as string ---------- % if (!$a{Dropdowns}) { @@ -167,7 +169,7 @@ $routestring => '' Enter route (islands, or archipelagoes, separated by |s or commas; abbreviations are OK):
- + - + @@ -398,14 +400,14 @@ Debug log: % } - + <& footer &> @@ -413,6 +415,5 @@ function debug (m) { use CommodsWeb; use HTML::Entities; use URI::Escape; -use JSON; diff --git a/yarrg/web/source.tar.gz b/yarrg/web/source.tar.gz index 7a0525a..8825da4 100755 --- a/yarrg/web/source.tar.gz +++ b/yarrg/web/source.tar.gz @@ -33,7 +33,9 @@ the YARRG website's source code. -<%perl> +<%flags> +inherit => undef +<%perl> use IO::Pipe; use CommodsWeb; -- 2.30.2