X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.main.git;a=blobdiff_plain;f=yarrg%2Fweb%2Fqtextstring;h=6872e7ecdd449c353a6828dd5807462d62f7808f;hp=d57f863490fda37637957afd0e988be1e1c4f14d;hb=59393edc418d7062f6fb074a90d3b8e810c43772;hpb=166893c6f6bd3e9b382aca095dc5ac80a22f89b7 diff --git a/yarrg/web/qtextstring b/yarrg/web/qtextstring index d57f863..6872e7e 100644 --- a/yarrg/web/qtextstring +++ b/yarrg/web/qtextstring @@ -39,26 +39,32 @@ $qa => $m->caller_args(1)->{'qa'} $dbh $thingstring +$checkkind => undef $emsgstore -$perresult -$prefix => 'ts'; -$helpref => undef; +$onresults +$boxopts => 'size=10' +$prefix => 'ts' +$helpref => undef <%perl> my $stringval= $qa->{$thingstring}; $stringval='' if !defined $stringval; +$checkkind= $thingstring if !defined $checkkind; my $p= $prefix.'_'; +my $checker= $m->fetch_comp("check_${checkkind}"); +my $significant_nonempty= $checker->attr_exists('significant_nonempty'); + <&| script &> <%$p%>uri= "qtextstringcheck?format=application/json&ctype=text/xml" - + "&what=<% $thingstring %>" + + "&what=<% $checkkind %>" + "&ocean=<% uri_escape($qa->{Ocean}) %>"; <%$p%>timeout=false; <%$p%>request=false; -<%$p%>done=''; +<%$p%>done=<% $significant_nonempty ? "null" : "''" %>; <%$p%>needed=''; function <%$p%>Later(){ window.clearTimeout(<%$p%>timeout); @@ -94,18 +100,13 @@ function <%$p%>Ready() { register_onload(<%$p%>Needed); -content %> - id="<% $thingstring %>" name="<% $thingstring %>" - onchange="<%$p%>Needed();" onkeyup="<%$p%>Later();" - value="<% $stringval |h %>" - ><% defined($helpref) ? "[?]" : '' %> -
-
 

- <%perl> -if (length $thingstring) { - my ($emsg,$canonstring,$results)= $m->comp('qtextstringcheck', - what => $thingstring, +my ($canonstring); + +if ($significant_nonempty || length $thingstring) { + my ($emsg,@results); + ($emsg,$canonstring,@results)= $m->comp('qtextstringcheck', + what => $checkkind, ocean => $qa->{Ocean}, string => $stringval, format => 'return' @@ -114,10 +115,21 @@ if (length $thingstring) { $$emsgstore='' unless defined $$emsgstore; $$emsgstore .= $emsg. ' '; } - - foreach my $entry (@$results) { -#print STDERR "qts entry perresult \`@$entry'\n"; - $perresult->(@$entry); - } + $onresults->(@results); } + +% if (!printable($m)) { + + id="<% $thingstring %>" name="<% $thingstring %>" + onchange="<%$p%>Needed();" onkeyup="<%$p%>Later();" + value="<% $stringval |h %>" + ><% defined($helpref) ? "[?]" : '' %><% + $m->content %> +
+
 

+% } else { +<% $canonstring |h %> +
+
+% }