Code

Updated system management.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Feb 2008 07:47:31 +0000 (07:47 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Feb 2008 07:47:31 +0000 (07:47 +0000)
-Implemented trigger action.

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

gosa-plugins/systems/admin/systems/class_systemManagement.inc

index d2f695baab99468eeb2794c0c7b6db979392ca27..7b1454225790581844f85efbd20de23468df7187 100644 (file)
@@ -499,7 +499,8 @@ class systems extends plugin
     /********************
       SCHEDULE action in GOsa Daemon
      ********************/
-    if(preg_match("/^schedule_event_/",$s_action)){
+    $save_events_directly = FALSE;
+    if(preg_match("/^schedule_event_/",$s_action) || preg_match("/^trigger_event_/",$s_action)){
       $this->dns = array();
       $ids = $this->list_get_selected_items();
 
@@ -515,11 +516,23 @@ class systems extends plugin
           }
         }
         $events = DaemonEvent::get_event_types();
-        $type = preg_replace("/^schedule_event_/","",$s_action);
+        if(preg_match("/^trigger_event_/",$s_action)){
+          $type = preg_replace("/^trigger_event_/","",$s_action);
+        }else{
+          $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);
+
+          /* Insert event directly with current timestamp 
+           *  to force direct execution.
+           */
+          if(preg_match("/^trigger_event_/",$s_action)){
+            $this->systab->set_timestamp(time());
+            $save_events_directly = TRUE;
+          }
         }
       }
     }
@@ -527,8 +540,8 @@ class systems extends plugin
     /* 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();
+      if(isset($_POST['save_event_dialog']) || $save_events_directly){
+        $header     = $this->systab->get_schedule_action();
         $targets    = $this->systab->get_targets();
         $data       = $this->systab->save();
         $data['timestamp'] = $this->systab->get_timestamp();