From 1cfa87af22af0cc6e2e7dfd17d775100f4e96e9d Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 3 Mar 2008 14:12:24 +0000 Subject: [PATCH] Added notification plugin git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9245 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/ogroups/class_divListOGroup.inc | 8 ++++ .../admin/ogroups/class_ogroupManagement.inc | 48 ++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/gosa-core/plugins/admin/ogroups/class_divListOGroup.inc b/gosa-core/plugins/admin/ogroups/class_divListOGroup.inc index 6fb84643f..964a5b4b5 100644 --- a/gosa-core/plugins/admin/ogroups/class_divListOGroup.inc +++ b/gosa-core/plugins/admin/ogroups/class_divListOGroup.inc @@ -184,6 +184,14 @@ class divListOGroup extends MultiSelectWindow $s.= "..|". " "._("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']." ".$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"; diff --git a/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc b/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc index 76c797a84..3838ce7cc 100644 --- a/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc +++ b/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc @@ -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); } -- 2.30.2