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 ++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 17 deletions(-) (limited to 'views/default/river/elements/body.php') 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; -- 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/body.php') 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