chiark / gitweb /
Trade plan; wip data age
[ypp-sc-tools.db-live.git] / yarrg / web / qtextstring
index 6efe368e650dfc396b020f5fa58f5679d3c86426..16aa372bd6794caad89992d6d7b2f2a976d519c2 100644 (file)
  sponsored by Three Rings.
 
 
- This Mason component handles `live' analysis of text string entries.
+ This Mason component handles analysis of text string entries, including
+ both the AJAX calls from web page javascript and the entry validation
+ and processing calls from other components.
 
 
 </%doc>
 <%args>
-$thingstring
 $qa => $m->caller_args(1)->{'qa'}
+$dbh
+$thingstring
+$emsgstore
+$perresult
 </%args>
 <%perl>
 my $stringval= $qa->{$thingstring};
 $stringval='' if !defined $stringval;
 </%perl>
 
-Enter route (islands, or archipelagoes, separated by |s or commas;
- abbreviations are OK):<br>
-
 <&| script &>
-ts_uri= "check_<% $thingstring %>?format=json&type=text/xml"
+ts_uri= "qtextstringcheck?format=application/json&ctype=text/xml"
+               + "&what=<% $thingstring %>"
                + "&ocean=<% uri_escape($qa->{Ocean}) %>";
 
 ts_timeout=false;
@@ -94,3 +97,19 @@ window.onload= ts_Needed;
  >
 <br>
 <div id="ts_results">&nbsp;</div><br>
+
+<%perl>
+if (length $thingstring) {
+       my ($emsg,$canonstring,$results)= $m->comp('qtextstringcheck',
+               what => $thingstring,
+               ocean => $qa->{Ocean},
+               string => $stringval,
+               format => 'return'
+       );
+       $$emsgstore= $emsg;
+
+       foreach my $entry (@$results) {
+               $perresult->(@$entry);
+       }
+}
+</%perl>