Fixed some issues with unbound Gui pages

This commit is contained in:
Jos Schellevis 2015-01-27 16:51:18 +00:00
parent 60a5170dc8
commit b3fea6b917
6 changed files with 126 additions and 148 deletions

View File

@ -28,9 +28,9 @@ var addRowTo = (function() {
if(typeof(rowtype[i]) == 'function') {
td.innerHTML="<input type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "' />" + rowtype[i](rowname[i], rowsize[i], totalrows) + " ";
} else if(rowtype[i] == 'textbox') {
td.innerHTML="<input type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "' /><input size='" + rowsize[i] + "' class='formfld unknown' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "' /> ";
td.innerHTML="<input type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "' /><input size='" + rowsize[i] + "' class='formfld unknown' type='text' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "' /> ";
} else if(rowtype[i] == 'textbox,ipv4v6') {
td.innerHTML="<input type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "' /><input size='" + rowsize[i] + "' class='formfld unknown ipv4v6' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "' /> ";
td.innerHTML="<input type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "' /><input size='" + rowsize[i] + "' class='formfld unknown ipv4v6' type='text' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "' /> ";
} else if(rowtype[i] == 'password') {
td.innerHTML="<input type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "' /><input type='password' size='" + rowsize[i] + "' class='formfld pwd' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "' /> ";
} else if(rowtype[i] == 'select') {

View File

@ -134,7 +134,7 @@ if ($_GET['act'] == "del") {
$closehead = false;
$pgtitle = array(gettext("Services"),gettext("DNS forwarder"));
$shortcut_section = "resolver";
$shortcut_section = "forwarder";
include("head.inc");
?>

View File

@ -67,17 +67,18 @@ else
$pconfig['outgoing_interface'] = explode(",", $config['unbound']['outgoing_interface']);
if ($_POST) {
$pconfig = $_POST;
unset($input_errors);
if ($_POST['apply']) {
$retval = services_unbound_configure();
$savemsg = get_std_save_message($retval);
if ($retval == 0)
if ($retval == 0) {
clear_subsystem_dirty('unbound');
}
/* Update resolv.conf in case the interface bindings exclude localhost. */
system_resolvconf_generate();
} else {
$pconfig = $_POST;
if (isset($_POST['enable']) && isset($config['dnsmasq']['enable']))
$input_errors[] = "The system dns-forwarder is still active. Disable it before enabling the DNS Resolver.";
@ -156,6 +157,7 @@ if ($_GET['act'] == "del") {
$closehead = false;
$pgtitle = array(gettext("Services"),gettext("DNS Resolver"));
$shortcut_section = "resolver";
include_once("head.inc");
?>
@ -236,7 +238,7 @@ function show_advanced_dns() {
?>
<?=gettext("Interface IPs used by the DNS Resolver for responding to queries from clients. If an interface has both IPv4 and IPv6 IPs, both are used. Queries to other interface IPs not selected below are discarded. The default behavior is to respond to queries on every available IPv4 and IPv6 address.");?>
<br /><br />
<select id="active_interface" name="active_interface[]" multiple="multiple" size="3">
<select id="active_interface" name="active_interface[]" multiple="multiple" size="3" class="selectpicker" data-live-search="true">
<option value="" <?php if (empty($pconfig['active_interface']) || empty($pconfig['active_interface'][0])) echo 'selected="selected"'; ?>>All</option>
<?php
foreach ($interface_addresses as $laddr):
@ -261,7 +263,7 @@ function show_advanced_dns() {
?>
<?=gettext("Utilize different network interface(s) that the DNS Resolver will use to send queries to authoritative servers and receive their replies. By default all interfaces are used.");?>
<br /><br />
<select id="outgoing_interface" name="outgoing_interface[]" multiple="multiple" size="3">
<select id="outgoing_interface" name="outgoing_interface[]" multiple="multiple" size="3" class="selectpicker" data-live-search="true">
<option value="" <?php if (empty($pconfig['outgoing_interface']) || empty($pconfig['outgoing_interface'][0])) echo 'selected="selected"'; ?>>All</option>
<?php
foreach ($interface_addresses as $laddr):
@ -327,7 +329,7 @@ function show_advanced_dns() {
<td width="22%" valign="top" class="vncellreq"><?=gettext("Advanced");?></td>
<td width="78%" class="vtable">
<div id="showadvbox" <?php if ($pconfig['custom_options']) echo "style='display:none'"; ?>>
<input type="button" onclick="show_advanced_dns()" value="<?=gettext("Advanced"); ?>" /> - <?=gettext("Show advanced option");?>
<input type="button" class="btn btn-xs btn-default" onclick="show_advanced_dns()" value="<?=gettext("Advanced"); ?>" /> - <?=gettext("Show advanced option");?>
</div>
<div id="showadv" <?php if (empty($pconfig['custom_options'])) echo "style='display:none'"; ?>>
<strong><?=gettext("Advanced");?><br /></strong>

View File

@ -136,6 +136,8 @@ include("head.inc");
?>
<body>
<script type="text/javascript" src="/javascript/jquery.ipv4v6ify.js"></script>
<script type="text/javascript" src="/javascript/row_helper.js"></script>
@ -154,10 +156,6 @@ include("head.inc");
rowsize[2] = "40";
//]]>
</script>
</head>
<body>
<?php include("fbegin.inc"); ?>
<section class="page-content-main">
@ -191,153 +189,134 @@ include("head.inc");
?>
<div class="tab-content content-box col-xs-12">
<form action="services_unbound_acls.php" method="post" name="iform" id="iform">
<?php if($act=="new" || $act=="edit"): ?>
<input name="aclid" type="hidden" value="<?=$id;?>" />
<input name="act" type="hidden" value="<?=$act;?>" />
<div class="table-responsive">
<table class="table table-striped">
<tr>
<td colspan="2" valign="top" class="listtopic"><?=ucwords(sprintf(gettext("%s Access List"),$act));?></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Access List name");?></td>
<td width="78%" class="vtable">
<input name="aclname" type="text" class="formfld" id="aclname" size="30" maxlength="30" value="<?=htmlspecialchars($pconfig['aclname']);?>" />
<br />
<span class="vexpl"><?=gettext("Provide an Access List name.");?></span>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Action");?></td>
<td width="78%" class="vtable">
<select name="aclaction" class="formselect">
<?php $types = explode(",", "Allow,Deny,Refuse,Allow Snoop"); foreach ($types as $type): ?>
<option value="<?=strtolower($type);?>" <?php if (strtolower($type) == strtolower($pconfig['aclaction'])) echo "selected=\"selected\""; ?>>
<?=htmlspecialchars($type);?>
</option>
<?php endforeach; ?>
</select>
<br />
<span class="vexpl">
<table class="table table-striped">
<tr>
<td colspan="2"><?=ucwords(sprintf(gettext("%s Access List"),$act));?></td>
</tr>
<tr>
<td width="22%"><?=gettext("Access List name");?></td>
<td width="78%">
<input name="aclname" type="text" class="formfld" id="aclname" size="30" maxlength="30" value="<?=htmlspecialchars($pconfig['aclname']);?>" />
<br />
<span><?=gettext("Provide an Access List name.");?></span>
</td>
</tr>
<tr>
<td width="22%"><?=gettext("Action");?></td>
<td width="78%">
<select name="aclaction" class="selectpicker">
<?php $types = explode(",", "Allow,Deny,Refuse,Allow Snoop"); foreach ($types as $type): ?>
<option value="<?=strtolower($type);?>" <?php if (strtolower($type) == strtolower($pconfig['aclaction'])) echo "selected=\"selected\""; ?>>
<?=htmlspecialchars($type);?>
</option>
<?php endforeach; ?>
</select>
<br />
<span class="text-default">
<?=gettext("Choose what to do with DNS requests that match the criteria specified below.");?> <br />
<?=gettext("<b>Deny:</b> This action stops queries from hosts within the netblock defined below.");?> <br />
<?=gettext("<b>Refuse:</b> This action also stops queries from hosts within the netblock defined below, but sends a DNS rcode REFUSED error message back to the client.");?> <br />
<?=gettext("<b>Allow:</b> This action allows queries from hosts within the netblock defined below.");?> <br />
<?=gettext("<b>Allow Snoop:</b> This action allows recursive and nonrecursive access from hosts within the netblock defined below. Used for cache snooping and ideally should only be configured for your administrative host.");?> <br />
</span>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Networks");?></td>
<td width="78%" class="vtable">
<table id="maintable" summary="networks">
<tbody>
</span>
</td>
</tr>
<tr>
<td width="22%"><?=gettext("Networks");?></td>
<td width="78%">
<table id="maintable" summary="networks" class="table table-striped">
<tr>
<td><div id="onecolumn"><?=gettext("Network");?></div></td>
<td><div id="twocolumn"><?=gettext("CIDR");?></div></td>
<td><div id="threecolumn"><?=gettext("Description");?></div></td>
<td></td>
</tr>
<?php $counter = 0; ?>
<?php
<?php $counter = 0;
if($networkacl)
foreach($networkacl as $item):
?>
<?php
$network = $item['acl_network'];
$cidr = $item['mask'];
$description = $item['description'];
?>
<tr>
<td>
<input name="acl_network<?=$counter;?>" type="text" class="formfld unknown ipv4v6" id="acl_network<?=$counter;?>" size="30" value="<?=htmlspecialchars($network);?>" />
</td>
<td>
<select name="mask<?=$counter;?>" class="formselect ipv4v6" id="mask<?=$counter;?>">
<?php
for ($i = 128; $i > 0; $i--) {
echo "<option value=\"$i\" ";
if ($i == $cidr) echo "selected=\"selected\"";
echo ">" . $i . "</option>";
}
?>
</select>
</td>
<td>
<input name="description<?=$counter;?>" type="text" class="formfld unknown" id="description<?=$counter;?>" size="40" value="<?=htmlspecialchars($description);?>" />
</td>
<td>
<a onclick="removeRow(this); return false;" href="#" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></a>
</td>
</tr>
?>
<tr>
<td>
<input name="acl_network<?=$counter;?>" type="text" class="formfld unknown ipv4v6" id="acl_network<?=$counter;?>" size="30" value="<?=htmlspecialchars($network);?>" />
</td>
<td>
<select name="mask<?=$counter;?>" class="formselect ipv4v6" id="mask<?=$counter;?>">
<?php
for ($i = 128; $i > 0; $i--) {
echo "<option value=\"$i\" ";
if ($i == $cidr) echo "selected=\"selected\"";
echo ">" . $i . "</option>";
}
?>
</select>
</td>
<td>
<input name="description<?=$counter;?>" type="text" class="formfld unknown" id="description<?=$counter;?>" size="40" value="<?=htmlspecialchars($description);?>" />
</td>
<td>
<a onclick="removeRow(this); return false;" href="#" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></a>
</td>
</tr>
<?php $counter++; ?>
<?php endforeach; ?>
</tbody>
</table>
<a onclick="javascript:addRowTo('maintable', 'formfldalias'); return false;" href="#" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-plus"></span>
</a>
<script type="text/javascript">
//<![CDATA[
field_counter_js = 3;
rows = 1;
totalrows = <?php echo $counter; ?>;
loaded = <?php echo $counter; ?>;
//]]>
</script>
</td>
</tr>
<a onclick="javascript:addRowTo('maintable', 'formfldalias'); return false;" href="#" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span>
</a>
<script type="text/javascript">
//<![CDATA[
field_counter_js = 3;
rows = 1;
totalrows = <?php echo $counter; ?>;
loaded = <?php echo $counter; ?>;
//]]>
</script>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td>
<td width="78%" class="vtable">
<input name="description" type="text" class="formfld unknown" id="description" size="52" maxlength="52" value="<?=htmlspecialchars($pconfig['description']);?>" />
<br />
<span class="vexpl"><?=gettext("You may enter a description here for your reference.");?></span>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<tr>
<td width="22%" valign="top"><?=gettext("Description");?></td>
<td width="78%">
<input name="description" type="text" class="formfld unknown" id="description" size="52" maxlength="52" value="<?=htmlspecialchars($pconfig['description']);?>" />
<br />
<span><?=gettext("You may enter a description here for your reference.");?></span>
</td>
</tr>
<tr>
<td width="22%">&nbsp;</td>
<td width="78%">
&nbsp;<br />&nbsp;
<input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" />
<input type="button" class="btn btn-default" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<?php else: ?>
<div class="table-responsive">
<table class="table table-striped sortable">
<table class="table table-striped">
<thead>
<tr>
<td width="25%" class="listhdrr"><?=gettext("Access List Name"); ?></td>
<td width="25%" class="listhdrr"><?=gettext("Action"); ?></td>
<td width="45%" class="listhdr"><?=gettext("Description"); ?></td>
<td width="5%" class="list">&nbsp;</td>
<td width="40%" class="listhdr"><?=gettext("Description"); ?></td>
<td width="10%" class="list"></td>
</tr>
</thead>
<tfoot>
<tr>
<td class="list" colspan="3">&nbsp;</td>
<td class="list">
<table border="0" cellspacing="0" cellpadding="1" summary="icons">
<tr>
<td width="17">&nbsp;</td>
<td valign="middle"><a href="services_unbound_acls.php?act=new" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a></td>
</tr>
</table>
<td colspan="3"></td>
<td>
<a href="services_unbound_acls.php?act=new" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a>
</td>
</tr>
<tr>
@ -348,28 +327,23 @@ include("head.inc");
</td>
</tr>
</tfoot>
<tbody>
<?php
$i = 0;
foreach($a_acls as $acl):
?>
<tr ondblclick="document.location='services_unbound_acls.php?act=edit&amp;id=<?=$i;?>'">
<td class="listlr">
<td>
<?=htmlspecialchars($acl['aclname']);?>
</td>
<td class="listr">
<td>
<?=htmlspecialchars($acl['aclaction']);?>
</td>
<td class="listbg">
<td>
<?=htmlspecialchars($acl['description']);?>
</td>
<td valign="middle" class="list nowrap">
<table border="0" cellspacing="0" cellpadding="1" summary="icons">
<tr>
<td valign="middle"><a href="services_unbound_acls.php?act=edit&amp;id=<?=$i;?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a></td>
<td valign="middle"><a href="services_unbound_acls.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this access list?"); ?>')" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></a></td>
</tr>
</table>
<td>
<a href="services_unbound_acls.php?act=edit&amp;id=<?=$i;?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="services_unbound_acls.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this access list?"); ?>')" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></a>
</td>
</tr>
<?php
@ -377,12 +351,9 @@ include("head.inc");
endforeach;
?>
<tr style="display:none"><td></td></tr>
</tbody>
</table>
</div>
<?php endif; ?>
</form>
</div>
</section>
</div>

View File

@ -201,7 +201,7 @@ include_once("head.inc");
<td width="22%" valign="top" class="vncell"><?=gettext("Message Cache Size");?></td>
<td width="78%" class="vtable">
<p>
<select id="msgcachesize" name="msgcachesize">
<select id="msgcachesize" name="msgcachesize" class="selectpicker">
<?php
foreach (array("4", "10", "20", "50", "100", "250", "512") as $size) :
?>
@ -220,7 +220,7 @@ include_once("head.inc");
<td width="22%" valign="top" class="vncell"><?=gettext("Outgoing TCP Buffers");?></td>
<td width="78%" class="vtable">
<p>
<select id="outgoing_num_tcp" name="outgoing_num_tcp">
<select id="outgoing_num_tcp" name="outgoing_num_tcp" class="selectpicker">
<?php
for ($num_tcp = 0; $num_tcp <= 50; $num_tcp += 10):
?>
@ -239,7 +239,7 @@ include_once("head.inc");
<td width="22%" valign="top" class="vncell"><?=gettext("Incoming TCP Buffers");?></td>
<td width="78%" class="vtable">
<p>
<select id="incoming_num_tcp" name="incoming_num_tcp">
<select id="incoming_num_tcp" name="incoming_num_tcp" class="selectpicker">
<?php
for ($num_tcp = 0; $num_tcp <= 50; $num_tcp += 10):
?>
@ -258,7 +258,7 @@ include_once("head.inc");
<td width="22%" valign="top" class="vncell"><?=gettext("EDNS Buffer Size");?></td>
<td width="78%" class="vtable">
<p>
<select id="edns_buffer_size" name="edns_buffer_size">
<select id="edns_buffer_size" name="edns_buffer_size" class="selectpicker">
<?php
foreach (array("512", "1480", "4096") as $size) :
?>
@ -277,7 +277,7 @@ include_once("head.inc");
<td width="22%" valign="top" class="vncell"><?=gettext("Number of queries per thread");?></td>
<td width="78%" class="vtable">
<p>
<select id="num_queries_per_thread" name="num_queries_per_thread">
<select id="num_queries_per_thread" name="num_queries_per_thread" class="selectpicker">
<?php
foreach (array("512", "1024", "2048") as $queries) :
?>
@ -296,7 +296,7 @@ include_once("head.inc");
<td width="22%" valign="top" class="vncell"><?=gettext("Jostle Timeout");?></td>
<td width="78%" class="vtable">
<p>
<select id="jostle_timeout" name="jostle_timeout">
<select id="jostle_timeout" name="jostle_timeout" class="selectpicker">
<?php
foreach (array("100", "200", "500", "1000") as $timeout) :
?>
@ -333,7 +333,7 @@ include_once("head.inc");
<td width="22%" valign="top" class="vncell"><?=gettext("TTL for Host cache entries");?></td>
<td width="78%" class="vtable">
<p>
<select id="infra_host_ttl" name="infra_host_ttl">
<select id="infra_host_ttl" name="infra_host_ttl" class="selectpicker">
<option value="60" <?php if ($pconfig['infra_host_ttl'] == "60") echo "selected=\"selected\""; ?>>1 minute</option>
<option value="120" <?php if ($pconfig['infra_host_ttl'] == "120") echo "selected=\"selected\""; ?>>2 minutes</option>
<option value="300" <?php if ($pconfig['infra_host_ttl'] == "300") echo "selected=\"selected\""; ?>>5 minutes</option>
@ -348,7 +348,7 @@ include_once("head.inc");
<td width="22%" valign="top" class="vncell"><?=gettext("TTL for lame delegation");?></td>
<td width="78%" class="vtable">
<p>
<select id="infra_lame_ttl" name="infra_lame_ttl">
<select id="infra_lame_ttl" name="infra_lame_ttl" class="selectpicker">
<option value="60" <?php if ($pconfig['infra_lame_ttl'] == "60") echo "selected=\"selected\""; ?>>1 minute</option>
<option value="120" <?php if ($pconfig['infra_lame_ttl'] == "120") echo "selected=\"selected\""; ?>>2 minutes</option>
<option value="300" <?php if ($pconfig['infra_lame_ttl'] == "300") echo "selected=\"selected\""; ?>>5 minutes</option>
@ -363,7 +363,7 @@ include_once("head.inc");
<td width="22%" valign="top" class="vncell"><?=gettext("Number of Hosts to cache");?></td>
<td width="78%" class="vtable">
<p>
<select id="infra_cache_numhosts" name="infra_cache_numhosts">
<select id="infra_cache_numhosts" name="infra_cache_numhosts" class="selectpicker">
<option value="1000" <?php if ($pconfig['infra_cache_numhosts'] == "1000") echo "selected=\"selected\""; ?>>1000</option>
<option value="5000" <?php if ($pconfig['infra_cache_numhosts'] == "5000") echo "selected=\"selected\""; ?>>5000</option>
<option value="10000" <?php if ($pconfig['infra_cache_numhosts'] == "10000") echo "selected=\"selected\""; ?>>10 000</option>
@ -378,7 +378,7 @@ include_once("head.inc");
<td width="22%" valign="top" class="vncell"><?=gettext("Unwanted Reply Threshold");?></td>
<td width="78%" class="vtable">
<p>
<select id="unwanted_reply_threshold" name="unwanted_reply_threshold">
<select id="unwanted_reply_threshold" name="unwanted_reply_threshold" class="selectpicker">
<option value="disabled" <?php if ($pconfig['unwanted_reply_threshold'] == "disabled") echo "selected=\"selected\""; ?>>disabled</option>
<option value="5000000" <?php if ($pconfig['unwanted_reply_threshold'] == "5000000") echo "selected=\"selected\""; ?>>5 million</option>
<option value="10000000" <?php if ($pconfig['unwanted_reply_threshold'] == "10000000") echo "selected=\"selected\""; ?>>10 million</option>
@ -394,7 +394,7 @@ include_once("head.inc");
<td width="22%" valign="top" class="vncell"><?=gettext("Log level verbosity");?></td>
<td width="78%" class="vtable">
<p>
<select id="log_verbosity" name="log_verbosity">
<select id="log_verbosity" name="log_verbosity" class="selectpicker">
<?php
for ($level = 0; $level <= 5; $level++):
?>

View File

@ -223,10 +223,15 @@ $shortcuts['trafficshaper-limiters'] = array();
$shortcuts['trafficshaper-limiters']['main'] = "firewall_shaper_vinterface.php";
$shortcuts['trafficshaper-limiters']['status'] = "diag_limiter_info.php";
$shortcuts['forwarder'] = array();
$shortcuts['forwarder']['main'] = "services_dnsmasq.php";
$shortcuts['forwarder']['log'] = "diag_logs_resolver.php";
$shortcuts['forwarder']['service'] = "dnsmasq";
$shortcuts['resolver'] = array();
$shortcuts['resolver']['main'] = "services_dnsmasq.php";
$shortcuts['resolver']['main'] = "services_unbound.php";
$shortcuts['resolver']['log'] = "diag_logs_resolver.php";
$shortcuts['resolver']['service'] = "dnsmasq";
$shortcuts['resolver']['service'] = "unbound";
$shortcuts['wireless'] = array();
$shortcuts['wireless']['main'] = "interfaces_wireless.php";