From: hickert Date: Fri, 29 Feb 2008 14:52:17 +0000 (+0000) Subject: Updated event handling X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=70d1e6d8c11d8fcb14bf46ffc385ae9aa63c6a6f;p=gosa.git Updated event handling git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9216 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc b/gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc index dce8cdfb4..cb7b2eafe 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc @@ -169,12 +169,48 @@ class termgeneric extends plugin } if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate") && isset($this->mapActions[$_POST['saction']])){ + + + + /* Check given action */ + $mapEvent = array("wake" => "wakeup", + "instant_update" => "update"); + $action = $_POST['saction']; + if(isset($mapEvent[$action])){ + $action = $mapEvent[$action]; + } + + /* Check if we have an DaemonEvent for this action */ + if(class_available("DaemonEvent_".$action)){ + $events = DaemonEvent::get_event_types(); + if(isset($events['BY_CLASS']["DaemonEvent_".$action])){ + $evt = $events['BY_CLASS']["DaemonEvent_".$action]; + $tmp = new $evt['CLASS_NAME']($this->config); + $tmp->add_targets(array($this->netConfigDNS->macAddress)); + $tmp->set_type(TRIGGERED_EVENT); + $o_queue = new gosaSupportDaemon(); + if(!$o_queue->append($tmp)){ + msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."), + $o_queue->get_error()),ERROR_DIALOG); + } + } + }else{ + + msg_dialog::display(_("Missing Daemon Event"), + sprintf(_("The requested action does not exists '%s' Sending event manually."),"DaemonEvent_".$action),ERROR_DIALOG); + + /* No event found, send action manually. + */ $method= "gosa"; $action= $_POST['saction']; if ($action == "reinstall" || $action == "update" || $action == "instant_update"){ - $method= "job"; + $method= "job"; } - gosaSupportDaemon::send("${method}_trigger_action_".$action, $this->netConfigDNS->macAddress, array("macAddress" => $this->netConfigDNS->macAddress)); + + gosaSupportDaemon::send("${method}_trigger_action_".$action, + $this->netConfigDNS->macAddress, + array("macAddress" => $this->netConfigDNS->macAddress)); + } } /* Base select dialog */ @@ -511,8 +547,21 @@ class termgeneric extends plugin $this->netConfigDNS->save(); show_ldap_error($ldap->get_error(), sprintf(_("Saving of object system terminal/generic with dn '%s' failed."),$this->dn)); + /* Send installation activation + */ if ($activate){ - gosaSupportDaemon::send("gosa_set_activated_for_installation", $this->netConfigDNS->ipHostNumber); + $events = DaemonEvent::get_event_types(); + $o_queue = new gosaSupportDaemon(); + if(isset($events['BY_CLASS']['DaemonEvent_installation_activation'])){ + $evt = $events['BY_CLASS']['DaemonEvent_installation_activation']; + $tmp = new $evt['CLASS_NAME']($this->config); + $tmp->set_type(TRIGGERED_EVENT); + $tmp->add_targets(array($this->netConfigDNS->macAddress)); + if(!$o_queue->append($tmp)){ + msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."), + $o_queue->get_error()),ERROR_DIALOG); + } + } } } diff --git a/gosa-plugins/goto/admin/systems/goto/class_terminalStartup.inc b/gosa-plugins/goto/admin/systems/goto/class_terminalStartup.inc index da458705e..388d35840 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_terminalStartup.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_terminalStartup.inc @@ -448,8 +448,22 @@ class termstartup extends plugin show_ldap_error($ldap->get_error(), sprintf(_("Saving of system terminal/startup with dn '%s' failed."),$this->dn)); $this->handle_post_events("modify"); + /* Send ldap configuration update + */ if ($ldap_changed){ - gosaSupportDaemon::send("gosa_reload_ldap_config", $this->parent->by_object['termgeneric']->netConfigDNS->macAddress); + $events = DaemonEvent::get_event_types(); + $o_queue = new gosaSupportDaemon(); + if(isset($events['BY_CLASS']['DaemonEvent_reload_ldap_config'])){ + $evt = $events['BY_CLASS']['DaemonEvent_reload_ldap_config']; + $tmp = new $evt['CLASS_NAME']($this->config); + $tmp->set_type(TRIGGERED_EVENT); + $tmp->add_targets(array($this->netConfigDNS->macAddress)); + if(!$o_queue->append($tmp)){ + msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."), + $o_queue->get_error()),ERROR_DIALOG); + } + } + } } diff --git a/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc b/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc index 09915e9e0..0d8175d71 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc @@ -599,7 +599,21 @@ class workgeneric extends plugin show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn)); if ($activate){ - gosaSupportDaemon::send("gosa_set_activated_for_installation", $this->netConfigDNS->macAddress); + + /* Send installation activation + */ + $events = DaemonEvent::get_event_types(); + $o_queue = new gosaSupportDaemon(); + if(isset($events['BY_CLASS']['DaemonEvent_installation_activation'])){ + $evt = $events['BY_CLASS']['DaemonEvent_installation_activation']; + $tmp = new $evt['CLASS_NAME']($this->config); + $tmp->set_type(TRIGGERED_EVENT); + $tmp->add_targets(array($this->netConfigDNS->macAddress)); + if(!$o_queue->append($tmp)){ + msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."), + $o_queue->get_error()),ERROR_DIALOG); + } + } } } diff --git a/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc b/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc index 06a1223ba..9571b208b 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc @@ -903,9 +903,19 @@ class workstartup extends plugin /* Check if LDAP server has changed */ if ($ldap_changed){ - gosaSupportDaemon::send("gosa_reload_ldap_config", $this->parent->by_object['workgeneric']->netConfigDNS->macAddress); + $events = DaemonEvent::get_event_types(); + $o_queue = new gosaSupportDaemon(); + if(isset($events['BY_CLASS']['DaemonEvent_reload_ldap_config'])){ + $evt = $events['BY_CLASS']['DaemonEvent_reload_ldap_config']; + $tmp = new $evt['CLASS_NAME']($this->config); + $tmp->set_type(TRIGGERED_EVENT); + $tmp->add_targets(array($this->netConfigDNS->macAddress)); + if(!$o_queue->append($tmp)){ + msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."), + $o_queue->get_error()),ERROR_DIALOG); + } + } } - }