Code

Updated ogroup mangement.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Mar 2008 13:14:34 +0000 (13:14 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Mar 2008 13:14:34 +0000 (13:14 +0000)
-Better event hanlding

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

gosa-core/plugins/admin/ogroups/class_divListOGroup.inc
gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc

index d57e83166a14fc1969c2bbf32598cfd63f8ed7e5..e9df2b35968d9025faa9f3a7b09d979423322260 100644 (file)
@@ -204,12 +204,15 @@ class divListOGroup extends MultiSelectWindow
     $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
       "&nbsp;"._("Remove")."|"."remove_multiple_ogroups/|\n";
 
-    /* Add notification event */
-    if(class_available("DaemonEvent_notify")){
+    /* Add event tag */
+    if(class_available("DaemonEvent")){
       $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(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 */
index f9fac4e4ff5c50ee3ddb4f4f238a80c0ee133a3c..07fcbeff7507b5936dff1e0547ea1adbe4f7a065 100644 (file)
@@ -133,26 +133,31 @@ class ogroupManagement extends plugin
     }
 
     /* Hanlde notification event requests */
-    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'];
     }
 
+
     /********************
       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->ogrouplist[$id]['cn'][0];
       }
       if(count($uids)){
-        $this->ogroup= new DaemonEvent_notify($this->config);
-        $this->ogroup->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->ogroup = new $type['CLASS_NAME']($this->config);
+          $this->ogroup->add_targets($uids);
+          $this->ogroup->set_type(TRIGGERED_EVENT);
+        }
       }
-
     }
 
     /* Abort event dialog */