« blib/lib/CGI/OptimalQuery/InteractiveQuery2Tools.pm
↑ Summary
blib/lib/CGI/OptimalQuery/SimpleQuery.pm »
| 1 | package CGI::OptimalQuery::ShowColumns; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | no warnings qw( uninitialized ); | ||
| 6 | use base 'CGI::OptimalQuery::Base'; | ||
| 7 | |||
| 8 | sub escapeHTML { CGI::OptimalQuery::Base::escapeHTML(@_) } | ||
| 9 | |||
| 10 | sub output { | ||
| 11 | my $o = shift; | ||
| 12 | my $buf = CGI::header('text/html'). | ||
| 13 | "<!DOCTYPE html> | ||
| 14 | <html> | ||
| 15 | <body> | ||
| 16 | <div class=OQAddColumnsPanel> | ||
| 17 | <h2>select fields to add ..</h2>"; | ||
| 18 | my $s = $$o{schema}{select}; | ||
| 19 | my @c = sort { $$s{$a}[2] cmp $$s{$b}[2] } keys %$s; | ||
| 20 | foreach my $colAlias (@c) { | ||
| 21 | my $label = $$s{$colAlias}[2]; | ||
| 22 | my $colOpts = $$s{$colAlias}[3]; | ||
| 23 | $buf .= '<label class=ckbox><input type=checkbox value="'.escapeHTML($colAlias).'">' | ||
| 24 | .escapeHTML($label).'</label>' | ||
| 25 | unless $label eq '' || $$colOpts{disable_select} || $$colOpts{is_hidden}; | ||
| 26 | } | ||
| 27 | $buf .= " | ||
| 28 | <p> | ||
| 29 | <label>display as: | ||
| 30 | <select id=ShowColumnsDisplayAs> | ||
| 31 | <option value=default>table rows | ||
| 32 | <option value=recview".(($$o{q}->param('mode') eq 'recview')?" selected":"").">records | ||
| 33 | </select> | ||
| 34 | </label> | ||
| 35 | <p> | ||
| 36 | <button class=OQAddColumnsCancelBut>cancel</button> | ||
| 37 | <button class=OQAddColumnsOKBut>ok</button> | ||
| 38 | </div> | ||
| 39 | </body> | ||
| 40 | </html>"; | ||
| 41 | $$o{output_handler}->($buf); | ||
| 42 | return undef; | ||
| 43 | } | ||
| 44 | |||
| 45 | 1; |