diff options
author | Cash Costello <cash.costello@gmail.com> | 2011-10-29 09:35:46 -0700 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2011-10-29 09:35:46 -0700 |
commit | 96fa5ba183d4ea5fb01d4f5a44c808dcb3291b72 (patch) | |
tree | bdd9e5bbfc718404223fb2ccbb48fa7ddf38c8ad | |
parent | f0c096448105b0f88c03221414ded5fb765fe595 (diff) | |
parent | 82da6bff73a99d18bbe2363c7e30aaf6d3fc949f (diff) | |
download | elgg-96fa5ba183d4ea5fb01d4f5a44c808dcb3291b72.tar.gz elgg-96fa5ba183d4ea5fb01d4f5a44c808dcb3291b72.tar.bz2 |
Merge pull request #82 from cash/add_river_item_view
Fixes #4017 by making river/item the first view called by elgg_view_river_item()
17 files changed, 51 insertions, 22 deletions
diff --git a/engine/lib/views.php b/engine/lib/views.php index e8cb20232..3b26fb169 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1225,7 +1225,7 @@ function elgg_view_river_item($item, array $vars = array()) { $vars['item'] = $item; - return elgg_view($item->getView(), $vars); + return elgg_view('river/item', $vars); } /** diff --git a/mod/blog/views/default/river/object/blog/create.php b/mod/blog/views/default/river/object/blog/create.php index 613cbb165..a054c1061 100644 --- a/mod/blog/views/default/river/object/blog/create.php +++ b/mod/blog/views/default/river/object/blog/create.php @@ -7,7 +7,7 @@ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->excerpt); $excerpt = elgg_get_excerpt($excerpt); -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'message' => $excerpt, ));
\ No newline at end of file diff --git a/mod/bookmarks/views/default/river/object/bookmarks/create.php b/mod/bookmarks/views/default/river/object/bookmarks/create.php index 984d109be..388f54ac9 100644 --- a/mod/bookmarks/views/default/river/object/bookmarks/create.php +++ b/mod/bookmarks/views/default/river/object/bookmarks/create.php @@ -8,7 +8,7 @@ $object = $vars['item']->getObjectEntity(); $excerpt = elgg_get_excerpt($object->description); -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'message' => $excerpt, 'attachments' => elgg_view('output/url', array('href' => $object->address)), diff --git a/mod/file/views/default/river/object/file/create.php b/mod/file/views/default/river/object/file/create.php index dad629120..e8e6142e0 100644 --- a/mod/file/views/default/river/object/file/create.php +++ b/mod/file/views/default/river/object/file/create.php @@ -7,7 +7,7 @@ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); $excerpt = elgg_get_excerpt($excerpt); -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'message' => $excerpt, ));
\ No newline at end of file diff --git a/mod/groups/views/default/river/annotation/group_topic_post/reply.php b/mod/groups/views/default/river/annotation/group_topic_post/reply.php index cc94fbd43..afc823bde 100644 --- a/mod/groups/views/default/river/annotation/group_topic_post/reply.php +++ b/mod/groups/views/default/river/annotation/group_topic_post/reply.php @@ -6,7 +6,7 @@ $object = $vars['item']->getObjectEntity(); $reply = $vars['item']->getAnnotation(); $excerpt = elgg_get_excerpt($reply->value); -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'message' => $excerpt, ));
\ No newline at end of file diff --git a/mod/groups/views/default/river/group/create.php b/mod/groups/views/default/river/group/create.php index cacb5ad3f..ea42b5b00 100644 --- a/mod/groups/views/default/river/group/create.php +++ b/mod/groups/views/default/river/group/create.php @@ -7,7 +7,7 @@ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); $excerpt = elgg_get_excerpt($excerpt); -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'message' => $excerpt, ));
\ No newline at end of file diff --git a/mod/groups/views/default/river/object/groupforumtopic/create.php b/mod/groups/views/default/river/object/groupforumtopic/create.php index 80e7b09aa..e7d92bc08 100644 --- a/mod/groups/views/default/river/object/groupforumtopic/create.php +++ b/mod/groups/views/default/river/object/groupforumtopic/create.php @@ -15,7 +15,7 @@ if (elgg_is_logged_in() && $object->canAnnotate(0, 'group_topic_post')) { $responses = elgg_view_form('discussion/reply/save', $form_vars, $body_vars); } -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'message' => $excerpt, 'responses' => $responses, diff --git a/mod/groups/views/default/river/relationship/member/create.php b/mod/groups/views/default/river/relationship/member/create.php index d1c4c3ed3..0afd87e4b 100644 --- a/mod/groups/views/default/river/relationship/member/create.php +++ b/mod/groups/views/default/river/relationship/member/create.php @@ -3,6 +3,6 @@ * Group join river view. */ -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], )); diff --git a/mod/messageboard/views/default/river/object/messageboard/create.php b/mod/messageboard/views/default/river/object/messageboard/create.php index 975598805..7ce7f6b4e 100644 --- a/mod/messageboard/views/default/river/object/messageboard/create.php +++ b/mod/messageboard/views/default/river/object/messageboard/create.php @@ -5,7 +5,7 @@ $messageboard = $vars['item']->getAnnotation(); -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'message' => $messageboard->value, )); diff --git a/mod/pages/views/default/river/object/page/create.php b/mod/pages/views/default/river/object/page/create.php index ca15ddea7..4c31def33 100644 --- a/mod/pages/views/default/river/object/page/create.php +++ b/mod/pages/views/default/river/object/page/create.php @@ -7,7 +7,7 @@ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); $excerpt = elgg_get_excerpt($excerpt); -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'message' => $excerpt, ));
\ No newline at end of file diff --git a/mod/thewire/views/default/river/object/thewire/create.php b/mod/thewire/views/default/river/object/thewire/create.php index fbf592664..c75a42b3f 100644 --- a/mod/thewire/views/default/river/object/thewire/create.php +++ b/mod/thewire/views/default/river/object/thewire/create.php @@ -24,7 +24,7 @@ $object_link = elgg_view('output/url', array( $summary = elgg_echo("river:create:object:thewire", array($subject_link, $object_link)); -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'message' => $excerpt, 'summary' => $summary, diff --git a/views/default/river/annotation/generic_comment/create.php b/views/default/river/annotation/generic_comment/create.php index d3db68e41..7d586450d 100644 --- a/views/default/river/annotation/generic_comment/create.php +++ b/views/default/river/annotation/generic_comment/create.php @@ -5,7 +5,7 @@ $object = $vars['item']->getObjectEntity(); $comment = $vars['item']->getAnnotation(); -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'message' => elgg_get_excerpt($comment->value), )); 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/item.php b/views/default/river/item.php index 94622e272..75767e08d 100644 --- a/views/default/river/item.php +++ b/views/default/river/item.php @@ -1,14 +1,30 @@ <?php /** - * Layout of a river item + * 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('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($item->getView(), $vars); + + +$_elgg_special_river_catch = false; diff --git a/views/default/river/relationship/friend/create.php b/views/default/river/relationship/friend/create.php index a191e7b1e..0408d79e1 100644 --- a/views/default/river/relationship/friend/create.php +++ b/views/default/river/relationship/friend/create.php @@ -8,7 +8,7 @@ $object = $vars['item']->getObjectEntity(); $subject_icon = elgg_view_entity_icon($subject, 'tiny'); $object_icon = elgg_view_entity_icon($object, 'tiny'); -echo elgg_view('river/item', array( +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 90daab1a7..160ffd252 100644 --- a/views/default/river/user/default/profileiconupdate.php +++ b/views/default/river/user/default/profileiconupdate.php @@ -3,7 +3,6 @@ * Update avatar river view */ - $subject = $vars['item']->getSubjectEntity(); $subject_link = elgg_view('output/url', array( @@ -15,7 +14,7 @@ $subject_link = elgg_view('output/url', array( $string = elgg_echo('river:update:user:avatar', array($subject_link)); -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'summary' => $string, 'attachments' => elgg_view_entity_icon($subject, 'tiny', array('hover' => false)), diff --git a/views/default/river/user/default/profileupdate.php b/views/default/river/user/default/profileupdate.php index 69b69b106..ce72970d6 100644 --- a/views/default/river/user/default/profileupdate.php +++ b/views/default/river/user/default/profileupdate.php @@ -14,7 +14,7 @@ $subject_link = elgg_view('output/url', array( $string = elgg_echo('river:update:user:profile', array($subject_link)); -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'summary' => $string, )); |