From 538a22b85384008533aeef2ac356ff668766e0cb Mon Sep 17 00:00:00 2001 From: pete Date: Wed, 7 Apr 2010 14:10:51 +0000 Subject: Riverdashboard refreshed, and updated display of comments and likes (the loading of these needs to be moved to ajax callbacks) git-svn-id: http://code.elgg.org/elgg/trunk@5643 36083f99-b078-4883-b0ff-0f9b5a30f544 --- .../views/default/river/object/blog/create.php | 5 +- mod/groups/views/default/river/forum/create.php | 7 +- .../views/default/river/forum/topic/create.php | 7 +- .../views/default/river/object/page/create.php | 5 +- .../views/default/river/item/wrapper.php | 99 +++++++---- .../views/default/riverdashboard/css.php | 191 ++++++++------------- .../views/default/riverdashboard/js.php | 30 +++- .../views/default/riverdashboard/rivercomment.php | 11 +- 8 files changed, 183 insertions(+), 172 deletions(-) (limited to 'mod') diff --git a/mod/blog/views/default/river/object/blog/create.php b/mod/blog/views/default/river/object/blog/create.php index d59d601f5..1071deb30 100644 --- a/mod/blog/views/default/river/object/blog/create.php +++ b/mod/blog/views/default/river/object/blog/create.php @@ -10,11 +10,12 @@ $contents = strip_tags($object->description); //strip tags from the contents to $url = "getURL()}\">{$performed_by->name}"; $title = sprintf(elgg_echo('blog:river:create'), $url); -$string .= $title . " getURL() . "\">" . $object->title . " " . friendly_time($object->publish_time) . ""; +$string .= $title . " getURL() . "\">" . $object->title . " " . friendly_time($object->publish_time) . " Comment"; +$string .= elgg_view('likes/forms/link', array('entity' => $object)); $string .= "
"; $string .= "
"; if(strlen($contents) > 200) { - $string .= substr($contents, 0, strpos($contents, ' ', 200)) . "..."; + $string .= substr($contents, 0, strpos($contents, ' ', 200)) . "…"; }else{ $string .= $contents; } diff --git a/mod/groups/views/default/river/forum/create.php b/mod/groups/views/default/river/forum/create.php index fb6cd707c..e51d9fe72 100644 --- a/mod/groups/views/default/river/forum/create.php +++ b/mod/groups/views/default/river/forum/create.php @@ -2,7 +2,7 @@ $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); $object = get_entity($vars['item']->object_guid); - //$url = $object->getURL(); + $object_url = $object->getURL(); $forumtopic = $object->guid; $group_guid = $object->container_guid; //grab the annotation, if one exists @@ -12,12 +12,13 @@ $url = $vars['url'] . "mod/groups/topicposts.php?topic=" . $forumtopic . "&group_guid=" . $group_guid; $url_user = "getURL()}\">{$performed_by->name}"; $string = sprintf(elgg_echo("groupforum:river:posted"),$url_user) . " "; - $string .= elgg_echo("groupforum:river:annotate:create") . " | " . $object->title . ""; + $string .= elgg_echo("groupforum:river:annotate:create") . " | " . $object->title . " ". friendly_time($object->time_created) ." Visit discussion"; + $string .= elgg_view('likes/forms/link', array('entity' => $object)); $string .= "
"; if($comment){ $contents = strip_tags($comment);//this is so we don't get large images etc in the activity river if(strlen($contents) > 200) - $string .= substr($contents, 0, strpos($contents, ' ', 200)) . "..."; + $string .= substr($contents, 0, strpos($contents, ' ', 200)) . "…"; else $string .= $contents; } diff --git a/mod/groups/views/default/river/forum/topic/create.php b/mod/groups/views/default/river/forum/topic/create.php index f4c4aadfd..7b06cd275 100644 --- a/mod/groups/views/default/river/forum/topic/create.php +++ b/mod/groups/views/default/river/forum/topic/create.php @@ -2,7 +2,7 @@ $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); $object = get_entity($vars['item']->object_guid); - //$url = $object->getURL(); + $object_url = $object->getURL(); $forumtopic = $object->guid; $group_guid = $object->container_guid; $url = $vars['url'] . "mod/groups/topicposts.php?topic=" . $forumtopic . "&group_guid=" . $group_guid; @@ -13,10 +13,11 @@ $contents = strip_tags($contents);//this is so we don't get large images etc in the activity river $url_user = "getURL()}\">{$performed_by->name}"; $string = sprintf(elgg_echo("groupforum:river:postedtopic"),$url_user) . ": "; - $string .= "" . $object->title . ""; + $string .= "" . $object->title . " " . friendly_time($object->time_created) . " Visit discussion"; + $string .= elgg_view('likes/forms/link', array('entity' => $object)); $string .= "
"; if(strlen($contents) > 200) { - $string .= substr($contents, 0, strpos($contents, ' ', 200)) . "..."; + $string .= substr($contents, 0, strpos($contents, ' ', 200)) . "…"; }else{ $string .= $contents; } diff --git a/mod/pages/views/default/river/object/page/create.php b/mod/pages/views/default/river/object/page/create.php index 27352cef6..25efc216a 100644 --- a/mod/pages/views/default/river/object/page/create.php +++ b/mod/pages/views/default/river/object/page/create.php @@ -8,10 +8,11 @@ $url = "getURL()}\">{$performed_by->name}"; $contents = strip_tags($object->description); //strip tags from the contents to stop large images etc blowing out the river view $string = sprintf(elgg_echo("pages:river:created"),$url) . " "; - $string .= elgg_echo("pages:river:create") . " getURL() . "\">" . $object->title . ""; + $string .= elgg_echo("pages:river:create") . " getURL() . "\">" . $object->title . " ". friendly_time($object->time_created) ." Comment"; + $string .= elgg_view('likes/forms/link', array('entity' => $object)); $string .= "
"; if(strlen($contents) > 200) { - $string .= substr($contents, 0, strpos($contents, ' ', 200)) . "..."; + $string .= substr($contents, 0, strpos($contents, ' ', 200)) . "…"; }else{ $string .= $contents; } diff --git a/mod/riverdashboard/views/default/river/item/wrapper.php b/mod/riverdashboard/views/default/river/item/wrapper.php index 0dba70e5c..dba6f9953 100644 --- a/mod/riverdashboard/views/default/river/item/wrapper.php +++ b/mod/riverdashboard/views/default/river/item/wrapper.php @@ -8,6 +8,8 @@ $object = get_entity($vars['item']->object_guid); //get object url $object_url = $object->getURL(); +$numoflikes = elgg_count_likes($object); + //user //if displaying on the profile get the object owner, else the subject_guid if(get_context() == 'profile' && $object->getSubtype() == 'thewire') @@ -29,7 +31,7 @@ switch($vars['item']->subtype){ //count comment annotations $comment_count = count_annotations($vars['item']->object_guid, $vars['item']->type, $vars['item']->subtype, $annotation_comment); -//get last two comments display +//get last three comments display $get_comments = get_annotations($vars['item']->object_guid, "", "", $annotation_comment, "", "", 3, 0, "desc"); if($get_comments){ @@ -37,7 +39,7 @@ if($get_comments){ $get_comments = array_reverse($get_comments); } -//minus two off the comment total as we display two by default +//minus 3 off the comment total as we display 3 by default if($comment_count < 3) $num_comments = 0; else @@ -48,32 +50,40 @@ else $user, 'size' => 'small')); ?>
- - -
+ -"; - echo "
"; - echo elgg_view_likes($object); - echo "
"; - //display latest 2 comments if there are any + //display latest 3 comments if there are any if($get_comments){ $counter = 0; - $background = ""; - echo "
"; + //$background = ""; - //display the number of comments if there are any - if($num_comments != 0){ - //set the correct context comment or comments - if($num_comments == 1) - echo "+{$num_comments} more comment"; - else - echo "+{$num_comments} more comments"; + echo "
"; + + if($comment_count <= 3) { + echo "Comments"; + } + + //display 'more comments' if there are any + if($num_comments != 0){ + echo "Comments (+{$num_comments} more)"; } - + + if($numoflikes != 0){ + echo elgg_view('likes/forms/display', array('entity' => $object)); + } + echo "
"; // close river_comments_tabs + + echo "
"; + + if($numoflikes != 0){ + //show the users who liked the object + echo ""; + } + foreach($get_comments as $gc){ //get the comment owner $comment_owner = get_user($gc->owner_guid); @@ -92,7 +102,7 @@ else echo ""; //truncate comment to 150 characters if(strlen($gc->value) > 150) { - $gc->value = substr($gc->value, 0, strpos($gc->value, ' ', 150)) . "..."; + $gc->value = substr($gc->value, 0, strpos($gc->value, ' ', 150)) . "…"; } $contents = strip_tags($gc->value); echo "
"; @@ -101,20 +111,33 @@ else echo "
"; $counter++; } + echo elgg_make_river_comment($object); + echo "
"; // close river_comments + } else { + // tab bar nav - for users that liked object + echo "
"; + $numoflikes = elgg_count_likes($object); + if($numoflikes != 0){ + echo elgg_view('likes/forms/display', array('entity' => $object)); + } + echo "
"; // close river_comments_tabs + + echo "
"; + + if($numoflikes != 0){ + //show the users who liked the object + echo ""; } - //display the comment link - if($vars['item']->type != 'user'){ - //for now don't display the comment link on wire and conversations for now - if($vars['item']->subtype != 'thewire' && $vars['item']->subtype != 'conversations' && $vars['item']->subtype != '') - //don't display the comment option on group discussions atm - if($vars['item']->subtype == 'groupforumtopic'){ - echo "Visit discussion"; - }else{ - echo "
"; - echo elgg_make_river_comment($object); - echo "
"; - } - } - ?> + + // if there are no comments to display + // and this is not a user or a group discussion entry - include the inline comment form + if($vars['item']->type != 'user' && $vars['item']->subtype != 'groupforumtopic') { + echo elgg_make_river_comment($object); + } + echo "
"; + } +echo "
"; // close river_item_contents +?>
\ No newline at end of file diff --git a/mod/riverdashboard/views/default/riverdashboard/css.php b/mod/riverdashboard/views/default/riverdashboard/css.php index c8c004213..9a6109de0 100644 --- a/mod/riverdashboard/views/default/riverdashboard/css.php +++ b/mod/riverdashboard/views/default/riverdashboard/css.php @@ -36,6 +36,11 @@ .river_item p { margin:0; } +.river_item .entity_subtext { + padding-left:5px; + padding-right:5px; + font-size:85%; +} .river_item_useravatar { float:left; margin-top:3px; @@ -46,8 +51,9 @@ } .river_content_display { border-left:1px solid #DDDDDD; - font-size:90%; - margin:8px 0 6px 0; + font-size:85%; + line-height:1.5em; + margin:8px 0 5px 0; padding-left:5px; } .following_icon { @@ -58,148 +64,95 @@ } /* LATEST COMMENTS IN RIVER */ +.river_comments_tabs { + max-height: 19px; + overflow:hidden; +} .river_comments { - margin:5px 0 0 55px; - width:auto; + -moz-border-radius-bottomleft:5px; + -moz-border-radius-bottomright:5px; + -moz-border-radius-topleft:5px; + -moz-border-radius-topright:0; + -webkit-border-top-left-radius:5px; + -webkit-border-top-right-radius:0; + -webkit-border-bottom-right-radius:5px; + -webkit-border-bottom-left-radius:5px; + background-color: #eeeeee; } .river_comment { - background-color: #f8f8f8; padding:3px; - margin-bottom:3px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; + border-bottom:1px solid white; } .river_comment.penultimate { - background-color: #eeeeee; + } .river_comment.latest { - background-color: #dedede; - margin-bottom:0; -} -a.river_more_comments { - display:block; - float:right; - padding:2px 4px 7px 30px; - text-align:right; - width:auto; -} -.river_comment_owner_icon { - float:left; - margin:3px 8px 4px 2px; -} -.river_comment_contents { - margin-left:34px; -} -.river_item .comment_link { - margin-left:55px; -} -.river_comments .entity_subtext { - display: block; -} -/* ACTIVITY WIDGET? - @todo - -.collapsable_box_content .river_user_update { - background: url(_graphics/river_icons/river_icon_profile.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_user_profileupdate { - background: url(_graphics/river_icons/river_icon_profile.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_user_profileiconupdate { - background: url(_graphics/river_icons/river_icon_profile.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_annotate { - background: url(_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_bookmarks_create { - background: url(_graphics/river_icons/river_icon_bookmarks.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_bookmarks_comment { - background: url(_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_status_create { - background: url(_graphics/river_icons/river_icon_status.gif) no-repeat left -1px; } -.collapsable_box_content .river_object_file_create { - background: url(_graphics/river_icons/river_icon_files.gif) no-repeat left -1px; +/* hidden inline comment form */ +.river_comment_form.hidden { + padding:5px; } -.collapsable_box_content .river_object_file_update { - background: url(_graphics/river_icons/river_icon_files.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_file_comment { - background: url(_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_widget_create { - background: url(_graphics/river_icons/river_icon_plugin.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_forums_create { - background: url(_graphics/river_icons/river_icon_forum.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_forums_update { - background: url(_graphics/river_icons/river_icon_forum.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_widget_update { - background: url(_graphics/river_icons/river_icon_plugin.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_blog_create { - background: url(_graphics/river_icons/river_icon_blog.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_blog_update { - background: url(_graphics/river_icons/river_icon_blog.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_blog_comment { - background: url(_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_forumtopic_create { - background: url(_graphics/river_icons/river_icon_forum.gif) no-repeat left -1px; -} -.collapsable_box_content .river_user_friend { - background: url(_graphics/river_icons/river_icon_friends.gif) no-repeat left -1px; -} -.collapsable_box_content .river_object_relationship_friend_create { - background: url(_graphics/river_icons/river_icon_friends.gif) no-repeat left -1px; +.river_comment_form.hidden .input_text { + width:560px; + padding:3px; } -.collapsable_box_content .river_object_relationship_member_create { - background: url(_graphics/river_icons/river_icon_forum.gif) no-repeat left -1px; +.river_comment_form.hidden .submit_button { + margin:0 0 0 10px; + float:right; } -.collapsable_box_content .river_object_thewire_create { - background: url(_graphics/river_icons/river_icon_thewire.gif) no-repeat left -1px; +.river_link_divider { + color:#999999; } -.collapsable_box_content .river_group_join { - background: url(_graphics/river_icons/river_icon_forum.gif) no-repeat left -1px; +.river_comment_form_button, +.river_user_like_button { + font-size:85%; } -.collapsable_box_content .river_object_groupforumtopic_annotate { - background: url(_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px; +.elgg_likes_user { + border-bottom:1px solid white; + padding:3px; } -.collapsable_box_content .river_object_groupforumtopic_create { - background: url(_graphics/river_icons/river_icon_forum.gif) no-repeat left -1px; +.elgg_likes_user .entity_listing_icon { + margin:3px 0 4px 2px; } -.collapsable_box_content .river_object_sitemessage_create { - background: url(_graphics/river_icons/river_icon_blog.gif) no-repeat left -1px; +.elgg_likes_user .entity_listing_info { + width:635px; } -.collapsable_box_content .river_user_messageboard { - background: url(_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px; +.elgg_likes_user .entity_metadata { + margin-top:3px; } -.collapsable_box_content .river_object_page_create { - background: url(_graphics/river_icons/river_icon_pages.gif) no-repeat left -1px; +.river_item p.elgg_likes_owner { + padding-top:4px; } -.collapsable_box_content .river_object_page_update { - background: url(_graphics/river_icons/river_icon_pages.gif) no-repeat left -1px; +a.river_more_comments { + display:block; + float:right; + padding:1px 7px 1px 7px; + margin-left:6px; + text-align:right; + font-size:85%; + width:auto; + background-color: #eeeeee; + -moz-border-radius-topleft:4px; + -moz-border-radius-topright:4px; + -webkit-border-top-left-radius:4px; + -webkit-border-top-right-radius:4px; } -.collapsable_box_content .river_object_page_top_create { - background: url(_graphics/river_icons/river_icon_pages.gif) no-repeat left -1px; +a.river_more_comments.off { + background-color: white; } -.collapsable_box_content .river_object_page_top_update { - background: url(_graphics/river_icons/river_icon_pages.gif) no-repeat left -1px; +.river_comment_owner_icon { + float:left; + margin:3px 8px 4px 2px; } -.collapsable_box_content .river_object_page_top_comment { - background: url(_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px; +.river_comment_contents { + margin-left:34px; } -.collapsable_box_content .river_object_page_comment { - background: url(_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px; +/* +.river_item .comment_link { + margin-left:55px; } - */ + diff --git a/mod/riverdashboard/views/default/riverdashboard/js.php b/mod/riverdashboard/views/default/riverdashboard/js.php index ad96a6069..b1bace04a 100644 --- a/mod/riverdashboard/views/default/riverdashboard/js.php +++ b/mod/riverdashboard/views/default/riverdashboard/js.php @@ -1,7 +1,35 @@ \ No newline at end of file diff --git a/mod/riverdashboard/views/default/riverdashboard/rivercomment.php b/mod/riverdashboard/views/default/riverdashboard/rivercomment.php index 32d1b4675..d440e7ab6 100644 --- a/mod/riverdashboard/views/default/riverdashboard/rivercomment.php +++ b/mod/riverdashboard/views/default/riverdashboard/rivercomment.php @@ -5,11 +5,14 @@ */ if (isset($vars['entity']) && isloggedin()) { - $form_body = "Add comment"; - $form_body .= "
"; - $form_body .= elgg_view('input/text',array('internalname' => 'generic_comment', 'value' => 'Add a comment...')); + $form_body = ""; echo elgg_view('input/form', array('body' => $form_body, 'action' => "{$vars['url']}action/comments/add")); } \ No newline at end of file -- cgit v1.2.3