Code

Updated group management
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Mar 2008 13:14:53 +0000 (13:14 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Mar 2008 13:14:53 +0000 (13:14 +0000)
-Better event handling

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

gosa-core/plugins/admin/groups/class_divListGroup.inc
gosa-core/plugins/admin/groups/class_groupManagement.inc

index ab32f37de1f38c766f7eb61e090cbe4e4e1dd104..802f19f1060a5f279787ae866080045016b72413 100644 (file)
@@ -193,14 +193,16 @@ class divListGroup extends MultiSelectWindow
       "&nbsp;"._("Remove")."|"."remove_multiple|\n";
 
     /* Add event tag */
-    if(class_available("DaemonEvent_notify")){
-      $events  = DaemonEvent::get_event_types( USER_EVENT);
-      $event = $events['BY_CLASS']['DaemonEvent_notify'];
-      $s.= "..|---|\n";
-      $s.= "..|".$event['MenuImage']."&nbsp;".$event['s_Menu_Name']."|trigger_event_DaemonEvent_notify\n";
+    if(class_available("DaemonEvent")){
+      $events  = DaemonEvent::get_event_types(USER_EVENT);
+      if(count($events['BY_CLASS'])){
+        $s.= "..|---|\n";
+        foreach($events['BY_CLASS'] as $name => $event){
+          $s.= "..|".$event['MenuImage']."&nbsp;".$event['s_Menu_Name']."|event_".$name."\n";
+        }
+      }
     }
 
-
     /* Add multiple copy & cut icons */
     if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
       $s.= "..|---|\n";
index 7a764e80ebc9dcc6c8429ce55fb56b14697fce52..6b64a03eb8d1071d9a05568552fa0a77a176d2b4 100644 (file)
@@ -148,8 +148,8 @@ class groupManagement extends plugin
       $s_action = "multiple_edit";
     }
 
-    if(isset($_POST['menu_action']) && preg_match("/^trigger_event_DaemonEvent_notify/",$_POST['menu_action'])){
-      $s_action = "notify";
+    if(isset($_POST['menu_action']) && preg_match("/^event/",$_POST['menu_action'])){
+      $s_action = $_POST['menu_action'];
     }
 
     $smarty= get_smarty();
@@ -160,16 +160,21 @@ class groupManagement extends plugin
       Create notification event
      ********************/
 
-    if($s_action == "notify"){
-
+    if(preg_match("/^event_/",$s_action) && class_available("DaemonEvent")){
       $ids = $this->list_get_selected_items();
       $uids = array();
       foreach($ids as $id){
         $uids[] = $this->grouplist[$id]['cn'][0];
       }
       if(count($uids)){
-        $this->grouptab = new DaemonEvent_notify($this->config);
-        $this->grouptab->add_targets($uids);
+        $events = DaemonEvent::get_event_types(USER_EVENT);
+        $event = preg_replace("/^event_/","",$s_action);
+        if(isset($events['BY_CLASS'][$event])){
+          $type = $events['BY_CLASS'][$event];
+          $this->grouptab = new $type['CLASS_NAME']($this->config);
+          $this->grouptab->add_targets($uids);
+          $this->grouptab->set_type(TRIGGERED_EVENT);
+        }
       }
     }