diff options
Diffstat (limited to 'views/default/annotation')
| -rw-r--r-- | views/default/annotation/default.php | 35 | ||||
| -rw-r--r-- | views/default/annotation/generic_comment.php | 31 | ||||
| -rw-r--r-- | views/default/annotation/likes.php | 48 |
3 files changed, 45 insertions, 69 deletions
diff --git a/views/default/annotation/default.php b/views/default/annotation/default.php index dc1337362..5d29a53e2 100644 --- a/views/default/annotation/default.php +++ b/views/default/annotation/default.php @@ -2,12 +2,39 @@ /** * Elgg default annotation view * + * @note To add or remove from the annotation menu, register handlers for the menu:annotation hook. + * * @uses $vars['annotation'] */ -$owner = get_user($vars['annotation']->owner_guid); -$icon = elgg_view("profile/icon", array('entity' => $owner, 'size' => 'tiny')); +$annotation = $vars['annotation']; + +$owner = get_entity($annotation->owner_guid); +if (!$owner) { + return true; +} +$icon = elgg_view_entity_icon($owner, 'tiny'); +$owner_link = "<a href=\"{$owner->getURL()}\">$owner->name</a>"; + +$menu = elgg_view_menu('annotation', array( + 'annotation' => $annotation, + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz float-alt', +)); + +$text = elgg_view("output/longtext", array("value" => $annotation->value)); + +$friendlytime = elgg_view_friendly_time($annotation->time_created); -$info = elgg_view("output/longtext", array("value" => $vars['annotation']->value)); +$body = <<<HTML +<div class="mbn"> + $menu + $owner_link + <span class="elgg-subtext"> + $friendlytime + </span> + $text +</div> +HTML; -echo elgg_view_image_block($icon, $info); +echo elgg_view_image_block($icon, $body); diff --git a/views/default/annotation/generic_comment.php b/views/default/annotation/generic_comment.php index d5eb7492c..22a8d9211 100644 --- a/views/default/annotation/generic_comment.php +++ b/views/default/annotation/generic_comment.php @@ -3,14 +3,14 @@ * Elgg generic comment view * * @uses $vars['annotation'] ElggAnnotation object - * @uses $vars['full'] Display fill view or brief view + * @uses $vars['full_view'] Display fill view or brief view */ if (!isset($vars['annotation'])) { return true; } -$full_view = elgg_extract('full', $vars, true); +$full_view = elgg_extract('full_view', $vars, true); $comment = $vars['annotation']; @@ -22,29 +22,24 @@ if (!$entity || !$commenter) { $friendlytime = elgg_view_friendly_time($comment->time_created); -$commenter_icon = elgg_view("profile/icon", array('entity' => $commenter, 'size' => 'tiny')); +$commenter_icon = elgg_view_entity_icon($commenter, 'tiny'); $commenter_link = "<a href=\"{$commenter->getURL()}\">$commenter->name</a>"; $entity_title = $entity->title ? $entity->title : elgg_echo('untitled'); $entity_link = "<a href=\"{$entity->getURL()}\">$entity_title</a>"; if ($full_view) { - - $delete_button = ''; - if ($comment->canEdit()) { - $delete_button = elgg_view("output/confirmlink",array( - 'href' => "action/comments/delete?annotation_id={$comment->id}", - 'text' => elgg_echo('delete'), - 'confirm' => elgg_echo('deleteconfirm') - )); - $delete_button = "<span class=\"delete-button\">$delete_button</span>"; - } + $menu = elgg_view_menu('annotation', array( + 'annotation' => $comment, + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz float-alt', + )); $comment_text = elgg_view("output/longtext", array("value" => $comment->value)); $body = <<<HTML <div class="mbn"> - $delete_button + $menu $commenter_link <span class="elgg-subtext"> $friendlytime @@ -59,12 +54,14 @@ HTML; // brief view //@todo need link to actual comment! - - $on = elgg_echo('on'); + + $commented_on = elgg_echo('generic_comment:on', array($commenter_link, $entity_link)); + + $excerpt = elgg_get_excerpt($comment->value, 80); $body = <<<HTML <span class="elgg-subtext"> - $commenter_link $on $entity_link ($friendlytime) + $commented_on ($friendlytime): $excerpt </span> HTML; diff --git a/views/default/annotation/likes.php b/views/default/annotation/likes.php deleted file mode 100644 index 748d0b601..000000000 --- a/views/default/annotation/likes.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * Elgg show the users who liked the object - * - * @uses $vars['annotation'] - */ - -if (!isset($vars['annotation'])) { - return true; -} - -$like = $vars['annotation']; - -$user = $like->getOwnerEntity(); -if (!$user) { - return true; -} - -$user_icon = elgg_view("profile/icon", array('entity' => $user, 'size' => 'tiny')); -$user_link = elgg_view('output/url', array( - 'href' => $user->getURL(), - 'text' => $user->name, -)); - -$likes_string = elgg_echo('likes:this'); - -$friendlytime = elgg_view_friendly_time($like->time_created); - -if ($like->canEdit()) { - $delete_button = elgg_view("output/confirmlink",array( - 'href' => "action/likes/delete?annotation_id={$like->id}", - 'text' => elgg_echo('delete'), - 'confirm' => elgg_echo('deleteconfirm') - )); - $delete_button = "<span class=\"delete-button\">$delete_button</span>"; -} - -$body = <<<HTML -<p class="mbn"> - $delete_button - $user_link $likes_string - <span class="elgg-subtext"> - $friendlytime - </span> -</p> -HTML; - -echo elgg_view_image_block($user_icon, $body); |
