From a9394e1035147e3910b2dc3cf156b0361ea791cc Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 23 Dec 2011 20:43:48 -0500 Subject: Fixes #2074 adds group search --- mod/groups/languages/en.php | 1 + mod/groups/lib/groups.php | 8 +++++++- mod/groups/views/default/forms/groups/find.php | 16 ++++++++++++++++ mod/groups/views/default/forms/groups/search.php | 14 +++++++++----- mod/groups/views/default/groups/sidebar/find.php | 2 +- mod/groups/views/default/groups/sidebar/search.php | 15 +++++++++++++++ 6 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 mod/groups/views/default/forms/groups/find.php create mode 100644 mod/groups/views/default/groups/sidebar/search.php (limited to 'mod') diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index 09feaf8d1..3623c95fc 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -61,6 +61,7 @@ $english = array( 'groups:search:tags' => "tag", 'groups:search:title' => "Search for groups tagged with '%s'", 'groups:search:none' => "No matching groups were found", + 'groups:search_in_group' => "Search in this group", 'groups:activity' => "Group activity", 'groups:enableactivity' => 'Enable group activity', diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php index 7798e5dc3..5d6083077 100644 --- a/mod/groups/lib/groups.php +++ b/mod/groups/lib/groups.php @@ -234,6 +234,8 @@ function groups_handle_invitations_page() { function groups_handle_profile_page($guid) { elgg_set_page_owner_guid($guid); + elgg_push_context('group_profile'); + // turn this into a core function global $autofeed; $autofeed = true; @@ -247,7 +249,11 @@ function groups_handle_profile_page($guid) { $content = elgg_view('groups/profile/layout', array('entity' => $group)); if (group_gatekeeper(false)) { - $sidebar = elgg_view('groups/sidebar/members', array('entity' => $group)); + $sidebar = ''; + if (elgg_is_active_plugin('search')) { + $sidebar .= elgg_view('groups/sidebar/search', array('entity' => $group)); + } + $sidebar .= elgg_view('groups/sidebar/members', array('entity' => $group)); } else { $sidebar = ''; } diff --git a/mod/groups/views/default/forms/groups/find.php b/mod/groups/views/default/forms/groups/find.php new file mode 100644 index 000000000..ddf639b74 --- /dev/null +++ b/mod/groups/views/default/forms/groups/find.php @@ -0,0 +1,16 @@ + 'tag', + 'class' => 'elgg-input-search mbm', + 'value' => $tag_string, + 'onclick' => "if (this.value=='$tag_string') { this.value='' }", +); +echo elgg_view('input/text', $params); + +echo elgg_view('input/submit', array('value' => elgg_echo('search:go'))); diff --git a/mod/groups/views/default/forms/groups/search.php b/mod/groups/views/default/forms/groups/search.php index ddf639b74..850b6088e 100644 --- a/mod/groups/views/default/forms/groups/search.php +++ b/mod/groups/views/default/forms/groups/search.php @@ -1,16 +1,20 @@ 'tag', + 'name' => 'q', 'class' => 'elgg-input-search mbm', 'value' => $tag_string, - 'onclick' => "if (this.value=='$tag_string') { this.value='' }", ); echo elgg_view('input/text', $params); +echo elgg_view('input/hidden', array( + 'name' => 'container_guid', + 'value' => $vars['entity']->getGUID(), +)); + echo elgg_view('input/submit', array('value' => elgg_echo('search:go'))); diff --git a/mod/groups/views/default/groups/sidebar/find.php b/mod/groups/views/default/groups/sidebar/find.php index c5c986759..c1a8da3c2 100644 --- a/mod/groups/views/default/groups/sidebar/find.php +++ b/mod/groups/views/default/groups/sidebar/find.php @@ -5,7 +5,7 @@ * @package ElggGroups */ $url = elgg_get_site_url() . 'groups/search'; -$body = elgg_view_form('groups/search', array( +$body = elgg_view_form('groups/find', array( 'action' => $url, 'method' => 'get', 'disable_security' => true, diff --git a/mod/groups/views/default/groups/sidebar/search.php b/mod/groups/views/default/groups/sidebar/search.php new file mode 100644 index 000000000..226835715 --- /dev/null +++ b/mod/groups/views/default/groups/sidebar/search.php @@ -0,0 +1,15 @@ + $url, + 'method' => 'get', + 'disable_security' => true, +), $vars); + +echo elgg_view_module('aside', elgg_echo('groups:search_in_group'), $body); \ No newline at end of file -- cgit v1.2.3