From: hickert Date: Tue, 4 Mar 2008 09:19:52 +0000 (+0000) Subject: Updated event handling. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4d810f10e5bba54c47bebf4b85f959d92f75db7d;p=gosa.git Updated event handling. -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 --- diff --git a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc index b1a375f2c..3354a89cd 100644 --- a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc +++ b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc @@ -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); } diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc index a5f55534f..93cd7dc97 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc @@ -22,6 +22,11 @@ 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 \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); diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc index ceeaf6104..29b2c3f89 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc @@ -1,6 +1,9 @@