#!/usr/local/bin/perl
# list_dns.cgi
# Display the DNS client configuration

require './net-lib.pl';
$access{'dns'} || &error($text{'dns_ecannot'});
&header($text{'dns_title'}, "");
print "<hr>\n";

$dns = &get_dns_config();
print "<form action=save_dns.cgi>\n";
print "<table border width=100%>\n";
print "<tr $tb> <td><b>$text{'dns_options'}</b></td> </tr>\n";
print "<tr $cb> <td><table width=100%>\n";

print "<tr> <td><b>$text{'dns_hostname'}</b></td>\n";
printf "<td><input name=hostname size=20 value=\"%s\"></td>\n",
	&get_hostname();

print "<td><b>$text{'dns_order'}</b></td>\n";
print "<td>",&order_input($dns),"</td> </tr>\n";

print "<tr> <td valign=top><b>$text{'dns_servers'}</b></td> <td>\n";
for($i=0; $i<$max_dns_servers; $i++) {
	printf "<input name=nameserver_$i size=15 value=\"%s\"><br>\n",
		$dns->{'nameserver'}->[$i];
	}
print "</td>\n";

print "<td valign=top><b>$text{'dns_search'}</b></td> <td valign=top>\n";
printf "<input type=radio name=domain_def value=1 %s> $text{'dns_none'}\n",
	$dns->{'domain'} ? "" : "checked";
printf "<input type=radio name=domain_def value=0 %s> $text{'dns_listed'}\n",
	$dns->{'domain'} ? "checked" : "";
print "<br><textarea name=domain rows=3 cols=30>",
	join("\n", @{$dns->{'domain'}}),"</textarea></td> </tr>\n";

print "</table></td></tr></table>\n";
print "<input type=submit value=\"$text{'save'}\">\n"
	if ($access{'dns'} == 2);
print "</form>\n";

print "<hr>\n";
&footer("", $text{'index_return'});

