Multi-menu parameter type

This commit is contained in:
Jamie Cameron
2010-07-12 21:53:48 -07:00
parent a36c00f824
commit ed63da807e
3 changed files with 18 additions and 0 deletions

View File

@ -29,3 +29,4 @@ Added a button to clone an existing command when editing.
The sort order of commands can now be set on the Module Config page, and is respected in the Webmin Users module.
---- Changes since 1.510 ----
Fixed a bug that broke remote command execution with parameters.
Added a new parameter type for selecting multiple items from a menu.

View File

@ -431,6 +431,18 @@ foreach my $a (@{$cmd->{'args'}}) {
chown($uinfo->[2], $uinfo->[3], $rv);
push(@unlink, $rv);
}
elsif ($a->{'type'} == 12) {
local @vals = split(/\0/, $setin->{$n});
local @opts = &read_opts_file($a->{'opts'});
foreach my $v (@vals) {
local $found;
foreach my $l (@opts) {
$found++ if ($l->[0] eq $v);
}
$found || &error($text{'run_eopt'});
}
$rv = join(" ", @vals);
}
if ($rv eq '' && $a->{'must'} && $a->{'type'} != 7) {
&error(&text('run_emust', $a->{'desc'}));
}
@ -552,6 +564,10 @@ elsif ($a->{'type'} == 10) {
elsif ($a->{'type'} == 11) {
return &ui_textarea($n, undef, 4, 30);
}
elsif ($a->{'type'} == 12) {
return &ui_select($n, undef, [ &read_opts_file($a->{'opts'}) ],
5, 1);
}
else {
return "Unknown parameter type $a->{'type'}";
}

View File

@ -46,6 +46,7 @@ edit_type8=Password
edit_type9=Menu..
edit_type10=Upload
edit_type11=Text box
edit_type12=Multi menu..
edit_noshow=Hide command when executing?
edit_usermin=Available in Usermin?
edit_timeout=Maximum time to wait for command?