Code

Added check to avoid multiple uploads of the same file
[gosa.git] / plugins / admin / systems / class_terminalGeneric.inc
index bff08ac14359f370512cc76500b08bb44adc6595..5c825dcaead8423c96fba623721c7baf0c7f3af0 100644 (file)
@@ -37,6 +37,7 @@ class termgeneric extends plugin
   var $modes= array();
 
   /* attribute list for save action */
+  var $ignore_account= TRUE;
   var $attributes= array("gotoMode", "gotoTerminalPath", "macAddress",
       "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer",
       "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
@@ -75,6 +76,9 @@ class termgeneric extends plugin
 
   function execute()
   {
+       /* Call parent execute */
+       plugin::execute();
+
     /* Do we need to flip is_account state? */
     if (isset($_POST['modify_state'])){
       $this->is_account= !$this->is_account;
@@ -83,7 +87,7 @@ class termgeneric extends plugin
     if (isset($_POST['action'])){
       switch($_POST['saction']){
         case 'wake':
-          $cmd= $this->search($this->config->data['TABS'], "termgeneric", "WAKECMD");
+          $cmd= search_config($this->config->data['TABS'], "termgeneric", "WAKECMD");
           if ($cmd == ""){
             print_red(_("No WAKECMD definition found in your gosa.conf"));
           } else {
@@ -95,7 +99,7 @@ class termgeneric extends plugin
           break;
 
         case 'reboot':
-          $cmd= $this->search($this->config->data['TABS'], "termgeneric", "REBOOTCMD");
+          $cmd= search_config($this->config->data['TABS'], "termgeneric", "REBOOTCMD");
           if ($cmd == ""){
             print_red(_("No REBOOTCMD definition found in your gosa.conf"));
           } else {
@@ -107,7 +111,7 @@ class termgeneric extends plugin
           break;
 
         case 'halt':
-          $cmd= $this->search($this->config->data['TABS'], "termgeneric", "HALTCMD");
+          $cmd= search_config($this->config->data['TABS'], "termgeneric", "HALTCMD");
           if ($cmd == ""){
             print_red(_("No HALTCMD definition found in your gosa.conf"));
           } else {
@@ -130,6 +134,7 @@ class termgeneric extends plugin
     /* Fill templating stuff */
     $smarty= get_smarty();
     $smarty->assign("cn", $this->cn);
+    $smarty->assign("staticAddress", "");
 
     $smarty->assign("bases", $this->config->idepartments);
 
@@ -145,7 +150,28 @@ class termgeneric extends plugin
     }
     /* Arrays */
     $smarty->assign("modes", $this->modes);
-    $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
+
+    $tmp2 = array(); 
+    foreach($this->config->data['SERVERS']['NFS'] as $server){
+      if($server != "default"){
+        $tmp = split("\|",$server);
+        $tmp3= split(":",$tmp[0]);
+
+        $servername = $tmp3[0];
+        $nfsname    = $tmp3[1];  
+
+        $path ="";
+        if(isset($tmp[4])){
+          $path       = $tmp[4];  
+        }
+
+        $tmp2[$servername.":".$path]= $servername.":".$path; 
+      }else{
+        $tmp2[$server]=$server;
+      }
+    }
+  
+    $smarty->assign("nfsservers", $tmp2);
     $smarty->assign("syslogservers", $this->config->data['SERVERS']['SYSLOG']);
     $smarty->assign("ntpservers", $this->config->data['SERVERS']['NTP']);
 
@@ -167,22 +193,27 @@ class termgeneric extends plugin
 
   function remove_from_parent()
   {
+    
     $ldap= $this->config->get_ldap_link();
-    $ldap->rmdir($this->dn);
-    show_ldap_error($ldap->get_error());
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove");
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
+    $ldap->cd($this->dn);
+    $ldap->cat($this->dn);
+    if($ldap->count()){
+
+      $ldap->rmdir($this->dn);
+      show_ldap_error($ldap->get_error());
+
+      /* Optionally execute a command after we're done */
+      $this->handle_post_events("remove");
+
+      /* Delete references to object groups */
+      $ldap->cd ($this->config->current['BASE']);
+      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+      while ($ldap->fetch()){
+        $og= new ogroup($this->config, $ldap->getDN());
+        unset($og->member[$this->dn]);
+        $og->save ();
+      }
     }
-
   }