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

Merge branch '6039-update-the-system-plugin' into '1.4-dev'

Resolve "update the system plugin"

See merge request fusiondirectory/fd-plugins!756
parents 22e405ea 568b8ae8
......@@ -57,7 +57,7 @@ class InterfacesAttribute extends DialogOrderedArrayAttribute
function setValue ($value)
{
return $this->plugin->filter->loadTemplateValues($value);
return $this->plugin->setNetworkInterfaces($value);
}
protected function getAttributeArrayValue ($key, $value)
......
......@@ -409,27 +409,38 @@ class interfacesManagement extends management implements SimpleTab
return [];
}
public function adapt_from_template (array $attrs, array $skip = [])
public function setNetworkInterfaces ($interfaces = NULL)
{
$this->attrs = array_merge($this->attrs, $attrs);
if (isset($this->attrs['networkInterfaces']) && !in_array('networkInterfaces', $skip)) {
unset($this->attrs['networkInterfaces']['count']);
$this->filter->loadTemplateValues($this->attrs['networkInterfaces']);
if ($interfaces !== NULL) {
$this->filter->loadTemplateValues($interfaces);
}
$this->listing->update();
$this->listing->update();
$entryIterator = $this->listing->getIterator();
$entryIterator = $this->listing->getIterator();
$this->interfaces = [];
foreach ($entryIterator as $entry) {
$this->interfaces = [];
foreach ($entryIterator as $entry) {
if ($this->is_template) {
$this->interfaces[$entry->dn] = objects::createTemplate($entry->getTemplatedType());
} else {
$this->interfaces[$entry->dn] = objects::create($entry->getTemplatedType());
$this->filter->resetFromCache($entry->dn, $this->interfaces[$entry->dn]);
$this->interfaces[$entry->dn]->getBaseObject()->base = $this->getInterfacesBase();
}
$this->filter->resetFromCache($entry->dn, $this->interfaces[$entry->dn]);
$this->interfaces[$entry->dn]->getBaseObject()->base = $this->getInterfacesBase();
}
/* Fill ip/mac fields of main tab */
$this->save_object();
}
/* Fill ip/mac fields of main tab */
$this->save_object();
public function adapt_from_template (array $attrs, array $skip = [])
{
$this->attrs = array_merge($this->attrs, $attrs);
if (isset($this->attrs['networkInterfaces']) && !in_array('networkInterfaces', $skip)) {
unset($this->attrs['networkInterfaces']['count']);
$this->setNetworkInterfaces($this->attrs['networkInterfaces']);
}
}
......
Markdown is supported
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