From 866206093f4488b9f56098dcd43034d81a244cff Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 29 Mar 2006 06:35:41 +0000 Subject: [PATCH] Fixed some dns zone editor problems git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2922 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/class_servDNSeditZoneEntries.inc | 27 ++++++++++++++----- .../admin/systems/servDNSeditZoneEntries.tpl | 12 +++++++-- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/plugins/admin/systems/class_servDNSeditZoneEntries.inc b/plugins/admin/systems/class_servDNSeditZoneEntries.inc index 9265bf61d..e775a21f0 100644 --- a/plugins/admin/systems/class_servDNSeditZoneEntries.inc +++ b/plugins/admin/systems/class_servDNSeditZoneEntries.inc @@ -21,6 +21,9 @@ class servDNSeditZoneEntries extends plugin var $RecordTypes= array(); // Possible record type. They will be set in contrucktor // and some types will be added later (cName/Ptr) + + var $disableDialog = false; // Dialog will be disabled, if this zone is new + function servDNSeditZoneEntries ($config, $dn= NULL,$zoneName,$reverseName,$RTypes) { plugin::plugin ($config, $dn); @@ -46,6 +49,7 @@ class servDNSeditZoneEntries extends plugin * Workstations / Terminals */ $res = $ldap->search("(&(objectClass=dNSZone)(|(zoneName=".$zoneName.")(zoneName=".$reverseName.".in-addr.arpa))(!(relativeDomainName=@)))"); + $this->disableDialog = false; while($attrs = $ldap->fetch($res)){ if(preg_match("/zoneName=/",$attrs['dn'])) continue; foreach($this->RecordTypes as $atr => $val){ @@ -57,9 +61,18 @@ class servDNSeditZoneEntries extends plugin } } } + + /* Check if this zone exists + */ + $res = $ldap->search("(&(objectClass=dNSZone)(relativeDomainName=@)(|(zoneName=".$zoneName.")(zoneName=".$reverseName.".in-addr.arpa)))", + array("zoneName")); + if($ldap->count()){ + }else{ + $this->disableDialog = true; + } /* Add additional informations - to all catched objects ( ObjectInformations) + to all caught objects ( ObjectInformations) */ foreach($this->Devices as $dn => $Recs){ $attrs = $ldap->fetch($ldap->cat($dn,array("objectClass","cn"))); @@ -87,8 +100,6 @@ class servDNSeditZoneEntries extends plugin $GetSubInformations = array(); while($attrs = $ldap->fetch()){ - unset($attrs[$val]['count']); - $dn = $attrs['dn']; /* Split dn into relativeDomainNames @@ -208,6 +219,8 @@ class servDNSeditZoneEntries extends plugin $table .= $this->generateRecordConfigurationRow($key); } + + $smarty->assign("disableDialog",$this->disableDialog); $smarty->assign("table",$table);; $display.= $smarty->fetch(get_template_path('servDNSeditZoneEntries.tpl', TRUE)); return($display); @@ -263,11 +276,8 @@ class servDNSeditZoneEntries extends plugin - + - - - "; @@ -487,6 +497,9 @@ class servDNSeditZoneEntries extends plugin function save() { + + if($this->disableDialog) return; + /* Set all initial records to array() This means they will be removed from the entry if they won't be overwritten diff --git a/plugins/admin/systems/servDNSeditZoneEntries.tpl b/plugins/admin/systems/servDNSeditZoneEntries.tpl index c4d81168a..fed6442c7 100644 --- a/plugins/admin/systems/servDNSeditZoneEntries.tpl +++ b/plugins/admin/systems/servDNSeditZoneEntries.tpl @@ -3,8 +3,16 @@

 

- -{$table} +{if $disableDialog} +
+ {t}This dialog can't be used until the currently edited zone was saved or the zone entry exists in the ldap database.{/t} + +{else} + {t}To add a new host entry just click here{/t} + +
+ {$table} +{/if}

 

-- 2.30.2