aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Ping.php109
-rw-r--r--Zotlabs/Module/Settings/Channel.php3
-rw-r--r--Zotlabs/Widget/Activity_filter.php48
-rwxr-xr-xboot.php1
-rw-r--r--include/features.php13
-rw-r--r--include/nav.php4
-rw-r--r--include/text.php54
-rw-r--r--view/js/main.js3
-rw-r--r--view/pdl/mod_network.pdl3
-rwxr-xr-xview/tpl/common_pills.tpl3
-rw-r--r--view/tpl/notifications_widget.tpl3
-rwxr-xr-xview/tpl/settings.tpl1
12 files changed, 152 insertions, 93 deletions
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index 941b7b286..3f2015d6d 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -35,11 +35,12 @@ class Ping extends \Zotlabs\Web\Controller {
$result['birthdays_today'] = 0;
$result['all_events'] = 0;
$result['all_events_today'] = 0;
- $result['notice'] = array();
- $result['info'] = array();
+ $result['notice'] = [];
+ $result['info'] = [];
$result['pubs'] = 0;
$result['files'] = 0;
$result['forums'] = 0;
+ $result['forums_sub'] = [];
if(! $_SESSION['static_loadtime'])
$_SESSION['static_loadtime'] = datetime_convert();
@@ -625,75 +626,51 @@ class Ping extends \Zotlabs\Web\Controller {
-#### unseen forum
+ if($vnotify & VNOTIFY_FORUMS) {
+ $forums = get_forum_channels(local_channel());
- $perms_sql = item_permissions_sql(local_channel()) . item_normal();
-
- $xf = false;
-
- $x1 = q("select xchan from abconfig where chan = %d and cat = 'their_perms' and k = 'send_stream' and v = '0'",
- intval(local_channel())
- );
- if($x1) {
- $xc = ids_to_querystr($x1,'xchan',true);
-
- $x2 = q("select xchan from abconfig where chan = %d and cat = 'their_perms' and k = 'tag_deliver' and v = '1' and xchan in (" . $xc . ") ",
- intval(local_channel())
- );
-
- if($x2) {
- $xf = ids_to_querystr($x2,'xchan',true);
-
- // private forums
- $x3 = q("select xchan from abconfig where chan = %d and cat = 'their_perms' and k = 'post_wall' and v = '1' and xchan in (" . $xc . ") and not xchan in (" . $xf . ") ",
- intval(local_channel())
- );
- if($x3) {
- $xf = ids_to_querystr(array_merge($x2,$x3),'xchan',true);
- }
+ if(! $forums) {
+ $result['forums'] = 0;
}
- }
-
- $sql_extra = (($xf) ? " and ( xchan_hash in (" . $xf . ") or xchan_pubforum = 1 ) " : " and xchan_pubforum = 1 ");
-
- $r1 = q("select abook_id, xchan_hash, xchan_name, xchan_url, xchan_photo_s from abook left join xchan on abook_xchan = xchan_hash where xchan_deleted = 0 and abook_channel = %d and abook_pending = 0 and abook_ignored = 0 and abook_blocked = 0 $sql_extra order by xchan_name",
- intval(local_channel())
- );
+ else {
+ $fcount = count($forums);
+ $forums['total'] = 0;
+ for($x = 0; $x < $fcount; $x ++) {
+ $r = q("select sum(item_unseen) as unseen from item
+ where uid = %d and owner_xchan = '%s' and item_unseen = 1 $perms_sql ",
+ intval(local_channel()),
+ dbesc($forums[$x]['xchan_hash'])
+ );
+ if($r[0]['unseen']) {
+ $forums[$x]['notify_link'] = (($forums[$x]['private_forum']) ? $forums[$x]['xchan_url'] :z_root() . '/network/?f=&cid=' . $forums[$x]['abook_id']);
+ $forums[$x]['name'] = $forums[$x]['xchan_name'];
+ $forums[$x]['url'] = $forums[$x]['xchan_url'];
+ $forums[$x]['photo'] = $forums[$x]['xchan_photo_s'];
+ $forums[$x]['unseen'] = $r[0]['unseen'];
+ $forums[$x]['private_forum'] = (($forums[$x]['private_forum']) ? 'lock' : '');
+ $forums[$x]['message'] = (($forums[$x]['private_forum']) ? t('Private forum') : t('Public forum'));
+
+ $forums['total'] = $forums['total'] + $r[0]['unseen'];
+
+ unset($forums[$x]['abook_id']);
+ unset($forums[$x]['xchan_hash']);
+ unset($forums[$x]['xchan_name']);
+ unset($forums[$x]['xchan_url']);
+ unset($forums[$x]['xchan_photo_s']);
+
+ //if($forums[$x]['private_forum'])
+ // unset($forums[$x]['private_forum']);
- if(! $r1) {
- $result['forums'] = 0;
- }
- else {
- $fcount = count($r1);
- $r1['total'] = 0;
- for($x = 0; $x < $fcount; $x ++) {
- $r = q("select sum(item_unseen) as unseen from item
- where uid = %d and owner_xchan = '%s' and item_unseen = 1 $perms_sql ",
- intval(local_channel()),
- dbesc($r1[$x]['xchan_hash'])
- );
- if($r[0]['unseen']) {
- $r1[$x]['notify_link'] = z_root() . '/network/?f=&cid=' . $r1[$x]['abook_id'];
- $r1[$x]['name'] = $r1[$x]['xchan_name'];
- $r1[$x]['url'] = $r1[$x]['xchan_url'];
- $r1[$x]['photo'] = $r1[$x]['xchan_photo_s'];
- $r1[$x]['unseen'] = $r[0]['unseen'];
- $r1['total'] = $r1['total'] + $r[0]['unseen'];
-
- unset($r1[$x]['abook_id']);
- unset($r1[$x]['xchan_hash']);
- unset($r1[$x]['xchan_name']);
- unset($r1[$x]['xchan_url']);
- unset($r1[$x]['xchan_photo_s']);
- }
- else {
- unset($r1[$x]);
+ }
+ else {
+ unset($forums[$x]);
+ }
}
- }
- $result['forums'] = $r1['total'];
- unset($r1['total']);
+ $result['forums'] = $forums['total'];
+ unset($forums['total']);
- $result['forums_sub'] = $r1;
+ $result['forums_sub'] = $forums;
+ }
}
$x = json_encode($result);
diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php
index beb62a3a3..3a6e03588 100644
--- a/Zotlabs/Module/Settings/Channel.php
+++ b/Zotlabs/Module/Settings/Channel.php
@@ -215,6 +215,8 @@ class Channel {
$vnotify += intval($_POST['vnotify13']);
if(x($_POST,'vnotify14'))
$vnotify += intval($_POST['vnotify14']);
+ if(x($_POST,'vnotify15'))
+ $vnotify += intval($_POST['vnotify15']);
$always_show_in_notices = x($_POST,'always_show_in_notices') ? 1 : 0;
@@ -599,6 +601,7 @@ class Channel {
'$vnotify12' => array('vnotify12', t('Unseen shared files'), ($vnotify & VNOTIFY_FILES), VNOTIFY_FILES, '', $yes_no),
'$vnotify13' => (($disable_discover_tab && !$site_firehose) ? array() : array('vnotify13', t('Unseen public activity'), ($vnotify & VNOTIFY_PUBS), VNOTIFY_PUBS, '', $yes_no)),
'$vnotify14' => array('vnotify14', t('Unseen likes and dislikes'), ($vnotify & VNOTIFY_LIKE), VNOTIFY_LIKE, '', $yes_no),
+ '$vnotify15' => array('vnotify15', t('Unseen forum posts'), ($vnotify & VNOTIFY_FORUMS), VNOTIFY_FORUMS, '', $yes_no),
'$mailhost' => [ 'mailhost', t('Email notification hub (hostname)'), get_pconfig(local_channel(),'system','email_notify_host',\App::get_hostname()), sprintf( t('If your channel is mirrored to multiple hubs, set this to your preferred location. This will prevent duplicate email notifications. Example: %s'),\App::get_hostname()) ],
'$always_show_in_notices' => array('always_show_in_notices', t('Show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, '', $yes_no),
diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php
index 38e45ea29..6a1ad6f0a 100644
--- a/Zotlabs/Widget/Activity_filter.php
+++ b/Zotlabs/Widget/Activity_filter.php
@@ -25,7 +25,7 @@ class Activity_filter {
'icon' => 'user-circle',
'url' => z_root() . '/' . $cmd . '/?f=&conv=1',
'sel' => $conv_active,
- 'title' => t('Show posts that mention or involve me'),
+ 'title' => t('Show posts that mention or involve me')
];
}
@@ -40,7 +40,7 @@ class Activity_filter {
'icon' => 'star',
'url'=>z_root() . '/' . $cmd . '/?f=&star=1',
'sel'=>$starred_active,
- 'title' => t('Show posts that i have starred'),
+ 'title' => t('Show posts that i have starred')
];
}
@@ -60,7 +60,7 @@ class Activity_filter {
'icon' => '',
'url' => z_root() . '/' . $cmd . '/?f=&gid=' . $g['id'],
'sel' => $group_active,
- 'title' => sprintf(t('Show posts related to the %s privacy group'), $g['gname']),
+ 'title' => sprintf(t('Show posts related to the %s privacy group'), $g['gname'])
];
}
$tabs[] = [
@@ -93,7 +93,7 @@ class Activity_filter {
'icon' => '',
'url' => z_root() . '/' . $cmd . '/?f=&file=' . $t['term'],
'sel' => $file_active,
- 'title' => '',
+ 'title' => ''
];
}
@@ -109,6 +109,38 @@ class Activity_filter {
}
}
+ if(feature_enabled(local_channel(),'forums_tab')) {
+ $forums = get_forum_channels(local_channel());
+
+ if($forums) {
+ foreach($forums as $f) {
+ if(x($_GET,'cid')) {
+ $forum_active = (($_GET['cid'] == $f['abook_id']) ? 'active' : '');
+ $filter_active = 'forums';
+ }
+ $fsub[] = [
+ 'label' => $f['xchan_name'],
+ 'img' => $f['xchan_photo_s'],
+ 'url' => (($f['private_forum']) ? $f['xchan_url'] : z_root() . '/' . $cmd . '/?f=&cid=' . $f['abook_id']),
+ 'sel' => $forum_active,
+ 'title' => t('Private forum'),
+ 'lock' => (($f['private_forum']) ? 'lock' : '')
+ ];
+ }
+
+ $tabs[] = [
+ 'label' => t('Forums'),
+ 'icon' => 'comments-o',
+ 'url' => '#',
+ 'sel' => (($filter_active == 'forums') ? true : false),
+ 'title' => t('Show this forums posts'),
+ 'sub' => $fsub
+
+ ];
+ }
+ }
+
+
if(x($_GET,'search')) {
$filter_active = 'search';
$tabs[] = [
@@ -116,7 +148,7 @@ class Activity_filter {
'icon' => 'search',
'url' => z_root() . '/' . $cmd . '/?f=&search=' . $_GET['search'],
'sel' => 'active disabled',
- 'title' => t('Panel search'),
+ 'title' => t('Panel search')
];
}
@@ -127,7 +159,7 @@ class Activity_filter {
'icon' => 'remove',
'url'=> z_root() . '/' . $cmd,
'sel'=> '',
- 'title' => t('Remove active filter'),
+ 'title' => t('Remove active filter')
];
}
@@ -139,13 +171,13 @@ class Activity_filter {
if($arr['tabs']) {
$content = replace_macros(get_markup_template('common_pills.tpl'), [
- '$pills' => $arr['tabs'],
+ '$pills' => $arr['tabs']
]);
$o .= replace_macros(get_markup_template('activity_filter_widget.tpl'), [
'$title' => t('Activity Filters'),
'$reset' => $reset,
- '$content' => $content,
+ '$content' => $content
]);
}
diff --git a/boot.php b/boot.php
index c0d749c2e..e7e48d1a0 100755
--- a/boot.php
+++ b/boot.php
@@ -405,6 +405,7 @@ define ( 'VNOTIFY_REGISTER', 0x0400 );
define ( 'VNOTIFY_FILES', 0x0800 );
define ( 'VNOTIFY_PUBS', 0x1000 );
define ( 'VNOTIFY_LIKE', 0x2000 );
+define ( 'VNOTIFY_FORUMS', 0x4000 );
diff --git a/include/features.php b/include/features.php
index 3d3e41a05..bcdea73e0 100644
--- a/include/features.php
+++ b/include/features.php
@@ -395,9 +395,18 @@ function get_features($filtered = true, $level = (-1)) {
],
[
+ 'forums_tab',
+ t('Forum Filter'),
+ t('Ability to display only posts of a specific forum'),
+ false,
+ get_config('feature_lock','forums_tab'),
+ feature_level('forums_tab',1),
+ ],
+
+ [
'personal_tab',
- t('Network Personal Tab'),
- t('Enable tab to display only Network posts that you\'ve interacted on'),
+ t('Personal Posts Filter'),
+ t('Ability to display only Network posts that you\'ve interacted on'),
false,
get_config('feature_lock','personal_tab'),
feature_level('personal_tab',1),
diff --git a/include/nav.php b/include/nav.php
index d83337481..27a8ced0f 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -91,10 +91,10 @@ function nav($template = 'default') {
if(local_channel()) {
if(! $_SESSION['delegate']) {
- $nav['manage'] = array('manage', t('Manage Channels'), "", t('Manage your channels'),'manage_nav_btn');
+ $nav['manage'] = array('manage', t('Channel Manager'), "", t('Manage your channels'),'manage_nav_btn');
}
- $nav['group'] = array('group', t('Manage Privacy Groups'),"", t('Add and edit privacy groups'),'group_nav_btn');
+ $nav['group'] = array('group', t('Privacy Groups'),"", t('Manage your privacy groups'),'group_nav_btn');
$nav['settings'] = array('settings', t('Settings'),"", t('Account/Channel Settings'),'settings_nav_btn');
diff --git a/include/text.php b/include/text.php
index 319de67a8..7c519eb64 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3335,22 +3335,54 @@ function unique_multidim_array($array, $key) {
return $temp_array;
}
-function network_qstring($req) {
+function get_forum_channels($uid) {
- $ret = '?f=';
+ if(! $uid)
+ return;
+
+ $perms_sql = item_permissions_sql($uid) . item_normal();
- if(x($req, 'cid'))
- $ret .= '&cid=' . $req['cid'];
+ $xf = false;
- if(x($req, 'gid'))
- $ret .= '&gid=' . $req['gid'];
+ $x1 = q("select xchan from abconfig where chan = %d and cat = 'their_perms' and k = 'send_stream' and v = '0'",
+ intval($uid)
+ );
+ if($x1) {
+ $xc = ids_to_querystr($x1,'xchan',true);
- if(x($req, 'star'))
- $ret .= '&star=' . $req['star'];
+ $x2 = q("select xchan from abconfig where chan = %d and cat = 'their_perms' and k = 'tag_deliver' and v = '1' and xchan in (" . $xc . ") ",
+ intval($uid)
+ );
- if(x($req, 'conv'))
- $ret .= '&conv=' . $req['conv'];
+ if($x2) {
+ $xf = ids_to_querystr($x2,'xchan',true);
- return $ret;
+ // private forums
+ $x3 = q("select xchan from abconfig where chan = %d and cat = 'their_perms' and k = 'post_wall' and v = '1' and xchan in (" . $xc . ") and not xchan in (" . $xf . ") ",
+ intval(local_channel())
+ );
+ if($x3) {
+ $xf = ids_to_querystr(array_merge($x2,$x3),'xchan',true);
+ }
+ }
+ }
+
+ $sql_extra = (($xf) ? " and ( xchan_hash in (" . $xf . ") or xchan_pubforum = 1 ) " : " and xchan_pubforum = 1 ");
+
+ $r = q("select abook_id, xchan_hash, xchan_name, xchan_url, xchan_photo_s from abook left join xchan on abook_xchan = xchan_hash where xchan_deleted = 0 and abook_channel = %d and abook_pending = 0 and abook_ignored = 0 and abook_blocked = 0 $sql_extra order by xchan_name",
+ intval($uid)
+ );
+
+ for($x = 0; $x < count($r); $x ++) {
+ if($x3) {
+ foreach($x3 as $xx) {
+ if($r[$x]['xchan_hash'] == $xx['xchan']) {
+ $r[$x]['private_forum'] = 1;
+ }
+ }
+ }
+ }
+
+ return $r;
}
diff --git a/view/js/main.js b/view/js/main.js
index 7a8ddfe28..45c412296 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -509,7 +509,7 @@ function handleNotificationsItems(notifyType, data) {
notify_menu.html('');
$(data).each(function() {
- html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top,this.unseen);
+ html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top,this.unseen,this.private_forum);
notify_menu.append(html);
});
@@ -828,6 +828,7 @@ function updateInit() {
});
handleNotificationsItems('forums', fnotifs);
}
+
}
if(! src) {
diff --git a/view/pdl/mod_network.pdl b/view/pdl/mod_network.pdl
index d26422093..a4bdf0a9f 100644
--- a/view/pdl/mod_network.pdl
+++ b/view/pdl/mod_network.pdl
@@ -1,9 +1,8 @@
[region=aside]
[widget=activity_order][/widget]
[widget=activity_filter][/widget]
-[widget=forums][/widget]
-[widget=suggestions][/widget]
[widget=savedsearch][/widget]
+[widget=suggestions][/widget]
[widget=notes][/widget]
[/region]
diff --git a/view/tpl/common_pills.tpl b/view/tpl/common_pills.tpl
index 8f4381f3d..e2b018d26 100755
--- a/view/tpl/common_pills.tpl
+++ b/view/tpl/common_pills.tpl
@@ -3,6 +3,7 @@
<li class="nav-item hover-fx-show"{{if $p.id}} id="{{$p.id}}"{{/if}}>
<a class="nav-link{{if $p.sel}} {{$p.sel}}{{/if}}" href="{{$p.url}}"{{if $p.title}} title="{{$p.title}}"{{/if}}{{if $p.sub}} onclick="{{if $p.sel}}closeOpen('{{$p.id}}_sub');{{else}}openClose('{{$p.id}}_sub');{{/if}} return false;"{{/if}}>
{{if $p.icon}}<i class="fa fa-fw fa-{{$p.icon}}"></i>{{/if}}
+ {{if $p.img}}<img class="menu-img-1" src="{{$p.img}}">{{/if}}
{{$p.label}}
{{if $p.sub}}<i class="fa fa-fw fa-caret-down hover-fx-hide"></i>{{/if}}
</a>
@@ -12,7 +13,9 @@
<li class="nav-item"{{if $ps.id}} id="{{$ps.id}}"{{/if}}>
<a class="nav-link{{if $ps.sel}} {{$ps.sel}}{{/if}}" href="{{$ps.url}}"{{if $ps.title}} title="{{$ps.title}}"{{/if}}>
{{if $ps.icon}}<i class="fa fa-fw fa-{{$ps.icon}}"></i>{{/if}}
+ {{if $ps.img}}<img class="menu-img-1" src="{{$ps.img}}">{{/if}}
{{$ps.label}}
+ {{if $ps.lock}}<i class="fa fa-{{$ps.lock}} text-muted"></i>{{/if}}
</a>
</li>
{{/foreach}}
diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl
index c71f65b52..068441997 100644
--- a/view/tpl/notifications_widget.tpl
+++ b/view/tpl/notifications_widget.tpl
@@ -134,10 +134,11 @@
</a>
</div>
<div id="nav-notifications-forums-template" rel="template">
- <a class="list-group-item clearfix notification notification-forum" href="{0}" title="{2} {3}" data-b64mid="{6}" data-notify_id="{7}" data-thread_top="{8}" data-contact_name="{2}">
+ <a class="list-group-item clearfix notification notification-forum" href="{0}" title="{3}" data-b64mid="{6}" data-notify_id="{7}" data-thread_top="{8}" data-contact_name="{2}">
<span class="float-right badge badge-{{$notification.severity}}">{9}</span>
<img class="menu-img-1" src="{1}">
<span class="">{2}</span>
+ <i class="fa fa-{10} text-muted"></i>
</a>
</div>
<div id="notifications" class="navbar-nav">
diff --git a/view/tpl/settings.tpl b/view/tpl/settings.tpl
index b5e871c36..3a05ea828 100755
--- a/view/tpl/settings.tpl
+++ b/view/tpl/settings.tpl
@@ -147,6 +147,7 @@
{{include file="field_intcheckbox.tpl" field=$vnotify13}}
{{/if}}
{{include file="field_intcheckbox.tpl" field=$vnotify14}}
+ {{include file="field_intcheckbox.tpl" field=$vnotify15}}
{{include file="field_intcheckbox.tpl" field=$always_show_in_notices}}
{{include file="field_input.tpl" field=$evdays}}
</div>