From 1fd8bd6e296e2b1fc960fde1dd204b6c4e3e8aec Mon Sep 17 00:00:00 2001 From: Evan Winslow Date: Wed, 8 Jun 2011 02:31:30 -0700 Subject: River revamp for 1.8 --- views/default/river/elements/body.php | 55 ++++++++++++++++++++++---------- views/default/river/elements/summary.php | 36 +++++++++++++++++++++ 2 files changed, 74 insertions(+), 17 deletions(-) create mode 100644 views/default/river/elements/summary.php (limited to 'views/default/river/elements') diff --git a/views/default/river/elements/body.php b/views/default/river/elements/body.php index f9ecbc03c..a76cae909 100644 --- a/views/default/river/elements/body.php +++ b/views/default/river/elements/body.php @@ -6,28 +6,49 @@ */ $item = $vars['item']; -$subject = $item->getSubjectEntity(); + +$menu = elgg_view_menu('river', array('item' => $item, 'sort_by' => 'priority')); // 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 $timestamp"; +$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 = "
$message
"; +} -// body -$body = elgg_view($item->getView(), array('item' => $item)); +$attachments = elgg_extract('attachments', $vars, false); +if ($attachments !== false) { + $attachments = "
$attachments
"; +} -// footer $footer = elgg_view('river/elements/footer', $vars); -echo elgg_view('page/components/module', array( - 'header' => $header, - 'body' => $body, - 'footer' => $footer, - 'class' => 'mbn', -)); \ No newline at end of file +$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 <<$summary $group_string $timestamp +$message +$attachments +$footer +RIVER; diff --git a/views/default/river/elements/summary.php b/views/default/river/elements/summary.php new file mode 100644 index 000000000..eee8754e2 --- /dev/null +++ b/views/default/river/elements/summary.php @@ -0,0 +1,36 @@ +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 -- cgit v1.2.3 From b766230d132bedf68ec3c63f72538fefa54c62e2 Mon Sep 17 00:00:00 2001 From: Evan Winslow Date: Mon, 13 Jun 2011 22:23:09 -0700 Subject: Renamed river footer to a more semantic "responses". Fixed discussion to work inline again with this new layout. --- mod/groups/start.php | 3 +- .../river/object/groupforumtopic/create.php | 7 --- views/default/river/elements/body.php | 4 +- views/default/river/elements/footer.php | 52 ---------------------- views/default/river/elements/responses.php | 52 ++++++++++++++++++++++ 5 files changed, 56 insertions(+), 62 deletions(-) delete mode 100644 views/default/river/elements/footer.php create mode 100644 views/default/river/elements/responses.php (limited to 'views/default/river/elements') diff --git a/mod/groups/start.php b/mod/groups/start.php index 73bdd08a9..5aaba017c 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -621,7 +621,8 @@ function discussion_init() { // commenting not allowed on discussion topics (use a different annotation) elgg_register_plugin_hook_handler('permissions_check:comment', 'object', 'discussion_comment_override'); - + elgg_extend_view('river/elements/responses', 'discussion/river'); + $action_base = elgg_get_plugins_path() . 'groups/actions/discussion'; elgg_register_action('discussion/save', "$action_base/save.php"); elgg_register_action('discussion/delete', "$action_base/delete.php"); diff --git a/mod/groups/views/default/river/object/groupforumtopic/create.php b/mod/groups/views/default/river/object/groupforumtopic/create.php index cca44e523..f92e54a5c 100644 --- a/mod/groups/views/default/river/object/groupforumtopic/create.php +++ b/mod/groups/views/default/river/object/groupforumtopic/create.php @@ -11,10 +11,3 @@ echo elgg_view('river/item', array( 'item' => $vars['item'], 'message' => $excerpt, )); - -if (elgg_is_logged_in() && $object->canAnnotate(0, 'group_topic_post')) { - // inline comment form - $form_vars = array('id' => "groups-reply-{$object->getGUID()}", 'class' => 'hidden'); - $body_vars = array('entity' => $object, 'inline' => true); - echo elgg_view_form('discussion/reply/save', $form_vars, $body_vars); -} diff --git a/views/default/river/elements/body.php b/views/default/river/elements/body.php index a76cae909..080c04644 100644 --- a/views/default/river/elements/body.php +++ b/views/default/river/elements/body.php @@ -32,7 +32,7 @@ if ($attachments !== false) { $attachments = "
$attachments
"; } -$footer = elgg_view('river/elements/footer', $vars); +$responses = elgg_view('river/elements/responses', $vars); $group_string = ''; $object = $item->getObjectEntity(); @@ -50,5 +50,5 @@ $menu
$summary $group_string $timestamp
$message $attachments -$footer +$responses RIVER; diff --git a/views/default/river/elements/footer.php b/views/default/river/elements/footer.php deleted file mode 100644 index f1e79f131..000000000 --- a/views/default/river/elements/footer.php +++ /dev/null @@ -1,52 +0,0 @@ -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); - -?> - - - '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)), - ); - $link = elgg_view('output/url', $params); - echo "
$link
"; - } -} - -// 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/responses.php b/views/default/river/elements/responses.php new file mode 100644 index 000000000..f1e79f131 --- /dev/null +++ b/views/default/river/elements/responses.php @@ -0,0 +1,52 @@ +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); + +?> + + + '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)), + ); + $link = elgg_view('output/url', $params); + echo "
$link
"; + } +} + +// 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); -- cgit v1.2.3 From fb0a9d896b9a0bd1193c63badad6a1990afc0109 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 24 Jun 2011 07:52:27 -0400 Subject: fixed group forum discussion inline replies for activity page --- mod/groups/views/default/river/object/groupforumtopic/create.php | 9 +++++++++ views/default/river/elements/body.php | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'views/default/river/elements') diff --git a/mod/groups/views/default/river/object/groupforumtopic/create.php b/mod/groups/views/default/river/object/groupforumtopic/create.php index f92e54a5c..80e7b09aa 100644 --- a/mod/groups/views/default/river/object/groupforumtopic/create.php +++ b/mod/groups/views/default/river/object/groupforumtopic/create.php @@ -7,7 +7,16 @@ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); $excerpt = elgg_get_excerpt($excerpt); +$responses = ''; +if (elgg_is_logged_in() && $object->canAnnotate(0, 'group_topic_post')) { + // inline comment form + $form_vars = array('id' => "groups-reply-{$object->getGUID()}", 'class' => 'hidden'); + $body_vars = array('entity' => $object, 'inline' => true); + $responses = elgg_view_form('discussion/reply/save', $form_vars, $body_vars); +} + echo elgg_view('river/item', array( 'item' => $vars['item'], 'message' => $excerpt, + 'responses' => $responses, )); diff --git a/views/default/river/elements/body.php b/views/default/river/elements/body.php index 080c04644..7eebb0c99 100644 --- a/views/default/river/elements/body.php +++ b/views/default/river/elements/body.php @@ -32,7 +32,13 @@ if ($attachments !== false) { $attachments = "
$attachments
"; } -$responses = elgg_view('river/elements/responses', $vars); +$responses = elgg_extract('responses', $vars, false); +if ($responses === false) { + $responses = elgg_view('river/elements/responses', $vars); +} +if ($responses) { + $responses = "
$responses
"; +} $group_string = ''; $object = $item->getObjectEntity(); -- cgit v1.2.3 From a2c9bf0f294758dc546adaf27120ba1880d2832a Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 25 Jun 2011 09:52:54 -0400 Subject: Fixes #3566 separate out likes button from likes count --- mod/likes/start.php | 31 ++++++++++++++++++++++++++++--- mod/likes/views/default/likes/button.php | 25 +------------------------ mod/likes/views/default/likes/count.php | 30 ++++++++++++++++++++++++++++++ mod/likes/views/default/likes/css.php | 4 ++++ views/default/river/elements/body.php | 6 +++++- 5 files changed, 68 insertions(+), 28 deletions(-) create mode 100644 mod/likes/views/default/likes/count.php (limited to 'views/default/river/elements') diff --git a/mod/likes/start.php b/mod/likes/start.php index b2aa83260..df1c7b109 100644 --- a/mod/likes/start.php +++ b/mod/likes/start.php @@ -29,15 +29,27 @@ function likes_entity_menu_setup($hook, $type, $return, $params) { $entity = $params['entity']; - // likes + // likes button $options = array( 'name' => 'likes', - 'text' => elgg_view('likes/display', array('entity' => $entity)), + 'text' => elgg_view('likes/button', array('entity' => $entity)), 'href' => false, 'priority' => 1000, ); $return[] = ElggMenuItem::factory($options); + // likes count + $count = elgg_view('likes/count', array('entity' => $entity)); + if ($count) { + $options = array( + 'name' => 'likes_count', + 'text' => $count, + 'href' => false, + 'priority' => 1001, + ); + $return[] = ElggMenuItem::factory($options); + } + return $return; } @@ -50,14 +62,27 @@ function likes_river_menu_setup($hook, $type, $return, $params) { $object = $item->getObjectEntity(); if (!elgg_in_context('widgets') && $item->annotation_id == 0) { if ($object->canAnnotate(0, 'likes')) { + // like button $options = array( 'name' => 'likes', 'href' => false, - 'text' => elgg_view('likes/display', array('entity' => $object)), + 'text' => elgg_view('likes/button', array('entity' => $object)), 'is_action' => true, 'priority' => 100, ); $return[] = ElggMenuItem::factory($options); + + // likes count + $count = elgg_view('likes/count', array('entity' => $object)); + if ($count) { + $options = array( + 'name' => 'likes_count', + 'text' => $count, + 'href' => false, + 'priority' => 101, + ); + $return[] = ElggMenuItem::factory($options); + } } } } diff --git a/mod/likes/views/default/likes/button.php b/mod/likes/views/default/likes/button.php index 2dc50ddd0..383e1bb63 100644 --- a/mod/likes/views/default/likes/button.php +++ b/mod/likes/views/default/likes/button.php @@ -1,6 +1,6 @@ canAnnotate(0, 'likes')) { } echo $likes_button; - -$list = ''; -$num_of_likes = likes_count($vars['entity']); - -if ($num_of_likes) { - // display the number of likes - if ($num_of_likes == 1) { - $likes_string = elgg_echo('likes:userlikedthis', array($num_of_likes)); - } else { - $likes_string = elgg_echo('likes:userslikedthis', array($num_of_likes)); - } - $params = array( - 'text' => $likes_string, - 'title' => elgg_echo('likes:see'), - 'rel' => 'popup', - 'href' => "#likes-$guid" - ); - $list = elgg_view('output/url', $params); - $list .= ""; - echo $list; -} diff --git a/mod/likes/views/default/likes/count.php b/mod/likes/views/default/likes/count.php new file mode 100644 index 000000000..3d03fec66 --- /dev/null +++ b/mod/likes/views/default/likes/count.php @@ -0,0 +1,30 @@ + $likes_string, + 'title' => elgg_echo('likes:see'), + 'rel' => 'popup', + 'href' => "#likes-$guid" + ); + $list = elgg_view('output/url', $params); + $list .= ""; + echo $list; +} diff --git a/mod/likes/views/default/likes/css.php b/mod/likes/views/default/likes/css.php index cb0334b7c..fabf54e46 100644 --- a/mod/likes/views/default/likes/css.php +++ b/mod/likes/views/default/likes/css.php @@ -11,3 +11,7 @@ width: 345px; position: absolute; } + +.elgg-menu .elgg-menu-item-likes-count { + margin-left: 3px; +} diff --git a/views/default/river/elements/body.php b/views/default/river/elements/body.php index 7eebb0c99..6199e0861 100644 --- a/views/default/river/elements/body.php +++ b/views/default/river/elements/body.php @@ -7,7 +7,11 @@ $item = $vars['item']; -$menu = elgg_view_menu('river', array('item' => $item, 'sort_by' => 'priority')); +$menu = elgg_view_menu('river', array( + 'item' => $item, + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); // river item header $timestamp = elgg_get_friendly_time($item->getPostedTime()); -- cgit v1.2.3 From 8a6aca077a81b6cd654c1944b0a5e2498b1cc655 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 25 Jun 2011 11:56:10 -0400 Subject: added documentation to new river views and improved handling of responses --- views/default/river/elements/body.php | 11 ++++++----- views/default/river/elements/responses.php | 10 ++++++++++ views/default/river/elements/summary.php | 5 +++++ 3 files changed, 21 insertions(+), 5 deletions(-) (limited to 'views/default/river/elements') diff --git a/views/default/river/elements/body.php b/views/default/river/elements/body.php index 6199e0861..f7a9d2426 100644 --- a/views/default/river/elements/body.php +++ b/views/default/river/elements/body.php @@ -2,7 +2,11 @@ /** * 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']; @@ -36,10 +40,7 @@ if ($attachments !== false) { $attachments = "
$attachments
"; } -$responses = elgg_extract('responses', $vars, false); -if ($responses === false) { - $responses = elgg_view('river/elements/responses', $vars); -} +$responses = elgg_view('river/elements/responses', $vars); if ($responses) { $responses = "
$responses
"; } diff --git a/views/default/river/elements/responses.php b/views/default/river/elements/responses.php index f1e79f131..8c5be6316 100644 --- a/views/default/river/elements/responses.php +++ b/views/default/river/elements/responses.php @@ -1,8 +1,18 @@ getObjectEntity(); diff --git a/views/default/river/elements/summary.php b/views/default/river/elements/summary.php index eee8754e2..4d80c29a6 100644 --- a/views/default/river/elements/summary.php +++ b/views/default/river/elements/summary.php @@ -1,4 +1,9 @@ Date: Thu, 7 Jul 2011 06:32:36 -0400 Subject: fixed the float issue with the friends river view --- views/default/css/elements/components.php | 5 ++--- views/default/river/elements/body.php | 2 +- views/default/river/relationship/friend/create.php | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'views/default/river/elements') diff --git a/views/default/css/elements/components.php b/views/default/css/elements/components.php index 3f30a6422..4a09ca74e 100644 --- a/views/default/css/elements/components.php +++ b/views/default/css/elements/components.php @@ -174,9 +174,8 @@ margin: 8px 0 5px 0; padding-left: 5px; } - - -.elgg-river-content .elgg-avatar { +.elgg-river-attachments .elgg-avatar, +.elgg-river-attachments .elgg-icon { float: left; } .elgg-river-layout .elgg-input-dropdown { diff --git a/views/default/river/elements/body.php b/views/default/river/elements/body.php index f7a9d2426..c5a525733 100644 --- a/views/default/river/elements/body.php +++ b/views/default/river/elements/body.php @@ -37,7 +37,7 @@ if ($message !== false) { $attachments = elgg_extract('attachments', $vars, false); if ($attachments !== false) { - $attachments = "
$attachments
"; + $attachments = "
$attachments
"; } $responses = elgg_view('river/elements/responses', $vars); diff --git a/views/default/river/relationship/friend/create.php b/views/default/river/relationship/friend/create.php index f3f4a9b14..a191e7b1e 100644 --- a/views/default/river/relationship/friend/create.php +++ b/views/default/river/relationship/friend/create.php @@ -10,5 +10,5 @@ $object_icon = elgg_view_entity_icon($object, 'tiny'); echo elgg_view('river/item', array( 'item' => $vars['item'], - 'attachments' => $subject_icon . elgg_view_icon('arrow-right', true) . $object_icon, + 'attachments' => $subject_icon . elgg_view_icon('arrow-right') . $object_icon, )); -- cgit v1.2.3