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 --- engine/lib/views.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/lib') 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); } /** -- cgit v1.2.3 From 6e05a5d7486ede1c8408144b823b895c6282f270 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 19 Jun 2011 15:03:30 -0400 Subject: added another way for an action to be detected as an Ajax action: set the request variable X-Requested-With = XMLHttpRequest. This is because files cannot be uploaded with XMLHttpRequest --- engine/lib/actions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'engine/lib') diff --git a/engine/lib/actions.php b/engine/lib/actions.php index ff598916f..017653aa8 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -384,7 +384,8 @@ function actions_init() { */ function elgg_is_xhr() { return isset($_SERVER['HTTP_X_REQUESTED_WITH']) - && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; + && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' || + get_input('X-Requested-With') === 'XMLHttpRequest'; } /** @@ -448,6 +449,9 @@ function ajax_forward_hook($hook, $type, $reason, $params) { header("Content-type: application/json"); echo json_encode($params); exit; + } else { + echo json_encode('not ajax'); + exit; } } -- cgit v1.2.3 From 5240a01d98d7c8b99c9d9c3f820de9c598ec5849 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 20 Jun 2011 21:09:10 -0400 Subject: removed debug code --- engine/lib/actions.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/actions.php b/engine/lib/actions.php index 017653aa8..4ccffd267 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -449,9 +449,6 @@ function ajax_forward_hook($hook, $type, $reason, $params) { header("Content-type: application/json"); echo json_encode($params); exit; - } else { - echo json_encode('not ajax'); - exit; } } -- cgit v1.2.3 From e29500440b1848f192bc56a1bad89eac69408e7b Mon Sep 17 00:00:00 2001 From: benbro Date: Mon, 20 Jun 2011 08:43:09 +0300 Subject: added find_active_users hook --- engine/lib/statistics.php | 2 +- engine/lib/users.php | 34 ++++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 15 deletions(-) (limited to 'engine/lib') 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; } /** -- cgit v1.2.3 From 43e2672f65d12a36d75ad9257a936dc93a2108f3 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 24 Jun 2011 19:55:58 -0400 Subject: cleaned up the list/gallery css classes to use standard class naming - minor modifications only --- engine/lib/views.php | 4 ++-- mod/search/views/default/search/list.php | 4 ++-- views/default/css/admin.php | 2 +- views/default/css/elements/components.php | 4 ++-- views/default/object/elements/summary.php | 2 +- views/default/page/components/gallery.php | 31 ++++++++++++++++++++++++++++--- views/default/page/components/list.php | 6 +++--- 7 files changed, 39 insertions(+), 14 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/views.php b/engine/lib/views.php index 4911171c8..df69593f9 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -969,7 +969,7 @@ $list_type_toggle = true, $pagination = true) { // new function $defaults = array( 'items' => $entities, - 'list_class' => 'elgg-entity-list', + 'list_class' => 'elgg-list-entity', 'full_view' => true, 'pagination' => true, 'gallery' => false, @@ -992,7 +992,7 @@ $list_type_toggle = true, $pagination = true) { 'pagination' => $pagination, 'gallery' => false, 'list_type_toggle' => $list_type_toggle, - 'list_class' => 'elgg-entity-list', + 'list_class' => 'elgg-list-entity', ); } diff --git a/mod/search/views/default/search/list.php b/mod/search/views/default/search/list.php index c5afaaa86..11860c094 100644 --- a/mod/search/views/default/search/list.php +++ b/mod/search/views/default/search/list.php @@ -82,7 +82,7 @@ $more = ($more_check > 0) ? $more_check : 0; if ($more) { $title_key = ($more == 1) ? 'comment' : 'comments'; $more_str = elgg_echo('search:more', array($count, $type_str)); - $more_link = "
  • $more_str
  • "; + $more_link = "
  • $more_str
  • "; } else { $more_link = ''; } @@ -98,7 +98,7 @@ if ($view) { $body .= '
      '; foreach ($entities as $entity) { $id = "elgg-{$entity->getType()}-{$entity->getGUID()}"; - $body .= "
    • "; + $body .= "
    • "; $body .= elgg_view($view, array( 'entity' => $entity, 'params' => $vars['params'], diff --git a/views/default/css/admin.php b/views/default/css/admin.php index a56c7b214..d7c154438 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -383,7 +383,7 @@ table.mceLayout { margin-left: 5px; } -.elgg-list-item { +.elgg-item { margin: 3px; } .elgg-menu-metadata { diff --git a/views/default/css/elements/components.php b/views/default/css/elements/components.php index 203f6d257..594694e60 100644 --- a/views/default/css/elements/components.php +++ b/views/default/css/elements/components.php @@ -47,10 +47,10 @@ border-bottom: 1px dotted #CCCCCC; } -.elgg-list-item .elgg-subtext { +.elgg-item .elgg-subtext { margin-bottom: 5px; } -.elgg-list-content { +.elgg-item .elgg-content { margin: 10px 5px; } diff --git a/views/default/object/elements/summary.php b/views/default/object/elements/summary.php index d3a6ea862..9206ada66 100644 --- a/views/default/object/elements/summary.php +++ b/views/default/object/elements/summary.php @@ -49,5 +49,5 @@ echo "

      $title_link

      "; echo "
      $subtitle
      "; echo $tags; if ($content) { - echo "
      $content
      "; + echo "
      $content
      "; } diff --git a/views/default/page/components/gallery.php b/views/default/page/components/gallery.php index e86b9f885..f03eb1109 100644 --- a/views/default/page/components/gallery.php +++ b/views/default/page/components/gallery.php @@ -2,7 +2,17 @@ /** * Gallery view * - * @uses $vars['items'] + * Implemented as an unorder list + * + * @uses $vars['items'] Array of ElggEntity or ElggAnnotation objects + * @uses $vars['offset'] Index of the first list item in complete list + * @uses $vars['limit'] Number of items per page + * @uses $vars['count'] Number of items in the complete list + * @uses $vars['pagination'] Show pagination? (default: true) + * @uses $vars['position'] Position of the pagination: before, after, or both + * @uses $vars['full_view'] Show the full view of the items (default: false) + * @uses $vars['gallery_class'] Additional CSS class for the
        element + * @uses $vars['item_class'] Additional CSS class for the
      • elements */ $items = $vars['items']; @@ -19,6 +29,16 @@ $pagination = elgg_extract('pagination', $vars, true); $offset_key = elgg_extract('offset_key', $vars, 'offset'); $position = elgg_extract('position', $vars, 'after'); +$gallery_class = 'elgg-gallery'; +if (isset($vars['gallery_class'])) { + $gallery_class = "$gallery_class {$vars['gallery_class']}"; +} + +$item_class = 'elgg-item'; +if (isset($vars['item_class'])) { + $item_class = "$item_class {$vars['item_class']}"; +} + if ($pagination && $count) { $nav .= elgg_view('navigation/pagination', array( 'offset' => $offset, @@ -33,10 +53,15 @@ if ($position == 'before' || $position == 'both') { } ?> -