Now you can set search options so that searching for contacts or forums isn't occult science anymore.

This commit is contained in:
Michael Vogel 2015-08-24 11:55:29 +02:00
parent 109620ae99
commit 3ff196f00d
6 changed files with 46 additions and 8 deletions

View File

@ -26,7 +26,7 @@ function nav(&$a) {
$tpl = get_markup_template('nav.tpl');
$a->page['nav'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(),
'$baseurl' => $a->get_baseurl(),
'$langselector' => lang_selector(),
'$sitelocation' => $nav_info['sitelocation'],
'$nav' => $nav_info['nav'],
@ -118,6 +118,12 @@ function nav_info(&$a) {
$nav['search'] = array('search', t('Search'), "", t('Search site content'));
$nav['searchoption'] = array(
t("Full Text"),
t("Tags"),
t("Contacts"),
t("Forums"));
$gdirpath = 'directory';
if(strlen(get_config('system','singleuser'))) {

View File

@ -995,6 +995,11 @@ function search($s,$id='search-box',$url='/search',$save = false) {
'$search_label' => t('Search'),
'$save_label' => t('Save'),
'$savedsearch' => feature_enabled(local_user(),'savedsearch'),
'$searchoption' => array(
t("Full Text"),
t("Tags"),
t("Contacts"),
t("Forums"))
));
}}

View File

@ -14,13 +14,13 @@ function dirfind_init(&$a) {
function dirfind_content(&$a) {
function dirfind_content(&$a, $prefix = "") {
$community = false;
$local = get_config('system','poco_local_search');
$search = notags(trim($_REQUEST['search']));
$search = $prefix.notags(trim($_REQUEST['search']));
if(strpos($search,'@') === 0)
$search = substr($search,1);

View File

@ -1,4 +1,8 @@
<?php
require_once("include/bbcode.php");
require_once('include/security.php');
require_once('include/conversation.php');
require_once('mod/dirfind.php');
function search_saved_searches() {
@ -92,9 +96,6 @@ function search_content(&$a) {
nav_set_selected('search');
require_once("include/bbcode.php");
require_once('include/security.php');
require_once('include/conversation.php');
$o = '<h3>' . t('Search') . '</h3>';
@ -117,14 +118,27 @@ function search_content(&$a) {
$search = substr($search,1);
}
if(strpos($search,'@') === 0) {
require_once('mod/dirfind.php');
return dirfind_content($a);
}
if(strpos($search,'!') === 0) {
require_once('mod/dirfind.php');
return dirfind_content($a);
}
if(x($_GET,'search-option'))
switch($_GET['search-option']) {
case 'fulltext':
break;
case 'tags':
$tag = true;
break;
case 'contacts':
return dirfind_content($a, "@");
break;
case 'forums':
return dirfind_content($a, "!");
break;
}
if(! $search)
return $o;

View File

@ -2,6 +2,13 @@
<form action="{{$action_url}}" method="get" >
{{strip}}
<input type="text" name="search" id="search-text" placeholder="{{$search_label}}" value="{{$s}}" />
<select name="search-option">
<option value="fulltext">{{$searchoption.0}}</option>
<option value="tags">{{$searchoption.1}}</option>
<option value="contacts">{{$searchoption.2}}</option>
<option value="forums">{{$searchoption.3}}</option>
</select>
<input type="submit" name="submit" id="search-submit" value="{{$search_label}}" />
{{if $savedsearch}}
<input type="submit" name="save" id="search-save" value="{{$save_label}}" />

View File

@ -72,6 +72,12 @@
<li role="search" id="search-box">
<form method="get" action="{{$nav.search.0}}">
<input accesskey="s" id="search-text" class="nav-menu-search" type="text" value="" name="search">
<select name="search-option">
<option value="fulltext">{{$nav.searchoption.0}}</option>
<option value="tags">{{$nav.searchoption.1}}</option>
<option value="contacts">{{$nav.searchoption.2}}</option>
<option value="forums">{{$nav.searchoption.3}}</option>
</select>
</form>
</li>
{{/if}}