From 53ab8cf80e4990ac1daf17c7a23931d26110e2f5 Mon Sep 17 00:00:00 2001 From: cash Date: Tue, 14 Dec 2010 12:54:15 +0000 Subject: Fixes #2723 members listing pages now in core git-svn-id: http://code.elgg.org/elgg/trunk@7616 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/upgrades/2010121401.php | 7 ++++++ engine/lib/users.php | 24 ++++++++++++++++++ languages/en.php | 8 ++++++ pages/members/index.php | 37 +++++++++++++++++++++++++++ pages/members/search.php | 39 +++++++++++++++++++++++++++++ version.php | 2 +- views/default/core/members/nav.php | 24 ++++++++++++++++++ views/default/core/members/sidebar.php | 33 ++++++++++++++++++++++++ views/default/forms/members/name_search.php | 8 ++++++ views/default/forms/members/tag_search.php | 11 ++++++++ 10 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 engine/lib/upgrades/2010121401.php create mode 100644 pages/members/index.php create mode 100644 pages/members/search.php create mode 100644 views/default/core/members/nav.php create mode 100644 views/default/core/members/sidebar.php create mode 100644 views/default/forms/members/name_search.php create mode 100644 views/default/forms/members/tag_search.php diff --git a/engine/lib/upgrades/2010121401.php b/engine/lib/upgrades/2010121401.php new file mode 100644 index 000000000..30e4dff32 --- /dev/null +++ b/engine/lib/upgrades/2010121401.php @@ -0,0 +1,7 @@ +site->guid); \ No newline at end of file diff --git a/engine/lib/users.php b/engine/lib/users.php index a91f143b0..a7153a1be 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1461,6 +1461,29 @@ function user_create_hook_add_site_relationship($event, $object_type, $object) { add_entity_relationship($object->getGUID(), 'member_of_site', $CONFIG->site->getGUID()); } +/** + * Members page handler + * + * @param array $page url segments + */ +function elgg_members_page_handler($page) { + global $CONFIG; + + if (!isset($page[0])) { + $page[0] = 'newest'; + } + + $vars = array(); + $vars['page'] = $page[0]; + + if ($page[0] == 'search') { + $vars['search_type'] = $page[1]; + require_once("{$CONFIG->path}pages/members/search.php"); + } else { + require_once("{$CONFIG->path}pages/members/index.php"); + } +} + /** * Sets up user-related menu items * @@ -1511,6 +1534,7 @@ function users_init() { register_page_handler('register', 'registration_page_handler'); register_page_handler('resetpassword', 'elgg_user_resetpassword_page_handler'); register_page_handler('login', 'elgg_user_login_page_handler'); + register_page_handler('members', 'elgg_members_page_handler'); elgg_register_action("register", '', 'public'); elgg_register_action("useradd", '', 'public'); diff --git a/languages/en.php b/languages/en.php index bbda438a1..b89124c6c 100644 --- a/languages/en.php +++ b/languages/en.php @@ -638,6 +638,13 @@ $english = array( 'river:comments:more' => '+%u more', 'river:generic_comment' => 'commented on %s %s', + 'members:label:newest' => 'Newest', + 'members:label:popular' => 'Popular', + 'members:label:online' => 'Online', + 'members:searchname' => 'Search members by name', + 'members:searchtag' => 'Search members by tag', + 'members:title:searchname' => 'Member search for %s', + 'members:title:searchtag' => 'Members tagged with %s', /** * Generic action words @@ -676,6 +683,7 @@ $english = array( 'site' => 'Site', 'activity' => 'Activity', + 'members' => 'Members', 'up' => 'Up', 'down' => 'Down', diff --git a/pages/members/index.php b/pages/members/index.php new file mode 100644 index 000000000..82adf2a4a --- /dev/null +++ b/pages/members/index.php @@ -0,0 +1,37 @@ + 'user', 'full_view' => false); +switch ($vars['page']) { + case 'popular': + $options['relationship'] = 'friend'; + $options['inverse_relationship'] = false; + $content = elgg_list_entities_from_relationship_count($options); + break; + case 'online': + $content = get_online_users(); + break; + case 'newest': + default: + $content = elgg_list_entities($options); + break; +} + +$params = array( + 'content' => $content, + 'sidebar' => elgg_view('core/members/sidebar'), + 'title' => $title . " ($num_members)", + 'buttons' => '', + 'filter_override' => elgg_view('core/members/nav', array('selected' => $vars['page'])), +); + +$body = elgg_view_layout('content', $params); + +echo elgg_view_page($title, $body); diff --git a/pages/members/search.php b/pages/members/search.php new file mode 100644 index 000000000..1a0168660 --- /dev/null +++ b/pages/members/search.php @@ -0,0 +1,39 @@ + $content, + 'sidebar' => elgg_view('core/members/sidebar'), +); + +$body = elgg_view_layout('one_sidebar', $params); + +echo elgg_view_page($title, $body); diff --git a/version.php b/version.php index 89dd26f69..d2c27318c 100644 --- a/version.php +++ b/version.php @@ -11,7 +11,7 @@ // YYYYMMDD = Elgg Date // XX = Interim incrementer -$version = 2010111501; +$version = 2010121401; // Human-friendly version name $release = '1.8-svn'; diff --git a/views/default/core/members/nav.php b/views/default/core/members/nav.php new file mode 100644 index 000000000..a713fa8a3 --- /dev/null +++ b/views/default/core/members/nav.php @@ -0,0 +1,24 @@ + array( + 'title' => elgg_echo('members:label:newest'), + 'url' => "pg/members/newest/", + 'selected' => $vars['selected'] == 'newest', + ), + 'popular' => array( + 'title' => elgg_echo('members:label:popular'), + 'url' => "pg/members/popular/", + 'selected' => $vars['selected'] == 'popular', + ), + 'online' => array( + 'title' => elgg_echo('members:label:online'), + 'url' => "pg/members/online/", + 'selected' => $vars['selected'] == 'online', + ), +); + +echo elgg_view('navigation/tabs', array('tabs' => $tabs)); diff --git a/views/default/core/members/sidebar.php b/views/default/core/members/sidebar.php new file mode 100644 index 000000000..821547f99 --- /dev/null +++ b/views/default/core/members/sidebar.php @@ -0,0 +1,33 @@ + 'get', + 'action' => elgg_get_site_url() . 'pg/members/search/tag/', + 'disable_security' => true, +); +$body = elgg_view_form('members/tag_search', $params); + +$params = array( + 'title' => elgg_echo('members:searchtag'), + 'body' => $body, +); +echo elgg_view('layout/objects/module', $params); + + +// name search +$params = array( + 'method' => 'get', + 'action' => elgg_get_site_url() . 'pg/members/search/name/', + 'disable_security' => true, +); +$body = elgg_view_form('members/name_search', $params); + +$params = array( + 'title' => elgg_echo('members:searchname'), + 'body' => $body, +); +echo elgg_view('layout/objects/module', $params); diff --git a/views/default/forms/members/name_search.php b/views/default/forms/members/name_search.php new file mode 100644 index 000000000..265290fc9 --- /dev/null +++ b/views/default/forms/members/name_search.php @@ -0,0 +1,8 @@ + 'name', +); +echo elgg_view('input/text', $params); + +echo elgg_view('input/submit', array('value' => elgg_echo('search'))); diff --git a/views/default/forms/members/tag_search.php b/views/default/forms/members/tag_search.php new file mode 100644 index 000000000..1a281963d --- /dev/null +++ b/views/default/forms/members/tag_search.php @@ -0,0 +1,11 @@ + 'tag', +); +echo elgg_view('input/text', $params); + +echo elgg_view('input/submit', array('value' => elgg_echo('search'))); -- cgit v1.2.3