Multi-value options support
authorJamie Cameron <jcameron@webmin.com>
Fri, 7 May 2010 05:20:44 +0000 (22:20 -0700)
committerJamie Cameron <jcameron@webmin.com>
Fri, 7 May 2010 05:20:44 +0000 (22:20 -0700)
dhcpd/CHANGELOG
dhcpd/edit_options.cgi
dhcpd/save_options.cgi

index 937a748..d3ac820 100644 (file)
@@ -35,3 +35,5 @@ Converted buttons on the module's main page to use the Webmin UI library.
 Expired leases are no longer counted towards usage on the DHCP Leases page.
 Added a mode to the DHCP Leases page to show usage by subnet, thanks to a suggestion by Coles.
 When applying the configuration fails with an error mentioning a line in the config file, 10 lines around that will also be displayed by Webmin in the error.
+---- Changes since 1.510 ----
+Added support for multi-value options, thanks to a patch from Luke Suchocki.
index 01684a5..1a002fa 100755 (executable)
@@ -147,8 +147,9 @@ if ($config{'dhcpd_version'} >= 3) {
                printf "<input name=dnum_$i size=4 value='%s'>\n",
                        $o->{'values'}->[2];
                print "$text{'eopt_dtype'}\n";
+               my $a=scalar(@{$o->{'values'}})-1;
                printf "<input name=dtype_$i size=10 value='%s'>\n",
-                       $o->{'values'}->[4];
+                       join(" ",@{$o->{'values'}}[4..$a]);
                print "</td> </tr>\n";
                }
 
index 97c7fdc..af65249 100755 (executable)
@@ -98,7 +98,7 @@ if ($config{'dhcpd_version'} >= 3) {
                        &error(&text('sopt_edname', $in{"dname_$i"}));
                $in{"dnum_$i"} =~ /^\d+$/ ||
                        &error(&text('sopt_ednum', $in{"dnum_$i"}));
-               $in{"dtype_$i"} =~ /^[a-z0-9\.\-\_]+$/i ||
+               $in{"dtype_$i"} =~ /^[a-z0-9\s\.\-\_]+$/i ||
                        &error(&text('sopt_edtype', $in{"dtype_$i"}));
                push(@newdefs, { 'name' => 'option',
                                 'values' => [ $in{"dname_$i"}, "code",