aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r--Zotlabs/Widget/Affinity.php12
-rw-r--r--Zotlabs/Widget/Appcategories.php1
-rw-r--r--Zotlabs/Widget/Categories.php10
-rw-r--r--Zotlabs/Widget/Conversations.php12
-rw-r--r--Zotlabs/Widget/Forums.php32
-rw-r--r--Zotlabs/Widget/Hq_controls.php26
-rw-r--r--Zotlabs/Widget/Notifications.php18
-rw-r--r--Zotlabs/Widget/Settings_menu.php2
-rw-r--r--Zotlabs/Widget/Wiki_pages.php36
9 files changed, 123 insertions, 26 deletions
diff --git a/Zotlabs/Widget/Affinity.php b/Zotlabs/Widget/Affinity.php
index 439ba1f33..a3e5b5c07 100644
--- a/Zotlabs/Widget/Affinity.php
+++ b/Zotlabs/Widget/Affinity.php
@@ -9,15 +9,9 @@ class Affinity {
if(! local_channel())
return '';
- // Get default cmin value from pconfig, but allow GET parameter to override
- $cmin = intval(get_pconfig(local_channel(),'affinity','cmin'));
- $cmin = (($cmin) ? $cmin : 0);
- $cmin = ((x($_REQUEST,'cmin')) ? intval($_REQUEST['cmin']) : $cmin);
-
- // Get default cmax value from pconfig, but allow GET parameter to override
- $cmax = intval(get_pconfig(local_channel(),'affinity','cmax'));
- $cmax = (($cmax) ? $cmax : 99);
- $cmax = ((x($_REQUEST,'cmax')) ? intval($_REQUEST['cmax']) : $cmax);
+
+ $cmin = ((x($_REQUEST,'cmin')) ? intval($_REQUEST['cmin']) : 0);
+ $cmax = ((x($_REQUEST,'cmax')) ? intval($_REQUEST['cmax']) : 99);
if(feature_enabled(local_channel(),'affinity')) {
diff --git a/Zotlabs/Widget/Appcategories.php b/Zotlabs/Widget/Appcategories.php
index 490ec1abc..8ff14230f 100644
--- a/Zotlabs/Widget/Appcategories.php
+++ b/Zotlabs/Widget/Appcategories.php
@@ -26,6 +26,7 @@ class Appcategories {
and term.uid = app_channel
and term.otype = %d
and term.term != 'nav_featured_app'
+ and term.term != 'nav_pinned_app'
order by term.term asc",
intval(local_channel()),
intval(TERM_OBJ_APP)
diff --git a/Zotlabs/Widget/Categories.php b/Zotlabs/Widget/Categories.php
index 305869706..9bfa9742a 100644
--- a/Zotlabs/Widget/Categories.php
+++ b/Zotlabs/Widget/Categories.php
@@ -13,8 +13,14 @@ class Categories {
if(($cards) && (! feature_enabled(\App::$profile['profile_uid'],'cards')))
return '';
+ $articles = ((array_key_exists('articles',$arr) && $arr['articles']) ? true : false);
+
+ if(($articles) && (! feature_enabled(\App::$profile['profile_uid'],'articles')))
+ return '';
+
+
if((! \App::$profile['profile_uid'])
- || (! perm_is_allowed(\App::$profile['profile_uid'],get_observer_hash(),(($cards) ? 'view_pages' : 'view_stream')))) {
+ || (! perm_is_allowed(\App::$profile['profile_uid'],get_observer_hash(),(($cards || $articles) ? 'view_pages' : 'view_stream')))) {
return '';
}
@@ -25,6 +31,8 @@ class Categories {
if($cards)
return cardcategories_widget($srchurl, $cat);
+ elseif($articles)
+ return articlecategories_widget($srchurl, $cat);
else
return categories_widget($srchurl, $cat);
diff --git a/Zotlabs/Widget/Conversations.php b/Zotlabs/Widget/Conversations.php
index 56510750f..267d50fa0 100644
--- a/Zotlabs/Widget/Conversations.php
+++ b/Zotlabs/Widget/Conversations.php
@@ -28,6 +28,8 @@ class Conversations {
require_once('include/message.php');
+ $o = '';
+
// private_messages_list() can do other more complicated stuff, for now keep it simple
$r = private_messages_list(local_channel(), $mailbox, \App::$pager['start'], \App::$pager['itemspage']);
@@ -36,13 +38,13 @@ class Conversations {
return $o;
}
- $messages = array();
+ $messages = [];
foreach($r as $rr) {
$selected = ((argc() == 3) ? intval(argv(2)) == intval($rr['id']) : $r[0]['id'] == $rr['id']);
- $messages[] = array(
+ $messages[] = [
'mailbox' => $mailbox,
'id' => $rr['id'],
'from_name' => $rr['from']['xchan_name'],
@@ -57,14 +59,14 @@ class Conversations {
'date' => datetime_convert('UTC',date_default_timezone_get(),$rr['created'], 'c'),
'seen' => $rr['seen'],
'selected' => ((argv(1) != 'new') ? $selected : '')
- );
+ ];
}
$tpl = get_markup_template('mail_head.tpl');
- $o .= replace_macros($tpl, array(
+ $o .= replace_macros($tpl, [
'$header' => $header,
'$messages' => $messages
- ));
+ ]);
}
return $o;
diff --git a/Zotlabs/Widget/Forums.php b/Zotlabs/Widget/Forums.php
index 002c0ee21..91b987746 100644
--- a/Zotlabs/Widget/Forums.php
+++ b/Zotlabs/Widget/Forums.php
@@ -29,18 +29,32 @@ class Forums {
);
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)
+
+ 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);
+ }
+ }
}
$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 $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 $sql_extra order by xchan_name $limit ",
intval(local_channel())
);
+
if(! $r1)
return $o;
@@ -85,9 +99,21 @@ class Forums {
$o .= '<h3>' . t('Forums') . '</h3><ul class="nav nav-pills flex-column">';
foreach($r1 as $rr) {
+
+ $link = 'network?f=&pf=1&cid=' . $rr['abook_id'];
+ if($x3) {
+ foreach($x3 as $xx) {
+ if($rr['xchan_hash'] == $xx['xchan']) {
+ $link = zid($rr['xchan_url']);
+ }
+ }
+ }
+
if($unseen && (! intval($rr['unseen'])))
continue;
- $o .= '<li class="nav-item"><a class="nav-link" href="network?f=&pf=1&cid=' . $rr['abook_id'] . '" ><span class="badge badge-secondary float-right">' . ((intval($rr['unseen'])) ? intval($rr['unseen']) : '') . '</span><img class ="menu-img-1" src="' . $rr['xchan_photo_s'] . '" /> ' . $rr['xchan_name'] . '</a></li>';
+
+
+ $o .= '<li class="nav-item"><a class="nav-link" href="' . $link . '" ><span class="badge badge-secondary float-right">' . ((intval($rr['unseen'])) ? intval($rr['unseen']) : '') . '</span><img class ="menu-img-1" src="' . $rr['xchan_photo_s'] . '" /> ' . $rr['xchan_name'] . '</a></li>';
}
$o .= '</ul></div>';
}
diff --git a/Zotlabs/Widget/Hq_controls.php b/Zotlabs/Widget/Hq_controls.php
new file mode 100644
index 000000000..0caa54a1a
--- /dev/null
+++ b/Zotlabs/Widget/Hq_controls.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Hq_controls {
+
+ function widget($arr) {
+
+ if (! local_channel())
+ return;
+
+ return replace_macros(get_markup_template('hq_controls.tpl'),
+ [
+ '$title' => t('HQ Control Panel'),
+ '$menu' => [
+ 'create' => [
+ 'label' => t('Create a new post'),
+ 'id' => 'jot-toggle',
+ 'href' => '#',
+ 'class' => ''
+ ]
+ ]
+ ]
+ );
+ }
+}
diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php
index 191f2afb6..5a0c1f3d5 100644
--- a/Zotlabs/Widget/Notifications.php
+++ b/Zotlabs/Widget/Notifications.php
@@ -20,8 +20,10 @@ class Notifications {
'label' => t('View your network activity')
],
'markall' => [
- 'url' => '#',
'label' => t('Mark all notifications read')
+ ],
+ 'filter' => [
+ 'label' => t('Show new posts only')
]
];
@@ -36,8 +38,10 @@ class Notifications {
'label' => t('View your home activity')
],
'markall' => [
- 'url' => '#',
'label' => t('Mark all notifications seen')
+ ],
+ 'filter' => [
+ 'label' => t('Show new posts only')
]
];
@@ -52,7 +56,6 @@ class Notifications {
'label' => t('View your private mails')
],
'markall' => [
- 'url' => '#',
'label' => t('Mark all messages seen')
]
];
@@ -68,7 +71,6 @@ class Notifications {
'label' => t('View events')
],
'markall' => [
- 'url' => '#',
'label' => t('Mark all events seen')
]
];
@@ -104,7 +106,6 @@ class Notifications {
'label' => t('View all notices')
],
'markall' => [
- 'url' => '#',
'label' => t('Mark all notices seen')
]
];
@@ -132,8 +133,10 @@ class Notifications {
'label' => t('View the public stream')
],
'markall' => [
- 'url' => '#',
'label' => t('Mark all notifications seen')
+ ],
+ 'filter' => [
+ 'label' => t('Show new posts only')
]
];
}
@@ -141,7 +144,8 @@ class Notifications {
$o = replace_macros(get_markup_template('notifications_widget.tpl'), array(
'$module' => \App::$module,
'$notifications' => $notifications,
- '$loading' => t('Loading...')
+ '$no_notifications' => t('Sorry, you have got no notifications at the moment'),
+ '$loading' => t('Loading')
));
return $o;
diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php
index c15ad0980..e15ed96a5 100644
--- a/Zotlabs/Widget/Settings_menu.php
+++ b/Zotlabs/Widget/Settings_menu.php
@@ -107,7 +107,7 @@ class Settings_menu {
if($role === false || $role === 'custom') {
$tabs[] = array(
'label' => t('Connection Default Permissions'),
- 'url' => z_root() . '/connedit/' . $abook_self_id,
+ 'url' => z_root() . '/defperms',
'selected' => ''
);
}
diff --git a/Zotlabs/Widget/Wiki_pages.php b/Zotlabs/Widget/Wiki_pages.php
index 2aad8008f..06b32b5f5 100644
--- a/Zotlabs/Widget/Wiki_pages.php
+++ b/Zotlabs/Widget/Wiki_pages.php
@@ -5,6 +5,42 @@ namespace Zotlabs\Widget;
class Wiki_pages {
+ function create_missing_page($arr) {
+ if(argc() < 4)
+ return;
+
+ $c = channelx_by_nick(argv(1));
+ $w = \Zotlabs\Lib\NativeWiki::exists_by_name($c['channel_id'],urldecode(argv(2)));
+ $arr = array(
+ 'resource_id' => $w['resource_id'],
+ 'channel_id' => $c['channel_id'],
+ 'channel_address' => $c['channel_address'],
+ 'refresh' => false
+ );
+
+ $can_create = perm_is_allowed(\App::$profile['uid'],get_observer_hash(),'write_wiki');
+
+ $can_delete = ((local_channel() && (local_channel() == \App::$profile['uid'])) ? true : false);
+ $pageName = addslashes(escape_tags(urldecode(argv(3))));
+
+ return replace_macros(get_markup_template('wiki_page_not_found.tpl'), array(
+ '$resource_id' => $arr['resource_id'],
+ '$channel_address' => $arr['channel_address'],
+ '$wikiname' => $wikiname,
+ '$canadd' => $can_create,
+ '$candel' => $can_delete,
+ '$addnew' => t('Add new page'),
+ '$typelock' => $typelock,
+ '$lockedtype' => $w['mimeType'],
+ '$mimetype' => mimetype_select(0,$w['mimeType'],
+ [ 'text/markdown' => t('Markdown'), 'text/bbcode' => t('BBcode'), 'text/plain' => t('Text') ]),
+ '$pageName' => array('missingPageName', 'Create Page' , $pageName),
+ '$refresh' => $arr['refresh'],
+ '$options' => t('Options'),
+ '$submit' => t('Submit')
+ ));
+ }
+
function widget($arr) {
if(argc() < 3)