chiark / gitweb /
Make it pass W3C validator: add DTD, work around crazy javascript escaping, etc
[ypp-sc-tools.main.git] / yarrg / web / lookup
index 9206d4b536b68629c6cd93f9bc928fdffe2e4eeb..5a441b31b652e874e4d5c04f1dd9f7cc31dbf369 100755 (executable)
@@ -134,7 +134,9 @@ foreach my $var (@vars) {
                        my %qf= (%baseqf,%queryqf);
                        delete $qf{$lname};
                        $qf{$lname}= $value if $cvalix;
-                       print '<a href="',$quri->(%qf),'">';
+</%perl>
+<a href="<% $quri->(%qf) |h %>">
+<%perl>
                        $after= '</a>';
                }
                print $html, $after;
@@ -159,7 +161,7 @@ $routestring => ''
 % if ($a{Query} eq 'route') {
 
 <h1>Specify route</h1>
-<form action="<% $quri->() %>" method="get">
+<form action="<% $quri->() |h %>" method="get">
 
 %#---------- 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):<br/>
 
-<script type="text/javascript">
+<&| script &>
 tr_uri= "routetextstring?format=json&type=text/xml"
                + "&ocean=<% uri_escape($a{Ocean}) %>";
 
@@ -206,7 +208,7 @@ function tr_Ready() {
   tr_Request();
 }
 window.onload= tr_Needed;
-</script>
+</&script>
 
 <input type="text" id="routestring" name="routestring" size=80
  value="<% $routestring |h %>"
@@ -269,8 +271,8 @@ foreach my $arch (keys %islandlistdata) {
 
 <input type=hidden name=dropdowns value="<% $a{Dropdowns} |h %>">
 
-<script type="text/javascript">
-ms_lists= <% to_json(\%resetislandlistdata) %>;
+<&| script &>
+ms_lists= <% to_json_protecttags(\%resetislandlistdata) %>;
 function ms_Setarch(dd) {
   debug('ms_SetArch '+dd+' arch='+arch);
   var arch= document.getElementsByName('archipelago'+dd).item(0).value;
@@ -281,7 +283,7 @@ function ms_Setarch(dd) {
   select.innerHTML= got;
   debug('ms_SetArch '+dd+' arch='+arch+' innerHTML set');
 }
-</script>
+</&script>
 
 <table style="table-layout:fixed; width:90%;">
 
@@ -398,14 +400,14 @@ Debug log:
 </pre>
 % }
 
-<script type="text/javascript">
+<&| script &>
 function debug (m) {
 % if ($debug) {
   var node= document.getElementById('debug_log');
   node.innerHTML += "\n" + m + "\n";
 % }
 }
-</script>
+</&script>
 
 <& footer &>
 
@@ -413,6 +415,5 @@ function debug (m) {
 use CommodsWeb;
 use HTML::Entities;
 use URI::Escape;
-use JSON;
 
 </%init>