aboutsummaryrefslogtreecommitdiff
path: root/views/default/river
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/river')
-rw-r--r--views/default/river/annotation/generic_comment/create.php27
-rw-r--r--views/default/river/elements/body.php70
-rw-r--r--views/default/river/elements/responses.php (renamed from views/default/river/elements/footer.php)10
-rw-r--r--views/default/river/elements/summary.php41
-rw-r--r--views/default/river/item.php10
-rw-r--r--views/default/river/relationship/friend/create.php16
-rw-r--r--views/default/river/user/default/profileiconupdate.php18
7 files changed, 127 insertions, 65 deletions
diff --git a/views/default/river/annotation/generic_comment/create.php b/views/default/river/annotation/generic_comment/create.php
index aabb6a9c6..d3db68e41 100644
--- a/views/default/river/annotation/generic_comment/create.php
+++ b/views/default/river/annotation/generic_comment/create.php
@@ -5,26 +5,7 @@
$object = $vars['item']->getObjectEntity();
$comment = $vars['item']->getAnnotation();
-$url = $object->getURL();
-$title = $object->title;
-if (!$title) {
- $title = elgg_echo('untitled');
-}
-$params = array(
- 'href' => $object->getURL(),
- 'text' => $title,
-);
-$object_link = elgg_view('output/url', $params);
-
-$type = $object->getType();
-$subtype = $object->getSubtype();
-
-$type_string = elgg_echo("river:commented:$type:$subtype");
-echo elgg_echo('river:generic_comment', array($type_string, $object_link));
-
-if ($comment) {
- $excerpt = elgg_get_excerpt($comment->value);
- echo '<div class="elgg-river-content">';
- echo $excerpt;
- echo '</div>';
-}
+echo elgg_view('river/item', array(
+ 'item' => $vars['item'],
+ 'message' => elgg_get_excerpt($comment->value),
+));
diff --git a/views/default/river/elements/body.php b/views/default/river/elements/body.php
index f9ecbc03c..c5a525733 100644
--- a/views/default/river/elements/body.php
+++ b/views/default/river/elements/body.php
@@ -2,32 +2,64 @@
/**
* Body of river item
*
- * @uses $vars['item']
+ * @uses $vars['item'] ElggRiverItem
+ * @uses $vars['summary'] Alternate summary (the short text summary of action)
+ * @uses $vars['message'] Optional message (usually excerpt of text)
+ * @uses $vars['attachments'] Optional attachments (displaying icons or other non-text data)
+ * @uses $vars['responses'] Alternate respones (comments, replies, etc.)
*/
$item = $vars['item'];
-$subject = $item->getSubjectEntity();
+
+$menu = elgg_view_menu('river', array(
+ 'item' => $item,
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
// river item header
-$params = array(
- 'href' => $subject->getURL(),
- 'text' => $subject->name,
-);
-$subject_link = elgg_view('output/url', $params);
$timestamp = elgg_get_friendly_time($item->getPostedTime());
-$header = elgg_view_menu('river', array('item' => $item, 'sort_by' => 'priority'));
-$header .= "$subject_link <span class=\"elgg-river-timestamp\">$timestamp</span>";
+$summary = elgg_extract('summary', $vars, elgg_view('river/elements/summary', array('item' => $vars['item'])));
+if ($summary === false) {
+ $subject = $item->getSubjectEntity();
+ $summary = elgg_view('output/url', array(
+ 'href' => $subject->getURL(),
+ 'text' => $subject->name,
+ 'class' => 'elgg-river-subject',
+ ));
+}
+
+$message = elgg_extract('message', $vars, false);
+if ($message !== false) {
+ $message = "<div class=\"elgg-river-message\">$message</div>";
+}
+
+$attachments = elgg_extract('attachments', $vars, false);
+if ($attachments !== false) {
+ $attachments = "<div class=\"elgg-river-attachments clearfix\">$attachments</div>";
+}
-// body
-$body = elgg_view($item->getView(), array('item' => $item));
+$responses = elgg_view('river/elements/responses', $vars);
+if ($responses) {
+ $responses = "<div class=\"elgg-river-responses\">$responses</div>";
+}
-// footer
-$footer = elgg_view('river/elements/footer', $vars);
+$group_string = '';
+$object = $item->getObjectEntity();
+$container = $object->getContainerEntity();
+if ($container instanceof ElggGroup && $container->guid != elgg_get_page_owner_guid()) {
+ $group_link = elgg_view('output/url', array(
+ 'href' => $container->getURL(),
+ 'text' => $container->name,
+ ));
+ $group_string = elgg_echo('river:ingroup', array($group_link));
+}
-echo elgg_view('page/components/module', array(
- 'header' => $header,
- 'body' => $body,
- 'footer' => $footer,
- 'class' => 'mbn',
-)); \ No newline at end of file
+echo <<<RIVER
+$menu
+<div class="elgg-river-summary">$summary $group_string <span class="elgg-river-timestamp">$timestamp</span></div>
+$message
+$attachments
+$responses
+RIVER;
diff --git a/views/default/river/elements/footer.php b/views/default/river/elements/responses.php
index f1e79f131..8c5be6316 100644
--- a/views/default/river/elements/footer.php
+++ b/views/default/river/elements/responses.php
@@ -1,8 +1,18 @@
<?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();
diff --git a/views/default/river/elements/summary.php b/views/default/river/elements/summary.php
new file mode 100644
index 000000000..4d80c29a6
--- /dev/null
+++ b/views/default/river/elements/summary.php
@@ -0,0 +1,41 @@
+<?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',
+));
+
+$object_link = elgg_view('output/url', array(
+ 'href' => $object->getURL(),
+ 'text' => $object->title ? $object->title : $object->name,
+ 'class' => 'elgg-river-object',
+));
+
+$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,
+ );
+ $group_link = elgg_view('output/url', $params);
+ $group_string = elgg_echo('river:ingroup', array($group_link));
+}
+
+
+echo elgg_echo("river:$action:$type:$subtype", array($subject_link, $object_link)); \ No newline at end of file
diff --git a/views/default/river/item.php b/views/default/river/item.php
index bf7c80b03..94622e272 100644
--- a/views/default/river/item.php
+++ b/views/default/river/item.php
@@ -7,10 +7,8 @@
$item = $vars['item'];
-$vars = array(
- 'image' => elgg_view('river/elements/image', array('item' => $item)),
- 'body' => elgg_view('river/elements/body', array('item' => $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',
-);
-
-echo elgg_view('page/components/image_block', $vars);
+));
diff --git a/views/default/river/relationship/friend/create.php b/views/default/river/relationship/friend/create.php
index 14dab4451..a191e7b1e 100644
--- a/views/default/river/relationship/friend/create.php
+++ b/views/default/river/relationship/friend/create.php
@@ -5,18 +5,10 @@
$subject = $vars['item']->getSubjectEntity();
$object = $vars['item']->getObjectEntity();
-$params = array(
- 'href' => $object->getURL(),
- 'text' => $object->name,
-);
-$object_link = elgg_view('output/url', $params);
$subject_icon = elgg_view_entity_icon($subject, 'tiny');
$object_icon = elgg_view_entity_icon($object, 'tiny');
-echo elgg_echo("friends:river:add", array($object_link));
-
-echo '<div class="elgg-river-content clearfix">';
-echo $subject_icon;
-echo elgg_view_icon('arrow-right', true);
-echo $object_icon;
-echo '</div>';
+echo elgg_view('river/item', array(
+ 'item' => $vars['item'],
+ 'attachments' => $subject_icon . elgg_view_icon('arrow-right') . $object_icon,
+));
diff --git a/views/default/river/user/default/profileiconupdate.php b/views/default/river/user/default/profileiconupdate.php
index a723c5335..c7f691533 100644
--- a/views/default/river/user/default/profileiconupdate.php
+++ b/views/default/river/user/default/profileiconupdate.php
@@ -2,12 +2,20 @@
/**
* Update avatar river view
*/
+
+
$subject = $vars['item']->getSubjectEntity();
-$subject_icon = elgg_view_entity_icon($subject, 'tiny');
+$subject_link = elgg_view('output/url', array(
+ 'href' => $subject->getURL(),
+ 'text' => $subject->name,
+ 'class' => 'elgg-river-subject',
+));
-echo elgg_echo("profile:river:iconupdate");
+$string = elgg_echo('river:update:user:avatar', array($subject_link));
-echo '<div class="elgg-river-content clearfix">';
-echo $subject_icon;
-echo '</div>';
+echo elgg_view('river/item', array(
+ 'item' => $vars['item'],
+ 'summary' => $string,
+ 'attachments' => elgg_view_entity_icon($subject, 'tiny'),
+));