From d12efced7cfd1d77387bd8d1253a28160407061e Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 27 Jul 2010 09:17:11 +0000 Subject: [PATCH] Updated several service dialogs, fixed typos, string, html, post handling and more. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19143 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../services/dhcp/class_dhcpDnsZone.inc | 304 +++++++++--------- 1 file changed, 151 insertions(+), 153 deletions(-) diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpDnsZone.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpDnsZone.inc index ddf36870b..04777252e 100644 --- a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpDnsZone.inc +++ b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpDnsZone.inc @@ -1,200 +1,198 @@ new){ - $this->dhcpDnsZoneServer= $attrs['dhcpDnsZoneServer'][0]; - $this->dhcpKeyDN= base64_encode($attrs['dhcpKeyDN'][0]); - } + /* Used attributes */ + var $dhcpKeyDN=""; + var $dhcpDnsZone=""; + var $dhcpDnsZoneServer=""; + var $cn=""; - // Prepare LDAP link - $ldap= $config->get_ldap_link(); - $ldap->cd($config->current['BASE']); + var $drop_down_domain= array(); + var $drop_down_nameserver= array(); + var $drop_down_tsigkey= array(); - /* Search for all objects, recursive, that match the given ldap filter. - each dyndns zoen have to depent of an alreday DNS Zone created so we search it - */ + /* attribute list for save action */ + var $objectclasses= array("top", "dhcpDnsZone"); - // Search for domain - $ldap->search("(&(objectClass=dNSZone)(relativeDomainName=@))",array("zoneName")); - while($attrs = $ldap->fetch()){ - $this->drop_down_domain[$attrs["zoneName"][0]]= $attrs["zoneName"][0]; - } - $ldap->search("(&(objectClass=dNSZone)(relativeDomainName=@))",array("nSRecord")); - while($attrs = $ldap->fetch()){ - $this->drop_down_nameserver[$attrs["nSRecord"][0]]=$attrs["nSRecord"][0]; - } + function dhcpDnsZone($parent,$attrs,$host_exists_in_gosa = FALSE) + { + global $config; + dhcpPlugin::dhcpPlugin($parent,$attrs); - $ldap->search("(objectClass=dhcpTSigKey)",array("dn","cn")); - if ($ldap->count() != 0){ - while($attrs = $ldap->fetch()){ - $this->drop_down_tsigkey[base64_encode($attrs["dn"])]=$attrs["cn"][0]; - } - } - } + /* Load attributes */ + if (!$this->new){ + $this->dhcpDnsZoneServer= $attrs['dhcpDnsZoneServer'][0]; + $this->dhcpKeyDN= base64_encode($attrs['dhcpKeyDN'][0]); + } + // Prepare LDAP link + $ldap= $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); - function execute() - { - $smarty= get_smarty(); - $smarty->assign("cn", $this->cn); - $smarty->assign("cns",$this->drop_down_domain); + /* Search for all objects, recursive, that match the given ldap filter. + each dyndns zoen have to depent of an alreday DNS Zone created so we search it + */ - $smarty->assign("dhcpDnsZoneServer", $this->dhcpDnsZoneServer); - $smarty->assign("dhcpDnsZoneServers",$this->drop_down_nameserver); + // Search for domain + $ldap->search("(&(objectClass=dNSZone)(relativeDomainName=@))",array("zoneName")); + while($attrs = $ldap->fetch()){ + $this->drop_down_domain[$attrs["zoneName"][0]]= $attrs["zoneName"][0]; + } - $smarty->assign("dhcpKeyDN", $this->dhcpKeyDN); - $smarty->assign("dhcpKeyDNs",$this->drop_down_tsigkey); + $ldap->search("(&(objectClass=dNSZone)(relativeDomainName=@))",array("nSRecord")); + while($attrs = $ldap->fetch()){ + $this->drop_down_nameserver[$attrs["nSRecord"][0]]=$attrs["nSRecord"][0]; + } - /* Assign ACLs */ - $smarty->assign("acl",$this->parent->getacl("")); + $ldap->search("(objectClass=dhcpTSigKey)",array("dn","cn")); + if ($ldap->count() != 0){ + while($attrs = $ldap->fetch()){ + $this->drop_down_tsigkey[base64_encode($attrs["dn"])]=$attrs["cn"][0]; + } + } + } - /* Show main page */ - $display= $smarty->fetch(get_template_path('dhcp_dnszone.tpl', TRUE,dirname(__FILE__))); - /* Add footer */ - $display.= "
"; - if(preg_match("/w/",$this->parent->getacl(""))){ - $display.= " "; + function execute() + { + $smarty= get_smarty(); + $smarty->assign("cn", set_post($this->cn)); + $smarty->assign("cns", set_post($this->drop_down_domain)); + $smarty->assign("dhcpDnsZoneServer", set_post($this->dhcpDnsZoneServer)); + $smarty->assign("dhcpDnsZoneServers", set_post($this->drop_down_nameserver)); + $smarty->assign("dhcpKeyDN", set_post($this->dhcpKeyDN)); + $smarty->assign("dhcpKeyDNs", set_post($this->drop_down_tsigkey)); + + /* Assign ACLs */ + $smarty->assign("acl",$this->parent->getacl("")); + + /* Show main page */ + $display= $smarty->fetch(get_template_path('dhcp_dnszone.tpl', TRUE,dirname(__FILE__))); + + /* Add footer */ + $display.= "
"; + if(preg_match("/w/",$this->parent->getacl(""))){ + $display.= " "; + } + $display.= ""; + $display.= "
"; + + return ($display); } - $display.= ""; - $display.= "
"; - return ($display); - } + function remove_from_parent() + { + } + - function remove_from_parent() - { - } + /* Save data to object */ + function save_object() + { + /* Save remaining attributes */ + if (isset($_POST['dhcp_dnszone_posted']) && preg_match("/w/", $this->parent->getacl(""))){ + if (isset($_POST['dhcpKeyDN'])){ + $this->dhcpKeyDN= get_post('dhcpKeyDN'); + } - /* Save data to object */ - function save_object() - { - /* Save remaining attributes */ - if (isset($_POST['dhcp_dnszone_posted']) && preg_match("/w/", $this->parent->getacl(""))){ + if (isset($_POST['dhcpDnsZoneServer'])){ + $this->dhcpDnsZoneServer= get_post('dhcpDnsZoneServer'); + } + if (isset($_POST['cn'])){ + $this->cn= get_post('cn'); + } - if (isset($_POST['dhcpKeyDN'])){ - $this->dhcpKeyDN= get_post('dhcpKeyDN'); - } + } - if (isset($_POST['dhcpDnsZoneServer'])){ - $this->dhcpDnsZoneServer= get_post('dhcpDnsZoneServer'); - } - if (isset($_POST['cn'])){ - $this->cn= get_post('cn'); - } - + dhcpPlugin::save_object(); } - dhcpPlugin::save_object(); - } + /* Check values */ + function check() + { + $message= array(); - /* Check values */ - function check() - { - $message= array(); + $cache = array(); + if(isset($this->parent) && isset($this->parent->dhcpObjectCache)){ + $cache = $this->parent->dhcpObjectCache; + } - $cache = array(); - if(isset($this->parent) && isset($this->parent->dhcpObjectCache)){ - $cache = $this->parent->dhcpObjectCache; - } - - /* All required fields are set? */ - if ($this->cn == ""){ - $message[]= msgPool::required(_("DNS zone")); - } + /* All required fields are set? */ + if ($this->cn == ""){ + $message[]= msgPool::required(_("DNS zone")); + } - if ($this->dhcpDnsZoneServer == ""){ - $message[]= msgPool::required(_("DNS server")); - } + if ($this->dhcpDnsZoneServer == ""){ + $message[]= msgPool::required(_("DNS server")); + } - if ($this->dhcpKeyDN == ""){ - $message[]= msgPool::required(_("Key DN")); - } - - - /* cn already used? */ - if ($this->orig_cn != $this->cn || $this->new){ - - foreach($cache as $dn => $dummy){ - if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){ - $message[]= msgPool::duplicated(_("Name")); - break; + if ($this->dhcpKeyDN == ""){ + $message[]= msgPool::required(_("Key DN")); } - } - } - - /* Check external plugins */ - $net= $this->network->check(); - $adv= $this->advanced->check(); - $message= array_merge($message, $net, $adv); - return $message; - } + /* cn already used? */ + if ($this->orig_cn != $this->cn || $this->new){ - /* Save to LDAP */ - function save() - { - dhcpPlugin::save(); + foreach($cache as $dn => $dummy){ + if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){ + $message[]= msgPool::duplicated(_("Name")); + break; + } + } + } - if ($this->dhcpKeyDN != ""){ - $this->attrs['dhcpKeyDN']= array(base64_decode($this->dhcpKeyDN)); - } else { - $this->attrs['dhcpKeyDN']= array(); - } + /* Check external plugins */ + $net= $this->network->check(); + $adv= $this->advanced->check(); + $message= array_merge($message, $net, $adv); - if ($this->dhcpDnsZoneServer != ""){ - $this->attrs['dhcpDnsZoneServer']= array($this->dhcpDnsZoneServer); - } else { - $this->attrs['dhcpDnsZoneServer']= array(); + return $message; } - return ($this->attrs); - } + + /* Save to LDAP */ + function save() + { + dhcpPlugin::save(); + + if ($this->dhcpKeyDN != ""){ + $this->attrs['dhcpKeyDN']= array(base64_decode($this->dhcpKeyDN)); + } else { + $this->attrs['dhcpKeyDN']= array(); + } + + if ($this->dhcpDnsZoneServer != ""){ + $this->attrs['dhcpDnsZoneServer']= array($this->dhcpDnsZoneServer); + } else { + $this->attrs['dhcpDnsZoneServer']= array(); + } + + return ($this->attrs); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -- 2.30.2