diff options
-rw-r--r-- | engine/lib/river.php | 3 | ||||
-rw-r--r-- | mod/groups/start.php | 30 | ||||
-rw-r--r-- | mod/groups/views/default/forms/discussion/reply/save.php | 15 | ||||
-rw-r--r-- | mod/groups/views/default/river/object/groupforumtopic/create.php | 7 | ||||
-rw-r--r-- | views/default/river/item/controls.php | 5 |
5 files changed, 55 insertions, 5 deletions
diff --git a/engine/lib/river.php b/engine/lib/river.php index 656b496b5..c934e9932 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -521,6 +521,7 @@ function elgg_river_add_menu_items($hook, $type, $return, $params) { 'href' => "#comments-add-$object->guid", 'text' => elgg_echo('generic_comments:text'), 'class' => "elgg-toggler", + 'priority' => 50, ); $return[] = ElggMenuItem::factory($options); } @@ -534,6 +535,7 @@ function elgg_river_add_menu_items($hook, $type, $return, $params) { 'href' => $url, 'text' => elgg_echo('likes:likethis'), 'is_action' => true, + 'priority' => 100, ); } else { $likes = elgg_get_annotations(array( @@ -547,6 +549,7 @@ function elgg_river_add_menu_items($hook, $type, $return, $params) { 'href' => $url, 'text' => elgg_echo('likes:remove'), 'is_action' => true, + 'priority' => 100, ); } $return[] = ElggMenuItem::factory($options); diff --git a/mod/groups/start.php b/mod/groups/start.php index d83ff467e..08c0d1966 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -543,6 +543,9 @@ function discussion_init() { // Register for search. elgg_register_entity_type('object', 'groupforumtopic'); + // because replies are not comments, need of our menu item + elgg_register_plugin_hook_handler('register', 'menu:river', 'discussion_add_to_river_menu'); + // add the forum tool option add_group_tool_option('forum', elgg_echo('groups:enableforum'), true); elgg_extend_view('groups/tool_latest', 'discussion/group_module'); @@ -625,6 +628,33 @@ function discussion_owner_block_menu($hook, $type, $return, $params) { } /** + * Add the reply button for the river + */ +function discussion_add_to_river_menu($hook, $type, $return, $params) { + if (elgg_is_logged_in()) { + $item = $params['item']; + $object = $item->getObjectEntity(); + if (elgg_instanceof($object, 'object', 'groupforumtopic')) { + if ($item->annotation_id == 0) { + $group = $object->getContainerEntity(); + if ($group->isMember() || elgg_is_admin_logged_in()) { + $options = array( + 'name' => 'reply', + 'href' => "#groups-reply-$object->guid", + 'text' => elgg_echo('reply'), + 'class' => "elgg-toggler", + 'priority' => 50, + ); + $return[] = ElggMenuItem::factory($options); + } + } + } + } + + return $return; +} + +/** * Event handler for group forum posts * */ diff --git a/mod/groups/views/default/forms/discussion/reply/save.php b/mod/groups/views/default/forms/discussion/reply/save.php index 6281e941c..be258b8fe 100644 --- a/mod/groups/views/default/forms/discussion/reply/save.php +++ b/mod/groups/views/default/forms/discussion/reply/save.php @@ -2,21 +2,28 @@ /** * Discussion topic reply form bofy * - * @uses $vars['entity'] + * @uses $vars['entity'] A discussion topic object + * @uses $vars['inline'] Display a shortened form? */ if (isset($vars['entity']) && elgg_is_logged_in()) { + $inline = elgg_extract('inline', $vars, false); + + if ($inline) { + echo elgg_view('input/text', array('name' => 'group_topic_post')); + echo elgg_view('input/submit', array('value' => elgg_echo('reply'))); + } else { ?> <div> <label><?php echo elgg_echo("reply"); ?></label> <?php echo elgg_view('input/longtext', array('name' => 'group_topic_post')); ?> </div> <?php - echo elgg_view('input/submit', array('value' => elgg_echo('reply'))); - + echo elgg_view('input/submit', array('value' => elgg_echo('reply'))); + } echo elgg_view('input/hidden', array( 'name' => 'entity_guid', - 'value' => $vars['entity']->getGUID() + 'value' => $vars['entity']->getGUID(), )); } diff --git a/mod/groups/views/default/river/object/groupforumtopic/create.php b/mod/groups/views/default/river/object/groupforumtopic/create.php index 1ca871b58..2c914c3f8 100644 --- a/mod/groups/views/default/river/object/groupforumtopic/create.php +++ b/mod/groups/views/default/river/object/groupforumtopic/create.php @@ -33,3 +33,10 @@ if ($excerpt) { echo $excerpt; echo '</div>'; } + +if (elgg_is_logged_in() && $container->isMember(elgg_get_logged_in_user_entity())) { + // inline comment form + echo elgg_view_form('discussion/reply/save', array( + 'id' => "groups-reply-{$object->getGUID()}", + ), array('entity' => $object, 'inline' => true)); +} diff --git a/views/default/river/item/controls.php b/views/default/river/item/controls.php index d3f8c6fc0..188d01b5a 100644 --- a/views/default/river/item/controls.php +++ b/views/default/river/item/controls.php @@ -5,4 +5,7 @@ * @uses $vars['item'] */ -echo elgg_view_menu('river', array('item' => $vars['item'])); +echo elgg_view_menu('river', array( + 'item' => $vars['item'], + 'sort_by' => 'priority', +)); |