aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Daemon/Poller.php8
-rw-r--r--Zotlabs/Module/Channel.php32
-rw-r--r--Zotlabs/Module/Network.php35
-rw-r--r--Zotlabs/Widget/Activity_filter.php106
-rw-r--r--Zotlabs/Widget/Activity_order.php121
-rw-r--r--include/features.php20
-rw-r--r--include/group.php2
-rw-r--r--include/nav.php14
-rw-r--r--include/text.php22
-rw-r--r--view/css/default.css8
-rw-r--r--view/pdl/mod_network.pdl4
-rw-r--r--view/theme/redbasic/js/redbasic.js5
-rwxr-xr-xview/tpl/common_pills.tpl8
-rwxr-xr-xview/tpl/navbar_default.tpl2
14 files changed, 338 insertions, 49 deletions
diff --git a/Zotlabs/Daemon/Poller.php b/Zotlabs/Daemon/Poller.php
index e4bc9c143..49151437c 100644
--- a/Zotlabs/Daemon/Poller.php
+++ b/Zotlabs/Daemon/Poller.php
@@ -71,14 +71,18 @@ class Poller {
$randfunc = db_getfunc('RAND');
- $contacts = q("SELECT * FROM abook LEFT JOIN xchan on abook_xchan = xchan_hash
+ $contacts = q("SELECT abook.abook_updated, abook.abook_connected, abook.abook_feed,
+ abook.abook_channel, abook.abook_id, abook.abook_archived, abook.abook_pending,
+ abook.abook_ignored, abook.abook_blocked,
+ xchan.xchan_network,
+ account.account_lastlog, account.account_flags
+ FROM abook LEFT JOIN xchan on abook_xchan = xchan_hash
LEFT JOIN account on abook_account = account_id
where abook_self = 0
$sql_extra
AND (( account_flags = %d ) OR ( account_flags = %d )) $abandon_sql ORDER BY $randfunc",
intval(ACCOUNT_OK),
intval(ACCOUNT_UNVERIFIED) // FIXME
-
);
if($contacts) {
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 9108f6841..6969b6226 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -18,6 +18,9 @@ class Channel extends \Zotlabs\Web\Controller {
function init() {
+ if(in_array(substr($_GET['search'],0,1),[ '@', '!', '?']))
+ goaway('search' . '?f=&search=' . $_GET['search']);
+
$which = null;
if(argc() > 1)
$which = argv(1);
@@ -84,6 +87,7 @@ class Channel extends \Zotlabs\Web\Controller {
$hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : '');
$order = ((x($_GET,'order')) ? notags($_GET['order']) : 'post');
$static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);
+ $search = ((x($_GET,'search')) ? $_GET['search'] : EMPTY_STR);
$groups = array();
@@ -119,9 +123,12 @@ class Channel extends \Zotlabs\Web\Controller {
$static = channel_manual_conv_update(\App::$profile['profile_uid']);
- //$o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']);
-
- // $o .= common_friends_visitor_widget(\App::$profile['profile_uid']);
+ // search terms header
+ if($search) {
+ $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) {
$channel_acl = array(
@@ -180,15 +187,13 @@ class Channel extends \Zotlabs\Web\Controller {
$simple_update = (($update) ? " AND item_unseen = 1 " : '');
-
- $search = EMPTY_STR;
- if(x($_GET,'search')) {
- $search = escape_tags($_GET['search']);
+ if($search) {
+ $search = escape_tags($search);
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 {
- $sql_extra2 .= sprintf(" AND item.body like '%s' ",
+ $sql_extra .= sprintf(" AND item.body like '%s' ",
dbesc(protect_sprintf('%' . $search . '%'))
);
}
@@ -255,7 +260,7 @@ class Channel extends \Zotlabs\Web\Controller {
$sql_extra2 .= " and item.item_thread_top != 0 ";
}
- if($order === 'post')
+ if($order === 'post')
$ordering = "created";
else
$ordering = "commented";
@@ -282,7 +287,7 @@ class Channel extends \Zotlabs\Web\Controller {
WHERE true and item.uid = %d $item_normal
AND (abook.abook_blocked = 0 or abook.abook_flags is null)
AND item.item_wall = 1
- $sql_extra $sql_extra2
+ $sql_extra $sql_extra2
ORDER BY $ordering DESC, id $pager_sql ",
intval(\App::$profile['profile_uid'])
);
@@ -398,12 +403,13 @@ class Channel extends \Zotlabs\Web\Controller {
}
}
+ $mode = (($search) ? 'search' : 'channel');
if($checkjs->disabled()) {
- $o .= conversation($items,'channel',$update,'traditional');
+ $o .= conversation($items,$mode,$update,'traditional');
}
else {
- $o .= conversation($items,'channel',$update,$page_mode);
+ $o .= conversation($items,$mode,$update,$page_mode);
}
if((! $update) || ($checkjs->disabled())) {
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php
index 942b48109..8a381d678 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -15,6 +15,9 @@ class Network extends \Zotlabs\Web\Controller {
notice( t('Permission denied.') . EOL);
return;
}
+
+ if(in_array(substr($_GET['search'],0,1),[ '@', '!', '?']))
+ goaway('search' . '?f=&search=' . $_GET['search']);
if(count($_GET) < 2) {
$network_options = get_pconfig(local_channel(),'system','network_page_default');
@@ -57,13 +60,26 @@ class Network extends \Zotlabs\Web\Controller {
$datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
$datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : '');
- $nouveau = ((x($_GET,'new')) ? intval($_GET['new']) : 0);
$static = ((x($_GET,'static')) ? intval($_GET['static']) : 0);
$gid = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0);
$category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : '');
$hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : '');
$verb = ((x($_REQUEST,'verb')) ? $_REQUEST['verb'] : '');
-
+
+
+ $order = get_pconfig(local_channel(), 'mod_network', 'order', 0);
+ switch($order) {
+ case 0:
+ $order = 'comment';
+ break;
+ case 1:
+ $order = 'post';
+ break;
+ case 2:
+ $nouveau = true;
+ break;
+ }
+
$search = (($_GET['search']) ? $_GET['search'] : '');
if($search) {
$_GET['netsearch'] = escape_tags($search);
@@ -84,7 +100,7 @@ class Network extends \Zotlabs\Web\Controller {
}
if($datequery)
- $_GET['order'] = 'post';
+ $order = 'post';
// filter by collection (e.g. group)
@@ -107,16 +123,11 @@ class Network extends \Zotlabs\Web\Controller {
$def_acl = array('allow_gid' => '<' . $r[0]['hash'] . '>');
}
-
$default_cmin = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmin',0) : 0);
$default_cmax = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmax',99) : 99);
-
- // if no tabs are selected, defaults to comments
-
$cid = ((x($_GET,'cid')) ? intval($_GET['cid']) : 0);
$star = ((x($_GET,'star')) ? intval($_GET['star']) : 0);
- $order = ((x($_GET,'order')) ? notags($_GET['order']) : 'comment');
$liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0);
$conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0);
$spam = ((x($_GET,'spam')) ? intval($_GET['spam']) : 0);
@@ -130,6 +141,7 @@ class Network extends \Zotlabs\Web\Controller {
if(x($_GET,'search') || x($_GET,'file'))
$nouveau = true;
+
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",
intval($cid),
@@ -150,7 +162,7 @@ class Network extends \Zotlabs\Web\Controller {
}
if(! $update) {
- $tabs = network_tabs();
+ $tabs = ''; //network_tabs();
$o .= $tabs;
// search terms header
@@ -377,7 +389,7 @@ class Network extends \Zotlabs\Web\Controller {
if($conv) {
$item_thread_top = '';
- $sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan like '%s' or item_mentionsme = 1 )) ",
+ $sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan = '%s' or item_mentionsme = 1 )) ",
dbesc(protect_sprintf($channel['channel_hash']))
);
}
@@ -559,6 +571,9 @@ class Network extends \Zotlabs\Web\Controller {
}
$mode = (($nouveau) ? 'network-new' : 'network');
+
+ if($search)
+ $mode = 'search';
$o .= conversation($items,$mode,$update,$page_mode);
diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php
new file mode 100644
index 000000000..e56d13fc1
--- /dev/null
+++ b/Zotlabs/Widget/Activity_filter.php
@@ -0,0 +1,106 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Activity_filter {
+
+ function widget($arr) {
+
+ if(! local_channel())
+ return '';
+
+ $cmd = \App::$cmd;
+
+ $tabs = [];
+
+ if(feature_enabled(local_channel(),'personal_tab')) {
+ if(x($_GET,'conv')) {
+ $conv_active = (($_GET['conv'] == 1) ? 'active' : '');
+ }
+
+ $tabs[] = [
+ 'label' => t('Personal Posts'),
+ 'icon' => 'user-circle',
+ 'url' => z_root() . '/' . $cmd . '/?f=&conv=1',
+ 'sel' => $conv_active,
+ 'title' => t('Show posts that mention or involve me'),
+ ];
+ }
+
+ if(feature_enabled(local_channel(),'star_posts')) {
+ if(x($_GET,'star')) {
+ $starred_active = (($_GET['star'] == 1) ? 'active' : '');
+ }
+
+ $tabs[] = [
+ 'label' => t('Starred Posts'),
+ 'icon' => 'star',
+ 'url'=>z_root() . '/' . $cmd . '/?f=&star=1',
+ 'sel'=>$starred_active,
+ 'title' => t('Show posts that i have starred'),
+ ];
+ }
+
+ if(feature_enabled(local_channel(),'groups')) {
+ $groups = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
+ intval(local_channel())
+ );
+
+ if($groups) {
+ foreach($groups as $g) {
+ if(x($_GET,'gid')) {
+ $group_active = (($_GET['gid'] == $g['id']) ? 'active' : '');
+ }
+
+ $tabs[] = [
+ 'label' => $g['gname'],
+ 'icon' => 'users',
+ 'url' => z_root() . '/' . $cmd . '/?f=&gid=' . $g['id'],
+ 'sel' => $group_active,
+ 'title' => sprintf(t('Show posts related to the %s privacy group'), $g['gname']),
+ ];
+ }
+ }
+ }
+
+ if(feature_enabled(local_channel(),'filing')) {
+ $terms = q("select distinct term from term where uid = %d and ttype = %d order by term asc",
+ intval(local_channel()),
+ intval(TERM_FILE)
+ );
+
+ if($terms) {
+ foreach($terms as $t) {
+ if(x($_GET,'file')) {
+ $file_active = (($_GET['file'] == $t['term']) ? 'active' : '');
+ }
+
+ $tabs[] = [
+ 'label' => $t['term'],
+ 'icon' => 'folder',
+ 'url' => z_root() . '/' . $cmd . '/?f=&file=' . $t['term'],
+ 'sel' => $file_active,
+ 'title' => sprintf(t('Show posts that i have filed to %s'), $t['term']),
+ ];
+ }
+ }
+ }
+
+ $arr = ['tabs' => $tabs];
+
+ call_hooks('network_tabs', $arr);
+
+ $tpl = get_markup_template('common_pills.tpl');
+
+ if($arr['tabs']) {
+ return replace_macros($tpl, [
+ '$title' => t('Activity Filters'),
+ '$tabs' => $arr['tabs'],
+ ]);
+ }
+ else {
+ return '';
+ }
+ }
+
+}
diff --git a/Zotlabs/Widget/Activity_order.php b/Zotlabs/Widget/Activity_order.php
new file mode 100644
index 000000000..c973e3809
--- /dev/null
+++ b/Zotlabs/Widget/Activity_order.php
@@ -0,0 +1,121 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Activity_order {
+
+ function widget($arr) {
+
+ if(! local_channel())
+ return '';
+
+ if(! feature_enabled(local_channel(),'order_tab')) {
+ set_pconfig(local_channel(), 'mod_network', 'order', 0);
+ return '';
+ }
+
+ $commentord_active = '';
+ $postord_active = '';
+ $unthreaded_active = '';
+
+ if(x($_GET, 'order')) {
+ switch($_GET['order']){
+ case 'post':
+ $postord_active = 'active';
+ set_pconfig(local_channel(), 'mod_network', 'order', 1);
+ break;
+ case 'comment':
+ $commentord_active = 'active';
+ set_pconfig(local_channel(), 'mod_network', 'order', 0);
+ break;
+ case 'unthreaded':
+ $unthreaded_active = 'active';
+ set_pconfig(local_channel(), 'mod_network', 'order', 2);
+ break;
+ default:
+ $commentord_active = 'active';
+ }
+ }
+ else {
+ $order = get_pconfig(local_channel(), 'mod_network', 'order', 0);
+ switch($order) {
+ case 0:
+ $commentord_active = 'active';
+ break;
+ case 1:
+ $postord_active = 'active';
+ break;
+ case 2:
+ $unthreaded_active = 'active';
+ break;
+ default:
+ $commentord_active = 'active';
+ }
+ }
+
+ // override order for search results and filer results
+ if(x($_GET,'search') || x($_GET,'file')) {
+ $unthreaded_active = 'active';
+ $commentord_active = $postord_active = 'disabled';
+ }
+
+ $cmd = \App::$cmd;
+
+ $filter = '';
+
+ if(x($_GET,'cid'))
+ $filter .= '&cid=' . $_GET['cid'];
+
+ if(x($_GET,'gid'))
+ $filter .= '&gid=' . $_GET['gid'];
+
+ if(x($_GET,'star'))
+ $filter .= '&star=' . $_GET['star'];
+
+ if(x($_GET,'conv'))
+ $filter .= '&conv=' . $_GET['conv'];
+
+ if(x($_GET,'file'))
+ $filter .= '&file=' . $_GET['file'];
+
+
+ // tabs
+ $tabs = [];
+
+ $tabs[] = [
+ 'label' => t('Commented Date'),
+ 'url'=>z_root() . '/' . $cmd . '?f=&order=comment' . $filter,
+ 'sel'=> $commentord_active,
+ 'title' => t('Sort by Comment Date'),
+ ];
+ $tabs[] = [
+ 'label' => t('Posted Date'),
+ 'url'=>z_root() . '/' . $cmd . '?f=&order=post' . $filter,
+ 'sel'=> $postord_active,
+ 'title' => t('Sort by Post Date'),
+ ];
+ $tabs[] = array(
+ 'label' => t('Date Unthreaded'),
+ 'url' => z_root() . '/' . $cmd . '?f=&order=unthreaded' . $filter,
+ 'sel' => $unthreaded_active,
+ 'title' => t('Activity Stream - by date'),
+ );
+
+ $arr = ['tabs' => $tabs];
+
+ call_hooks('network_tabs', $arr);
+
+ $tpl = get_markup_template('common_pills.tpl');
+
+ if($arr['tabs']) {
+ return replace_macros($tpl, [
+ '$title' => t('Order Activity by'),
+ '$tabs' => $arr['tabs'],
+ ]);
+ }
+ else {
+ return '';
+ }
+ }
+
+}
diff --git a/include/features.php b/include/features.php
index 616e3f6c5..3d3e41a05 100644
--- a/include/features.php
+++ b/include/features.php
@@ -386,21 +386,21 @@ function get_features($filtered = true, $level = (-1)) {
],
[
- 'personal_tab',
- t('Network Personal Tab'),
- t('Enable tab to display only Network posts that you\'ve interacted on'),
+ 'order_tab',
+ t('Alternate Stream Order'),
+ t('Ability to order the stream by last post date, last comment date or unthreaded activities'),
false,
- get_config('feature_lock','personal_tab'),
- feature_level('personal_tab',1),
+ get_config('feature_lock','order_tab'),
+ feature_level('order_tab',2),
],
[
- 'new_tab',
- t('Network New Tab'),
- t('Enable tab to display all new Network activity'),
+ 'personal_tab',
+ t('Network Personal Tab'),
+ t('Enable tab to display only Network posts that you\'ve interacted on'),
false,
- get_config('feature_lock','new_tab'),
- feature_level('new_tab',2),
+ get_config('feature_lock','personal_tab'),
+ feature_level('personal_tab',1),
],
[
diff --git a/include/group.php b/include/group.php
index 8c95f6224..03ebf7ee5 100644
--- a/include/group.php
+++ b/include/group.php
@@ -284,7 +284,7 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
'text' => t('All Channels'),
'id' => 0,
'selected' => (($group_id == 0) ? 'group-selected' : ''),
- 'href' => $every . (($every === 'network') ? '?f=&gid=0' : '') . ((x($_GET,'order')) ? '&order=' . $_GET['order'] : ''),
+ 'href' => $every . (($every === 'network') ? '?f=&gid=0' : ''),
);
diff --git a/include/nav.php b/include/nav.php
index c5ceb97c5..994819ed4 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -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['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];
/**
diff --git a/include/text.php b/include/text.php
index 34063cdd7..319de67a8 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3333,4 +3333,24 @@ function unique_multidim_array($array, $key) {
$i++;
}
return $temp_array;
-}
+}
+
+function network_qstring($req) {
+
+ $ret = '?f=';
+
+ if(x($req, 'cid'))
+ $ret .= '&cid=' . $req['cid'];
+
+ if(x($req, 'gid'))
+ $ret .= '&gid=' . $req['gid'];
+
+ if(x($req, 'star'))
+ $ret .= '&star=' . $req['star'];
+
+ if(x($req, 'conv'))
+ $ret .= '&conv=' . $req['conv'];
+
+ return $ret;
+
+}
diff --git a/view/css/default.css b/view/css/default.css
index fc6da54f9..765a197d9 100644
--- a/view/css/default.css
+++ b/view/css/default.css
@@ -1,11 +1,3 @@
-header #banner {
- position: fixed;
- top: 0px;
- width: 33%;
- margin-left: 33%;
- margin-right: 33%;
-}
-
main {
display: table;
table-layout: fixed;
diff --git a/view/pdl/mod_network.pdl b/view/pdl/mod_network.pdl
index 09fdba573..d26422093 100644
--- a/view/pdl/mod_network.pdl
+++ b/view/pdl/mod_network.pdl
@@ -1,9 +1,9 @@
[region=aside]
-[widget=collections][/widget]
+[widget=activity_order][/widget]
+[widget=activity_filter][/widget]
[widget=forums][/widget]
[widget=suggestions][/widget]
[widget=savedsearch][/widget]
-[widget=filer][/widget]
[widget=notes][/widget]
[/region]
diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js
index 41f5eb7ce..c905c92cb 100644
--- a/view/theme/redbasic/js/redbasic.js
+++ b/view/theme/redbasic/js/redbasic.js
@@ -89,6 +89,11 @@ $(document).ready(function() {
tagClass: 'badge badge-pill badge-warning text-dark'
});
+ $('a.disabled').click(function(e) {
+ e.preventDefault();
+ e.stopPropagation();
+ });
+
var doctitle = document.title;
function checkNotify() {
var notifyUpdateElem = document.getElementById('notify-update');
diff --git a/view/tpl/common_pills.tpl b/view/tpl/common_pills.tpl
new file mode 100755
index 000000000..d10aa365b
--- /dev/null
+++ b/view/tpl/common_pills.tpl
@@ -0,0 +1,8 @@
+<div class="widget">
+ <h3>{{$title}}</h3>
+ <ul class="nav nav-pills flex-column">
+ {{foreach $tabs as $tab}}
+ <li class="nav-item"{{if $tab.id}} id="{{$tab.id}}"{{/if}}><a class="nav-link{{if $tab.sel}} {{$tab.sel}}{{/if}}" href="{{$tab.url}}"{{if $tab.title}} title="{{$tab.title}}"{{/if}}>{{if $tab.icon}}<i class="fa fa-fw fa-{{$tab.icon}}"></i> {{/if}}{{$tab.label}}</a></li>
+ {{/foreach}}
+ </ul>
+</div>
diff --git a/view/tpl/navbar_default.tpl b/view/tpl/navbar_default.tpl
index 7bc8df8d5..ebcadf365 100755
--- a/view/tpl/navbar_default.tpl
+++ b/view/tpl/navbar_default.tpl
@@ -119,7 +119,7 @@
<ul id="nav-right" class="navbar-nav ml-auto">
<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');"/>
</form>
<div id="nav-search-spinner" class="spinner-wrapper">