aboutsummaryrefslogtreecommitdiff
path: root/views/default/annotation
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/annotation')
-rw-r--r--views/default/annotation/annotate.php28
-rw-r--r--views/default/annotation/annotatelike.php11
-rw-r--r--views/default/annotation/default.php40
-rw-r--r--views/default/annotation/generic_comment.php108
-rw-r--r--views/default/annotation/latest_comments.php36
-rw-r--r--views/default/annotation/likes.php40
6 files changed, 105 insertions, 158 deletions
diff --git a/views/default/annotation/annotate.php b/views/default/annotation/annotate.php
deleted file mode 100644
index 2cb35798b..000000000
--- a/views/default/annotation/annotate.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
- $performed_by = get_entity($vars['item']->subject_guid);
- $object = get_entity($vars['item']->object_guid);
- $url = $object->getURL();
- $title = $object->title;
- if(!$title)
- $title = elgg_echo('file:untitled');
- $subtype = get_subtype_from_id($object->subtype);
- //grab the annotation, if one exists
- if($vars['item']->annotation_id != 0)
- $comment = get_annotation($vars['item']->annotation_id)->value;
- $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
- $string = sprintf(elgg_echo("river:posted:generic"),$url) . " ";
- $string .= elgg_echo("{$subtype}:river:annotate") . " <a href=\"{$object->getURL()}\">" . $title . "</a> <span class='entity_subtext'>". friendly_time($object->time_created) ."</span> <a class='river_comment_form_button link'>Comment</a>";
- $string .= elgg_view('likes/forms/link', array('entity' => $object));
- if(get_context() != 'riverdashboard'){
- $string .= "<div class='river_content_display'>";
- if($comment){
- $contents = strip_tags($comment);//this is so we don't get large images etc in the activity river
- if(strlen($contents) > 200)
- $string .= substr($contents, 0, strpos($contents, ' ', 200)) . "&hellip;";
- else
- $string .= $contents;
- }
- $string .= "</div>";
- }
-echo $string; \ No newline at end of file
diff --git a/views/default/annotation/annotatelike.php b/views/default/annotation/annotatelike.php
deleted file mode 100644
index 6a2dcd4ca..000000000
--- a/views/default/annotation/annotatelike.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-$performed_by = get_entity($vars['item']->subject_guid);
-$object = get_entity($vars['item']->object_guid);
-$url = $object->getURL();
-$title = $object->title;
-
-$string = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a> ";
-$string .= elgg_echo("likes:river:annotate") . " <a href=\"{$object->getURL()}\">" . $title . "</a> <span class='entity_subtext'>" . friendly_time($object->time_created)."</span>";
-
-echo $string; \ No newline at end of file
diff --git a/views/default/annotation/default.php b/views/default/annotation/default.php
new file mode 100644
index 000000000..5d29a53e2
--- /dev/null
+++ b/views/default/annotation/default.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Elgg default annotation view
+ *
+ * @note To add or remove from the annotation menu, register handlers for the menu:annotation hook.
+ *
+ * @uses $vars['annotation']
+ */
+
+$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);
+
+$body = <<<HTML
+<div class="mbn">
+ $menu
+ $owner_link
+ <span class="elgg-subtext">
+ $friendlytime
+ </span>
+ $text
+</div>
+HTML;
+
+echo elgg_view_image_block($icon, $body);
diff --git a/views/default/annotation/generic_comment.php b/views/default/annotation/generic_comment.php
index 02a6abb71..22a8d9211 100644
--- a/views/default/annotation/generic_comment.php
+++ b/views/default/annotation/generic_comment.php
@@ -1,47 +1,69 @@
<?php
/**
- * Elgg generic comment
+ * Elgg generic comment view
+ *
+ * @uses $vars['annotation'] ElggAnnotation object
+ * @uses $vars['full_view'] Display fill view or brief view
*/
-$owner = get_user($vars['annotation']->owner_guid);
-
-?>
-<a name="comment_<?php echo $vars['annotation']->id; ?>"></a>
-<div class="generic_comment clearfloat">
- <div class="generic_comment_icon">
- <?php
- echo elgg_view("profile/icon", array(
- 'entity' => $owner,
- 'size' => 'tiny'
- ));
- ?>
- </div>
-
- <div class="generic_comment_details">
- <?php
- // if the user looking at the comment can edit, show the delete link
- if ($vars['annotation']->canEdit()) {
- ?>
- <span class="delete_button">
- <?php echo elgg_view("output/confirmlink",array(
- 'href' => $vars['url'] . "action/comments/delete?annotation_id=" . $vars['annotation']->id,
- 'text' => elgg_echo('delete'),
- 'confirm' => elgg_echo('deleteconfirm')
- ));
- ?>
- </span>
- <?php
- } //end of can edit if statement
- ?>
- <p class="generic_comment_owner">
- <a href="<?php echo $owner->getURL(); ?>"><?php echo $owner->name; ?></a>
- <span class="entity_subtext">
- <?php echo friendly_time($vars['annotation']->time_created); ?>
- </span>
- </p>
- <!-- output the actual comment -->
- <div class="generic_comment_body">
- <?php echo elgg_view("output/longtext",array("value" => $vars['annotation']->value)); ?>
- </div>
- </div>
-</div> \ No newline at end of file
+if (!isset($vars['annotation'])) {
+ return true;
+}
+
+$full_view = elgg_extract('full_view', $vars, true);
+
+$comment = $vars['annotation'];
+
+$entity = get_entity($comment->entity_guid);
+$commenter = get_user($comment->owner_guid);
+if (!$entity || !$commenter) {
+ return true;
+}
+
+$friendlytime = elgg_view_friendly_time($comment->time_created);
+
+$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) {
+ $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">
+ $menu
+ $commenter_link
+ <span class="elgg-subtext">
+ $friendlytime
+ </span>
+ $comment_text
+</div>
+HTML;
+
+ echo elgg_view_image_block($commenter_icon, $body);
+
+} else {
+ // brief view
+
+ //@todo need link to actual comment!
+
+ $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">
+ $commented_on ($friendlytime): $excerpt
+</span>
+HTML;
+
+ echo elgg_view_image_block($commenter_icon, $body);
+}
diff --git a/views/default/annotation/latest_comments.php b/views/default/annotation/latest_comments.php
deleted file mode 100644
index e1181b63e..000000000
--- a/views/default/annotation/latest_comments.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * Display latest comments on objects
- **/
-
-if($vars['comments']){
- global $CONFIG;
- echo "<h3>" . elgg_echo('generic_comments:latest') . "</h3>";
- foreach($vars['comments'] as $comment){
- //grab the entity the comment is on
- $entity = get_entity($comment->entity_guid);
- //comment owner
- $comment_owner = get_user($comment->owner_guid);
- $friendlytime = friendly_time($comment->time_created); // get timestamp for comment
-
- //set the title
- if($entity->title){
- $objecttitle = $entity->title;
- }else{
- $objecttitle = elgg_echo('untitled');
- }
-
- //if the entity has been deleted, don't link to it
- if($entity){
- $url = $entity->getURL(); // get url to file for comment link
- $url_display = "<a href=\"{$url}\">{$objecttitle}</a>";
- }else{
- $url_display = $objecttitle;
- }
-
- echo "<div class='generic_comment latest clearfloat'><span class='generic_comment_icon'>" . elgg_view("profile/icon",array('entity' => $comment_owner, 'size' => 'tiny')) . "</span>";
- echo "<div class='generic_comment_details'><span class='entity_subtext'><a href=\"{$vars['url']}pg/profile/{$comment_owner->username}\">{$comment_owner->name}</a> " . elgg_echo('on') . " <span class='entity_title'>{$url_display}</span> ({$friendlytime})</span></div>";
- echo "</div>";
-
- }
-} \ No newline at end of file
diff --git a/views/default/annotation/likes.php b/views/default/annotation/likes.php
deleted file mode 100644
index 2808664df..000000000
--- a/views/default/annotation/likes.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
- * Elgg show the user who liked the object
- */
-
-$owner = get_user($vars['annotation']->owner_guid);
-
-?>
-<div class="elgg_likes_user clearfloat">
- <div class="entity_listing_icon">
- <?php
- echo elgg_view("profile/icon", array(
- 'entity' => $owner,
- 'size' => 'tiny'
- ));
- ?>
- </div>
-
- <div class="entity_listing_info">
- <?php
- // if the user looking at the like listing can edit, show the delete link
- if ($vars['annotation']->canEdit()) {
- ?>
- <div class="entity_metadata"><span class="delete_button">
- <?php echo elgg_view("output/confirmlink",array(
- 'href' => $vars['url'] . "action/likes/delete?annotation_id=" . $vars['annotation']->id,
- 'text' => elgg_echo('remove'),
- 'confirm' => elgg_echo('deleteconfirm')
- ));
- ?>
- </span></div>
- <?php
- } //end of can edit if statement
- ?>
- <p class="elgg_likes_owner">
- <a href="<?php echo $owner->getURL(); ?>"><?php echo $owner->name; ?></a> <?php echo elgg_echo('likes:this') .
- " <span class=\"entity_subtext\">" . friendly_time($vars['annotation']->time_created) . "</span>"; ?>
- </p>
- </div>
-</div> \ No newline at end of file