From 6f4ca315db3a8c162fe032e79a9b27f16732bf2d Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Wed, 24 Aug 2011 20:38:12 -0700 Subject: Fixes #3612, #3750. Added edit replies back to group plugin with the annotation menu. --- mod/groups/start.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'mod/groups/start.php') diff --git a/mod/groups/start.php b/mod/groups/start.php index 83353bae5..9e4694457 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -65,6 +65,9 @@ function groups_init() { // group user hover menu elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'groups_user_entity_menu_setup'); + // delete and edit annotations for topic replies + elgg_register_plugin_hook_handler('register', 'menu:annotation', 'groups_annotation_menu_setup'); + //extend some views elgg_extend_view('css/elgg', 'groups/css'); elgg_extend_view('js/elgg', 'groups/js'); @@ -408,6 +411,51 @@ function groups_user_entity_menu_setup($hook, $type, $return, $params) { return $return; } +/** + * Add edit and delete links for forum replies + */ +function groups_annotation_menu_setup($hook, $type, $return, $params) { + if (elgg_in_context('widgets')) { + return $return; + } + + $annotation = $params['annotation']; + + if ($annotation->name != 'group_topic_post') { + return $return; + } + + if ($annotation->canEdit()) { + $url = elgg_http_add_url_query_elements('action/discussion/reply/delete', array( + 'annotation_id' => $annotation->id, + )); + + $options = array( + 'name' => 'delete', + 'href' => $url, + 'text' => "", + 'confirm' => elgg_echo('deleteconfirm'), + 'text_encode' => false + ); + $return[] = ElggMenuItem::factory($options); + + $url = elgg_http_add_url_query_elements('discussion', array( + 'annotation_id' => $annotation->id, + )); + + $options = array( + 'name' => 'edit', + 'href' => "#edit-annotation-$annotation->id", + 'text' => elgg_echo('edit'), + 'text_encode' => false, + 'rel' => 'toggle', + ); + $return[] = ElggMenuItem::factory($options); + } + + return $return; +} + /** * Groups created so create an access list for it */ -- cgit v1.2.3