Code

Updated gotomasses.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Mar 2008 12:30:59 +0000 (12:30 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Mar 2008 12:30:59 +0000 (12:30 +0000)
-Only display those that are schedulable

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

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

index 13c563bb3005d7dfa7459f495861d06cb64f37d9..2a80bf2875e4580b4edd378f3be8c88c1821ba1b 100644 (file)
@@ -273,7 +273,8 @@ class gotomasses extends plugin
     $divlist->SetHeadpageMode();
     $s = ".|"._("Actions")."|\n";
     $s.= "..|<img src='images/list_new.png' alt='' border='0' class='center'>&nbsp;"._("Create")."\n";
-    foreach($this->events['BY_CLASS'] as $name =>  $event){
+    foreach($this->events['BY_SCHEDULED_ACTION'] as $name =>  $event){
+      $name = $event['CLASS_NAME'];
       $s.= "...|".$event['MenuImage']."&nbsp;".$event['s_Menu_Name']."|add_event_".$name."\n";
     }
     if($this->acl_is_removeable()){
index ae4f7e3105402c6aec7aad6a62a18a54ce9db127..f5da13b044843c03ab19e9d3356ba69fb50f88dd 100644 (file)
@@ -23,9 +23,9 @@
 define("SCHEDULED_EVENT",1);
 define("TRIGGERED_EVENT",2);
 
-define("HIDDEN_EVENT",0);
-define("SYSTEM_EVENT",1);
-define("USER_EVENT"  ,2);
+define("HIDDEN_EVENT",1);
+define("SYSTEM_EVENT",2);
+define("USER_EVENT"  ,4);
 
 
 /*! \brief    This is the event base class 
@@ -347,9 +347,13 @@ class DaemonEvent
   public function get_event_info()
   {
     $data =array();
-    $data['CLASS_NAME']         = get_class($this);
-    foreach(array("s_Menu_Name","s_Event_Name","s_Queued_Action","s_Schedule_Action","s_Trigger_Action") as $attr){
-      $data[$attr]  = $this->$attr;
+    $data['CLASS_NAME']   = get_class($this);
+    $data['s_Menu_Name']  = $this->s_Menu_Name;
+    $data['s_Event_Name'] = $this->s_Event_Name;
+    foreach(array("s_Queued_Action","s_Schedule_Action","s_Trigger_Action") as $attr){
+      if(!empty($this->$attr)){
+        $data[$attr]  = $this->$attr;
+      }
     }
     $data['MenuImage']    = "<img src='".$this->s_Menu_Image."' alt='".$this->s_Menu_Name."' border='0' class='center'>";
     $data['ListImage']    = "<img src='".$this->s_List_Image."' title='".$this->s_Event_Name."' 
@@ -382,14 +386,18 @@ class DaemonEvent
     foreach($class_mapping as $name => $path){
       if(preg_match("/^DaemonEvent_/",$name)){
         $tmp  = new $name($config);
-
         if($tmp->visible_for & $type){
           $evt  = $tmp->get_event_info();
-
           $list['BY_CLASS'][$name]                      = $evt;
-          $list['BY_TRIGGERED_ACTION'][$evt['s_Trigger_Action']]  = $evt;
-          $list['BY_SCHEDULED_ACTION'][$evt['s_Schedule_Action']] = $evt;
-          $list['BY_QUEUED_ACTION']   [$evt['s_Queued_Action']]   = $evt;
+          if(isset($evt['s_Trigger_Action'])){
+            $list['BY_TRIGGERED_ACTION'][$evt['s_Trigger_Action']]  = $evt;
+          }
+          if(isset($evt['s_Schedule_Action'])){
+            $list['BY_SCHEDULED_ACTION'][$evt['s_Schedule_Action']] = $evt;
+          }
+          if(isset($evt['s_Queued_Action'])){
+            $list['BY_QUEUED_ACTION']   [$evt['s_Queued_Action']]   = $evt;
+          }
         }
       }
     }