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 --- .../river/annotation/generic_comment/create.php | 27 ++--------- views/default/river/elements/body.php | 55 +++++++++++++++------- views/default/river/elements/summary.php | 36 ++++++++++++++ views/default/river/item.php | 10 ++-- views/default/river/relationship/friend/create.php | 16 ++----- 5 files changed, 86 insertions(+), 58 deletions(-) create mode 100644 views/default/river/elements/summary.php (limited to 'views') 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 '
'; - echo $excerpt; - echo '
'; -} +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..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 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..f3f4a9b14 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 '
'; -echo $subject_icon; -echo elgg_view_icon('arrow-right', true); -echo $object_icon; -echo '
'; +echo elgg_view('river/item', array( + 'item' => $vars['item'], + 'attachments' => $subject_icon . elgg_view_icon('arrow-right', true) . $object_icon, +)); -- cgit v1.2.3 From dea90f2e6af72473e24e5e67b154754faf84513e Mon Sep 17 00:00:00 2001 From: Evan Winslow Date: Mon, 13 Jun 2011 19:47:17 -0700 Subject: elgg-river-message and elgg-river-attachments now get the old elgg-river-content styling --- views/default/css/elements/components.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'views') diff --git a/views/default/css/elements/components.php b/views/default/css/elements/components.php index 0fcbe3619..4b0034dd3 100644 --- a/views/default/css/elements/components.php +++ b/views/default/css/elements/components.php @@ -161,12 +161,15 @@ font-style: italic; line-height: 1.2em; } + +.elgg-river-attachments, +.elgg-river-message, .elgg-river-content { - border-left: 1px solid #CCC; - font-size: 85%; - line-height: 1.5em; - margin: 8px 0 5px 0; - padding-left: 5px; + border-left: 1px solid #CCC; + font-size: 85%; + line-height: 1.5em; + margin: 8px 0 5px 0; + padding-left: 5px; } -- 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') 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 cf85a49c7e74133feaec7d52d8f289d22b59a56c Mon Sep 17 00:00:00 2001 From: Evan Winslow Date: Mon, 13 Jun 2011 22:31:48 -0700 Subject: Using tabs, not spaces for indentation --- views/default/css/elements/components.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'views') diff --git a/views/default/css/elements/components.php b/views/default/css/elements/components.php index 4b0034dd3..203f6d257 100644 --- a/views/default/css/elements/components.php +++ b/views/default/css/elements/components.php @@ -165,11 +165,11 @@ .elgg-river-attachments, .elgg-river-message, .elgg-river-content { - border-left: 1px solid #CCC; - font-size: 85%; - line-height: 1.5em; - margin: 8px 0 5px 0; - padding-left: 5px; + border-left: 1px solid #CCC; + font-size: 85%; + line-height: 1.5em; + margin: 8px 0 5px 0; + padding-left: 5px; } -- 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') 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