Add new parameter type which is actually a submit button

This commit is contained in:
Jamie Cameron
2011-11-30 21:42:43 -08:00
parent 35ade47f36
commit 4fa1f307ce
6 changed files with 18 additions and 4 deletions

View File

@ -38,3 +38,5 @@ A command can now be configured to not display any output at all, and instead re
---- Changes since 1.560 ---- ---- Changes since 1.560 ----
Added an option to the file editor to run a command before the file is displayed, thanks to a suggestion from Sart Cole. Added an option to the file editor to run a command before the file is displayed, thanks to a suggestion from Sart Cole.
Added new date and left-right menu parameter types. Added new date and left-right menu parameter types.
---- Changes since 1.570 ----
Added a new parameter type which is a submit button.

View File

@ -1,4 +1,3 @@
line1=Configurable options,11
display_mode=Main page shows,1,0-All commands and parameters,1-Links to commands display_mode=Main page shows,1,0-All commands and parameters,1-Links to commands
width=Width of file editor window,3,Default (80 chars) width=Width of file editor window,3,Default (80 chars)
height=Height of file editor window,3,Default (20 chars) height=Height of file editor window,3,Default (20 chars)

View File

@ -459,6 +459,9 @@ foreach my $a (@{$cmd->{'args'}}) {
$setin->{$n."_month"}."-". $setin->{$n."_month"}."-".
$setin->{$n."_day"}; $setin->{$n."_day"};
} }
elsif ($a->{'type'} == 16) {
$rv = $setin->{$n} ? 1 : 0;
}
if ($rv eq '' && $a->{'must'} && $a->{'type'} != 7) { if ($rv eq '' && $a->{'must'} && $a->{'type'} != 7) {
&error(&text('run_emust', $a->{'desc'})); &error(&text('run_emust', $a->{'desc'}));
} }
@ -620,6 +623,9 @@ elsif ($a->{'type'} == 15) {
$n."_day", $n."_month", $n."_year")." ". $n."_day", $n."_month", $n."_year")." ".
&date_chooser_button($n."_day", $n."_month", $n."_year"); &date_chooser_button($n."_day", $n."_month", $n."_year");
} }
elsif ($a->{'type'} == 16) {
return &ui_submit($v || $a->{'name'}, $a->{'name'});
}
else { else {
return "Unknown parameter type $a->{'type'}"; return "Unknown parameter type $a->{'type'}";
} }

View File

@ -35,12 +35,14 @@ print &ui_table_row(undef, $cmd->{'html'}, 4) if ($cmd->{'html'});
foreach $a (@{$cmd->{'args'}}) { foreach $a (@{$cmd->{'args'}}) {
print &ui_table_row(&html_escape($a->{'desc'}), print &ui_table_row(&html_escape($a->{'desc'}),
&show_parameter_input($a, 0)); &show_parameter_input($a, 0), 1,
[ "valign=top", "valign=top" ]);
$got_submit++ if ($a->{'type'} == 16);
} }
$txt = $cmd->{'edit'} ? $text{'form_edit'} : $text{'form_exec'}; $txt = $cmd->{'edit'} ? $text{'form_edit'} : $text{'form_exec'};
print &ui_table_end(); print &ui_table_end();
print &ui_form_end([ [ undef, $txt ] ]); print &ui_form_end($got_submit ? [ ] : [ [ undef, $txt ] ]);
&ui_print_footer("", $text{'index_return'}); &ui_print_footer("", $text{'index_return'});

View File

@ -56,7 +56,11 @@ elsif ($config{'display_mode'} == 0) {
$html .= &ui_table_start(undef, undef, $w, $html .= &ui_table_start(undef, undef, $w,
$config{'columns'} == 1 ? [ "width=20%", "width=30%" ] $config{'columns'} == 1 ? [ "width=20%", "width=30%" ]
: [ "width=30%" ]); : [ "width=30%" ]);
$html .= &ui_table_row(undef, &ui_submit($c->{'desc'}), $w, []); ($got_submit) = grep { $_->{'type'} == 16 } @a;
if (!$got_submit) {
$html .= &ui_table_row(undef,
&ui_submit($c->{'desc'}), $w, []);
}
if ($c->{'html'}) { if ($c->{'html'}) {
$html .= &ui_table_row(undef, $html .= &ui_table_row(undef,
&filter_javascript($c->{'html'}), $w, []); &filter_javascript($c->{'html'}), $w, []);

View File

@ -51,6 +51,7 @@ edit_type12=Multi menu..
edit_type13=Large multi menu.. edit_type13=Large multi menu..
edit_type14=Left-right menu.. edit_type14=Left-right menu..
edit_type15=Date edit_type15=Date
edit_type16=Submit button..
edit_noshow=Hide command when executing? edit_noshow=Hide command when executing?
edit_usermin=Available in Usermin? edit_usermin=Available in Usermin?
edit_timeout=Maximum time to wait for command? edit_timeout=Maximum time to wait for command?