Code

Updated manufacturer handling
[gosa.git] / plugins / admin / systems / class_workstationGeneric.inc
index a1c4b595c11cf452614ad1312de429c9b6bc4c76..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];
     }
@@ -68,6 +70,7 @@ class workgeneric extends plugin
     $this->modes["active"]= _("Activated");
     $this->modes["locked"]= _("Locked");
     $this->modes["memcheck"]= _("Memory test");
+    $this->modes["sysinfo"]= _("System analysis");
 
     /* Set base */
     if ($this->dn == "new"){
@@ -85,19 +88,22 @@ class workgeneric extends plugin
   {
        /* Call parent execute */
        plugin::execute();
+
     /* Do we need to flip is_account state? */
     if (isset($_POST['modify_state'])){
       $this->is_account= !$this->is_account;
     }
 
     if (isset($_POST['action'])){
-      $cmd= search_config($this->config->data['TABS'], "terminfo", "ACTIONCMD");
+      $cmd= search_config($this->config->data['TABS'], "workgeneric", "ACTIONCMD");
       if ($cmd == ""){
         print_red(_("No ACTIONCMD definition found in your gosa.conf"));
       } else {
-        exec ($cmd." ".$this->macAddress." ".escapeshellarg($_POST['action']), $dummy, $retval);
+        exec ($cmd." ".$this->macAddress." ".escapeshellarg($_POST['saction']), $dummy, $retval);
         if ($retval != 0){
           print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
+        } else {
+          $this->didAction= TRUE;
         }
       }
     }
@@ -125,9 +131,11 @@ class workgeneric extends plugin
       $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"),
                                        "instant_update" => _("Instant update"),
                                        "update" => _("Scheduled update"),
+                                       "reinstall" => _("Reinstall"),
                                        "rescan" => _("Rescan hardware")));
     } else {
       $smarty->assign("actions", array("wake" => _("Wake up"),
+                                       "reinstall" => _("Reinstall"),
                                        "update" => _("Scheduled update")));
     }
     /* Arrays */
@@ -261,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();
   }
 
 }