diff options
-rw-r--r-- | Zotlabs/Module/Network.php | 15 | ||||
-rw-r--r-- | Zotlabs/Widget/Activity_filter.php | 17 | ||||
-rw-r--r-- | include/features.php | 11 | ||||
-rw-r--r-- | view/css/widgets.css | 1 | ||||
-rw-r--r-- | view/js/mod_network.js | 3 | ||||
-rw-r--r-- | view/tpl/activity_filter_widget.tpl | 10 |
6 files changed, 50 insertions, 7 deletions
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 9837d35a3..132770608 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -262,13 +262,18 @@ class Network extends \Zotlabs\Web\Controller { $item_thread_top = ''; if($load || $update) { - $ttype = (($pf) ? TERM_FORUM : TERM_MENTION); + if(!$pf && $nouveau) { + $sql_extra = " AND author_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' "; + } + else { + $ttype = (($pf) ? TERM_FORUM : TERM_MENTION); - $p1 = q("SELECT DISTINCT parent FROM item WHERE uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' OR owner_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' ) $item_normal "); - $p2 = q("SELECT oid AS parent FROM term WHERE uid = " . intval(local_channel()) . " AND ttype = $ttype AND term = '" . dbesc($cid_r[0]['xchan_name']) . "'"); + $p1 = q("SELECT DISTINCT parent FROM item WHERE uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' OR owner_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' ) $item_normal "); + $p2 = q("SELECT oid AS parent FROM term WHERE uid = " . intval(local_channel()) . " AND ttype = $ttype AND term = '" . dbesc($cid_r[0]['xchan_name']) . "'"); - $p_str = ids_to_querystr(array_merge($p1,$p2),'parent'); - $sql_extra = " AND item.parent IN ( $p_str ) "; + $p_str = ids_to_querystr(array_merge($p1,$p2),'parent'); + $sql_extra = " AND item.parent IN ( $p_str ) "; + } } $title = replace_macros(get_markup_template("section_title.tpl"),array( diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php index 32da20bf6..78e439fdd 100644 --- a/Zotlabs/Widget/Activity_filter.php +++ b/Zotlabs/Widget/Activity_filter.php @@ -154,6 +154,20 @@ class Activity_filter { ]; } + $name = []; + if(feature_enabled(local_channel(),'name_tab')) { + if(x($_GET,'cid') && ! x($_GET,'pf')) { + $filter_active = 'name'; + } + $name = [ + 'label' => x($_GET,'name') ? $_GET['name'] : t('Filter by name'), + 'icon' => 'filter', + 'url'=> z_root() . '/' . $cmd . '/', + 'sel'=> $filter_active == 'name' ? 'is-valid' : '', + 'title' => '' + ]; + } + $reset = []; if($filter_active) { $reset = [ @@ -179,7 +193,8 @@ class Activity_filter { $o .= replace_macros(get_markup_template('activity_filter_widget.tpl'), [ '$title' => t('Activity Filters'), '$reset' => $reset, - '$content' => $content + '$content' => $content, + '$name' => $name ]); } diff --git a/include/features.php b/include/features.php index bcdea73e0..03f50c9a4 100644 --- a/include/features.php +++ b/include/features.php @@ -395,6 +395,15 @@ function get_features($filtered = true, $level = (-1)) { ], [ + 'name_tab', + t('Contact Filter'), + t('Ability to display only posts of a selected contact'), + false, + get_config('feature_lock','name_tab'), + feature_level('name_tab',1), + ], + + [ 'forums_tab', t('Forum Filter'), t('Ability to display only posts of a specific forum'), @@ -406,7 +415,7 @@ function get_features($filtered = true, $level = (-1)) { [ 'personal_tab', t('Personal Posts Filter'), - t('Ability to display only Network posts that you\'ve interacted on'), + t('Ability to display only posts that you\'ve interacted on'), false, get_config('feature_lock','personal_tab'), feature_level('personal_tab',1), diff --git a/view/css/widgets.css b/view/css/widgets.css index 9730d6915..e330c38e1 100644 --- a/view/css/widgets.css +++ b/view/css/widgets.css @@ -182,6 +182,7 @@ a.wikilist { .notifications-textinput { padding: .75rem 0.85rem; + position: relative; } .notifications-textinput input { diff --git a/view/js/mod_network.js b/view/js/mod_network.js index 2899bbacd..734e572bb 100644 --- a/view/js/mod_network.js +++ b/view/js/mod_network.js @@ -1,4 +1,7 @@ $(document).ready(function() { $("#search-text").contact_autocomplete(baseurl + '/search_ac','',true); + $("#cid-filter").name_autocomplete(baseurl + '/acl', 'a', true, function(data) { + $("#cid").val(data.id); + }); }); diff --git a/view/tpl/activity_filter_widget.tpl b/view/tpl/activity_filter_widget.tpl index 7ff5a4f7e..1b1e2c880 100644 --- a/view/tpl/activity_filter_widget.tpl +++ b/view/tpl/activity_filter_widget.tpl @@ -8,4 +8,14 @@ {{/if}} </h3> {{$content}} + {{if $name}} + <div class="notifications-textinput"> + <form method="get" action="{{$name.url}}" role="search"> + <div class="text-muted notifications-textinput-filter"><i class="fa fa-fw fa-filter"></i></div> + <input id="cid" type="hidden" value="" name="cid" /> + <input id="cid-filter" class="form-control form-control-sm{{if $name.sel}} {{$name.sel}}{{/if}}" type="text" value="" placeholder="{{$name.label}}" name="name" title="" /> + </form> + </div> + {{/if}} + </div> |