X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_servDNSeditZoneEntries.inc;h=50812871960c60f872fcc874222198b83a7f53d2;hb=c30fdf675865a86365275ed6fb9f8a0cc06e41af;hp=f7d983982a8cd58029d95145183506b0428c6b72;hpb=50d7475d3b255015cd1a197845c70ad177888ba6;p=gosa.git diff --git a/plugins/admin/systems/class_servDNSeditZoneEntries.inc b/plugins/admin/systems/class_servDNSeditZoneEntries.inc index f7d983982..508128719 100644 --- a/plugins/admin/systems/class_servDNSeditZoneEntries.inc +++ b/plugins/admin/systems/class_servDNSeditZoneEntries.inc @@ -2,14 +2,9 @@ class servDNSeditZoneEntries extends plugin { - /* CLI vars */ - var $cli_summary= "Manage server basic objects"; - var $cli_description= "Some longer text\nfor help"; - var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser"); - /* attribute list for save action */ var $ignore_account = TRUE; - var $attributes = array(); + var $attributes = array("cn"); var $objectclasses = array("whatever"); var $Devices = array(); @@ -20,6 +15,7 @@ class servDNSeditZoneEntries extends plugin var $RecordTypes = array(); // Possible record type. var $disableDialog = false; // Dialog will be disabled, if this zone is new + var $cn; function servDNSeditZoneEntries ($config,$dn, $zoneObject) { @@ -28,7 +24,7 @@ class servDNSeditZoneEntries extends plugin /* Initialise class */ $this->RecordTypes = getDnsRecordTypes(); - $this->dn = "zoneName=".$zoneObject['InitialzoneName'].",".$dn; + $this->dn = "zoneName=".getNameFromMix($zoneObject['InitialzoneName']).",".$dn; $this->zoneName = $zoneObject['InitialzoneName']; $this->reverseName = $zoneObject['InitialReverseZone']; @@ -46,8 +42,11 @@ class servDNSeditZoneEntries extends plugin $this->Devices[$attrs['relativeDomainName'][0]]['OrigCn'] = $attrs['relativeDomainName'][0]; } - if(!count($this->Devices)){ - $this->disableDialog = true; + $ldap->cat($this->dn,array("objectClass")); + + $this->disableDialog = true; + if(count($this->Devices)|| $ldap->count()){ + $this->disableDialog = false; } } @@ -75,7 +74,7 @@ class servDNSeditZoneEntries extends plugin $entry['exists'] = true; $entry['zoneName'] = $this->zoneName; $entry['RECORDS'][] = array("type" => "aRecord" , "value"=>""); - $this->Devices[_("New Entry")] = $entry; + $this->Devices[_("New entry")] = $entry; } if(count($tmp2) != 2) continue; @@ -192,8 +191,14 @@ class servDNSeditZoneEntries extends plugin $ldap->cd($this->config->current['BASE']); $names = array(); + foreach($this->Devices as $DevName => $device){ + /* skip checking empty attributes */ + if(count($this->Devices[$DevName]['RECORDS']) == 0){ + return; + } + /* Checking entry name */ if((!is_uid($DevName)) | (empty($DevName))){ @@ -203,13 +208,13 @@ class servDNSeditZoneEntries extends plugin /* Renaming check for existing devices */ if(isset($device['OrigCn']) && ($DevName != $device['OrigCn'] )){ - $ldap->cd($this->config->current['BASE']); + $ldap->cd($this->dn); $ldap->search("(relativeDomainName=".$DevName.")",array("relativeDomainName")); if($ldap->count()){ $message[] = sprintf(_("Can not rename '%s' to '%s',the destination name already exists."),$device['OrigCn'],$DevName); } }elseif(!isset($device['OrigCn'])){ - $ldap->cd($this->config->current['BASE']); + $ldap->cd($this->dn); $ldap->search("(relativeDomainName=".$DevName.")",array("relativeDomainName")); if($ldap->count()){ $message[] = sprintf(_("Can not create '%s',the destination name already exists."),$DevName); @@ -226,6 +231,8 @@ class servDNSeditZoneEntries extends plugin /* Names should be written in lowercase */ + + if(strtolower($DevName) != $DevName){ $message[] = sprintf(_("The host name '%s' should be written in lowercase."), $DevName); } @@ -272,6 +279,7 @@ class servDNSeditZoneEntries extends plugin $todo = array(); + /* Create todolist */ foreach($this->Devices as $name => $dev){ @@ -383,7 +391,7 @@ class servDNSeditZoneEntries extends plugin