diff options
Diffstat (limited to 'views/default/river')
-rw-r--r-- | views/default/river/annotation/generic_comment/create.php | 11 | ||||
-rw-r--r-- | views/default/river/elements/body.php | 67 | ||||
-rw-r--r-- | views/default/river/elements/image.php | 16 | ||||
-rw-r--r-- | views/default/river/elements/layout.php | 14 | ||||
-rw-r--r-- | views/default/river/elements/responses.php | 63 | ||||
-rw-r--r-- | views/default/river/elements/summary.php | 53 | ||||
-rw-r--r-- | views/default/river/item.php | 30 | ||||
-rw-r--r-- | views/default/river/object/album/create.php | 40 | ||||
-rw-r--r-- | views/default/river/object/image/create.php | 41 | ||||
-rw-r--r-- | views/default/river/object/tidypics_batch/create.php | 66 | ||||
-rw-r--r-- | views/default/river/relationship/friend/create.php | 14 | ||||
-rw-r--r-- | views/default/river/user/default/profileiconupdate.php | 24 | ||||
-rw-r--r-- | views/default/river/user/default/profileupdate.php | 20 |
13 files changed, 312 insertions, 147 deletions
diff --git a/views/default/river/annotation/generic_comment/create.php b/views/default/river/annotation/generic_comment/create.php new file mode 100644 index 000000000..7d586450d --- /dev/null +++ b/views/default/river/annotation/generic_comment/create.php @@ -0,0 +1,11 @@ +<?php +/** + * Post comment river view + */ +$object = $vars['item']->getObjectEntity(); +$comment = $vars['item']->getAnnotation(); + +echo elgg_view('river/elements/layout', 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 new file mode 100644 index 000000000..2cd7f2289 --- /dev/null +++ b/views/default/river/elements/body.php @@ -0,0 +1,67 @@ +<?php +/** + * Body of river 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']; + +$menu = elgg_view_menu('river', array( + 'item' => $item, + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); + +// river item header +$timestamp = elgg_view_friendly_time($item->getPostedTime()); + +$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', + 'is_trusted' => true, + )); +} + +$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>"; +} + +$responses = elgg_view('river/elements/responses', $vars); +if ($responses) { + $responses = "<div class=\"elgg-river-responses\">$responses</div>"; +} + +$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, + 'is_trusted' => true, + )); + $group_string = elgg_echo('river:ingroup', array($group_link)); +} + +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/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 new file mode 100644 index 000000000..f6c32e142 --- /dev/null +++ b/views/default/river/elements/responses.php @@ -0,0 +1,63 @@ +<?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 ($item->annotation_id != 0 || !$object) { + return true; +} + +$comment_count = $object->countComments(); + +$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 + // comments by sorting desc and limiting by 3, but we want to display + // 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)) { + $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>"; + } +} + +// 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..416bc708b --- /dev/null +++ b/views/default/river/elements/summary.php @@ -0,0 +1,53 @@ +<?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_link = elgg_view('output/url', array( + 'href' => $object->getURL(), + 'text' => $object->title ? $object->title : $object->name, + '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/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/album/create.php b/views/default/river/object/album/create.php deleted file mode 100644 index 29620041f..000000000 --- a/views/default/river/object/album/create.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * Album river view - * - * @author Cash Costello - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 - */ - -elgg_load_css('lightbox'); -elgg_load_js('lightbox'); -elgg_load_js('tidypics'); - -$album = $vars['item']->getObjectEntity(); - -$album_river_view = elgg_get_plugin_setting('album_river_view', 'tidypics'); -if ($album_river_view == "cover") { - $image = $album->getCoverImage(); - if ($image) { - $attachments = elgg_view_entity_icon($image, 'tiny'); - } -} else { - $images = $album->getImages(7); - - if (count($images)) { - $attachments = '<ul class="tidypics-river-list elgg-lightbox-gallery">'; - foreach($images as $image) { - $attachments .= '<li class="tidypics-photo-item">'; - $attachments .= elgg_view_entity_icon($image, 'tiny', array( - 'link_class' => 'tidypics-lightbox elgg-lightbox-photo', - )); - $attachments .= '</li>'; - } - $attachments .= '</ul>'; - } -} - -echo elgg_view('river/elements/layout', array( - 'item' => $vars['item'], - 'attachments' => $attachments, -)); diff --git a/views/default/river/object/image/create.php b/views/default/river/object/image/create.php deleted file mode 100644 index 6b68b4d68..000000000 --- a/views/default/river/object/image/create.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -/** - * Image album view - * - * @author Cash Costello - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 - */ - -elgg_load_css('lightbox'); -elgg_load_js('lightbox'); -elgg_load_js('tidypics'); - -$subject = $vars['item']->getSubjectEntity(); -$subject_link = elgg_view('output/url', array( - 'href' => $subject->getURL(), - 'text' => $subject->name, - 'class' => 'elgg-river-subject', - 'is_trusted' => true, -)); - -$image = $vars['item']->getObjectEntity(); -$attachments = elgg_view_entity_icon($image, 'tiny'); - -$image_link = elgg_view('output/url', array( - 'href' => $image->getURL(), - 'text' => $image->getTitle(), - 'is_trusted' => true, - 'class' => 'elgg-lightbox-photo', -)); - -$album_link = elgg_view('output/url', array( - 'href' => $image->getContainerEntity()->getURL(), - 'text' => $image->getContainerEntity()->getTitle(), - 'is_trusted' => true, -)); - -echo elgg_view('river/elements/layout', array( - 'item' => $vars['item'], - 'attachments' => $attachments, - 'summary' => elgg_echo('image:river:created', array($subject_link, $image_link, $album_link)), -)); diff --git a/views/default/river/object/tidypics_batch/create.php b/views/default/river/object/tidypics_batch/create.php deleted file mode 100644 index b97c853a3..000000000 --- a/views/default/river/object/tidypics_batch/create.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Batch river view - * - * @author Cash Costello - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 - */ - -elgg_load_css('lightbox'); -elgg_load_js('lightbox'); -elgg_load_js('tidypics'); - -$batch = $vars['item']->getObjectEntity(); - -// Get images related to this batch -$images = elgg_get_entities_from_relationship(array( - 'relationship' => 'belongs_to_batch', - 'relationship_guid' => $batch->getGUID(), - 'inverse_relationship' => true, - 'type' => 'object', - 'subtype' => 'image', - 'offset' => 0, -)); - -$album = $batch->getContainerEntity(); -if (!$album) { - // something went quite wrong - this batch has no associated album - return true; -} -$album_link = elgg_view('output/url', array( - 'href' => $album->getURL(), - 'text' => $album->getTitle(), - 'is_trusted' => true, -)); - -$subject = $vars['item']->getSubjectEntity(); -$subject_link = elgg_view('output/url', array( - 'href' => $subject->getURL(), - 'text' => $subject->name, - 'class' => 'elgg-river-subject', - 'is_trusted' => true, -)); - -if (count($images)) { - $attachments = '<ul class="tidypics-river-list elgg-lightbox-gallery">'; - foreach($images as $image) { - $attachments .= '<li class="tidypics-photo-item">'; - $attachments .= elgg_view_entity_icon($image, 'tiny', array( - 'link_class' => 'tidypics-lightbox elgg-lightbox-photo', - )); - $attachments .= '</li>'; - } - $attachments .= '</ul>'; -} - -if (count($images) == 1) { - $summary = elgg_echo('image:river:created', array($subject_link, $album_link)); -} else { - $summary = elgg_echo('image:river:created:multiple', array($subject_link, count($images), $album_link)); -} - -echo elgg_view('river/elements/layout', array( - 'item' => $vars['item'], - 'attachments' => $attachments, - 'summary' => $summary -)); 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 new file mode 100644 index 000000000..271064a06 --- /dev/null +++ b/views/default/river/user/default/profileiconupdate.php @@ -0,0 +1,24 @@ +<?php +/** + * Update avatar river view + */ + +$subject = $vars['item']->getSubjectEntity(); + +$subject_link = elgg_view('output/url', array( + 'href' => $subject->getURL(), + 'text' => $subject->name, + 'class' => 'elgg-river-subject', + 'is_trusted' => true, +)); + +$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, 'tiny', array( + 'use_hover' => false, + 'use_link' => false, + )), +)); diff --git a/views/default/river/user/default/profileupdate.php b/views/default/river/user/default/profileupdate.php new file mode 100644 index 000000000..ce72970d6 --- /dev/null +++ b/views/default/river/user/default/profileupdate.php @@ -0,0 +1,20 @@ +<?php +/** + * Update profile river view + */ + +$subject = $vars['item']->getSubjectEntity(); + +$subject_link = elgg_view('output/url', array( + 'href' => $subject->getURL(), + 'text' => $subject->name, + 'class' => 'elgg-river-subject', + 'is_trusted' => true, +)); + +$string = elgg_echo('river:update:user:profile', array($subject_link)); + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'summary' => $string, +)); |