Commit 40df3c70 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #1217 Printing only related DNS records

parent 29175424
......@@ -31,6 +31,7 @@ class dnsHost extends simplePlugin
'plIcon' => 'geticon.php?context=applications&icon=dns&size=48',
'plSmallIcon' => 'geticon.php?context=applications&icon=dns&size=16',
'plObjectType' => array('server', 'workstation'),
'plPriority' => 5,
'plProvidedAcls' => parent::generatePlProvidedAcls(self::getAttributesInfo())
);
......@@ -73,15 +74,21 @@ class dnsHost extends simplePlugin
$smarty->assign('usePrototype', 'true');
$dnsZones = $this->fdDNSZoneDn;
$dnsRecords = array();
$ips = $this->parent->getBaseObject()->ipHostNumber;
$cn = $this->parent->getBaseObject()->cn;
foreach($dnsZones as $dn) {
$tabObject = objects::open($dn, 'dnsZone');
$dnsRecords[] = array(
'records' => $tabObject->getBaseObject()->dnsRecords,
'records' => array_filter(
$tabObject->getBaseObject()->dnsRecords,
function ($record) use ($ips, $cn) {
return (in_array($record[2], $ips) || ($record[0] == $cn));
}
),
'name' => $tabObject->getBaseObject()->zoneName
);
}
$this->dnsRecords = $dnsRecords;
print_r($dnsRecords);
return parent::execute();
}
}
......@@ -3,7 +3,7 @@
{$section}
</span>
<div>
{if $attributes.dnsRecords}
{if is_array($attributes.dnsRecords)}
<ul>
{foreach from=$attributes.dnsRecords key=key item=node}
{if isset($node.img)}
......@@ -14,7 +14,7 @@
<a href="#" onclick="Effect.toggle('toggle_{$key}', 'blind', {literal}{ duration: 0.3 }{/literal}); return false;">
{$node.name}
</a>
<div id="toggle_{$key}" style="overflow: visible; display: none;">
<div id="toggle_{$key}" style="overflow: visible;">
<table class="listingTable">
<tbody>
{foreach from=$node.records item=record}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment