Code

Removed debug trash ...
[gosa.git] / plugins / admin / systems / class_terminalGeneric.inc
index fefa8fc74d4d0c387c07fd53f6e4409cd38fd7e3..98f247e7515a6ed32f9026a9f1b498a9f527a405 100644 (file)
@@ -12,6 +12,7 @@ class termgeneric extends plugin
   var $gotoTerminalPath= "";
   var $gotoSwapServer= "";
   var $gotoSyslogServer= "";
+  var $gotoSyslogServers = array();
   var $gotoNtpServer= array();
   var $gotoNtpServers= array();
   var $gotoSndModule= "";
@@ -71,7 +72,7 @@ class termgeneric extends plugin
     }
 
     /* Set inherit checkbox state */
-    if(in_array("default",$this->gotoNtpServer)){
+    if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
       $this->inheritTimeServer = true;
       $this->gotoNtpServer=array();
     }
@@ -96,6 +97,16 @@ class termgeneric extends plugin
       $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
     }
 
+    /* Create an array of all Syslog servers */
+    $tmp = $this->config->data['SERVERS']['SYSLOG'];
+    foreach($tmp as $server){
+      $visible = $server;
+      if($server == "default") {
+        $visible = "["._("inherited")."]";
+      }
+      $this->gotoSyslogServers[$server] = $visible;
+    }
+
     $this->orig_dn= $this->dn;
   }
 
@@ -232,12 +243,15 @@ class termgeneric extends plugin
 
         $tmp2[$servername.":".$path]= $servername.":".$path; 
       }else{
-        $tmp2[$server]=$server;
+        $tmp2[$server]="["._("inherited")."]";
       }
     }
   
     $smarty->assign("nfsservers",     $tmp2);
-    $smarty->assign("syslogservers",  $this->config->data['SERVERS']['SYSLOG']);
+
+    
+
+    $smarty->assign("syslogservers",  $this->gotoSyslogServers);
     $smarty->assign("ntpservers",     $this->gotoNtpServers);
 
     /* Variables */
@@ -259,14 +273,14 @@ class termgeneric extends plugin
     
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->dn);
-    $ldap->cat($this->dn);
+    $ldap->cat($this->dn, array('dn'));
     if($ldap->count()){
       $this->netConfigDNS->remove_from_parent();
       $ldap->rmDir($this->dn);
-      show_ldap_error($ldap->get_error());
+      show_ldap_error($ldap->get_error(), _("Removing terminal failed"));
 
       /* Optionally execute a command after we're done */
-      $this->handle_post_events("remove");
+      $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress));
 
       /* Delete references to object groups */
       $ldap->cd ($this->config->current['BASE']);
@@ -294,7 +308,7 @@ class termgeneric extends plugin
     $this->parent->by_object['termstartup']->gotoTerminalPath=
       $this->gotoTerminalPath;
   
-    if(isset($_POST['cn'])){
+    if(isset($_POST['termgeneric_posted'])){
       if(isset($_POST["inheritTimeServer"])){
         $this->inheritTimeServer = true;
       }else{
@@ -385,7 +399,7 @@ class termgeneric extends plugin
     }
 
     if($this->inheritTimeServer){
-      $this->attrs['gotoNtpServer'] = "default";
+      $this->attrs['gotoNtpServer'] = array();
     }else{  
       /* Set ntpServers */
       $this->attrs['gotoNtpServer'] = array();
@@ -394,6 +408,11 @@ class termgeneric extends plugin
       }
     }
 
+    /* Append gosaAdministrativeUnitTag to objectClass if gosaUnitTag isset */
+    if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){
+      $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag";
+    }
+
     /* Write back to ldap */
     $ldap= $this->config->get_ldap_link();
     if ($this->orig_dn == 'new'){
@@ -408,13 +427,13 @@ class termgeneric extends plugin
       }
       $ldap->cd($this->dn);
       $this->cleanup();
-$ldap->modify ($this->attrs); 
+      $ldap->modify ($this->attrs); 
 
       $this->handle_post_events("modify");
     }
     $this->netConfigDNS->cn = $this->cn;
     $this->netConfigDNS->save($this->dn);
-    show_ldap_error($ldap->get_error());
+    show_ldap_error($ldap->get_error(), _("Saving terminal failed"));
 
     /* Optionally execute a command after we're done */
     $this->postcreate();