diff options
Diffstat (limited to 'mod/messageboard')
-rw-r--r-- | mod/messageboard/start.php | 31 | ||||
-rw-r--r-- | mod/messageboard/views/default/annotation/messageboard.php | 11 | ||||
-rw-r--r-- | mod/messageboard/views/default/messageboard/js.php | 2 |
3 files changed, 32 insertions, 12 deletions
diff --git a/mod/messageboard/start.php b/mod/messageboard/start.php index efe453286..0b0155069 100644 --- a/mod/messageboard/start.php +++ b/mod/messageboard/start.php @@ -26,6 +26,9 @@ function messageboard_init() { $action_path = dirname(__FILE__) . '/actions'; elgg_register_action("messageboard/add", "$action_path/add.php"); elgg_register_action("messageboard/delete", "$action_path/delete.php"); + + // delete annotations for posts + elgg_register_plugin_hook_handler('register', 'menu:annotation', 'messageboard_annotation_menu_setup'); } /** @@ -127,4 +130,32 @@ function messageboard_add($poster, $owner, $message, $access_id = ACCESS_PUBLIC) return $result; } + +/** + * Add edit and delete links for forum replies + */ +function messageboard_annotation_menu_setup($hook, $type, $return, $params) { + $annotation = $params['annotation']; + if ($annotation->name != 'messageboard') { + return $return; + } + + if ($annotation->canEdit()) { + $url = elgg_http_add_url_query_elements('action/messageboard/delete', array( + 'annotation_id' => $annotation->id, + )); + + $options = array( + 'name' => 'delete', + 'href' => $url, + 'text' => "<span class=\"elgg-icon elgg-icon-delete\"></span>", + 'confirm' => elgg_echo('deleteconfirm'), + 'encode_text' => false + ); + $return[] = ElggMenuItem::factory($options); + } + + return $return; +} + elgg_register_event_handler('init', 'system', 'messageboard_init');
\ No newline at end of file diff --git a/mod/messageboard/views/default/annotation/messageboard.php b/mod/messageboard/views/default/annotation/messageboard.php deleted file mode 100644 index 8dfba3a22..000000000 --- a/mod/messageboard/views/default/annotation/messageboard.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -/** - * Message board post - * - * @uses $vars['annotation'] ElggAnnotation object - * @uses $vars['full_view'] Display fill view or brief view - */ - -$vars['delete_action'] = 'action/messageboard/delete'; - -echo elgg_view('annotation/default', $vars);
\ No newline at end of file diff --git a/mod/messageboard/views/default/messageboard/js.php b/mod/messageboard/views/default/messageboard/js.php index 5d89fcd69..e5495409a 100644 --- a/mod/messageboard/views/default/messageboard/js.php +++ b/mod/messageboard/views/default/messageboard/js.php @@ -23,7 +23,7 @@ elgg.messageboard.submit = function(e) { data: data, success: function(json) { // the action always returns the full ul and li wrapped annotation. - var ul = form.next('ul.elgg-annotation-list'); + var ul = form.next('ul.elgg-list-annotation'); if (ul.length < 1) { form.parent().append(json.output); |