--- quos.cgi 2004/10/26 16:56:28 1.4
+++ quos.cgi 2004/10/27 16:23:46 1.5
@@ -1,4 +1,4 @@
-#!/usr/opkg/bin/perl
+#!/usr/opkg/bin/perl
##
## OSSP quos - Query On Steroids
## Copyright (c) 2004 Ralf S. Engelschall <rse@engelschall.com>
@@ -33,7 +33,10 @@
# create objects
my $cgi = new CGI;
my $html = new String::Divert;
+my $nr_lops = 4;
+my $nr_rows = 7;
$html->overload(1);
+#&printparams($cgi);
# generate outer canvas
$html .= "<div class=\"quos\">\n";
@@ -75,71 +78,104 @@
# sample
$html >> "query";
-$html .= "this is the query part<br>";
-$html .= $cgi->popup_menu(-name=>'opr1c1',
- -values=>['(',')','!','&','|'],
- -default=>'&');
-$html .= $cgi->popup_menu(-name=>'opr1c2',
- -values=>['(',')','!','&','|'],
- -default=>'&');
-$html .= $cgi->popup_menu(-name=>'opr1c3',
- -values=>['(',')','!','&','|'],
- -default=>'&');
-$html .= $cgi->popup_menu(-name=>'fieldr1',
- -values=>['name','description','foo'],
- -default=>'name');
-$html .= $cgi->popup_menu(-name=>'opr1c4',
- -values=>['=','begins with','ends with'],
- -default=>'=');
-$html .= $cgi->textfield(-name=>'valuer1');
-$html .= '<br>';
-$html .= $cgi->popup_menu(-name=>'opr1c1',
- -values=>['(',')','!','&','|'],
- -default=>'&');
-$html .= $cgi->popup_menu(-name=>'opr1c2',
- -values=>['(',')','!','&','|'],
- -default=>'&');
-$html .= $cgi->popup_menu(-name=>'opr1c3',
- -values=>['(',')','!','&','|'],
- -default=>'&');
-$html .= $cgi->popup_menu(-name=>'fieldr1',
- -values=>['name','description','foo'],
- -default=>'name');
-$html .= $cgi->popup_menu(-name=>'opr1c4',
- -values=>['=','begins with','ends with'],
- -default=>'=');
-$html .= $cgi->textfield(-name=>'valuer1');
-$html .= '<br>';
-$html .= $cgi->popup_menu(-name=>'opr1c1',
- -values=>['(',')','!','&','|'],
- -default=>'&');
-$html .= $cgi->popup_menu(-name=>'opr1c2',
- -values=>['(',')','!','&','|'],
- -default=>'&');
-$html .= $cgi->popup_menu(-name=>'opr1c3',
- -values=>['(',')','!','&','|'],
- -default=>'&');
-$html .= $cgi->popup_menu(-name=>'fieldr1',
- -values=>['name','description','foo'],
- -default=>'name');
-$html .= $cgi->popup_menu(-name=>'opr1c4',
- -values=>['=','begins with','ends with'],
- -default=>'=');
-$html .= $cgi->textfield(-name=>'valuer1');
-$html .= '<br>';
-$html .= $cgi->submit('Action','submit');
+$html .= "parametrize your query<br>";
+$html .= $cgi->start_html("query on steroids");
+$html .= $cgi->start_form;
+$html .= "<table>";
+$html .= '<table>';
+for ($i = 0; $i < $cgi->param('nr_rows'); $i++) {
+ $html .= "<tr>";
+ for ($j = $cgi->param('nr_lops') -1; $j >= 0; $j--) {
+ $html .= "<td>";
+ $html .= $cgi->popup_menu(-name=>"logop$j-$i",
+ -values=>[' ','(',')','!','&','|'],
+ -default=>' ');
+ $html .= "</td>";
+ }
+ $html .= "<td>";
+ $html .= $cgi->popup_menu(-name=>"f_name-$i",
+ -values=>['name','description','foo'],
+ -default=>'name');
+ $html .= '</td>';
+ $html .= '<td>';
+ $html .= $cgi->popup_menu(-name=>"f_operator-$i",
+ -values=>['=','begins with','ends with'],
+ -default=>'=');
+ $html .= '</td>';
+ $html .= '<td>';
+ $html .= $cgi->textfield(-name=>"f_value-$i");
+ $html .= '</td>';
+ $html .= '<br>';
+ $html .= '</tr>';
+}
+$html .= "</table>";
+$html .= '<table>';
+ $html .= '<tr>';
+ $html .= '<td>';
+ $html .= $cgi->popup_menu(-name=>"nr_lops",
+ -values=>[1..9],
+ -default=>'3');
+ $html .= '</td>';
+ $html .= '<td>';
+ $html .= $cgi->popup_menu(-name=>'nr_rows',
+ -values=>[1..9],
+ -default=>'4');
+ $html .= '</td>';
+ $html .= '<td>';
+ $html .= $cgi->submit('act_matrix_upd','update');
+ $html .= '</td>';
+ $html .= '<td>';
+ $html .= $cgi->submit('act_matrix_clear','clear');
+ $html .= '</td>';
+ $html .= '<td>';
+ $html .= $cgi->submit('act_matrix_submit','submit');
+ $html .= '</td>';
+ $html .= '</tr>';
+$html .= '</table>';
+
+$html .= '<table>';
+ $html .= '<tr>';
+ $html .= '<td>';
+ $html .= 'name of query';
+ $html .= '</td>';
+ $html .= '<td>';
+ $html .= $cgi->submit('act_matrix_clear','load');
+ $html .= '</td>';
+ $html .= '<td>';
+ $html .= $cgi->submit('act_matrix_submit','delete');
+ $html .= '</td>';
+ $html .= '</tr>';
+ $html .= '<tr>';
+ $html .= '<td>';
+ $html .= $cgi->textfield(-name=>'name_persquery');
+ $html .= '</td>';
+ $html .= '<td>';
+ $html .= $cgi->submit('act_matrix_clear','save');
+ $html .= '</td>';
+ $html .= '<td>';
+ $html .= 'hyperlink';
+ $html .= '</td>';
+ $html .= '</tr>';
+$html .= '</table>';
+
+$html .= '</table>';
+$html .= $cgi->end_form;
sub printparams {
my($cgi) = @_;
my(@values,$key);
foreach $key ($cgi->param) {
- print "<strong>$key</strong> -> ";
- @values = $query->param($key);
- print join(", ",@values),"<br>\n";
+ $html .= "<strong>$key</strong> -> ";
+ @values = $cgi->param($key);
+ $html .= join(", ",@values)."<br>\n";
}
}
+# my($cgi) = @=;
+
+
+
$html << 1;
# read HTML skeleton
@@ -159,7 +195,6 @@
);
$http .= $html;
print STDOUT $http;
-&printparams($cgi);
__END__
|