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/group_topic_post/reply.php | 25 ++++------------- mod/groups/views/default/river/group/create.php | 20 +++----------- .../river/object/groupforumtopic/create.php | 32 ++++------------------ .../default/river/relationship/member/create.php | 14 ++-------- 4 files changed, 17 insertions(+), 74 deletions(-) (limited to 'mod/groups/views/default') 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 1999c8dd9..cc94fbd43 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 @@ -4,24 +4,9 @@ */ $object = $vars['item']->getObjectEntity(); $reply = $vars['item']->getAnnotation(); +$excerpt = elgg_get_excerpt($reply->value); -$url = $object->getURL(); -$title = $object->title; -$params = array( - 'href' => $object->getURL(), - 'text' => $title, -); -$object_link = elgg_view('output/url', $params); - -$type = $object->getType(); -$subtype = $object->getSubtype(); - -echo elgg_echo('groups:river:reply') . ' '; -echo $object_link; - -if ($reply) { - $excerpt = elgg_get_excerpt($reply->value); - echo '
'; - echo $excerpt; - echo '
'; -} +echo elgg_view('river/item', 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 a70f8b51d..cacb5ad3f 100644 --- a/mod/groups/views/default/river/group/create.php +++ b/mod/groups/views/default/river/group/create.php @@ -7,19 +7,7 @@ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); $excerpt = elgg_get_excerpt($excerpt); -$params = array( - 'href' => $object->getURL(), - 'text' => $object->name, -); -$link = elgg_view('output/url', $params); - - -echo elgg_echo('groups:river:create'); - -echo " $link"; - -if ($excerpt) { - echo '
'; - echo $excerpt; - echo '
'; -} +echo elgg_view('river/item', 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 466196921..cca44e523 100644 --- a/mod/groups/views/default/river/object/groupforumtopic/create.php +++ b/mod/groups/views/default/river/object/groupforumtopic/create.php @@ -7,34 +7,12 @@ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); $excerpt = elgg_get_excerpt($excerpt); -$params = array( - 'href' => $object->getURL(), - 'text' => $object->title, -); -$link = elgg_view('output/url', $params); +echo elgg_view('river/item', array( + 'item' => $vars['item'], + 'message' => $excerpt, +)); -$group_string = ''; -$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('forumtopic:river:create'); - -echo " $link $group_string"; - -if ($excerpt) { - echo '
'; - echo $excerpt; - echo '
'; -} - -if (elgg_is_logged_in() && $container->canWriteToContainer()) { +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); diff --git a/mod/groups/views/default/river/relationship/member/create.php b/mod/groups/views/default/river/relationship/member/create.php index 060826649..d1c4c3ed3 100644 --- a/mod/groups/views/default/river/relationship/member/create.php +++ b/mod/groups/views/default/river/relationship/member/create.php @@ -3,14 +3,6 @@ * Group join river view. */ -$object = $vars['item']->getObjectEntity(); - -$params = array( - 'href' => $object->getURL(), - 'text' => $object->name, -); -$link = elgg_view('output/url', $params); - -echo elgg_echo('groups:river:join'); - -echo " $link"; +echo elgg_view('river/item', array( + 'item' => $vars['item'], +)); -- 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 'mod/groups/views/default') 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