diff options
author | cash <cash.costello@gmail.com> | 2011-06-24 13:42:07 -0400 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2011-06-24 13:42:07 -0400 |
commit | 3c2f72753335a5ca793cf8250c4233d04689e5d2 (patch) | |
tree | 43fb542574f791bc47546e65e24f858c3eec0698 | |
parent | 42e02f03c306717002aac0d36f0e2b48bf369fed (diff) | |
parent | d701c3bdf59e2d326c27dd0567323e09a65c00f2 (diff) | |
download | elgg-3c2f72753335a5ca793cf8250c4233d04689e5d2.tar.gz elgg-3c2f72753335a5ca793cf8250c4233d04689e5d2.tar.bz2 |
Merge branch 'master' of github.com:Elgg/Elgg
36 files changed, 199 insertions, 340 deletions
diff --git a/engine/lib/statistics.php b/engine/lib/statistics.php index cd2b7a6a1..1232c6128 100644 --- a/engine/lib/statistics.php +++ b/engine/lib/statistics.php @@ -96,7 +96,7 @@ function get_number_users($show_deactivated = false) { */ function get_online_users() { $offset = get_input('offset', 0); - $count = count(find_active_users(600, 9999)); + $count = find_active_users(600, 10, $offset, true); $objects = find_active_users(600, 10, $offset); if ($objects) { diff --git a/engine/lib/users.php b/engine/lib/users.php index 59bfa1259..e7e1a57f0 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -625,31 +625,37 @@ function get_user_by_email($email) { /** * A function that returns a maximum of $limit users who have done something within the last - * $seconds seconds. + * $seconds seconds or the total count of active users. * * @param int $seconds Number of seconds (default 600 = 10min) * @param int $limit Limit, default 10. - * @param int $offset Offset, defualt 0. + * @param int $offset Offset, default 0. + * @param bool $count Count, default false. * * @return mixed */ -function find_active_users($seconds = 600, $limit = 10, $offset = 0) { - global $CONFIG; - +function find_active_users($seconds = 600, $limit = 10, $offset = 0, $count = false) { $seconds = (int)$seconds; $limit = (int)$limit; $offset = (int)$offset; + $params = array('seconds' => $seconds, 'limit' => $limit, 'offset' => $offset, 'count' => $count); + $data = elgg_trigger_plugin_hook('find_active_users', 'system', $params, NULL); + if (!$data) { + global $CONFIG; - $time = time() - $seconds; - - $access = get_access_sql_suffix("e"); - - $query = "SELECT distinct e.* from {$CONFIG->dbprefix}entities e - join {$CONFIG->dbprefix}users_entity u on e.guid = u.guid - where u.last_action >= {$time} and $access - order by u.last_action desc limit {$offset}, {$limit}"; + $time = time() - $seconds; - return get_data($query, "entity_row_to_elggstar"); + $data = elgg_get_entities(array( + 'type' => 'user', + 'limit' => $limit, + 'offset' => $offset, + 'count' => $count, + 'joins' => array("join {$CONFIG->dbprefix}users_entity u on e.guid = u.guid"), + 'wheres' => array("u.last_action >= {$time}"), + 'order_by' => "u.last_action desc" + )); + } + return $data; } /** diff --git a/engine/lib/views.php b/engine/lib/views.php index 45b2c35f8..4911171c8 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1203,7 +1203,7 @@ function elgg_view_river_item($item, array $vars = array()) { $vars['item'] = $item; - return elgg_view('river/item', $vars); + return elgg_view($item->getView(), $vars); } /** diff --git a/languages/en.php b/languages/en.php index 2e76ee2e7..e7806be27 100644 --- a/languages/en.php +++ b/languages/en.php @@ -403,14 +403,13 @@ $english = array( * River */ 'river' => "River", - 'river:relationship:friend' => 'is now friends with', - 'friends:river:add' => "is now a friend with %s", + 'river:friend:user:default' => "%s is now a friend with %s", 'profile:river:iconupdate' => 'updated their profile icon', 'river:noaccess' => 'You do not have permission to view this item.', 'river:posted:generic' => '%s posted', 'riveritem:single:user' => 'a user', 'riveritem:plural:user' => 'some users', - 'river:ingroup' => 'to the group %s', + 'river:ingroup' => 'in the group %s', 'river:none' => 'No activity', 'river:widget:title' => "Activity", diff --git a/mod/blog/languages/en.php b/mod/blog/languages/en.php index b626085d7..460c407d9 100644 --- a/mod/blog/languages/en.php +++ b/mod/blog/languages/en.php @@ -53,8 +53,9 @@ $english = array( 'blog:error:revision_not_found' => 'Cannot find this revision.', // river - 'blog:river:create' => 'published a blog post', - 'river:commented:object:blog' => 'the blog', + + 'river:create:object:blog' => '%s published a blog post %s', + 'river:comment:object:blog' => '%s commented on the blog %s', // widget 'blog:widget:description' => 'Display your latest blog posts', diff --git a/mod/blog/views/default/river/object/blog/create.php b/mod/blog/views/default/river/object/blog/create.php index bd2405d42..613cbb165 100644 --- a/mod/blog/views/default/river/object/blog/create.php +++ b/mod/blog/views/default/river/object/blog/create.php @@ -7,29 +7,7 @@ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->excerpt); $excerpt = elgg_get_excerpt($excerpt); -$params = array( - 'href' => $object->getURL(), - 'text' => $object->title, -); -$link = elgg_view('output/url', $params); - -$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('blog:river:create'); - -echo " $link $group_string"; - -if ($excerpt) { - echo '<div class="elgg-river-content">'; - echo $excerpt; - echo '</div>'; -} +echo elgg_view('river/item', array( + 'item' => $vars['item'], + 'message' => $excerpt, +));
\ No newline at end of file diff --git a/mod/bookmarks/languages/en.php b/mod/bookmarks/languages/en.php index 42865f8cf..1d32a0344 100644 --- a/mod/bookmarks/languages/en.php +++ b/mod/bookmarks/languages/en.php @@ -35,10 +35,10 @@ $english = array( 'bookmarks:visit' => "Visit resource", 'bookmarks:recent' => "Recent bookmarks", - 'bookmarks:river:created' => 'bookmarked %s', + 'river:create:object:bookmarks' => '%s bookmarked %s', + 'river:comment:object:bookmarks' => '%s commented on a bookmark %s', 'bookmarks:river:annotate' => 'a comment on this bookmark', 'bookmarks:river:item' => 'an item', - 'river:commented:object:bookmarks' => 'a bookmark', 'item:object:bookmarks' => 'Bookmarks', diff --git a/mod/bookmarks/views/default/river/object/bookmarks/create.php b/mod/bookmarks/views/default/river/object/bookmarks/create.php index 743efdb22..984d109be 100644 --- a/mod/bookmarks/views/default/river/object/bookmarks/create.php +++ b/mod/bookmarks/views/default/river/object/bookmarks/create.php @@ -8,29 +8,8 @@ $object = $vars['item']->getObjectEntity(); $excerpt = elgg_get_excerpt($object->description); -$params = array( - 'href' => $object->getURL(), - 'text' => $object->title, -); -$link = elgg_view('output/url', $params); - -$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)); -} - -$link = elgg_echo('bookmarks:river:created', array($link)); - -echo " $link $group_string"; - -if ($excerpt) { - echo '<div class="elgg-river-content">'; - echo $excerpt; - echo '</div>'; -} +echo elgg_view('river/item', array( + 'item' => $vars['item'], + 'message' => $excerpt, + 'attachments' => elgg_view('output/url', array('href' => $object->address)), +)); diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php index 5d5c28bee..c5fe763cb 100644 --- a/mod/file/actions/file/upload.php +++ b/mod/file/actions/file/upload.php @@ -106,9 +106,10 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { $file->originalfilename = $_FILES['upload']['name']; $file->simpletype = file_get_simple_type($_FILES['upload']['type']); + // Open the file to guarantee the directory exists $file->open("write"); - $file->write(get_uploaded_file('upload')); $file->close(); + move_uploaded_file($_FILES['upload']['tmp_name'], $file->getFilenameOnFilestore()); $guid = $file->save(); diff --git a/mod/file/download.php b/mod/file/download.php index a386d490f..8e0287a1e 100644 --- a/mod/file/download.php +++ b/mod/file/download.php @@ -33,8 +33,7 @@ if (strpos($mime, "image/") !== false) { header("Content-Disposition: attachment; filename=\"$filename\""); } -$contents = $file->grabFile(); -$splitString = str_split($contents, 8192); -foreach ($splitString as $chunk) { - echo $chunk; -} +ob_clean(); +flush(); +readfile($file->getFilenameOnFilestore()); +exit; diff --git a/mod/file/languages/en.php b/mod/file/languages/en.php index 7ced3f112..1db32afcb 100644 --- a/mod/file/languages/en.php +++ b/mod/file/languages/en.php @@ -73,8 +73,8 @@ $english = array( 'file:display:number' => "Number of files to display", - 'file:river:create' => 'uploaded the file', - 'river:commented:object:file' => 'the file', + 'river:create:object:file' => '%s uploaded the file %s', + 'river:comment:object:file' => '%s commented on the file %s', 'item:object:file' => 'Files', diff --git a/mod/file/views/default/river/object/file/create.php b/mod/file/views/default/river/object/file/create.php index 620d1d18c..dad629120 100644 --- a/mod/file/views/default/river/object/file/create.php +++ b/mod/file/views/default/river/object/file/create.php @@ -7,29 +7,7 @@ $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); - -$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('file:river:create'); - -echo " $link $group_string"; - -if ($excerpt) { - echo '<div class="elgg-river-content">'; - echo $excerpt; - echo '</div>'; -} +echo elgg_view('river/item', array( + 'item' => $vars['item'], + 'message' => $excerpt, +));
\ No newline at end of file diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index f2895db88..9f8bed9a4 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -213,10 +213,10 @@ or click below to view the group's join requests: Forum river items */ - 'groups:river:create' => 'created the group', - 'groups:river:join' => 'joined the group', - 'forumtopic:river:create' => 'added a new discussion topic', - 'groups:river:reply' => 'replied on the discussion topic', + 'river:create:group:default' => '%s created the group %s', + 'river:join:group:default' => '%s joined the group %s', + 'river:create:object:groupforumtopic' => '%s added a new discussion topic %s', + 'river:reply:object:groupforumtopic' => '%s replied on the discussion topic %s', 'groups:nowidgets' => 'No widgets have been defined for this group.', diff --git a/mod/groups/start.php b/mod/groups/start.php index 9a375e89d..066b309a5 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -663,7 +663,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/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 '<div class="elgg-river-content">'; - echo $excerpt; - echo '</div>'; -} +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 '<div class="elgg-river-content">'; - echo $excerpt; - echo '</div>'; -} +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..80e7b09aa 100644 --- a/mod/groups/views/default/river/object/groupforumtopic/create.php +++ b/mod/groups/views/default/river/object/groupforumtopic/create.php @@ -7,36 +7,16 @@ $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); - -$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 '<div class="elgg-river-content">'; - echo $excerpt; - echo '</div>'; -} - -if (elgg_is_logged_in() && $container->canWriteToContainer()) { +$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); - echo elgg_view_form('discussion/reply/save', $form_vars, $body_vars); + $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/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'], +)); diff --git a/mod/likes/views/default/river/annotation/likes/create.php b/mod/likes/views/default/river/annotation/likes/create.php index 463fe5049..0160bcc0b 100644 --- a/mod/likes/views/default/river/annotation/likes/create.php +++ b/mod/likes/views/default/river/annotation/likes/create.php @@ -5,22 +5,6 @@ * @todo not finished */ -$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:likes', array($type_string, $object_link)); +echo elgg_view('river/item', array( + 'item' => $vars['item'], +)); diff --git a/mod/messageboard/languages/en.php b/mod/messageboard/languages/en.php index d8ccbdeee..9027eb650 100644 --- a/mod/messageboard/languages/en.php +++ b/mod/messageboard/languages/en.php @@ -26,10 +26,7 @@ $english = array( /** * Message board widget river */ - 'messageboard:river:added' => "posted on", - 'messageboard:river:user' => "%s's", - 'messageboard:river:messageboard' => "message board", - + 'river:messageboard:user:default' => "%s posted on %s's message board", /** * Status messages diff --git a/mod/messageboard/views/default/river/object/messageboard/create.php b/mod/messageboard/views/default/river/object/messageboard/create.php index 0268930bf..975598805 100644 --- a/mod/messageboard/views/default/river/object/messageboard/create.php +++ b/mod/messageboard/views/default/river/object/messageboard/create.php @@ -3,22 +3,9 @@ * Messageboard river view */ -$performed_by = $vars['item']->getSubjectEntity(); -$performed_on = $vars['item']->getObjectEntity(); +$messageboard = $vars['item']->getAnnotation(); -$comment = $vars['item']->getAnnotation(); - -$link = elgg_view('output/url', array( - 'href' => $performed_on->getURL(), - 'text' => elgg_echo('messageboard:river:user', array($performed_on->name)), +echo elgg_view('river/item', array( + 'item' => $vars['item'], + 'message' => $messageboard->value, )); - -echo elgg_echo("messageboard:river:added"); -echo " $link "; -echo elgg_echo("messageboard:river:messageboard"); - -if ($comment) { - echo '<div class="elgg-river-content">'; - echo elgg_get_excerpt($comment->value); - echo '</div>'; -} diff --git a/mod/pages/languages/en.php b/mod/pages/languages/en.php index f590afb9c..1c6d0318c 100644 --- a/mod/pages/languages/en.php +++ b/mod/pages/languages/en.php @@ -38,13 +38,12 @@ $english = array( * River **/ - 'pages:river:create' => 'created the page', - 'pages:river:created' => "%s wrote", - 'pages:river:updated' => "%s updated", - 'pages:river:posted' => "%s posted", - 'pages:river:update' => "a page titled", - 'river:commented:object:page' => 'the page', - 'river:commented:object:page_top' => 'the page', + 'river:create:object:page' => '%s created a page %s', + 'river:create:object:page_top' => '%s created a page %s', + 'river:update:object:page' => '%s updated a page %s', + 'river:update:object:page_top' => '%s updated a page %s', + 'river:comment:object:page' => '%s commented on a page titled %s', + 'river:comment:object:page_top' => '%s commented on a page titled %s', /** * Form fields diff --git a/mod/pages/views/default/river/object/page/create.php b/mod/pages/views/default/river/object/page/create.php index 032046063..ca15ddea7 100644 --- a/mod/pages/views/default/river/object/page/create.php +++ b/mod/pages/views/default/river/object/page/create.php @@ -7,29 +7,7 @@ $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); - -$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('pages:river:create'); - -echo " $link $group_string"; - -if ($excerpt) { - echo '<div class="elgg-river-content">'; - echo $excerpt; - echo '</div>'; -} +echo elgg_view('river/item', array( + 'item' => $vars['item'], + 'message' => $excerpt, +));
\ No newline at end of file diff --git a/mod/thewire/languages/en.php b/mod/thewire/languages/en.php index 9b2b480ae..e2dd5fdac 100644 --- a/mod/thewire/languages/en.php +++ b/mod/thewire/languages/en.php @@ -29,7 +29,7 @@ $english = array( /** * The wire river */ - 'thewire:river:create' => "posted to the wire", + 'river:create:object:thewire' => "%s posted to the wire", /** * Wire widget diff --git a/mod/thewire/views/default/js/thewire.php b/mod/thewire/views/default/js/thewire.php index 1eda90bee..d9bf6d10e 100644 --- a/mod/thewire/views/default/js/thewire.php +++ b/mod/thewire/views/default/js/thewire.php @@ -30,7 +30,7 @@ elgg.thewire.init = function() { */ elgg.thewire.textCounter = function(textarea, status, limit) { - var remaining_chars = limit - textarea.value.length; + var remaining_chars = limit - $(textarea).val().length; status.html(remaining_chars); if (remaining_chars < 0) { @@ -83,4 +83,4 @@ elgg.thewire.viewPrevious = function(event) { event.preventDefault(); } -elgg.register_hook_handler('init', 'system', elgg.thewire.init);
\ No newline at end of file +elgg.register_hook_handler('init', 'system', elgg.thewire.init); diff --git a/mod/thewire/views/default/river/object/thewire/create.php b/mod/thewire/views/default/river/object/thewire/create.php index d4dac38ee..2e9cfd83b 100644 --- a/mod/thewire/views/default/river/object/thewire/create.php +++ b/mod/thewire/views/default/river/object/thewire/create.php @@ -7,18 +7,8 @@ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); $excerpt = thewire_filter($excerpt); -$params = array( - 'href' => $object->getURL(), - 'text' => $object->title, -); -$link = elgg_view('output/url', $params); - -echo elgg_echo('thewire:river:create'); - -echo " $link"; - -if ($excerpt) { - echo '<div class="elgg-river-content">'; - echo $excerpt; - echo '</div>'; -} +echo elgg_view('river/item', array( + 'item' => $vars['item'], + 'message' => $excerpt, + 'summary' => false, +));
\ No newline at end of file diff --git a/vendors/markdown/License.text b/vendors/markdown/License.text index 4d6bf8b63..4d6bf8b63 100755..100644 --- a/vendors/markdown/License.text +++ b/vendors/markdown/License.text diff --git a/vendors/markdown/PHP Markdown Extra Readme.text b/vendors/markdown/PHP Markdown Extra Readme.text index b72ee998e..b72ee998e 100755..100644 --- a/vendors/markdown/PHP Markdown Extra Readme.text +++ b/vendors/markdown/PHP Markdown Extra Readme.text diff --git a/vendors/markdown/markdown.php b/vendors/markdown/markdown.php index 3f1f3a715..3f1f3a715 100755..100644 --- a/vendors/markdown/markdown.php +++ b/vendors/markdown/markdown.php diff --git a/views/default/css/elements/components.php b/views/default/css/elements/components.php index 0fcbe3619..203f6d257 100644 --- a/views/default/css/elements/components.php +++ b/views/default/css/elements/components.php @@ -161,6 +161,9 @@ font-style: italic; line-height: 1.2em; } + +.elgg-river-attachments, +.elgg-river-message, .elgg-river-content { border-left: 1px solid #CCC; font-size: 85%; 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 '<div class="elgg-river-content">'; - echo $excerpt; - echo '</div>'; -} +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..7eebb0c99 100644 --- a/views/default/river/elements/body.php +++ b/views/default/river/elements/body.php @@ -6,28 +6,55 @@ */ $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 <span class=\"elgg-river-timestamp\">$timestamp</span>"; +$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 = "<div class=\"elgg-river-message\">$message</div>"; +} + +$attachments = elgg_extract('attachments', $vars, false); +if ($attachments !== false) { + $attachments = "<div class=\"elgg-river-attachments\">$attachments</div>"; +} -// body -$body = elgg_view($item->getView(), array('item' => $item)); +$responses = elgg_extract('responses', $vars, false); +if ($responses === false) { + $responses = elgg_view('river/elements/responses', $vars); +} +if ($responses) { + $responses = "<div class=\"elgg-river-responses\">$responses</div>"; +} -// footer -$footer = elgg_view('river/elements/footer', $vars); +$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 elgg_view('page/components/module', array( - 'header' => $header, - 'body' => $body, - 'footer' => $footer, - 'class' => 'mbn', -));
\ No newline at end of file +echo <<<RIVER +$menu +<div class="elgg-river-summary">$summary $group_string <span class="elgg-river-timestamp">$timestamp</span></div> +$message +$attachments +$responses +RIVER; diff --git a/views/default/river/elements/footer.php b/views/default/river/elements/responses.php index f1e79f131..f1e79f131 100644 --- a/views/default/river/elements/footer.php +++ b/views/default/river/elements/responses.php 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 @@ +<?php + +$item = $vars['item']; + +$subject = $item->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 '<div class="elgg-river-content clearfix">'; -echo $subject_icon; -echo elgg_view_icon('arrow-right', true); -echo $object_icon; -echo '</div>'; +echo elgg_view('river/item', array( + 'item' => $vars['item'], + 'attachments' => $subject_icon . elgg_view_icon('arrow-right', true) . $object_icon, +)); |