]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2074 adds group search
authorCash Costello <cash.costello@gmail.com>
Sat, 24 Dec 2011 01:43:48 +0000 (20:43 -0500)
committerCash Costello <cash.costello@gmail.com>
Sat, 24 Dec 2011 01:43:48 +0000 (20:43 -0500)
mod/groups/languages/en.php
mod/groups/lib/groups.php
mod/groups/views/default/forms/groups/find.php [new file with mode: 0644]
mod/groups/views/default/forms/groups/search.php
mod/groups/views/default/groups/sidebar/find.php
mod/groups/views/default/groups/sidebar/search.php [new file with mode: 0644]

index 09feaf8d135800035430ae35fd28ed30e4d82582..3623c95fcb5eb28e69ee972dc9d22325d59b33b1 100644 (file)
@@ -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',
index 7798e5dc3aebc4e8c0e91cd8c313a166bb58bb17..5d60830771da22af62beb751be477f308dba2a06 100644 (file)
@@ -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 (file)
index 0000000..ddf639b
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Group tag-based search form body
+ */
+
+$tag_string = elgg_echo('groups:search:tags');
+
+$params = array(
+       'name' => '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')));
index ddf639b74673e06ff2f26b1f86d0d8559dd0d696..850b6088e52ed1ce036fe2acfb973601e2584b49 100644 (file)
@@ -1,16 +1,20 @@
 <?php
 /**
- * Group tag-based search form body
+ * Group search form
+ *
+ * @uses $vars['entity'] ElggGroup
  */
 
-$tag_string = elgg_echo('groups:search:tags');
-
 $params = array(
-       'name' => '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')));
index c5c98675987dedb54d82abaa2b0584770924b672..c1a8da3c2ccad1e8f226e708e5d1795aa52aee84 100644 (file)
@@ -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 (file)
index 0000000..2268357
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+/**
+ * Search for content in this group
+ *
+ * @uses vars['entity'] ElggGroup
+ */
+
+$url = elgg_get_site_url() . 'search';
+$body = elgg_view_form('groups/search', array(
+       'action' => $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