aboutsummaryrefslogtreecommitdiff
path: root/views/default/river/elements
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/river/elements')
-rw-r--r--views/default/river/elements/attachment.php25
-rw-r--r--views/default/river/elements/body.php15
-rw-r--r--views/default/river/elements/image.php16
-rw-r--r--views/default/river/elements/layout.php14
-rw-r--r--views/default/river/elements/responses.php54
-rw-r--r--views/default/river/elements/summary.php54
6 files changed, 125 insertions, 53 deletions
diff --git a/views/default/river/elements/attachment.php b/views/default/river/elements/attachment.php
deleted file mode 100644
index d5c0aab99..000000000
--- a/views/default/river/elements/attachment.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-$title = '';
-$subtitle = false;
-$image = false;
-$description = false;
-
-extract($vars, EXTR_IF_EXISTS);
-
-$body = "<h4 class=\"elgg-attachment-title\">$title</h4>";
-
-if ($subtitle) {
- $body .= "<div class=\"elgg-attachment-subtitle\">$subtitle</div>";
-}
-
-if ($description) {
- $body .= "<div class=\"elgg-attachment-description\">$description</div>";
-}
-
-
-if ($image) {
- echo elgg_view_image_block($image, $body);
-} else {
- echo $body;
-} \ No newline at end of file
diff --git a/views/default/river/elements/body.php b/views/default/river/elements/body.php
index 56d7a09e9..2cd7f2289 100644
--- a/views/default/river/elements/body.php
+++ b/views/default/river/elements/body.php
@@ -14,11 +14,11 @@ $item = $vars['item'];
$menu = elgg_view_menu('river', array(
'item' => $item,
'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
));
// river item header
-if($item->action_type != 'comment') {
-$timestamp = elgg_get_friendly_time($item->getPostedTime());
+$timestamp = elgg_view_friendly_time($item->getPostedTime());
$summary = elgg_extract('summary', $vars, elgg_view('river/elements/summary', array('item' => $vars['item'])));
if ($summary === false) {
@@ -27,6 +27,7 @@ if ($summary === false) {
'href' => $subject->getURL(),
'text' => $subject->name,
'class' => 'elgg-river-subject',
+ 'is_trusted' => true,
));
}
@@ -37,7 +38,7 @@ if ($message !== false) {
$attachments = elgg_extract('attachments', $vars, false);
if ($attachments !== false) {
- $attachments = "<div class=\"elgg-river-attachments\">$attachments</div>";
+ $attachments = "<div class=\"elgg-river-attachments clearfix\">$attachments</div>";
}
$responses = elgg_view('river/elements/responses', $vars);
@@ -52,17 +53,15 @@ if ($container instanceof ElggGroup && $container->guid != elgg_get_page_owner_g
$group_link = elgg_view('output/url', array(
'href' => $container->getURL(),
'text' => $container->name,
+ 'is_trusted' => true,
));
$group_string = elgg_echo('river:ingroup', array($group_link));
}
echo <<<RIVER
-<div class="elgg-river-summary">$summary $group_string</div>
+$menu
+<div class="elgg-river-summary">$summary $group_string <span class="elgg-river-timestamp">$timestamp</span></div>
$message
$attachments
-<span class="elgg-river-timestamp">$timestamp</span>
-$menu
$responses
RIVER;
-
-} \ No newline at end of file
diff --git a/views/default/river/elements/image.php b/views/default/river/elements/image.php
new file mode 100644
index 000000000..6f6aeae65
--- /dev/null
+++ b/views/default/river/elements/image.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Elgg river image
+ *
+ * Displayed next to the body of each river item
+ *
+ * @uses $vars['item']
+ */
+
+$subject = $vars['item']->getSubjectEntity();
+
+if (elgg_in_context('widgets')) {
+ echo elgg_view_entity_icon($subject, 'tiny');
+} else {
+ echo elgg_view_entity_icon($subject, 'small');
+}
diff --git a/views/default/river/elements/layout.php b/views/default/river/elements/layout.php
new file mode 100644
index 000000000..94622e272
--- /dev/null
+++ b/views/default/river/elements/layout.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Layout of a river item
+ *
+ * @uses $vars['item'] ElggRiverItem
+ */
+
+$item = $vars['item'];
+
+echo elgg_view('page/components/image_block', array(
+ 'image' => elgg_view('river/elements/image', $vars),
+ 'body' => elgg_view('river/elements/body', $vars),
+ 'class' => 'elgg-river-item',
+));
diff --git a/views/default/river/elements/responses.php b/views/default/river/elements/responses.php
index 432296737..f6c32e142 100644
--- a/views/default/river/elements/responses.php
+++ b/views/default/river/elements/responses.php
@@ -1,25 +1,35 @@
<?php
/**
* River item footer
+ *
+ * @uses $vars['item'] ElggRiverItem
+ * @uses $vars['responses'] Alternate override for this item
*/
+// allow river views to override the response content
+$responses = elgg_extract('responses', $vars, false);
+if ($responses) {
+ echo $responses;
+ return true;
+}
+
$item = $vars['item'];
$object = $item->getObjectEntity();
// annotations do not have comments
-if (!$object || $item->annotation_id) {
+if ($item->annotation_id != 0 || !$object) {
return true;
}
-
$comment_count = $object->countComments();
-$comments = elgg_get_annotations(array(
+$options = array(
'guid' => $object->getGUID(),
'annotation_name' => 'generic_comment',
'limit' => 3,
'order_by' => 'n_table.time_created desc'
-));
+);
+$comments = elgg_get_annotations($options);
if ($comments) {
// why is this reversing it? because we're asking for the 3 latest
@@ -27,23 +37,27 @@ if ($comments) {
// these comments with the latest at the bottom.
$comments = array_reverse($comments);
+?>
+ <span class="elgg-river-comments-tab"><?php echo elgg_echo('comments'); ?></span>
+
+<?php
+
+ echo elgg_view_annotation_list($comments, array('list_class' => 'elgg-river-comments'));
+
if ($comment_count > count($comments)) {
- $link = elgg_view('output/url', array(
- 'href' => $object->getURL(),
- 'text' => elgg_echo('river:comments:all', array($comment_count)),
- ));
-
- echo elgg_view_image_block(elgg_view_icon('speech-bubble-alt'), $link, array('class' => 'elgg-river-participation'));
+ $num_more_comments = $comment_count - count($comments);
+ $url = $object->getURL();
+ $params = array(
+ 'href' => $url,
+ 'text' => elgg_echo('river:comments:more', array($num_more_comments)),
+ 'is_trusted' => true,
+ );
+ $link = elgg_view('output/url', $params);
+ echo "<div class=\"elgg-river-more\">$link</div>";
}
-
- echo elgg_view_annotation_list($comments, array('list_class' => 'elgg-river-comments', 'item_class' => 'elgg-river-participation'));
-
}
-if ($object->canAnnotate(0, 'generic_comment')) {
- // inline comment form
- echo elgg_view_form('comments/add', array(
- 'id' => "comments-add-{$object->getGUID()}",
- 'class' => 'elgg-river-participation elgg-form-small',
- ), array('entity' => $object, 'inline' => true));
-} \ No newline at end of file
+// inline comment form
+$form_vars = array('id' => "comments-add-{$object->getGUID()}", 'class' => 'hidden');
+$body_vars = array('entity' => $object, 'inline' => true);
+echo elgg_view_form('comments/add', $form_vars, $body_vars);
diff --git a/views/default/river/elements/summary.php b/views/default/river/elements/summary.php
new file mode 100644
index 000000000..d7bde51dd
--- /dev/null
+++ b/views/default/river/elements/summary.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Short summary of the action that occurred
+ *
+ * @vars['item'] ElggRiverItem
+ */
+
+$item = $vars['item'];
+
+$subject = $item->getSubjectEntity();
+$object = $item->getObjectEntity();
+$target = $object->getContainerEntity();
+
+$subject_link = elgg_view('output/url', array(
+ 'href' => $subject->getURL(),
+ 'text' => $subject->name,
+ 'class' => 'elgg-river-subject',
+ 'is_trusted' => true,
+));
+
+$object_text = $object->title ? $object->title : $object->name;
+$object_link = elgg_view('output/url', array(
+ 'href' => $object->getURL(),
+ 'text' => elgg_get_excerpt($object_text, 100),
+ 'class' => 'elgg-river-object',
+ 'is_trusted' => true,
+));
+
+$action = $item->action_type;
+$type = $item->type;
+$subtype = $item->subtype ? $item->subtype : 'default';
+
+$container = $object->getContainerEntity();
+if ($container instanceof ElggGroup) {
+ $params = array(
+ 'href' => $container->getURL(),
+ 'text' => $container->name,
+ 'is_trusted' => true,
+ );
+ $group_link = elgg_view('output/url', $params);
+ $group_string = elgg_echo('river:ingroup', array($group_link));
+}
+
+// check summary translation keys.
+// will use the $type:$subtype if that's defined, otherwise just uses $type:default
+$key = "river:$action:$type:$subtype";
+$summary = elgg_echo($key, array($subject_link, $object_link));
+
+if ($summary == $key) {
+ $key = "river:$action:$type:default";
+ $summary = elgg_echo($key, array($subject_link, $object_link));
+}
+
+echo $summary; \ No newline at end of file