More work
authorJamie Cameron <jcameron@webmin.com>
Wed, 9 Jan 2008 00:37:44 +0000 (00:37 +0000)
committerJamie Cameron <jcameron@webmin.com>
Wed, 9 Jan 2008 00:37:44 +0000 (00:37 +0000)
dhcp-dns/config.info
dhcp-dns/dhcp-dns-lib.pl
dhcp-dns/index.cgi
dhcp-dns/module.info

index d0c585e..1484505 100644 (file)
@@ -1,2 +1,2 @@
 domain=DNS domain for hosts,0
-subnets=DHCP subnets for hosts,0
+subnets=DHCP subnets for hosts<br>(In network/netmask format),0
index fef6582..9f59173 100644 (file)
@@ -10,6 +10,32 @@ do '../ui-lib.pl';
 # Returns a list of DHCP host structures for managed hosts
 sub list_dhcp_hosts
 {
+local $conf = &dhcpd::get_config();
+local $parent = &dhcpd::get_parent_config();
+local @rv;
+foreach my $h (&dhcpd::find("host", $conf)) {
+       $h->{'parent'} = $parent;
+       push(@rv, $h);
+       }
+foreach my $g (&dhcpd::find("group", $conf)) {
+       foreach my $h (&dhcpd::find("host", $g->{'members'})) {
+               $h->{'parent'} = $g;
+               push(@rv, $h);
+               }
+       }
+foreach my $s (&dhcpd::find("subnet", $conf)) {
+       foreach my $h (&dhcpd::find("host", $s->{'members'})) {
+               $h->{'parent'} = $s;
+               push(@rv, $h);
+               }
+       foreach my $g (&dhcpd::find("group", $s->{'members'})) {
+               foreach my $h (&dhcpd::find("host", $g->{'members'})) {
+                       $h->{'parent'} = $g;
+                       push(@rv, $h);
+                       }
+               }
+       }
+return @rv;
 }
 
 # host_form([&host])
@@ -30,9 +56,9 @@ $rv .= &ui_table_start($text{'form_header'}, "width=100%", 2);
 
 # Hostname
 local $short = &short_hostname($h->{'values'}->[0]);
-local $indom = $new || $short eq $h->{'values'}->[0];
+local $indom = $new || $short ne $h->{'values'}->[0];
 $rv .= &ui_table_row($text{'form_host'},
-       &ui_textbox("host", $short, 40).
+       &ui_textbox("host", $short, 20).
        ($indom ? "<tt>.$config{'domain'}</tt>" : ""));
 $rv .= &ui_hidden("indom", 1);
 
@@ -44,7 +70,11 @@ $rv .= &ui_table_row($text{'form_ip'},
 # MAC address
 local $hard = &dhcpd::find("hardware", $h->{'members'});
 $rv .= &ui_table_row($text{'form_mac'},
-       &ui_textbox("mac", $hard ? $hard->{'values'}->[0] : undef, 20));
+       &ui_select("media", $hard ? $hard->{'values'}->[0] : "ethernet",
+                  [ [ "ethernet", $text{'form_ethernet'} ],
+                    [ "token-ring", $text{'form_tr'} ],
+                    [ "fddi", $text{'form_fddi'} ] ], 1, 0, 1).
+       &ui_textbox("mac", $hard ? $hard->{'values'}->[1] : undef, 20));
 
 $rv .= &ui_table_end();
 if ($new) {
index d406ee5..ff16272 100644 (file)
@@ -27,13 +27,11 @@ print &ui_hidden_end();
 
 # Show hosts, if any
 @hosts = &list_dhcp_hosts();
-@links = ( "<a href='edit.cgi?new=1'>$text{'index_add'}</a>" );
 if (@hosts) {
        @tds = ( "width=5" );
        print &ui_form_start("delete.cgi");
        @links = ( &select_all_link("d", 1),
-                  &select_invert_link("d", 1),
-                  @links );
+                  &select_invert_link("d", 1) );
        print &ui_links_row(\@links);
        print &ui_columns_start([ "",
                                  $text{'index_host'},
@@ -44,9 +42,12 @@ if (@hosts) {
                $fixed = &dhcpd::find("fixed-address", $h->{'members'});
                $hard = &dhcpd::find("hardware", $h->{'members'});
                print &ui_checked_columns_row([
-                       &html_escape(&short_hostname($h->{'values'}->[0])),
+                       "<a href='edit.cgi?host=".&urlize($h->{'values'}->[0]).
+                       "'>".
+                       &html_escape(&short_hostname($h->{'values'}->[0])).
+                       "</a>",
                        $fixed ? $fixed->{'values'}->[0] : undef,
-                       $hard ? $hard->{'values'}->[0] : undef,
+                       $hard ? $hard->{'values'}->[1] : undef,
                        ], \@tds, "d", $h->{'values'}->[0])
                }
        print &ui_columns_end();
index c9cb0d5..8e5da31 100644 (file)
@@ -1,3 +1,3 @@
-desc=DHCP and DNS Client
+desc=DHCP and DNS Hosts
 category=servers
 depends=bind8 dhcpd