3 # Display the DNS client configuration
5 require './net-lib.pl';
6 $access{'dns'} || &error($text{'dns_ecannot'});
7 &ui_print_header(undef, $text{'dns_title'}, "");
8 $dns = &get_dns_config();
11 print &ui_form_start("save_dns.cgi");
12 print &ui_table_start($text{'dns_options'}, "width=100%", 4);
14 # Find hostname in /etc/hosts, offer to fix
15 @hosts = &list_hosts();
17 foreach $n (@{$h->{'hosts'}}) {
18 $found++ if ($n eq &get_hostname());
23 print &ui_table_row($text{'dns_hostname'},
24 &ui_textbox("hostname", &get_hostname(), 40).
25 ($found ? "<br>".&ui_checkbox("hosts", 1, $text{'dns_hoststoo'}, 1)
28 # DNS resolution order
29 $order = &order_input($dns);
31 print &ui_table_row($text{'dns_order'}, $order, 3);
34 # Check if hostname is set from DHCP
36 #$dhost = defined(&get_dhcp_hostname) ? &get_dhcp_hostname() : -1;
38 # print "<tr> <td></td>\n";
39 # print "<td>",&ui_checkbox("dhcp", 1, $text{'dns_dhcp'}, $dhost),
45 for($i=0; $i<$max_dns_servers || $i<@{$dns->{'nameserver'}}+1; $i++) {
46 push(@nslist, &ui_textbox("nameserver_$i",
47 $dns->{'nameserver'}->[$i], 15));
49 print &ui_table_row($text{'dns_servers'}.
50 ($dns->{'name'} ? " ".$dns->{'name'}[0] : ""),
51 join("<br>", @nslist));
52 print &ui_hidden("name0", $dns->{'name'}[0]) if ($dns->{'name'});
54 # Additional DNS servers, as seen on Windows
55 if (@{$dns->{'name'}} > 1) {
56 for ($j=1; $j<@{$dns->{'name'}}; $j++) {
58 for ($i=0; $i<$max_dns_servers; $i++) {
59 push(@nslist, &ui_textbox("nameserver${j}_$i",
60 $dns->{"nameserver$j"}->[$i], 15));
62 print &ui_table_row($text{'dns_servers'}." ".$dns->{'name'}[$j],
63 join("<br>", @nslist));
64 print &ui_hidden("name$j", $dns->{'name'}[$j]);
69 print &ui_table_row($text{'dns_search'},
70 &ui_radio("domain_def", $dns->{'domain'} ? 0 : 1,
71 [ [ 1, $text{'dns_none'} ],
72 [ 0, $text{'dns_listed'} ] ])."<br>".
73 &ui_textarea("domain", join("\n", @{$dns->{'domain'}}), 3, 30));
76 print &ui_table_end();
77 if ($access{'dns'} == 2) {
78 print &ui_form_end([ [ undef, $text{'save'} ] ]);
84 &ui_print_footer("", $text{'index_return'});