Code

Updated event handling.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Mar 2008 09:19:52 +0000 (09:19 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Mar 2008 09:19:52 +0000 (09:19 +0000)
-Event are now only visible for a specific type.

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

gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_install.inc
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_notify.inc
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reboot.inc
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_update.inc
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc

index b1a375f2c4505ad06b545514439ea3804d972d40..3354a89cda040e2df8d1fae7adf6d80f9e28e0c0 100644 (file)
@@ -29,7 +29,7 @@ class gotomasses extends plugin
     /* Include config object */
     $this->config= &$config;
     $this->o_queue = new gosaSupportDaemon(TRUE,10);
-    $this->events  = DaemonEvent::get_event_types();
+    $this->events  = DaemonEvent::get_event_types( USER_EVENT | SYSTEM_EVENT);
   }
 
 
index a5f55534ffa89aa5fd615d3dcfac3aea6b2235c0..93cd7dc9706f9d5151dfe4e2af547e4df58d278f 100644 (file)
 define("SCHEDULED_EVENT",1);
 define("TRIGGERED_EVENT",2);
 
+define("HIDDEN_EVENT",0);
+define("SYSTEM_EVENT",1);
+define("USER_EVENT"  ,2);
+
+
 /*! \brief    This is the event base class 
   \author   Fabian Hickert <hickert@gonicus.de>
   \version  1.00
@@ -61,6 +66,7 @@ class DaemonEvent
   protected $workstation_list     = array();  // Used as cache in the target list.
   protected $server_list          = array();  // Used as cache in the target list.
 
+  protected $visible_for          = HIDDEN_EVENT;
  
   function set_type($type)
   {
@@ -363,19 +369,27 @@ class DaemonEvent
   /*! \brief  Returns a complete list of all available events.
     @return   Array   Containing $this->get_event_info() for all available events.
    */
-  static function get_event_types()
+  static function get_event_types($type)
   {
     global $class_mapping,$config;
     $list = array();
+    $list['BY_CLASS'] = array();
+    $list['BY_TRIGGERED_ACTION'] = array();
+    $list['BY_SCHEDULED_ACTION'] = array();
+    $list['BY_QUEUED_ACTION'] = array();
+
     foreach($class_mapping as $name => $path){
       if(preg_match("/^DaemonEvent_/",$name)){
         $tmp  = new $name($config);
-        $evt  = $tmp->get_event_info();
 
-        $list['BY_CLASS'][$name]                      = $evt;
-        $list['BY_TRIGGERED_ACTION'][$evt['s_Trigger_Action']]  = $evt;
-        $list['BY_SCHEDULED_ACTION'][$evt['s_Schedule_Action']] = $evt;
-        $list['BY_QUEUED_ACTION']   [$evt['s_Queued_Action']]   = $evt;
+        if($tmp->visible_for & $type){
+          $evt  = $tmp->get_event_info();
+
+          $list['BY_CLASS'][$name]                      = $evt;
+          $list['BY_TRIGGERED_ACTION'][$evt['s_Trigger_Action']]  = $evt;
+          $list['BY_SCHEDULED_ACTION'][$evt['s_Schedule_Action']] = $evt;
+          $list['BY_QUEUED_ACTION']   [$evt['s_Queued_Action']]   = $evt;
+        }
       }
     }
     return($list);
index ceeaf61045ef69594b852d8f145fe524237faf41..29b2c3f89f8c87b62d7fd67dc6b51e1324a419ad 100644 (file)
@@ -1,6 +1,9 @@
 <?php
 class DaemonEvent_halt extends DaemonEvent
 {
+
+  var $visible_for = SYSTEM_EVENT;
+
   public function __construct($config,$data = array())
   {
     DaemonEvent::__construct($config,$data);
index 20e2c7a1c308b0ad55e3e2d94e29d1a44cdec492..c3335b687a54b8862cc10e873f83ad4ba66f0257 100644 (file)
@@ -5,6 +5,7 @@ class DaemonEvent_install extends DaemonEvent
   var $progress = 0;  
   var $status   = "";  
 
+  var $visible_for = SYSTEM_EVENT;
   public function __construct($config,$data = array())
   {
     DaemonEvent::__construct($config,$data);
index 55215ee1fff67a9afbf838230878f5ccf995ba43..7ebc7ec45d67b5f54145ebaf66b025c547c79d98 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 class DaemonEvent_notify extends DaemonEvent
 {
+  var $visible_for = USER_EVENT;
   public function __construct($config,$data = array())
   {
     DaemonEvent::__construct($config,$data);
index f8b1321f3bd8474c735ba91ce3b9a2b2c6d3ec7f..e2183ee07c7d251b63530228ac9e6945aed1de60 100644 (file)
@@ -2,6 +2,7 @@
 
 class DaemonEvent_reboot extends DaemonEvent
 {
+  var $visible_for = SYSTEM_EVENT;
   public function __construct($config,$data = array())
   {
     DaemonEvent::__construct($config,$data);
index 33e405ad902209e5216fec1856f559b456bcf9c9..59764fb0e4ec263235a87399d0ee2a4a901f1762 100644 (file)
@@ -4,6 +4,7 @@ class DaemonEvent_reinstall extends DaemonEvent
 {
   var $progress = 0;  
   var $status   = "";  
+  var $visible_for = SYSTEM_EVENT;
 
   public function __construct($config,$data = array())
   {
index 0ef11d0432539dc05a11cce84ec51ac44878337a..9a00ea92b904992fdcf27d66f276879ae2350309 100644 (file)
@@ -3,6 +3,7 @@
 
 class DaemonEvent_update extends DaemonEvent
 {
+  var $visible_for = SYSTEM_EVENT;
   public function __construct($config,$data = array())
   {
     DaemonEvent::__construct($config,$data);
index 22b82ca685a18a00fd7d5f818bf0c79ff4d62711..0172010e5a7d817fb46e0092d344d697290798ca 100644 (file)
@@ -2,6 +2,7 @@
 
 class DaemonEvent_wakeup extends DaemonEvent
 {
+  var $visible_for = SYSTEM_EVENT;
   public function __construct($config,$data = array())
   {
     DaemonEvent::__construct($config,$data);