Code

Updated New Device && opsi host
[gosa.git] / gosa-plugins / systems / admin / systems / class_systemManagement.inc
index f29de41cbfa79e170b3c0112c186aa48a05e9c6d..e6423173c36b632761505afbc960f606f857ac91 100644 (file)
@@ -370,6 +370,19 @@ class systems extends plugin
                */
               $this->systab->was_activated = TRUE;
 
+              /* Assign some default values for opsi hosts 
+               */
+              if($this->systab instanceOf opsi_tabs){
+                $ldap = $this->config->get_ldap_link();
+                $ldap->cat($dn);
+                $source_attrs = $ldap->fetch();
+                foreach(array("macAddress" => "mac" ,"cn" => "hostId","description","description") as $src => $attr){
+                  if(isset($source_attrs[$src][0])){
+                    $this->systab->by_object['opsiGeneric']->$attr = $source_attrs[$src][0];
+                  }
+                }
+              }
+
               if($selected_group != "none"){
 
                 /*******
@@ -989,8 +1002,15 @@ class systems extends plugin
         $this->systab->save();
 
         /* Post handling for activated systems 
+            target opsi -> Remove source.
+            target gosa -> Activate system.
          */
-        if(isset($this->systab->was_activated) && $this->systab->was_activated){
+        if($this->systab instanceOf opsi_tabs && $this->systab->was_activated){
+          $ldap = $this->config->get_ldap_link();
+          $ldap->cd($this->config->current['BASE']);
+          $ldap->rmdir ($this->systab->dn);
+          @DEBUG(DEBUG_LDAP,__LINE__, __FUNCTION__, __FILE__,"Source removed: ".$this->systab->dn,"Opsi host activated.");
+        }elseif(isset($this->systab->was_activated) && $this->systab->was_activated){
           $this->activate_new_device($this->systab->dn);
         }
 
@@ -1037,6 +1057,11 @@ class systems extends plugin
 
     /* Show tab dialog if object is present */
     if (isset($this->systab->config)){
+
+      if($this->systab instanceOf plugin && !($this->systab instanceOf tabs)){
+        $this->systab->save_object();
+      }
+
       $display= $this->systab->execute();
 
       /* Don't show buttons if tab dialog requests this */
@@ -1570,7 +1595,7 @@ class systems extends plugin
         "C" => array("plugins/systems/images/select_component.png",_("Network device")),
         "P" => array("plugins/systems/images/select_printer.png",_("Printer")),
 
-        "W" => array("plugins/systems/images/select_winstation.png",_("Win workstation")),
+        "W" => array("plugins/systems/images/select_winstation.png",_("Windows workstation")),
 
         "L" => array("plugins/systems/images/select_workstation.png",_("Workstation")),
         "S" => array("plugins/systems/images/select_server.png",_("Server")),