diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-07-25 10:19:19 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-07-25 10:19:19 +0200 |
commit | 1b1d11dcf1091158232e98abad966d4900e2ccc9 (patch) | |
tree | 380d5e04c73391089bf3d658ea4b27eecffa4916 /Zotlabs/Widget | |
parent | b655d04b3474893ee3dea99b77f2e7dd764729a0 (diff) | |
parent | 35200e5f1b10cdd18af8f0ea646996e438b97011 (diff) | |
download | volse-hubzilla-1b1d11dcf1091158232e98abad966d4900e2ccc9.tar.gz volse-hubzilla-1b1d11dcf1091158232e98abad966d4900e2ccc9.tar.bz2 volse-hubzilla-1b1d11dcf1091158232e98abad966d4900e2ccc9.zip |
Merge branch '3.6RC'
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r-- | Zotlabs/Widget/Activity_filter.php | 204 | ||||
-rw-r--r-- | Zotlabs/Widget/Activity_order.php | 128 | ||||
-rw-r--r-- | Zotlabs/Widget/Admin.php | 6 | ||||
-rw-r--r-- | Zotlabs/Widget/Appcategories.php | 3 | ||||
-rw-r--r-- | Zotlabs/Widget/Appstore.php | 18 | ||||
-rw-r--r-- | Zotlabs/Widget/Collections.php | 3 | ||||
-rw-r--r-- | Zotlabs/Widget/Notifications.php | 11 | ||||
-rw-r--r-- | Zotlabs/Widget/Settings_menu.php | 2 |
8 files changed, 371 insertions, 4 deletions
diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php new file mode 100644 index 000000000..fadf39144 --- /dev/null +++ b/Zotlabs/Widget/Activity_filter.php @@ -0,0 +1,204 @@ +<?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(),'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(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(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') + ]; + } + + $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 = [ + '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, + '$name' => $name + ]); + } + + return $o; + + } + +} diff --git a/Zotlabs/Widget/Activity_order.php b/Zotlabs/Widget/Activity_order.php new file mode 100644 index 000000000..0e660afc3 --- /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, filer and cid results + if(x($_GET,'search') || x($_GET,'file') || (! x($_GET,'pf') && x($_GET,'cid'))) { + $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/Admin.php b/Zotlabs/Widget/Admin.php index a761eebe3..f349377a0 100644 --- a/Zotlabs/Widget/Admin.php +++ b/Zotlabs/Widget/Admin.php @@ -24,7 +24,7 @@ class Admin { 'channels' => array(z_root() . '/admin/channels/', t('Channels'), 'channels'), 'security' => array(z_root() . '/admin/security/', t('Security'), 'security'), 'features' => array(z_root() . '/admin/features/', t('Features'), 'features'), - 'plugins' => array(z_root() . '/admin/plugins/', t('Plugins'), 'plugins'), + 'addons' => array(z_root() . '/admin/addons/', t('Addons'), 'addons'), 'themes' => array(z_root() . '/admin/themes/', t('Themes'), 'themes'), 'queue' => array(z_root() . '/admin/queue', t('Inspect queue'), 'queue'), 'profs' => array(z_root() . '/admin/profs', t('Profile Fields'), 'profs'), @@ -39,7 +39,7 @@ class Admin { if($r) { foreach ($r as $h){ $plugin = $h['aname']; - $plugins[] = array(z_root() . '/admin/plugins/' . $plugin, $plugin, 'plugin'); + $plugins[] = array(z_root() . '/admin/addons/' . $plugin, $plugin, 'plugin'); // temp plugins with admin \App::$plugins_admin[] = $plugin; } @@ -53,7 +53,7 @@ class Admin { $o .= replace_macros(get_markup_template('admin_aside.tpl'), array( '$admin' => $aside, '$admtxt' => t('Admin'), - '$plugadmtxt' => t('Plugin Features'), + '$plugadmtxt' => t('Addon Features'), '$plugins' => $plugins, '$logtxt' => t('Logs'), '$logs' => $logs, diff --git a/Zotlabs/Widget/Appcategories.php b/Zotlabs/Widget/Appcategories.php index 8ff14230f..aebd144d0 100644 --- a/Zotlabs/Widget/Appcategories.php +++ b/Zotlabs/Widget/Appcategories.php @@ -17,6 +17,9 @@ class Appcategories { // Leaving this line which negates the effect of the two invalid lines prior $srchurl = z_root() . '/apps'; + if(argc() > 1 && argv(1) === 'available') + $srchurl .= '/available'; + $terms = array(); diff --git a/Zotlabs/Widget/Appstore.php b/Zotlabs/Widget/Appstore.php new file mode 100644 index 000000000..237707733 --- /dev/null +++ b/Zotlabs/Widget/Appstore.php @@ -0,0 +1,18 @@ +<?php + +namespace Zotlabs\Widget; + + +class Appstore { + + function widget($arr) { + $store = ((argc() > 1 && argv(1) === 'available') ? 1 : 0); + return replace_macros(get_markup_template('appstore.tpl'), [ + '$title' => t('App Collections'), + '$options' => [ + [ z_root() . '/apps/available', t('Available Apps'), $store ], + [ z_root() . '/apps', t('Installed apps'), 1 - $store ] + ] + ]); + } +}
\ No newline at end of file diff --git a/Zotlabs/Widget/Collections.php b/Zotlabs/Widget/Collections.php index d2b29679a..bc9c812c6 100644 --- a/Zotlabs/Widget/Collections.php +++ b/Zotlabs/Widget/Collections.php @@ -8,6 +8,9 @@ class Collections { function widget($args) { + if(argc() < 2) + return; + $mode = ((array_key_exists('mode',$args)) ? $args['mode'] : 'conversation'); switch($mode) { case 'conversation': 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()) { diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php index 9574becc3..f35d6f147 100644 --- a/Zotlabs/Widget/Settings_menu.php +++ b/Zotlabs/Widget/Settings_menu.php @@ -105,7 +105,7 @@ class Settings_menu { if(feature_enabled(local_channel(),'permcats')) { $tabs[] = array( - 'label' => t('Permission Groups'), + 'label' => t('Permission Categories'), 'url' => z_root() . '/settings/permcats', 'selected' => ((argv(1) === 'permcats') ? 'active' : ''), ); |