Code

Updated gotomasses.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 20 Feb 2008 12:23:48 +0000 (12:23 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 20 Feb 2008 12:23:48 +0000 (12:23 +0000)
-Some minor changes.

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

gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc

index 1fb655a36c5a391a5341a66831505c55d7493541..a03420249444ed04c2dab9be564b45af78ca35e2 100644 (file)
@@ -67,7 +67,7 @@ class gotomasses extends plugin
     }
 
     /* Menu actions */
-    if(isset($_POST['menu_action'])){
+    if(isset($_POST['menu_action']) && !empty($_POST['menu_action'])){
       $s_action = $_POST['menu_action'];
     }
     
@@ -130,6 +130,8 @@ class gotomasses extends plugin
      * REMOVE 
      ************/
 
+    echo $s_action;
+    
     /* Remove multiple */
     if($s_action == "remove_multiple" || $s_action == "remove"){
 
@@ -190,11 +192,33 @@ class gotomasses extends plugin
 #     $this->current = -1;
 #   }
 #
-   /* Close dialog */
-   if(isset($_POST['abort_event_dialog'])){
-     $this->dialog = FALSE;
-     $this->current = -1;
-   }
+
+    /* Close dialog */
+    if(isset($_POST['save_event_dialog'])){
+
+      if($this->dialog->is_new()){
+        $header     = $this->dialog->get_header_tag();
+        $targets    = $this->dialog->get_targets();
+        $data       = $this->dialog->save();
+        $data['TIMESTAMP'] = $this->dialog->get_timestamp(); 
+
+        foreach($targets as $target){
+          if(!$this->o_queue->send($header,$target,$data)){
+            msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."),
+                  $this->o_queue->get_error()),ERROR_DIALOG);
+          }  
+        }
+        $this->dialog = FALSE; 
+        $this->current = -1;
+      }
+    }
+
+
+    /* Close dialog */
+    if(isset($_POST['abort_event_dialog'])){
+      $this->dialog = FALSE;
+      $this->current = -1;
+    }
 #
 #   /* Close dialog */
 #   if((isset($_POST['save_goto_task']) || isset($_POST['apply_goto_task'])) && is_object($this->dialog) ){
@@ -447,11 +471,9 @@ class gotomasses extends plugin
     $stop   = $this->range;
 
     $entries = $this->o_queue->get_queued_entries($start,$stop,$sort);
-    if(!is_array($entries)){
-      if ($this->o_queue->get_error()){
-        msg_dialog::display(_("Error"), sprintf(_("Cannot load queue entries: %s"), "<br><br>".$this->o_queue->get_error()), ERROR_DIALOG);
-      }
-      return(array());
+    if ($this->o_queue->is_error()){
+
+      msg_dialog::display(_("Error"), sprintf(_("Cannot load queue entries: %s"), "<br><br>".$this->o_queue->get_error()), ERROR_DIALOG);
     }
 
     $this->entries = array();
@@ -534,17 +556,6 @@ class gotomasses extends plugin
   }
 
 
-  function get_actions()
-  {
-    /* Prepare list of available actions */
-    $actions = array(      
-        "gosa_ping"       => _("GOsa ping"),
-        "ping"            => _("Ping"),
-        "sayHello"        => _("Say hello"));
-    return($actions);
-  }
-
-
   static function plInfo()
   {
     return (array(
index d321a3f20bea721c4403f20189f08348e63cc340..88af593b728d3daccc39df0704df2f16585e7a15 100644 (file)
@@ -467,6 +467,31 @@ class DaemonEvent
   }
 
 
+  public function is_new()
+  {
+    return($this->is_new);
+  }
+
+  public function get_header_tag()
+  {
+    return($this->s_action);
+  }
+  public function save()
+  {
+    return(array());
+  }
+  public function get_targets()
+  {
+    return($this->a_targets);
+  }
+
+  public function get_timestamp()
+  {
+    return($this->_timestamp_to_event($this->timestamp));
+  }
+
   protected  function list_get_selected_items()
   {
     $ids = array();
index 02ff35dae399ca69da6cb4ad78d43c502d1c3cd2..fadb51628e1f837b0d07ebd0fa1f2688c643ff5e 100644 (file)
@@ -7,7 +7,7 @@ class DaemonEvent_wakeup extends DaemonEvent
     DaemonEvent::__construct($config,$data);
     $this->s_Menu_Name  = _("Wake up"); 
     $this->s_Event_Name = _("Wake up"); 
-    $this->s_action     = "trigger_action_wake";
+    $this->s_action     = "job_trigger_action_wake";
     $this->s_Menu_Image = "images/status_running.png";
   }