From 21f41d24e2fad631499ab80950e4d9a1e22bcca0 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 20 Mar 2011 20:50:00 +0000 Subject: Fixes #3114 added the rss link back to pages git-svn-id: http://code.elgg.org/elgg/trunk@8784 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/entities.php | 6 ++++++ engine/lib/group.php | 2 +- engine/lib/sites.php | 2 +- engine/lib/users.php | 2 +- engine/lib/views.php | 24 ++++++++++++++++++++++++ views/default/page/elements/sidebar.php | 5 ++++- 6 files changed, 37 insertions(+), 4 deletions(-) diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 7f07f7359..a800817d7 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1199,6 +1199,9 @@ $time_created_lower = NULL, $time_updated_upper = NULL, $time_updated_lower = NU function elgg_list_entities(array $options = array(), $getter = 'elgg_get_entities', $viewer = 'elgg_view_entity_list') { + global $autofeed; + $autofeed = true; + $defaults = array( 'offset' => (int) max(get_input('offset', 0), 0), 'limit' => (int) max(get_input('limit', 10), 0), @@ -2067,6 +2070,9 @@ function entities_page_handler($page) { * @since 1.7.0 */ function elgg_list_registered_entities(array $options = array()) { + global $autofeed; + $autofeed = true; + $defaults = array( 'full_view' => TRUE, 'allowed_types' => TRUE, diff --git a/engine/lib/group.php b/engine/lib/group.php index f3314ada6..d78274961 100644 --- a/engine/lib/group.php +++ b/engine/lib/group.php @@ -24,7 +24,7 @@ function get_group_entity_as_row($guid) { } /** - * Create or update the extras table for a given group. + * Create or update the entities table for a given group. * Call create_entity first. * * @param int $guid GUID diff --git a/engine/lib/sites.php b/engine/lib/sites.php index 1df20a5ce..5fed29822 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -40,7 +40,7 @@ function get_site_entity_as_row($guid) { } /** - * Create or update the extras table for a given site. + * Create or update the entities table for a given site. * Call create_entity first. * * @param int $guid Site GUID diff --git a/engine/lib/users.php b/engine/lib/users.php index ef673cacb..55bacdcb2 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -30,7 +30,7 @@ function get_user_entity_as_row($guid) { } /** - * Create or update the extras table for a given user. + * Create or update the entities table for a given user. * Call create_entity first. * * @param int $guid The user's GUID diff --git a/engine/lib/views.php b/engine/lib/views.php index 460b2c8b5..e74a286da 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1478,6 +1478,29 @@ function elgg_views_register_core_head_elements() { elgg_load_css('elgg'); } +/** + * Add the rss link to the extras when if needed + */ +function elgg_views_add_rss_link() { + global $autofeed; + if (isset($autofeed) && $autofeed == true) { + $url = full_url(); + if (substr_count($url,'?')) { + $url .= "&view=rss"; + } else { + $url .= "?view=rss"; + } + + $url = elgg_format_url($url); + elgg_register_menu_item('extras', array( + 'name' => 'rss', + 'text' => elgg_view_icon('rss'), + 'href' => $url, + 'title' => elgg_echo('feed:rss'), + )); + } +} + /** * Initialize viewtypes on system boot event * This ensures simplecache is cleared during upgrades. See #2252 @@ -1502,6 +1525,7 @@ function elgg_views_boot() { elgg_load_js('jquery.form'); elgg_register_event_handler('ready', 'system', 'elgg_views_register_core_head_elements'); + elgg_register_event_handler('pagesetup', 'system', 'elgg_views_add_rss_link'); // discover the built-in view types // @todo the cache is loaded in load_plugins() but we need to know view_types earlier diff --git a/views/default/page/elements/sidebar.php b/views/default/page/elements/sidebar.php index 6d40daf20..e1d25eed5 100644 --- a/views/default/page/elements/sidebar.php +++ b/views/default/page/elements/sidebar.php @@ -5,7 +5,10 @@ * @uses $vars['sidebar'] Optional content that is displayed at the bottom of sidebar */ -echo elgg_view_menu('extras', array('sort_by' => 'name')); +echo elgg_view_menu('extras', array( + 'sort_by' => 'name', + 'class' => 'elgg-menu-hz', +)); echo elgg_view('page/elements/owner_block', $vars); -- cgit v1.2.3