2 # Show a list of clients, and a form to add
4 require './dhcp-dns-lib.pl';
5 &ui_print_header(undef, $module_info{'desc'}, "", undef, 1, 1);
9 if (!&foreign_installed("bind8", 1)) {
10 &ui_print_endpage(&text('index_ebind8', "../bind8/"));
12 if (!&foreign_installed("dhcpd", 1)) {
13 &ui_print_endpage(&text('index_edhcpd', "../dhcpd/"));
17 if (!$config{'domain'}) {
18 &ui_print_endpage(&text('index_edomain', "../config.cgi?$module_name"));
20 ($fn, $recs) = &get_dns_zone();
22 &ui_print_endpage(&text('index_edomain2', "../config.cgi?$module_name",
27 print &ui_hidden_start($text{'index_cheader'}, "create", 0, "index.cgi");
29 print &ui_hidden_end();
32 @hosts = &list_dhcp_hosts();
35 print &ui_form_start("index.cgi");
36 print $text{'index_search'}," ",
37 &ui_textbox("search", $in{'search'}, 40)," ",
38 &ui_submit($text{'index_ok'}),"<p>\n",
43 $fixed = &dhcpd::find("fixed-address", $_->{'members'});
44 $hard = &dhcpd::find("hardware", $_->{'members'});
45 $_->{'values'}->[0] =~ /\Q$s\E/i ||
46 $_->{'comment'} =~ /\Q$s\E/i ||
47 $fixed->{'values'}->[0] =~ /\Q$s\E/i ||
48 $hard->{'values'}->[1] =~ /\Q$s\E/i } @hosts;
54 print &ui_form_start("delete.cgi");
55 @links = ( &select_invert_link("d", 1) );
56 print &ui_links_row(\@links);
57 print &ui_columns_start([ "",
59 $text{'index_subnet'},
64 foreach $h (sort { lc($a->{'values'}->[0]) cmp
65 lc($b->{'values'}->[0]) } @hosts) {
66 $fixed = &dhcpd::find("fixed-address", $h->{'members'});
67 $hard = &dhcpd::find("hardware", $h->{'members'});
69 my $par = $h->{'parent'};
71 if ($par->{'name'} eq 'subnet') {
72 $parentdesc = $par->{'values'}->[0];
74 elsif ($par->{'name'} eq 'group') {
75 $parentdesc = $par->{'comment'} || 'Group';
77 elsif ($par->{'name'} eq 'shared-network') {
78 $parentdesc = $par->{'values'}->[0];
81 print &ui_checked_columns_row([
82 "<a href='edit.cgi?host=".&urlize($h->{'values'}->[0]).
84 &html_escape(&short_hostname($h->{'values'}->[0])).
87 $fixed ? $fixed->{'values'}->[0] : undef,
88 $hard ? $hard->{'values'}->[1] : undef,
89 &html_escape($h->{'comment'}),
90 ], \@tds, "d", $h->{'values'}->[0])
92 print &ui_columns_end();
93 print &ui_links_row(\@links);
94 print &ui_form_end([ [ undef, $text{'index_delete'} ] ]);
96 elsif ($in{'search'}) {
97 # Nothing matched search
98 print "<b>$text{'index_none2'}</b><p>\n";
102 print "<b>$text{'index_none'}</b><p>\n";
106 print &ui_buttons_start();
107 print &ui_buttons_row("apply.cgi", $text{'index_apply'},
108 $text{'index_applydesc'});
109 print &ui_buttons_end();
111 &ui_print_footer("/", $text{'index'});