diff options
Diffstat (limited to 'mod/messageboard')
-rw-r--r-- | mod/messageboard/languages/en.php | 5 | ||||
-rw-r--r-- | mod/messageboard/pages/messageboard/owner.php | 4 | ||||
-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/forms/messageboard/add.php | 2 | ||||
-rw-r--r-- | mod/messageboard/views/default/river/object/messageboard/create.php | 21 |
6 files changed, 39 insertions, 35 deletions
diff --git a/mod/messageboard/languages/en.php b/mod/messageboard/languages/en.php index d8ccbdeee..9027eb650 100644 --- a/mod/messageboard/languages/en.php +++ b/mod/messageboard/languages/en.php @@ -26,10 +26,7 @@ $english = array( /** * Message board widget river */ - 'messageboard:river:added' => "posted on", - 'messageboard:river:user' => "%s's", - 'messageboard:river:messageboard' => "message board", - + 'river:messageboard:user:default' => "%s posted on %s's message board", /** * Status messages diff --git a/mod/messageboard/pages/messageboard/owner.php b/mod/messageboard/pages/messageboard/owner.php index 58021c29e..2c854d4f3 100644 --- a/mod/messageboard/pages/messageboard/owner.php +++ b/mod/messageboard/pages/messageboard/owner.php @@ -16,7 +16,8 @@ elgg_push_breadcrumb($page_owner->name, $page_owner->getURL()); $options = array( 'annotations_name' => 'messageboard', 'guid' => $page_owner_guid, - 'limit' => 10 + 'limit' => 10, + 'reverse_order_by' => true, ); if ($history_user) { @@ -47,7 +48,6 @@ if (!$content) { $vars = array( 'filter' => false, - 'buttons' => false, 'content' => $content, 'title' => $title, 'reverse_order_by' => true diff --git a/mod/messageboard/start.php b/mod/messageboard/start.php index efe453286..8a7f00958 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'), + 'text_encode' => 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/forms/messageboard/add.php b/mod/messageboard/views/default/forms/messageboard/add.php index 87bec9b20..b219fd800 100644 --- a/mod/messageboard/views/default/forms/messageboard/add.php +++ b/mod/messageboard/views/default/forms/messageboard/add.php @@ -7,7 +7,7 @@ echo elgg_view('input/plaintext', array( 'name' => 'message_content', - 'class' => 'messageboard-input' + 'class' => 'messageboard-input mbs' )); echo elgg_view('input/hidden', array( diff --git a/mod/messageboard/views/default/river/object/messageboard/create.php b/mod/messageboard/views/default/river/object/messageboard/create.php index 0268930bf..975598805 100644 --- a/mod/messageboard/views/default/river/object/messageboard/create.php +++ b/mod/messageboard/views/default/river/object/messageboard/create.php @@ -3,22 +3,9 @@ * Messageboard river view */ -$performed_by = $vars['item']->getSubjectEntity(); -$performed_on = $vars['item']->getObjectEntity(); +$messageboard = $vars['item']->getAnnotation(); -$comment = $vars['item']->getAnnotation(); - -$link = elgg_view('output/url', array( - 'href' => $performed_on->getURL(), - 'text' => elgg_echo('messageboard:river:user', array($performed_on->name)), +echo elgg_view('river/item', array( + 'item' => $vars['item'], + 'message' => $messageboard->value, )); - -echo elgg_echo("messageboard:river:added"); -echo " $link "; -echo elgg_echo("messageboard:river:messageboard"); - -if ($comment) { - echo '<div class="elgg-river-content">'; - echo elgg_get_excerpt($comment->value); - echo '</div>'; -} |