Multi-menu parameter type
authorJamie Cameron <jcameron@webmin.com>
Tue, 13 Jul 2010 04:53:48 +0000 (21:53 -0700)
committerJamie Cameron <jcameron@webmin.com>
Tue, 13 Jul 2010 04:53:48 +0000 (21:53 -0700)
custom/CHANGELOG
custom/custom-lib.pl
custom/lang/en

index 36fe04c..bea1a6c 100644 (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.
index ea21dcb..e1c0b3c 100755 (executable)
@@ -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'}";
        }
index f8ad637..3492f4e 100644 (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?