use new meta HTML classes

This commit is contained in:
Roland Gruber 2010-09-15 19:52:18 +00:00
parent a1de3afcf2
commit a9899078c4
1 changed files with 30 additions and 42 deletions

View File

@ -329,46 +329,33 @@ class ddns extends baseModule {
* @return array HTML meta data * @return array HTML meta data
*/ */
public function display_html_attributes() { public function display_html_attributes() {
$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 ($_SESSION['config']->get_suffix('dhcp') == $this->getAccountContainer()->dn_orig) {
if (!in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) { if (!in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
StatusMessage("ERROR", _('Please set your LDAP suffix to an LDAP entry with object class "dhcpServer".')); $return->addElement(new htmlStatusMessage('ERROR', _('Please set your LDAP suffix to an LDAP entry with object class "dhcpServer".')));
return array(); return $return;
} }
} }
if ($this->getAccountContainer()->dn_orig==$_SESSION['config']->get_suffix('dhcp')) { if ($this->getAccountContainer()->dn_orig == $_SESSION['config']->get_suffix('dhcp')) {
// DHCP main settings // DHCP main settings
$return[] = array( $return->addElement(new htmlTableExtendedInputCheckbox('active', $this->isDynDNSActivated(), _('Activate DynDNS'), 'active'), true);
array('kind' => 'text', 'text' => _('Activate DynDNS') . ":* "), $return->addElement(new htmlTableExtendedInputCheckbox('insert_fixed', $this->addFixIPs(), _('Add fix IP addresses to DNS'), 'fixed_ips'), true);
array('kind' => 'input', 'type' => 'checkbox', 'name' => 'active', 'checked' => $this->isDynDNSActivated()), $return->addElement(new htmlTableExtendedInputCheckbox('client_insert', $this->isIgnoreClientUpdates(), _('Disable client updates'), 'client_insert'), true);
array('kind' => 'help', 'value' => 'active', 'scope' => 'user')); $keyInput = new htmlTableExtendedInputField(_('Path to key for DNS updates'), 'key_path', $this->getUpdateKey(), 'keypath');
$keyInput->setRequired(true);
$return[] = array( $return->addElement($keyInput);
array('kind' => 'text', 'text' => _('Add fix IP addresses to DNS') . ":* "),
array('kind' => 'input', 'type' => 'checkbox', 'name' => 'insert_fixed', 'checked' => $this->addFixIPs()),
array('kind' => 'help', 'value' => 'fixed_ips', 'scope' => 'user'));
$return[] = array(
array('kind' => 'text', 'text' => _('Disable client updates') . ":* "),
array('kind' => 'input', 'type' => 'checkbox', 'name' => 'client_insert', 'checked' => $this->isIgnoreClientUpdates()),
array('kind' => 'help', 'value' => 'client_insert', 'scope' => 'user'));
$return[] = array(
array('kind' => 'text', 'text' => _('Path to key for DNS updates') . ":* "),
array('kind' => 'input', 'type' => 'text', 'name' => 'key_path', 'value' => $this->getUpdateKey()),
array('kind' => 'help', 'value' => 'keypath', 'scope' => 'user'));
} }
else { else {
// Account edit // Account edit
if (!$this->check_if_ddns_is_enable()) { if (!$this->check_if_ddns_is_enable()) {
echo _("DDNS ist not activated. You can activate it in the DHCP settings (DDNS).") . "<br/><br/>"; $return->addElement(new htmlOutputText(_("DDNS ist not activated. You can activate it in the DHCP settings (DDNS).")));
} }
else { else {
$return[] = array( // DNS server
array('kind' => 'text', 'text' => _('IP address of the DNS server') . ":* "), $serverInput = new htmlTableExtendedInputField(_('IP address of the DNS server'), 'ip', $this->getDNSServer(), 'dns');
array('kind' => 'input', 'type' => 'text', 'name' => 'ip', 'value' => $this->getDNSServer()), $serverInput->setRequired(true);
array('kind' => 'help', 'value' => 'dns', 'scope' => 'user')); $return->addElement($serverInput, true);
$zones = $this->getZoneNames(); $zones = $this->getZoneNames();
$zone = ''; $zone = '';
@ -379,20 +366,17 @@ class ddns extends baseModule {
if (isset($zones[1])) { if (isset($zones[1])) {
$revzone = $zones[1]; $revzone = $zones[1];
} }
$return[] = array( // zone names
array('kind' => 'text', 'text' => _('Zone names') . ":* "), $zoneInput = new htmlTableExtendedInputField(_('Zone names'), 'zone', $zone, 'zone');
array('kind' => 'input', 'type' => 'text', 'name' => 'zone', 'value' => $zone), $zoneInput->setRequired(true);
array('kind' => 'help', 'value' => 'zone', 'scope' => 'user')); $return->addElement($zoneInput, true);
// reverse zone names
$return[] = array( $revZoneInput = new htmlTableExtendedInputField(_('Reverse zone names'), 'zone_reverse', $revzone, 'zone_reverse');
array('kind' => 'text', 'text' => _('Reverse zone names') . ":* "), $revZoneInput->setRequired(true);
array('kind' => 'input', 'type' => 'text', 'name' => 'zone_reverse', 'value' => $revzone), $return->addElement($revZoneInput);
array('kind' => 'help', 'value' => 'zone_reverse', 'scope' => 'user'));
} }
} }
echo _("Attention: The DHCP service needs to be restarted after changes in DDNS.") . "<br />";
return $return; return $return;
} }
@ -428,7 +412,10 @@ class ddns extends baseModule {
if (is_array($this->attributes['dhcpStatements'])) { if (is_array($this->attributes['dhcpStatements'])) {
for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) { for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) {
if (substr($this->attributes['dhcpStatements'][$i], 0, 5) == 'zone ') { if (substr($this->attributes['dhcpStatements'][$i], 0, 5) == 'zone ') {
return array_shift(explode(";",array_pop(explode(". { primary ", $this->attributes['dhcpStatements'][$i])))); $parts = explode(". { primary ", $this->attributes['dhcpStatements'][$i]);
$temp = array_pop($parts);
$temp = explode(";", $temp);
return array_shift($temp);
} }
} }
} }
@ -445,7 +432,8 @@ class ddns extends baseModule {
if (is_array($this->attributes['dhcpStatements'])) { if (is_array($this->attributes['dhcpStatements'])) {
for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) { for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) {
if (substr($this->attributes['dhcpStatements'][$i], 0, 5) == 'zone ') { if (substr($this->attributes['dhcpStatements'][$i], 0, 5) == 'zone ') {
$return[] = substr(array_shift(explode(" ",substr($this->attributes['dhcpStatements'][$i],5))),0,-1); $parts = explode(" ",substr($this->attributes['dhcpStatements'][$i],5));
$return[] = substr(array_shift($parts),0,-1);
} }
} }
} }