aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-03-08 17:39:20 -0800
committerfriendica <info@friendica.com>2014-03-08 17:39:20 -0800
commitbef416a2d122609cb43b046cfc4211421f4149fd (patch)
tree881b77eace3ffc18d3baf72d7d8b0066699c8a59
parent20ef3aee722c1079f844e32405dcc39ff5e1215e (diff)
downloadvolse-hubzilla-bef416a2d122609cb43b046cfc4211421f4149fd.tar.gz
volse-hubzilla-bef416a2d122609cb43b046cfc4211421f4149fd.tar.bz2
volse-hubzilla-bef416a2d122609cb43b046cfc4211421f4149fd.zip
advanced search front-end
-rw-r--r--include/contact_widgets.php5
-rw-r--r--mod/directory.php8
-rw-r--r--mod/dirsearch.php4
-rwxr-xr-xview/tpl/peoplefind.tpl4
4 files changed, 19 insertions, 2 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index 482bbed78..865fda5f9 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -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()
));
diff --git a/mod/directory.php b/mod/directory.php
index 8fc62e95b..6e0e2e7dc 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -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);
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 759e27c5b..1f2ec1108 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -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';
diff --git a/view/tpl/peoplefind.tpl b/view/tpl/peoplefind.tpl
index 45b3d7d4b..268861781 100755
--- a/view/tpl/peoplefind.tpl
+++ b/view/tpl/peoplefind.tpl
@@ -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}}