Code

Removed duplicated post call
[gosa.git] / plugins / admin / systems / class_workstationGeneric.inc
index ef68b3993add8d2a3e020635384a8a83ab3a8187..4604c98a77c16c7965795458e083127982d3c129 100644 (file)
@@ -51,6 +51,7 @@ class workgeneric extends plugin
   var $objectclasses= array("top", "gotoWorkstation", "GOhard");
 
   var $mapActions   = array("reboot"          => "localboot",
+                            "localboot"       => "localboot",
                             "instant_update"  => "softupdate",
                             "update"          => "sceduledupdate",
                             "reinstall"       => "install",
@@ -126,6 +127,10 @@ class workgeneric extends plugin
       $this->gotoSyslogServers[$server] = $visible;
     }
 
+    if($this->is_account){
+      @log::log("view","workstation/".get_class($this),$this->dn);
+    } 
+
     /* Save 'dn' for later referal */
     $this->orig_dn= $this->dn;
   }
@@ -168,7 +173,7 @@ class workgeneric extends plugin
         } elseif ($_POST['saction'] != "wake") {
 
           /* Set FAIstate */
-          if($this->fai_activated){
+          if($this->fai_activated && $this->dn != "new"){
             $ldap = $this->config->get_ldap_link();
             $ldap->cd($this->config->current['BASE']);
             $ldap->cat($this->dn,array("objectClass"));
@@ -287,12 +292,14 @@ class workgeneric extends plugin
                                        "reinstall" => _("Reinstall"),
                                        "rescan" => _("Rescan hardware"),
                                        "memcheck" => _("Memory test"),
+                                       "localboot" => _("Force localboot"),
                                        "sysinfo"  => _("System analysis")));
     } else {
       $smarty->assign("actions", array("wake" => _("Wake up"),
                                        "reinstall" => _("Reinstall"),
                                        "update" => _("Scheduled update"),
                                        "memcheck" => _("Memory test"),
+                                       "localboot" => _("Force localboot"),
                                        "sysinfo"  => _("System analysis")));
     }
     /* Arrays */
@@ -329,10 +336,11 @@ class workgeneric extends plugin
       $this->netConfigDNS->remove_from_parent();
       $ldap= $this->config->get_ldap_link();
       $ldap->rmdir($this->dn);
+      @log::log("remove","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
       show_ldap_error($ldap->get_error(), sprintf(_("Removing of system workstation/generic with dn '%s' failed."),$this->dn));
 
       /* Optionally execute a command after we're done */
-      $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress));
+      $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS-ipHostNumber));
 
       /* Delete references to object groups */
       $ldap->cd ($this->config->current['BASE']);
@@ -436,7 +444,7 @@ class workgeneric extends plugin
     /* Strip out 'default' values */
     foreach (array("gotoSyslogServer") as $val){
 
-      if ($this->attrs[$val] == "default"){
+      if (isset($this->attrs[$val]) && $this->attrs[$val] == "default"){
         $this->attrs[$val]= array();
       }
     }
@@ -488,9 +496,10 @@ class workgeneric extends plugin
       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
       $ldap->cd($this->dn);
       $ldap->add($this->attrs);
+      @log::log("create","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
       show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn));
       if(!$this->didAction){
-        $this->handle_post_events("add");
+        $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
       }
     } else {
       if ($this->orig_dn != $this->dn){
@@ -499,14 +508,13 @@ class workgeneric extends plugin
       $ldap->cd($this->dn);
       $this->cleanup();
       $ldap->modify ($this->attrs); 
+      @log::log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
 
       if(!$this->didAction){
-        $this->handle_post_events("modify");
+        $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
       }
     }
 
-    print_a($this->attrs);
-
     /* cn=default and macAddress=- indicates that this is a template */
     if($this->cn == "wdefault"){
       $this->netConfigDNS->macAddress = "-";