make navbar search use the module search function in /network and /channel
This commit is contained in:
parent
e1a55ba471
commit
6349a7417f
@ -84,6 +84,7 @@ class Channel extends \Zotlabs\Web\Controller {
|
|||||||
$hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : '');
|
$hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : '');
|
||||||
$order = ((x($_GET,'order')) ? notags($_GET['order']) : 'post');
|
$order = ((x($_GET,'order')) ? notags($_GET['order']) : 'post');
|
||||||
$static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);
|
$static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);
|
||||||
|
$search = ((x($_GET,'search')) ? $_GET['search'] : EMPTY_STR);
|
||||||
|
|
||||||
$groups = array();
|
$groups = array();
|
||||||
|
|
||||||
@ -119,9 +120,12 @@ class Channel extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
$static = channel_manual_conv_update(\App::$profile['profile_uid']);
|
$static = channel_manual_conv_update(\App::$profile['profile_uid']);
|
||||||
|
|
||||||
//$o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']);
|
// search terms header
|
||||||
|
if($search) {
|
||||||
// $o .= common_friends_visitor_widget(\App::$profile['profile_uid']);
|
$o .= replace_macros(get_markup_template("section_title.tpl"),array(
|
||||||
|
'$title' => t('Search Results For:') . ' ' . htmlspecialchars($search, ENT_COMPAT,'UTF-8')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
if($channel && $is_owner) {
|
if($channel && $is_owner) {
|
||||||
$channel_acl = array(
|
$channel_acl = array(
|
||||||
@ -180,15 +184,13 @@ class Channel extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
$simple_update = (($update) ? " AND item_unseen = 1 " : '');
|
$simple_update = (($update) ? " AND item_unseen = 1 " : '');
|
||||||
|
|
||||||
|
if($search) {
|
||||||
$search = EMPTY_STR;
|
$search = escape_tags($search);
|
||||||
if(x($_GET,'search')) {
|
|
||||||
$search = escape_tags($_GET['search']);
|
|
||||||
if(strpos($search,'#') === 0) {
|
if(strpos($search,'#') === 0) {
|
||||||
$sql_extra2 .= term_query('item',substr($search,1),TERM_HASHTAG,TERM_COMMUNITYTAG);
|
$sql_extra .= term_query('item',substr($search,1),TERM_HASHTAG,TERM_COMMUNITYTAG);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$sql_extra2 .= sprintf(" AND item.body like '%s' ",
|
$sql_extra .= sprintf(" AND item.body like '%s' ",
|
||||||
dbesc(protect_sprintf('%' . $search . '%'))
|
dbesc(protect_sprintf('%' . $search . '%'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -255,7 +257,7 @@ class Channel extends \Zotlabs\Web\Controller {
|
|||||||
$sql_extra2 .= " and item.item_thread_top != 0 ";
|
$sql_extra2 .= " and item.item_thread_top != 0 ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($order === 'post')
|
if($order === 'post')
|
||||||
$ordering = "created";
|
$ordering = "created";
|
||||||
else
|
else
|
||||||
$ordering = "commented";
|
$ordering = "commented";
|
||||||
@ -282,7 +284,7 @@ class Channel extends \Zotlabs\Web\Controller {
|
|||||||
WHERE true and item.uid = %d $item_normal
|
WHERE true and item.uid = %d $item_normal
|
||||||
AND (abook.abook_blocked = 0 or abook.abook_flags is null)
|
AND (abook.abook_blocked = 0 or abook.abook_flags is null)
|
||||||
AND item.item_wall = 1
|
AND item.item_wall = 1
|
||||||
$sql_extra $sql_extra2
|
$sql_extra $sql_extra2
|
||||||
ORDER BY $ordering DESC, id $pager_sql ",
|
ORDER BY $ordering DESC, id $pager_sql ",
|
||||||
intval(\App::$profile['profile_uid'])
|
intval(\App::$profile['profile_uid'])
|
||||||
);
|
);
|
||||||
@ -398,12 +400,13 @@ class Channel extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$mode = (($search) ? 'search' : 'channel');
|
||||||
|
|
||||||
if($checkjs->disabled()) {
|
if($checkjs->disabled()) {
|
||||||
$o .= conversation($items,'channel',$update,'traditional');
|
$o .= conversation($items,$mode,$update,'traditional');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$o .= conversation($items,'channel',$update,$page_mode);
|
$o .= conversation($items,$mode,$update,$page_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((! $update) || ($checkjs->disabled())) {
|
if((! $update) || ($checkjs->disabled())) {
|
||||||
|
@ -138,6 +138,7 @@ class Network extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
if(x($_GET,'search') || x($_GET,'file'))
|
if(x($_GET,'search') || x($_GET,'file'))
|
||||||
$nouveau = true;
|
$nouveau = true;
|
||||||
|
|
||||||
if($cid) {
|
if($cid) {
|
||||||
$r = q("SELECT abook_xchan, xchan_addr, xchan_url FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_id = %d AND abook_channel = %d LIMIT 1",
|
$r = q("SELECT abook_xchan, xchan_addr, xchan_url FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_id = %d AND abook_channel = %d LIMIT 1",
|
||||||
intval($cid),
|
intval($cid),
|
||||||
@ -567,6 +568,9 @@ class Network extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$mode = (($nouveau) ? 'network-new' : 'network');
|
$mode = (($nouveau) ? 'network-new' : 'network');
|
||||||
|
|
||||||
|
if($search)
|
||||||
|
$mode = 'search';
|
||||||
|
|
||||||
$o .= conversation($items,$mode,$update,$page_mode);
|
$o .= conversation($items,$mode,$update,$page_mode);
|
||||||
|
|
||||||
|
@ -53,6 +53,12 @@ class Activity_order {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// override order for search results and filer results
|
||||||
|
if(x($_GET,'search') || x($_GET,'file')) {
|
||||||
|
$unthreaded_active = 'active';
|
||||||
|
$commentord_active = $postord_active = '';
|
||||||
|
}
|
||||||
|
|
||||||
$cmd = \App::$cmd;
|
$cmd = \App::$cmd;
|
||||||
|
|
||||||
$filter = '';
|
$filter = '';
|
||||||
@ -69,6 +75,7 @@ class Activity_order {
|
|||||||
if(x($_GET,'conv'))
|
if(x($_GET,'conv'))
|
||||||
$filter .= '&conv=' . $_GET['conv'];
|
$filter .= '&conv=' . $_GET['conv'];
|
||||||
|
|
||||||
|
|
||||||
// tabs
|
// tabs
|
||||||
$tabs = [];
|
$tabs = [];
|
||||||
|
|
||||||
|
@ -168,7 +168,19 @@ function nav($template = 'default') {
|
|||||||
$nav['help'] = [$help_url, t('Help'), "", t('Help and documentation'), 'help_nav_btn', $context_help, $enable_context_help];
|
$nav['help'] = [$help_url, t('Help'), "", t('Help and documentation'), 'help_nav_btn', $context_help, $enable_context_help];
|
||||||
}
|
}
|
||||||
|
|
||||||
$nav['search'] = ['search', t('Search'), "", t('Search site @name, !forum, #tag, ?docs, content')];
|
switch(App::$module) {
|
||||||
|
case 'network':
|
||||||
|
$search_form_action = 'network';
|
||||||
|
break;
|
||||||
|
case 'channel':
|
||||||
|
$search_form_action = 'channel';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$search_form_action = 'search';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$nav['search'] = ['search', t('Search'), "", t('Search site @name, !forum, #tag, ?docs, content'), $search_form_action];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,7 +119,7 @@
|
|||||||
|
|
||||||
<ul id="nav-right" class="navbar-nav ml-auto">
|
<ul id="nav-right" class="navbar-nav ml-auto">
|
||||||
<li class="nav-item collapse clearfix" id="nav-search">
|
<li class="nav-item collapse clearfix" id="nav-search">
|
||||||
<form class="form-inline" method="get" action="search" role="search">
|
<form class="form-inline" method="get" action="{{$nav.search.4}}" role="search">
|
||||||
<input class="form-control form-control-sm mt-1 mr-2" id="nav-search-text" type="text" value="" placeholder="{{$help}}" name="search" title="{{$nav.search.3}}" onclick="this.submit();" onblur="closeMenu('nav-search'); openMenu('nav-search-btn');"/>
|
<input class="form-control form-control-sm mt-1 mr-2" id="nav-search-text" type="text" value="" placeholder="{{$help}}" name="search" title="{{$nav.search.3}}" onclick="this.submit();" onblur="closeMenu('nav-search'); openMenu('nav-search-btn');"/>
|
||||||
</form>
|
</form>
|
||||||
<div id="nav-search-spinner" class="spinner-wrapper">
|
<div id="nav-search-spinner" class="spinner-wrapper">
|
||||||
|
Reference in New Issue
Block a user