Code

Updated preg_matches
[gosa.git] / plugins / admin / systems / class_servDNSeditZoneEntries.inc
index bf510a9bb733fb48969aa1cc6dac53bd4fb7fa08..3a13bde7dbfac17fc1f0b18238cb336979970ad1 100644 (file)
@@ -46,8 +46,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;
     }
   }
 
@@ -69,13 +72,13 @@ class servDNSeditZoneEntries extends plugin
 
       /* Add new host entry
        */
-      if((preg_match("/^UserRecord_/",$name)) && ($once)){
+      if((preg_match("/^UserRecord_?/",$name)) && ($once)){
         $once = false;
         $entry = getDNSHostEntries($this->config,"",true);     
         $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;
@@ -323,7 +326,7 @@ class servDNSeditZoneEntries extends plugin
      */
     foreach($tmp['add'] as $dn => $attrs){
       $ldap->cd($dn);
-      $ldap->cat($dn);
+      $ldap->cat($dn, array('dn'));
       if(count($ldap->fetch())){
         $ldap->cd($dn);
         $ldap->modify ($attrs);
@@ -350,7 +353,7 @@ class servDNSeditZoneEntries extends plugin
 
     /* Set title 
      */
-    $str = "<h3>".sprintf(_("Settings for '%s'"),$objKey)." : </h3>";
+    $str= "<br>";
 
     $hostNameOnce = true;
 
@@ -363,29 +366,27 @@ class servDNSeditZoneEntries extends plugin
        */
       $name = base64_encode($objKey)."|".$id;
 
-      $str .= "<tr><td style='width:80px;'>\n";
+      $str .= "<tr><td style='width:170px;'>\n";
 
       /* Only first host entry name should be editable
        */
       if($hostNameOnce){
         $hostNameOnce = false;  
         $str .="<input type='text' name='RenameHost_".$name."' value='".$objectName."'>\n";
-      }else{
-        $str .=$objectName;
-      }  
+      }
 
       /* Create rest. Selectbox, icons ...
        */
       $str .="
         </td>
-        <td style='width:80px;'>
+        <td style='width:90px;'>
           ".$this->createRecordTypeSelection($record['type'],$name)."
         </td>
         <td>
           <input type='text'  value='".$record['value']."' name='ValueSelection_".$name."' style='width:250px;'>
         </td>
         <td style='width:50px;text-align:right;'>
-          <input type='image' name='AddRecord_".$name."'   src='images/crossref.png' alt='"._("Add")."' title='"._("Add")."'>
+          <input type='image' name='AddRecord_".$name."'   src='images/list_new.png' alt='"._("Add")."' title='"._("Add")."'>
           <input type='image' name='RemoveRecord_".$name."' src='images/edittrash.png'      alt='"._("Remove")."' title='"._("Remove")."'>
         </td>
       </tr>";