diff options
author | Andrew Manning <tamanning@zoho.com> | 2018-06-08 05:22:01 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2018-06-08 05:22:01 -0400 |
commit | df2d18160212ec546ec640dd1d2152fecada5557 (patch) | |
tree | 126504df4e5ab2d42defbee153a748fe40253b38 /Zotlabs/Widget | |
parent | ed17e8a6499e48b032393be351c39f31a0edcbf3 (diff) | |
parent | 7bf1c5f27b8b8f0eea226e81a5db99585c5a56b3 (diff) | |
download | volse-hubzilla-df2d18160212ec546ec640dd1d2152fecada5557.tar.gz volse-hubzilla-df2d18160212ec546ec640dd1d2152fecada5557.tar.bz2 volse-hubzilla-df2d18160212ec546ec640dd1d2152fecada5557.zip |
Merge branch 'dev' of framagit.org:hubzilla/core into dev
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r-- | Zotlabs/Widget/Activity_filter.php | 190 | ||||
-rw-r--r-- | Zotlabs/Widget/Activity_order.php | 128 | ||||
-rw-r--r-- | Zotlabs/Widget/Forums.php | 2 | ||||
-rw-r--r-- | Zotlabs/Widget/Notifications.php | 11 |
4 files changed, 330 insertions, 1 deletions
diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php new file mode 100644 index 000000000..32da20bf6 --- /dev/null +++ b/Zotlabs/Widget/Activity_filter.php @@ -0,0 +1,190 @@ +<?php + +namespace Zotlabs\Widget; + +class Activity_filter { + + function widget($arr) { + + if(! local_channel()) + return ''; + + $cmd = \App::$cmd; + $filter_active = false; + + $tabs = []; + + if(feature_enabled(local_channel(),'personal_tab')) { + if(x($_GET,'conv')) { + $conv_active = (($_GET['conv'] == 1) ? 'active' : ''); + $filter_active = 'personal'; + } + + $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' : ''); + $filter_active = 'star'; + } + + $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' : ''); + $filter_active = 'group'; + } + $gsub[] = [ + 'label' => $g['gname'], + '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']) + ]; + } + $tabs[] = [ + 'id' => 'privacy_groups', + 'label' => t('Privacy Groups'), + 'icon' => 'users', + 'url' => '#', + 'sel' => (($filter_active == 'group') ? true : false), + 'title' => t('Show my privacy groups'), + 'sub' => $gsub + + ]; + } + } + + 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' : ''); + $filter_active = 'file'; + } + $tsub[] = [ + 'label' => $t['term'], + 'icon' => '', + 'url' => z_root() . '/' . $cmd . '/?f=&file=' . $t['term'], + 'sel' => $file_active, + 'title' => sprintf(t('Show posts that I have filed to %s'), $t['term']), + ]; + } + + $tabs[] = [ + 'id' => 'saved_folders', + 'label' => t('Saved Folders'), + 'icon' => 'folder', + 'url' => '#', + 'sel' => (($filter_active == 'file') ? true : false), + 'title' => t('Show filed post categories'), + 'sub' => $tsub + + ]; + } + } + + if(feature_enabled(local_channel(),'forums_tab')) { + $forums = get_forum_channels(local_channel()); + + if($forums) { + foreach($forums as $f) { + if(x($_GET,'pf') && x($_GET,'cid')) { + $forum_active = ((x($_GET,'pf') && $_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=&pf=1&cid=' . $f['abook_id']), + 'sel' => $forum_active, + 'title' => t('Show posts to this forum'), + 'lock' => (($f['private_forum']) ? 'lock' : '') + ]; + } + + $tabs[] = [ + 'id' => 'forums', + 'label' => t('Forums'), + 'icon' => 'comments-o', + 'url' => '#', + 'sel' => (($filter_active == 'forums') ? true : false), + 'title' => t('Show forums'), + 'sub' => $fsub + + ]; + } + } + + + if(x($_GET,'search')) { + $filter_active = 'search'; + $tabs[] = [ + 'label' => t('Search'), + 'icon' => 'search', + 'url' => z_root() . '/' . $cmd . '/?f=&search=' . $_GET['search'], + 'sel' => 'active disabled', + 'title' => t('Panel search') + ]; + } + + $reset = []; + if($filter_active) { + $reset = [ + 'label' => '', + 'icon' => 'remove', + 'url'=> z_root() . '/' . $cmd, + 'sel'=> '', + 'title' => t('Remove active filter') + ]; + } + + $arr = ['tabs' => $tabs]; + + call_hooks('network_tabs', $arr); + + $o = ''; + + if($arr['tabs']) { + $content = replace_macros(get_markup_template('common_pills.tpl'), [ + '$pills' => $arr['tabs'] + ]); + + $o .= replace_macros(get_markup_template('activity_filter_widget.tpl'), [ + '$title' => t('Activity Filters'), + '$reset' => $reset, + '$content' => $content + ]); + } + + return $o; + + } + +} diff --git a/Zotlabs/Widget/Activity_order.php b/Zotlabs/Widget/Activity_order.php new file mode 100644 index 000000000..534d6caee --- /dev/null +++ b/Zotlabs/Widget/Activity_order.php @@ -0,0 +1,128 @@ +<?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'), + 'icon' => '', + 'url'=>z_root() . '/' . $cmd . '?f=&order=comment' . $filter, + 'sel'=> $commentord_active, + 'title' => t('Order by last commented date'), + ]; + $tabs[] = [ + 'label' => t('Posted Date'), + 'icon' => '', + 'url'=>z_root() . '/' . $cmd . '?f=&order=post' . $filter, + 'sel'=> $postord_active, + 'title' => t('Order by last posted date'), + ]; + $tabs[] = array( + 'label' => t('Date Unthreaded'), + 'icon' => '', + 'url' => z_root() . '/' . $cmd . '?f=&order=unthreaded' . $filter, + 'sel' => $unthreaded_active, + 'title' => t('Order unthreaded by date'), + ); + + $arr = ['tabs' => $tabs]; + + call_hooks('network_tabs', $arr); + + $o = ''; + + if($arr['tabs']) { + $content = replace_macros(get_markup_template('common_pills.tpl'), [ + '$pills' => $arr['tabs'], + ]); + + $o = replace_macros(get_markup_template('common_widget.tpl'), [ + '$title' => t('Activity Order'), + '$content' => $content, + ]); + } + + return $o; + + } + +} diff --git a/Zotlabs/Widget/Forums.php b/Zotlabs/Widget/Forums.php index 7415c0f0a..d3e2f2534 100644 --- a/Zotlabs/Widget/Forums.php +++ b/Zotlabs/Widget/Forums.php @@ -51,7 +51,7 @@ class Forums { - $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 $limit ", + $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 and abook_archived = 0 $sql_extra order by xchan_name $limit ", intval(local_channel()) ); diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php index fc78a2a39..a4cf4e706 100644 --- a/Zotlabs/Widget/Notifications.php +++ b/Zotlabs/Widget/Notifications.php @@ -111,6 +111,17 @@ class Notifications { 'label' => t('Mark all notices seen') ] ]; + + $notifications[] = [ + 'type' => 'forums', + 'icon' => 'comments-o', + 'severity' => 'secondary', + 'label' => t('Forums'), + 'title' => t('Forums'), + 'filter' => [ + 'name_label' => t('Filter by name') + ] + ]; } if(local_channel() && is_site_admin()) { |