chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.db-live.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Further refactoring to make query_commod small
[ypp-sc-tools.db-live.git]
/
yarrg
/
web
/
query_commod
diff --git
a/yarrg/web/query_commod
b/yarrg/web/query_commod
index 2358b4167cc373874dd8bf959f3099a610612eeb..eddc0975d05f067358c6835a81710d97f8039b8d 100644
(file)
--- a/
yarrg/web/query_commod
+++ b/
yarrg/web/query_commod
@@
-36,29
+36,49
@@
<%args>
$quri
$commodstring => '';
<%args>
$quri
$commodstring => '';
+$someresults
+$emsgokorprint
</%args>
</%args>
-% my $qa= \%ARGS;
+<%perl>
+my $emsg;
+my ($commodname,$commodid);
-%#---------- textbox, user enters route as string ----------
-% if (!$qa->{Dropdowns}) {
+my $qa= \%ARGS;
+</%perl>
<h1>Select commodity</h1>
<h1>Select commodity</h1>
+%#---------- textbox, user enters route as string ----------
+% if (!$qa->{Dropdowns}) {
+
Enter commodity (abbreviations are OK):<br>
<form action="<% $quri->() |h %>" method="get">
Enter commodity (abbreviations are OK):<br>
<form action="<% $quri->() |h %>" method="get">
-<&| qtextstring, qa => $qa, thingstring => 'commodstring' &>
+<&| qtextstring, qa => $qa, thingstring => 'commodstring', emsgstore => \$emsg,
+ perresult => sub { ($commodname,$commodid)= @_; }
+ &>
size=80
</&>
size=80
</&>
+% } else { #---------- dropdowns, user selects from menus ----------
+
+Not yet implemented.
+
+% } #---------- end of dropdowns, now common middle of page code ----------
+
<input type=submit name=submit value="Go">
<input type=submit name=submit value="Go">
-% my $ours= sub { $_[0] =~ m/^commodstring/; };
+% my $ours= sub { $_[0] =~ m/^commodstring
|^commodid
/; };
<& "lookup:formhidden", ours => $ours &>
</form>
<& "lookup:formhidden", ours => $ours &>
</form>
-% } else { #---------- dropdowns, user selects from menus ----------
+%#========== results ==========
+% $emsgokorprint->($emsg) or $commodid=undef;
-% } #---------- end of dropdowns, now common middle of page code ----------
+% if (defined $commodid) {
+% $someresults->();
+COMMODITY <% $commodid %> named <% $commodname |h %>
+
+% }