advanced search front-end

This commit is contained in:
friendica 2014-03-08 17:39:20 -08:00
parent 20ef3aee72
commit bef416a2d1
4 changed files with 19 additions and 2 deletions

View File

@ -15,6 +15,8 @@ function findpeople_widget() {
. '</div>' . $inv;
}
}
$advanced_search = ((local_user() && get_pconfig(local_user(),'feature','expert')) ? true : false);
return replace_macros(get_markup_template('peoplefind.tpl'),array(
'$findpeople' => t('Find Channels'),
@ -26,6 +28,9 @@ function findpeople_widget() {
'$similar' => '', // FIXME and uncomment when mod/match working // t('Similar Interests'),
'$random' => t('Random Profile'),
'$inv' => t('Invite Friends'),
'$advanced_search' => $advanced_search,
'$advanced_hint' => t('Exammple: name=fred and country=iceland'),
'$find_advanced' => t('Advanced Find'),
'$loggedin' => local_user()
));

View File

@ -42,12 +42,13 @@ function directory_content(&$a) {
else
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
$advanced = ((x($_REQUEST,'query')) ? notags(trim($_REQUEST['query'])) : '');
$keywords = (($_GET['keywords']) ? $_GET['keywords'] : '');
$tpl = get_markup_template('directory_header.tpl');
$dirmode = intval(get_config('system','directory_mode'));
if(($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) {
@ -81,6 +82,7 @@ function directory_content(&$a) {
if($url) {
// We might want to make the tagadelic count (&kw=) configurable or turn it off completely.
$numtags = get_config('system','directorytags');
$kw = ((intval($numtags)) ? $numtags : 24);
@ -92,7 +94,9 @@ function directory_content(&$a) {
$query .= '&address=' . urlencode($search);
if($keywords)
$query .= '&keywords=' . urlencode($keywords);
if($advanced)
$query .= '&query=' . urlencode($advanced);
$sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : '');
if($sort_order)
$query .= '&order=' . urlencode($sort_order);

View File

@ -283,6 +283,10 @@ function dir_parse_query($s) {
$curr['logic'] = 'or';
continue;
}
if($q === 'not') {
$curr['logic'] .= ' not';
continue;
}
if(strpos($q,'=')) {
if(! isset($curr['logic']))
$curr['logic'] = 'or';

View File

@ -4,6 +4,10 @@
<form action="directory" method="post" />
<input class="icon-search" id="side-peoplefind-url" type="text" name="search" size="24" title="{{$hint}}" placeholder="&#xf002;"/>
<input id="side-peoplefind-submit" type="submit" name="submit" value="{{$findthem}}" />
{{if $advanced_search}}
<input class="icon-search" id="side-peoplefind-url" type="text" name="query" size="24" title="{{$advanced_hint}}" placeholder="&#xf002;"/>
<input id="side-peoplefind-submit" type="submit" name="submit" value="{{$find_advanced}}" />
{{/if}}
</form>
<br />
{{if $similar}}<a href="match" >{{$similar}}</a><br />{{/if}}