Code

Added notification plugin
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Mar 2008 14:12:24 +0000 (14:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Mar 2008 14:12:24 +0000 (14:12 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9245 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 6fb84643fbf24d3ae619ce7309625a5bf71ac893..964a5b4b5480db94d7c670b56a1b352c13f8a094 100644 (file)
@@ -184,6 +184,14 @@ 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")){
+      $events  = DaemonEvent::get_event_types();
+      $event = $events['BY_CLASS']['DaemonEvent_notify'];
+      $s.= "..|---|\n";
+      $s.= "..|".$event['MenuImage']."&nbsp;".$event['s_Menu_Name']."|trigger_event_DaemonEvent_notify\n";
+    }
+
     /* Add multiple copy & cut icons */
     if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
       $s.= "..|---|\n";
index 76c797a846a0fac870b7bdd7fca98a4f44979500..3838ce7ccf0ee0157ba61d070f6a7039f041ea1b 100644 (file)
@@ -130,6 +130,52 @@ class ogroupManagement extends plugin
       $s_action = "del_multiple";
     }
 
+    /* Hanlde notification event requests */
+    if(isset($_POST['menu_action']) && preg_match("/^trigger_event_DaemonEvent_notify/",$_POST['menu_action'])){
+      $s_action = "notify";
+    }
+
+    /********************
+      Create notification event
+     ********************/
+
+    if($s_action == "notify"){
+
+      $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);
+      }
+
+    }
+
+    /* Abort event dialog */
+    if(isset($_POST['abort_event_dialog'])){
+      $this->ogroup = FALSE;
+    }
+
+    /* Save event */
+    if(isset($_POST['save_event_dialog'])){
+      $o_queue = new gosaSupportDaemon();
+      $o_queue->append($this->ogroup);
+      if($o_queue->is_error()){
+        msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."),
+              $o_queue->get_error()),ERROR_DIALOG);
+      }else{
+        $this->ogroup = FALSE;
+      }
+    }
+
+    /* Display event */
+    if($this->ogroup instanceof DaemonEvent){
+      $this->ogroup->save_object();
+      return($this->ogroup->execute());
+    }
+
 
     /****************
       Copy & Paste handling 
@@ -153,7 +199,7 @@ class ogroupManagement extends plugin
          react on this. */
       $this->dn= "new";
 
-      /* Create new usertab object */
+      /* Create new ogroup- object */
       $this->ogroup= new ogrouptabs($this->config,$this->config->data['TABS']['OGROUPTABS'], $this->dn,"ogroups");
       $this->ogroup->set_acl_base($this->DivListOGroup->selectedBase);
     }