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.php (renamed from views/default/river/object/messageboard/create.php)0
-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
-rw-r--r--views/default/river/group/create.php25
-rw-r--r--views/default/river/item.php30
-rw-r--r--views/default/river/object/blog/create.php11
-rw-r--r--views/default/river/object/bookmarks/create.php14
-rw-r--r--views/default/river/object/file/create.php13
-rw-r--r--views/default/river/object/groupforumtopic/create.php11
-rw-r--r--views/default/river/object/page/create.php11
-rw-r--r--views/default/river/relationship/friend/create.php14
-rw-r--r--views/default/river/user/default/profileiconupdate.php2
16 files changed, 170 insertions, 139 deletions
diff --git a/views/default/river/object/messageboard/create.php b/views/default/river/annotation/generic_comment/create.php
index 7d586450d..7d586450d 100644
--- a/views/default/river/object/messageboard/create.php
+++ b/views/default/river/annotation/generic_comment/create.php
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
diff --git a/views/default/river/group/create.php b/views/default/river/group/create.php
deleted file mode 100644
index 6beaf2d7d..000000000
--- a/views/default/river/group/create.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-/**
- * Group creation river view.
- */
-
-$object = $vars['item']->getObjectEntity();
-$subject = $vars['item']->getSubjectEntity();
-
-$subject_link = elgg_view('output/url', array(
- 'href' => $subject->getURL(),
- 'text' => $subject->name,
- 'class' => 'elgg-actor-name',
- 'encode_text' => true,
-));
-
-$group_link = elgg_view('output/url', array(
- 'href' => $object->getURL(),
- 'text' => $object->name,
- 'encode_text' => true,
-));
-
-echo elgg_view('river/item', array(
- 'item' => $vars['item'],
- 'attachments' => elgg_view('group/default/river', array('entity' => $object)),
-)); \ No newline at end of file
diff --git a/views/default/river/item.php b/views/default/river/item.php
new file mode 100644
index 000000000..75767e08d
--- /dev/null
+++ b/views/default/river/item.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Primary river item view
+ *
+ * Calls the individual view saved for that river item. Most of these
+ * individual river views then use the views in river/elements.
+ *
+ * @uses $vars['item'] ElggRiverItem
+ */
+
+// @todo remove this in Elgg 1.9
+global $_elgg_special_river_catch;
+if (!isset($_elgg_special_river_catch)) {
+ $_elgg_special_river_catch = false;
+}
+if ($_elgg_special_river_catch) {
+ // we changed the views a little in 1.8.1 so this catches the plugins that
+ // were updated in 1.8.0 and redirects to the layout view
+ echo elgg_view('river/elements/layout', $vars);
+ return true;
+}
+$_elgg_special_river_catch = true;
+
+
+$item = $vars['item'];
+
+echo elgg_view($item->getView(), $vars);
+
+
+$_elgg_special_river_catch = false;
diff --git a/views/default/river/object/blog/create.php b/views/default/river/object/blog/create.php
deleted file mode 100644
index 2d08a7d86..000000000
--- a/views/default/river/object/blog/create.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-/**
- * Blog river view.
- */
-
-$object = $vars['item']->getObjectEntity();
-
-echo elgg_view('river/item', array(
- 'item' => $vars['item'],
- 'attachments' => elgg_view('object/blog/river', array('entity' => $object)),
-)); \ No newline at end of file
diff --git a/views/default/river/object/bookmarks/create.php b/views/default/river/object/bookmarks/create.php
deleted file mode 100644
index b4170b8ec..000000000
--- a/views/default/river/object/bookmarks/create.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-/**
- * New bookmarks river entry
- *
- * @package Bookmarks
- */
-
-$object = $vars['item']->getObjectEntity();
-
-
-echo elgg_view('river/item', array(
- 'item' => $vars['item'],
- 'attachments' => elgg_view('object/bookmarks/river', array('entity' => $object)),
-)); \ No newline at end of file
diff --git a/views/default/river/object/file/create.php b/views/default/river/object/file/create.php
deleted file mode 100644
index 99af38ace..000000000
--- a/views/default/river/object/file/create.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-/**
- * New file river entry
- *
- * @package File
- */
-
-$object = $vars['item']->getObjectEntity();
-
-echo elgg_view('river/item', array(
- 'item' => $vars['item'],
- 'attachments' => elgg_view('object/file/river', array('entity' => $object)),
-)); \ No newline at end of file
diff --git a/views/default/river/object/groupforumtopic/create.php b/views/default/river/object/groupforumtopic/create.php
deleted file mode 100644
index 291585698..000000000
--- a/views/default/river/object/groupforumtopic/create.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-/**
- * Group discussion topic river view.
- */
-
-$object = $vars['item']->getObjectEntity();
-
-echo elgg_view('river/item', array(
- 'item' => $vars['item'],
- 'attachments' => elgg_view('object/groupforumtopic/river', array('entity' => $object)),
-)); \ No newline at end of file
diff --git a/views/default/river/object/page/create.php b/views/default/river/object/page/create.php
deleted file mode 100644
index 1f1ab4801..000000000
--- a/views/default/river/object/page/create.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-/**
- * Page river view.
- */
-
-$object = $vars['item']->getObjectEntity();
-
-echo elgg_view('river/item', array(
- 'item' => $vars['item'],
- 'attachments' => elgg_view('object/page/river', array('entity' => $object)),
-)); \ No newline at end of file
diff --git a/views/default/river/relationship/friend/create.php b/views/default/river/relationship/friend/create.php
new file mode 100644
index 000000000..0408d79e1
--- /dev/null
+++ b/views/default/river/relationship/friend/create.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Create friend river view
+ */
+$subject = $vars['item']->getSubjectEntity();
+$object = $vars['item']->getObjectEntity();
+
+$subject_icon = elgg_view_entity_icon($subject, 'tiny');
+$object_icon = elgg_view_entity_icon($object, 'tiny');
+
+echo elgg_view('river/elements/layout', 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 255d660ca..271064a06 100644
--- a/views/default/river/user/default/profileiconupdate.php
+++ b/views/default/river/user/default/profileiconupdate.php
@@ -17,7 +17,7 @@ $string = elgg_echo('river:update:user:avatar', array($subject_link));
echo elgg_view('river/elements/layout', array(
'item' => $vars['item'],
'summary' => $string,
- 'attachments' => elgg_view_entity_icon($subject, 'medium', array(
+ 'attachments' => elgg_view_entity_icon($subject, 'tiny', array(
'use_hover' => false,
'use_link' => false,
)),