Code

Updated manufacturer handling
[gosa.git] / plugins / admin / systems / class_workstationGeneric.inc
index acd4678767a9d82e6cb0e3e87dd3e54ee94c8031..33a49bcb040347a9de0ab30398f0989b91ac99b5 100644 (file)
@@ -25,6 +25,8 @@ class workgeneric extends plugin
   var $ghGfxAdapter= "-";
   var $ghSoundAdapter= "-";
   var $gotoLastUser= "-";
+  var $FAIscript="";
+  var $didAction= FALSE;
 
   /* Needed values and lists */
   var $base= "";
@@ -40,8 +42,8 @@ class workgeneric extends plugin
   var $attributes= array("gotoMode", "macAddress", "gotoSyslogServer", "gotoNtpServer",
       "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
       "ghCpuType", "ghMemSize", "ghUsbSupport", "ipHostNumber",
-      "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l");
-  var $objectclasses= array("top", "gotoWorkstation", "GOhard");
+      "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l","FAIscript");
+  var $objectclasses= array("top", "gotoWorkstation", "GOhard","FAIobject");
 
   function workgeneric ($config, $dn= NULL)
   {
@@ -50,7 +52,7 @@ class workgeneric extends plugin
     /* Load available modes */
     $ldap= $this->config->get_ldap_link();
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(objectClass=gotoInstallProfile)");
+    $ldap->search ("(objectClass=gotoInstallProfile)",array("cn"));
     while ($attrs= $ldap->fetch()){
       $this->modes[]= $attrs["cn"][0];
     }
@@ -100,6 +102,8 @@ class workgeneric extends plugin
         exec ($cmd." ".$this->macAddress." ".escapeshellarg($_POST['saction']), $dummy, $retval);
         if ($retval != 0){
           print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
+        } else {
+          $this->didAction= TRUE;
         }
       }
     }
@@ -131,6 +135,7 @@ class workgeneric extends plugin
                                        "rescan" => _("Rescan hardware")));
     } else {
       $smarty->assign("actions", array("wake" => _("Wake up"),
+                                       "reinstall" => _("Reinstall"),
                                        "update" => _("Scheduled update")));
     }
     /* Arrays */
@@ -264,19 +269,20 @@ class workgeneric extends plugin
       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
       $ldap->cd($this->dn);
       $ldap->add($this->attrs);
-      $this->handle_post_events("add");
+      if(!$this->didAction){
+        $this->handle_post_events("add");
+      }
     } else {
       if ($this->orig_dn != $this->dn){
         $this->move($this->orig_dn, $this->dn);
       }
       $ldap->cd($this->dn);
       $ldap->modify($this->attrs);
-      $this->handle_post_events("modify");
+      if(!$this->didAction){
+        $this->handle_post_events("modify");
+      }
     }
     show_ldap_error($ldap->get_error());
-
-    /* Optionally execute a command after we're done */
-    $this->postcreate();
   }
 
 }