Code

Updated object group trigger action.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 7 Jul 2008 05:38:03 +0000 (05:38 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 7 Jul 2008 05:38:03 +0000 (05:38 +0000)
- Some events were not send.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11540 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc

index 327f94b8381cd19e302b246374e424a6ecbcfda0..e84b55aab99914428de63a47dcacb72b9e761837 100644 (file)
@@ -17,10 +17,10 @@ class termgroup extends plugin
   var $mapActions   = array("halt"            => "halt",
                             "reboot"          => "localboot",
                             "instant_update"  => "softupdate",
-                            "update"          => "sceduledupdate",
-                            "reinstall"       => "install",
-                            "rescan"          => "",
-                            "wake"            => "",
+                            "update"          => "update",
+                            "reinstall"       => "reinstall",
+                            "rescan"          => "rescan",
+                            "wake"            => "wakeup",
                             "memcheck"        => "memcheck",
                             "sysinfo"         => "sysinfo");
 
@@ -146,17 +146,37 @@ class termgroup extends plugin
       new log("view","ogroups/".get_class($this),$this->dn);
     }
 
+
     /*************** 
       Handle requested action
      ***************/
 
     /* Watch for events */
     if ((isset($_POST['action'])) && ($this->acl_is_writeable("FAIstate")) && isset($this->mapActions[$_POST['saction']]) ){
-      $macaddresses= array();
-      foreach ($this->members as $cn => $macAddress){
-        $macaddresses[]= $macAddress;
+
+      /* Check if we have an DaemonEvent for this action */
+      $action = $this->mapActions[$_POST['saction']];
+      if(class_available("DaemonEvent")){
+        $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
+        $macaddresses= array();
+        foreach ($this->members as $cn => $macAddress){
+          $macaddresses[]= $macAddress;
+        }
+
+        if(isset($events['TRIGGERED']["DaemonEvent_".$action])){
+          $evt = $events['TRIGGERED']["DaemonEvent_".$action];
+          $tmp = new $evt['CLASS_NAME']($this->config);
+          $tmp->add_targets($macaddresses);
+          $tmp->set_type(TRIGGERED_EVENT);
+          $o_queue = new gosaSupportDaemon();
+          if(!$o_queue->append($tmp)){
+            msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
+          }
+        }
+      } else {
+        msg_dialog::display(_("Event error"),
+            sprintf(_("Event '%s' is not available!"),$action),ERROR_DIALOG);
       }
-      gosaSupportDaemon::send("gosa_trigger_action_".$_POST['saction'], $macaddresses);
     }