diff options
Diffstat (limited to 'mod/search')
-rw-r--r-- | mod/search/README.txt | 5 | ||||
-rw-r--r-- | mod/search/manifest.xml | 7 | ||||
-rw-r--r-- | mod/search/search_hooks.php | 4 | ||||
-rw-r--r-- | mod/search/start.php | 8 | ||||
-rw-r--r-- | mod/search/views/default/search/css.php | 10 | ||||
-rw-r--r-- | mod/search/views/default/search/header.php | 6 | ||||
-rw-r--r-- | mod/search/views/default/search/search_box.php | 12 | ||||
-rw-r--r-- | mod/search/views/rss/search/list.php (renamed from mod/search/views/rss/search/listing.php) | 0 |
8 files changed, 30 insertions, 22 deletions
diff --git a/mod/search/README.txt b/mod/search/README.txt index 63b490e28..98a002dd5 100644 --- a/mod/search/README.txt +++ b/mod/search/README.txt @@ -44,11 +44,6 @@ by saying in your plugin's init function: register_entity_type($type, $subtype); -If you are extending ElggObject with your own class, it is also advised -to add a subtype in your plugin's run_once function by saying: - - add_subtype($type, $subtype, $class); - If your plugin uses ElggEntity's standard title and description, and you don't need a custom display, there is nothing else you need to do for your results to appear in search. If you would like more diff --git a/mod/search/manifest.xml b/mod/search/manifest.xml index 053e22178..513d3a6b9 100644 --- a/mod/search/manifest.xml +++ b/mod/search/manifest.xml @@ -7,11 +7,10 @@ <description>Allow search across entities of the site</description> <website>http://www.elgg.org/</website> <copyright>See COPYRIGHT.txt</copyright> - <license>GNU Public License version 2</license> + <license>GNU General Public License version 2</license> <requires> - <type>elgg_version</type> - <version>2009030702</version> + <type>elgg_release</type> + <version>1.8</version> </requires> <activate_on_install>true</activate_on_install> - <admin_interface>advanced</admin_interface> </plugin_manifest> diff --git a/mod/search/search_hooks.php b/mod/search/search_hooks.php index b302272fb..ab000f6f6 100644 --- a/mod/search/search_hooks.php +++ b/mod/search/search_hooks.php @@ -325,6 +325,8 @@ function search_comments_hook($hook, $type, $value, $params) { $db_prefix = elgg_get_config('dbprefix'); $query = sanitise_string($params['query']); + $limit = sanitise_int($params['limit']); + $offset = sanitise_int($params['offset']); $params['annotation_names'] = array('generic_comment', 'group_topic_post'); $params['joins'] = array( @@ -379,7 +381,7 @@ function search_comments_hook($hook, $type, $value, $params) { AND $a_access $container_and - LIMIT {$params['offset']}, {$params['limit']} + LIMIT $offset, $limit "; $comments = get_data($q); diff --git a/mod/search/start.php b/mod/search/start.php index 18a0d59e3..73a96dc0a 100644 --- a/mod/search/start.php +++ b/mod/search/start.php @@ -14,7 +14,7 @@ function search_init() { require_once 'search_hooks.php'; // page handler for search actions and results - elgg_register_page_handler('search','search_page_handler'); + elgg_register_page_handler('search', 'search_page_handler'); // register some default search hooks elgg_register_plugin_hook_handler('search', 'object', 'search_objects_hook'); @@ -49,13 +49,14 @@ function search_init() { elgg_extend_view('css/elgg', 'search/css'); // extend view for elgg topbar search box - elgg_extend_view('page/elements/header', 'search/search_box'); + elgg_extend_view('page/elements/header', 'search/header'); } /** * Page handler for search * - * @param array $page Page elements from pain page handler + * @param array $page Page elements from core page handler + * @return bool */ function search_page_handler($page) { @@ -71,6 +72,7 @@ function search_page_handler($page) { $base_dir = elgg_get_plugins_path() . 'search/pages/search'; include_once("$base_dir/index.php"); + return true; } /** diff --git a/mod/search/views/default/search/css.php b/mod/search/views/default/search/css.php index 601536c81..30ff45172 100644 --- a/mod/search/views/default/search/css.php +++ b/mod/search/views/default/search/css.php @@ -8,16 +8,16 @@ /********************************** Search plugin ***********************************/ -.elgg-page-header .elgg-search { +.elgg-search-header { bottom: 5px; height: 23px; position: absolute; right: 0; } -.elgg-page-header .elgg-search input[type=text] { +.elgg-search input[type=text] { width: 230px; } -.elgg-page-header .elgg-search input[type=submit] { +.elgg-search input[type=submit] { display: none; } .elgg-search input[type=text] { @@ -30,11 +30,11 @@ Search plugin font-size: 12px; font-weight: bold; padding: 2px 4px 2px 26px; - background: transparent url(<?php echo elgg_get_site_url(); ?>_graphics/elgg_sprites.png) no-repeat 2px -718px; + background: transparent url(<?php echo elgg_get_site_url(); ?>_graphics/elgg_sprites.png) no-repeat 2px -934px; } .elgg-search input[type=text]:focus, .elgg-search input[type=text]:active { background-color: white; - background-position: 2px -700px; + background-position: 2px -916px; border: 1px solid white; color: #0054A7; } diff --git a/mod/search/views/default/search/header.php b/mod/search/views/default/search/header.php new file mode 100644 index 000000000..6f8654c13 --- /dev/null +++ b/mod/search/views/default/search/header.php @@ -0,0 +1,6 @@ +<?php +/** + * Search box in page header + */ + +echo elgg_view('search/search_box', array('class' => 'elgg-search-header'));
\ No newline at end of file diff --git a/mod/search/views/default/search/search_box.php b/mod/search/views/default/search/search_box.php index ff5910937..9440dd1de 100644 --- a/mod/search/views/default/search/search_box.php +++ b/mod/search/views/default/search/search_box.php @@ -3,8 +3,7 @@ * Search box * * @uses $vars['value'] Current search query - * - * @todo Move javascript into something that extends elgg.js + * @uses $vars['class'] Additional class */ if (array_key_exists('value', $vars)) { @@ -15,6 +14,11 @@ if (array_key_exists('value', $vars)) { $value = elgg_echo('search'); } +$class = "elgg-search"; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} + // @todo - why the strip slashes? $value = stripslashes($value); @@ -26,9 +30,9 @@ $display_query = htmlspecialchars($display_query, ENT_QUOTES, 'UTF-8', false); ?> -<form class="elgg-search" action="<?php echo elgg_get_site_url(); ?>search" method="get"> +<form class="<?php echo $class; ?>" action="<?php echo elgg_get_site_url(); ?>search" method="get"> <fieldset> - <input type="text" size="21" name="q" value="<?php echo elgg_echo('search'); ?>" onblur="if (this.value=='') { this.value='<?php echo elgg_echo('search'); ?>' }" onfocus="if (this.value=='<?php echo elgg_echo('search'); ?>') { this.value='' };" class="search-input" /> + <input type="text" class="search-input" size="21" name="q" value="<?php echo elgg_echo('search'); ?>" onblur="if (this.value=='') { this.value='<?php echo elgg_echo('search'); ?>' }" onfocus="if (this.value=='<?php echo elgg_echo('search'); ?>') { this.value='' };" /> <input type="submit" value="<?php echo elgg_echo('search:go'); ?>" class="search-submit-button" /> </fieldset> </form>
\ No newline at end of file diff --git a/mod/search/views/rss/search/listing.php b/mod/search/views/rss/search/list.php index 32082fd31..32082fd31 100644 --- a/mod/search/views/rss/search/listing.php +++ b/mod/search/views/rss/search/list.php |