summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 026d177)
raw | patch | inline | side by side (parent: 026d177)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 27 Feb 2008 07:24:36 +0000 (07:24 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 27 Feb 2008 07:24:36 +0000 (07:24 +0000) |
-Trigger actions from menu updated. (Only Schedule works right now.)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9139 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9139 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/systems/admin/systems/class_divListSystem.inc | patch | blob | history | |
gosa-plugins/systems/admin/systems/class_systemManagement.inc | patch | blob | history |
diff --git a/gosa-plugins/systems/admin/systems/class_divListSystem.inc b/gosa-plugins/systems/admin/systems/class_divListSystem.inc
index dc5467a9872b452b2b153d9a45a77d0cfd7e9eb5..909cc65d8f2333494601224311a6b15ec904b811 100644 (file)
" "._("Component")."|"."newsystem_component|\n";
}
- # Actions
+ $events = DaemonEvent::get_event_types();
$s.= "..|<img src='images/rocket.png' alt='' border='0' class='center'>".
" "._("Trigger action")."|\n";
- $s.= "...|"." "._("Halt")."|"."halt_multiple|\n";
- $s.= "...|"." "._("Reboot")."|"."reboot_multiple|\n";
- $s.= "...|"." "._("Re-install")."|"."reinstall_multiple|\n";
- $s.= "...|"." "._("Softupdate")."|"."update_multiple|\n";
- $s.= "...|"." "._("Wake up")."|"."wake_multiple|\n";
+ foreach($events['BY_CLASS'] as $name => $event){
+ $s.= "...|".$event['MenuImage']." ".$event['s_Menu_Name']."|trigger_event_".$name."\n";
+ }
+
$s.= "..|<img src='images/clock.png' alt='' border='0' class='center'>".
" "._("Schedule action")."|\n";
- $s.= "...|"." "._("Halt")."|"."schedule_halt_multiple|\n";
- $s.= "...|"." "._("Reboot")."|"."schedule_reboot_multiple|\n";
- $s.= "...|"." "._("Re-install")."|"."schedule_reinstall_multiple|\n";
- $s.= "...|"." "._("Softupdate")."|"."schedule_update_multiple|\n";
- $s.= "...|"." "._("Wake up")."|"."schedule_wake_multiple|\n";
+ foreach($events['BY_CLASS'] as $name => $event){
+ $s.= "...|".$event['MenuImage']." ".$event['s_Menu_Name']."|schedule_event_".$name."\n";
+ }
$s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
" "._("Remove")."|"."remove_multiple|\n";
diff --git a/gosa-plugins/systems/admin/systems/class_systemManagement.inc b/gosa-plugins/systems/admin/systems/class_systemManagement.inc
index e626517c405bcdc5b76e4e8bcfefcabf5e5644da..d2f695baab99468eeb2794c0c7b6db979392ca27 100644 (file)
$s_action = "editPaste";
}
+ /* Handle daemon events */
+ if(isset($_POST['menu_action']) && preg_match("/^trigger_event_/",$_POST['menu_action'])){
+ $s_action = $_POST['menu_action'];
+ }
+
+ /* Handle daemon events */
+ if(isset($_POST['menu_action']) && preg_match("/^schedule_event_/",$_POST['menu_action'])){
+ $s_action = $_POST['menu_action'];
+ }
+
/* handle remove from layers menu */
if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
$s_action = "del_multiple";
/********************
- Action for MULTIPLE entries requested
+ Action(s) for MULTIPLE
********************/
- if (preg_match("/(halt|reboot|reinstall|update|wake|)_multiple/", $s_action)){
+
+ /********************
+ SCHEDULE action in GOsa Daemon
+ ********************/
+ if(preg_match("/^schedule_event_/",$s_action)){
$this->dns = array();
$ids = $this->list_get_selected_items();
if(count($ids)){
- $mac= array();
- $ldap = $this->config->get_ldap_link();
+ $mac= array();
+ $ldap = $this->config->get_ldap_link();
foreach($ids as $id){
- $ldap->cat ($this->terminals[$id]['dn'], array("macAddress"));
- $attrs= $ldap->fetch();
- if (isset($attrs['macAddress'][0])){
- $mac[]= $attrs['macAddress'][0];
- }
+ $ldap->cat ($this->terminals[$id]['dn'], array("macAddress"));
+ $attrs= $ldap->fetch();
+ if (isset($attrs['macAddress'][0])){
+ $mac[]= $attrs['macAddress'][0];
+ }
}
+ $events = DaemonEvent::get_event_types();
+ $type = preg_replace("/^schedule_event_/","",$s_action);
+ if(count($mac) && isset($events['BY_CLASS'][$type])){
+ $event = $events['BY_CLASS'][$type];
+ $this->systab = new $event['CLASS_NAME']($this->config);
+ $this->systab->add_targets($mac);
+ }
+ }
+ }
- /* Action.... */
- $action= preg_replace('/_multiple.*$/', '', $s_action);
- gosaSupportDaemon::send("gosa_trigger_action_".$action, $mac, array("macAddress" => $mac));
-
+ /* Insert scheduled events into queue */
+ if($this->systab instanceof DaemonEvent){
+ $this->systab->save_object();
+ if(isset($_POST['save_event_dialog'])){
+ $header = $this->systab->get_header_tag();
+ $targets = $this->systab->get_targets();
+ $data = $this->systab->save();
+ $data['timestamp'] = $this->systab->get_timestamp();
+ $o_queue = new gosaSupportDaemon();
+ foreach($targets as $target){
+ $data['mac'] = $target;
+ if(!$o_queue->send($header,$target,$data,TRUE)){
+ msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."),
+ $o_queue->get_error()),ERROR_DIALOG);
+ }
+ }
+ $this->systab = FALSE;
+ }
+ if(isset($_POST['abort_event_dialog'])){
+ $this->systab = FALSE;
}
}