From b409c2fc4f6586f286c1476232b4d0109a5eda5b Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 7 Jul 2008 05:38:03 +0000 Subject: [PATCH] Updated object group trigger action. - Some events were not send. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11540 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/ogroups/goto/class_termgroup.inc | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc b/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc index 327f94b83..e84b55aab 100644 --- a/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc +++ b/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc @@ -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); } -- 2.30.2