From ed63da807e6c3ae3cc55f64513f3a77468bae2d3 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Mon, 12 Jul 2010 21:53:48 -0700 Subject: [PATCH] Multi-menu parameter type --- custom/CHANGELOG | 1 + custom/custom-lib.pl | 16 ++++++++++++++++ custom/lang/en | 1 + 3 files changed, 18 insertions(+) diff --git a/custom/CHANGELOG b/custom/CHANGELOG index 36fe04c64..bea1a6c0a 100644 --- a/custom/CHANGELOG +++ b/custom/CHANGELOG @@ -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. diff --git a/custom/custom-lib.pl b/custom/custom-lib.pl index ea21dcb56..e1c0b3c86 100755 --- a/custom/custom-lib.pl +++ b/custom/custom-lib.pl @@ -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'}"; } diff --git a/custom/lang/en b/custom/lang/en index f8ad6378f..3492f4e82 100644 --- a/custom/lang/en +++ b/custom/lang/en @@ -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?