new type API
This commit is contained in:
parent
cc997a625f
commit
7d4dd7bda2
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
use \LAM\TYPES\TypeManager;
|
|
||||||
/*
|
/*
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
|
@ -163,7 +162,7 @@ class ddns extends baseModule {
|
||||||
public function module_complete() {
|
public function module_complete() {
|
||||||
$this->attributes = &$this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes;
|
$this->attributes = &$this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes;
|
||||||
$this->orig = &$this->getAccountContainer()->getAccountModule('dhcp_settings')->orig;
|
$this->orig = &$this->getAccountContainer()->getAccountModule('dhcp_settings')->orig;
|
||||||
if ($this->getAccountContainer()->dn_orig==$_SESSION['config']->get_suffix('dhcp')) {
|
if ($this->isRootNode()) {
|
||||||
// check if DHCP main settings and valid DHCP entry
|
// check if DHCP main settings and valid DHCP entry
|
||||||
if (!in_array_ignore_case('dhcpService', $this->attributes['objectClass']) && !in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
|
if (!in_array_ignore_case('dhcpService', $this->attributes['objectClass']) && !in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -186,6 +185,16 @@ class ddns extends baseModule {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the current DN is the root entry.
|
||||||
|
*
|
||||||
|
* @return bool is root
|
||||||
|
*/
|
||||||
|
private function isRootNode() {
|
||||||
|
$rootSuffix = $this->getAccountContainer()->get_type()->getSuffix();
|
||||||
|
return $this->getAccountContainer()->dn_orig == $rootSuffix;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of modifications which have to be made to the LDAP account.
|
* Returns a list of modifications which have to be made to the LDAP account.
|
||||||
*
|
*
|
||||||
|
@ -229,7 +238,7 @@ class ddns extends baseModule {
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
// Main Settings and Account have to different processes.
|
// Main Settings and Account have to different processes.
|
||||||
if ($this->getAccountContainer()->dn_orig==$_SESSION['config']->get_suffix('dhcp')) {
|
if ($this->isRootNode()) {
|
||||||
// main settings:
|
// main settings:
|
||||||
$errors = $this->process_attributes_mainSettings();
|
$errors = $this->process_attributes_mainSettings();
|
||||||
}
|
}
|
||||||
|
@ -349,13 +358,11 @@ class ddns extends baseModule {
|
||||||
$this->orig = &$this->getAccountContainer()->getAccountModule('dhcp_settings')->orig;
|
$this->orig = &$this->getAccountContainer()->getAccountModule('dhcp_settings')->orig;
|
||||||
$return = new htmlTable();
|
$return = new htmlTable();
|
||||||
// check if DHCP main settings and valid DHCP entry
|
// check if DHCP main settings and valid DHCP entry
|
||||||
if ($_SESSION['config']->get_suffix('dhcp') == $this->getAccountContainer()->dn_orig) {
|
if ($this->isRootNode()) {
|
||||||
if (!in_array_ignore_case('dhcpService', $this->attributes['objectClass']) && !in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
|
if (!in_array_ignore_case('dhcpService', $this->attributes['objectClass']) && !in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
|
||||||
$return->addElement(new htmlStatusMessage('ERROR', _('Please set your LDAP suffix to an LDAP entry with object class "dhcpService" or "dhcpServer".')));
|
$return->addElement(new htmlStatusMessage('ERROR', _('Please set your LDAP suffix to an LDAP entry with object class "dhcpService" or "dhcpServer".')));
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if ($this->getAccountContainer()->dn_orig == $_SESSION['config']->get_suffix('dhcp')) {
|
|
||||||
// DHCP main settings
|
// DHCP main settings
|
||||||
$return->addElement(new htmlTableExtendedInputCheckbox('active', $this->isDynDNSActivated(), _('Activate DynDNS'), 'active'), true);
|
$return->addElement(new htmlTableExtendedInputCheckbox('active', $this->isDynDNSActivated(), _('Activate DynDNS'), 'active'), true);
|
||||||
$return->addElement(new htmlTableExtendedInputCheckbox('insert_fixed', $this->addFixIPs(), _('Add fix IP addresses to DNS'), 'fixed_ips'), true);
|
$return->addElement(new htmlTableExtendedInputCheckbox('insert_fixed', $this->addFixIPs(), _('Add fix IP addresses to DNS'), 'fixed_ips'), true);
|
||||||
|
|
Loading…
Reference in New Issue