aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget
diff options
context:
space:
mode:
authormjfriaza <mjfriaza@disroot.org>2022-05-17 13:44:06 +0200
committermjfriaza <mjfriaza@disroot.org>2022-05-17 13:44:06 +0200
commita75c61d71efebf43713026200aa0f513bd7eef09 (patch)
tree909048adeaa329813e2530d43626ed3bd711bc25 /Zotlabs/Widget
parent481ecee9e87342ca7a1217395085e95d1a3b61ea (diff)
parent0d0f73fb67bbfcc53058cefded85ac36f951c7a7 (diff)
downloadvolse-hubzilla-a75c61d71efebf43713026200aa0f513bd7eef09.tar.gz
volse-hubzilla-a75c61d71efebf43713026200aa0f513bd7eef09.tar.bz2
volse-hubzilla-a75c61d71efebf43713026200aa0f513bd7eef09.zip
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r--Zotlabs/Widget/Activity.php15
-rw-r--r--Zotlabs/Widget/Activity_filter.php7
-rw-r--r--Zotlabs/Widget/Activity_order.php8
-rw-r--r--Zotlabs/Widget/Admin.php5
-rw-r--r--Zotlabs/Widget/Affinity.php12
-rw-r--r--Zotlabs/Widget/Album.php8
-rw-r--r--Zotlabs/Widget/Appcategories.php8
-rw-r--r--Zotlabs/Widget/Appcloud.php6
-rw-r--r--Zotlabs/Widget/Appstore.php13
-rw-r--r--Zotlabs/Widget/Archive.php6
-rw-r--r--Zotlabs/Widget/Bookmarkedchats.php9
-rw-r--r--Zotlabs/Widget/Catcloud.php9
-rw-r--r--Zotlabs/Widget/Catcloud_wall.php6
-rw-r--r--Zotlabs/Widget/Categories.php6
-rw-r--r--Zotlabs/Widget/Cdav.php10
-rw-r--r--Zotlabs/Widget/Chatroom_list.php6
-rw-r--r--Zotlabs/Widget/Chatroom_members.php6
-rw-r--r--Zotlabs/Widget/Clock.php5
-rw-r--r--Zotlabs/Widget/Collections.php54
-rw-r--r--Zotlabs/Widget/Common_friends.php8
-rw-r--r--Zotlabs/Widget/Conversations.php76
-rw-r--r--Zotlabs/Widget/Cover_photo.php6
-rw-r--r--Zotlabs/Widget/Design_tools.php8
-rw-r--r--Zotlabs/Widget/Dirsort.php6
-rw-r--r--Zotlabs/Widget/Dirtags.php8
-rw-r--r--Zotlabs/Widget/Eventstools.php19
-rw-r--r--Zotlabs/Widget/Filer.php7
-rw-r--r--Zotlabs/Widget/Findpeople.php5
-rw-r--r--Zotlabs/Widget/Follow.php7
-rw-r--r--Zotlabs/Widget/Forums.php41
-rw-r--r--Zotlabs/Widget/Fullprofile.php8
-rw-r--r--Zotlabs/Widget/Helpindex.php7
-rw-r--r--Zotlabs/Widget/Hq_controls.php46
-rw-r--r--Zotlabs/Widget/Item.php8
-rw-r--r--Zotlabs/Widget/Mailmenu.php36
-rw-r--r--Zotlabs/Widget/Menu_preview.php6
-rw-r--r--Zotlabs/Widget/Messages.php251
-rw-r--r--Zotlabs/Widget/Newmember.php9
-rw-r--r--Zotlabs/Widget/Notes.php23
-rw-r--r--Zotlabs/Widget/Notifications.php61
-rw-r--r--Zotlabs/Widget/Permcats.php103
-rw-r--r--Zotlabs/Widget/Photo.php6
-rw-r--r--Zotlabs/Widget/Photo_albums.php6
-rw-r--r--Zotlabs/Widget/Photo_rand.php11
-rw-r--r--Zotlabs/Widget/Pinned.php67
-rw-r--r--Zotlabs/Widget/Portfolio.php10
-rw-r--r--Zotlabs/Widget/Privacygroups.php62
-rw-r--r--Zotlabs/Widget/Profile.php19
-rw-r--r--Zotlabs/Widget/Pubsites.php16
-rw-r--r--Zotlabs/Widget/Pubtagcloud.php5
-rw-r--r--Zotlabs/Widget/Random_block.php5
-rw-r--r--Zotlabs/Widget/Rating.php6
-rw-r--r--Zotlabs/Widget/Savedsearch.php6
-rw-r--r--Zotlabs/Widget/Settings_menu.php10
-rw-r--r--Zotlabs/Widget/Shortprofile.php18
-rw-r--r--Zotlabs/Widget/Sitesearch.php6
-rw-r--r--Zotlabs/Widget/Suggestedchats.php10
-rw-r--r--Zotlabs/Widget/Suggestions.php13
-rw-r--r--Zotlabs/Widget/Tagcloud.php5
-rw-r--r--Zotlabs/Widget/Tagcloud_wall.php6
-rw-r--r--Zotlabs/Widget/Tasklist.php9
-rw-r--r--Zotlabs/Widget/Tokens.php57
-rw-r--r--Zotlabs/Widget/Vcard.php5
-rw-r--r--Zotlabs/Widget/Website_portation_tools.php7
-rw-r--r--Zotlabs/Widget/Wiki_list.php5
-rw-r--r--Zotlabs/Widget/Wiki_page_history.php8
-rw-r--r--Zotlabs/Widget/Wiki_pages.php10
-rw-r--r--Zotlabs/Widget/Zcard.php5
68 files changed, 952 insertions, 389 deletions
diff --git a/Zotlabs/Widget/Activity.php b/Zotlabs/Widget/Activity.php
index 04e9fc4b1..34e0f67dc 100644
--- a/Zotlabs/Widget/Activity.php
+++ b/Zotlabs/Widget/Activity.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: Activity
+ * * Description: Shows the unseen activity count per contact
+ */
+
namespace Zotlabs\Widget;
class Activity {
@@ -35,7 +40,7 @@ class Activity {
}
}
foreach($contributors as $k => $v) {
- $arr[] = [ 'author_xchan' => $k, 'total' => $v ];
+ $arr[] = [ 'author_xchan' => $k, 'total' => $v ];
}
usort($arr,'total_sort');
xchan_query($arr);
@@ -43,19 +48,19 @@ class Activity {
$x = [ 'entries' => $arr ];
call_hooks('activity_widget',$x);
- $arr = $x['entries'];
+ $arr = $x['entries'];
if($arr) {
$o .= '<div class="widget">';
- $o .= '<h3>' . t('Activity','widget') . '</h3><ul class="nav nav-pills flex-column">';
+ $o .= '<h3>' . t('Activity','widget') . '</h3><ul class="nav rounded-pill flex-column">';
foreach($arr as $rv) {
- $o .= '<li class="nav-item"><a class="nav-link" href="network?f=&xchan=' . urlencode($rv['author_xchan']) . '" ><span class="badge badge-secondary float-right">' . ((intval($rv['total'])) ? intval($rv['total']) : '') . '</span><img src="' . $rv['author']['xchan_photo_s'] . '" class="menu-img-1" /> ' . $rv['author']['xchan_name'] . '</a></li>';
+ $o .= '<li class="nav-item"><a class="nav-link" href="network?f=&xchan=' . urlencode($rv['author_xchan']) . '" ><span class="badge bg-secondary float-end">' . ((intval($rv['total'])) ? intval($rv['total']) : '') . '</span><img src="' . $rv['author']['xchan_photo_s'] . '" class="menu-img-1" /> ' . $rv['author']['xchan_name'] . '</a></li>';
}
$o .= '</ul></div>';
}
return $o;
}
-}
+}
diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php
index b7a69752e..daaf5fb67 100644
--- a/Zotlabs/Widget/Activity_filter.php
+++ b/Zotlabs/Widget/Activity_filter.php
@@ -1,5 +1,12 @@
<?php
+/**
+ * * Name: Activity filters
+ * * Description: Filters for the network stream
+ * * Requires: network
+ */
+
+
namespace Zotlabs\Widget;
use App;
diff --git a/Zotlabs/Widget/Activity_order.php b/Zotlabs/Widget/Activity_order.php
index d3fe2a30f..e8ee11508 100644
--- a/Zotlabs/Widget/Activity_order.php
+++ b/Zotlabs/Widget/Activity_order.php
@@ -2,6 +2,12 @@
namespace Zotlabs\Widget;
+/**
+ * * Name: Activity order
+ * * Description: Order the network stream by posted date, last commented or by date unthreaded
+ * * Requires: network
+ */
+
class Activity_order {
function widget($arr) {
@@ -22,7 +28,7 @@ class Activity_order {
switch($_GET['order']){
case 'post':
$postord_active = 'active';
- set_pconfig(local_channel(), 'mod_network', 'order', 1);
+ set_pconfig(local_channel(), 'mod_network', 'order', 1);
break;
case 'comment':
$commentord_active = 'active';
diff --git a/Zotlabs/Widget/Admin.php b/Zotlabs/Widget/Admin.php
index f349377a0..0a7a6925f 100644
--- a/Zotlabs/Widget/Admin.php
+++ b/Zotlabs/Widget/Admin.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: Admin menu
+ * * Requires: admin
+ */
+
namespace Zotlabs\Widget;
class Admin {
diff --git a/Zotlabs/Widget/Affinity.php b/Zotlabs/Widget/Affinity.php
index 572af0503..e083e576c 100644
--- a/Zotlabs/Widget/Affinity.php
+++ b/Zotlabs/Widget/Affinity.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Affinity Tool
+ * * Description: Filter the network stream by affinity, requires the Affinity Tool App
+ * * Requires: network
+ */
+
namespace Zotlabs\Widget;
use Zotlabs\Lib\Apps;
@@ -13,7 +19,7 @@ class Affinity {
if(! Apps::system_app_installed(local_channel(),'Affinity Tool'))
return;
-
+
$default_cmin = ((Apps::system_app_installed(local_channel(),'Affinity Tool')) ? get_pconfig(local_channel(),'affinity','cmin',0) : 0);
$default_cmax = ((Apps::system_app_installed(local_channel(),'Affinity Tool')) ? get_pconfig(local_channel(),'affinity','cmax',99) : 99);
@@ -54,7 +60,7 @@ class Affinity {
'$refresh' => t('Refresh'),
'$labels' => $label_str,
));
-
+
$arr = array('html' => $x);
call_hooks('main_slider',$arr);
@@ -63,4 +69,4 @@ class Affinity {
}
}
-
+
diff --git a/Zotlabs/Widget/Album.php b/Zotlabs/Widget/Album.php
index f359e6d0f..003f6f49d 100644
--- a/Zotlabs/Widget/Album.php
+++ b/Zotlabs/Widget/Album.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Album
+ * * Description: Displays an album with a title which can be defined via the 'album' and 'title' variable
+ * * Requires: channel, articles, cards, wiki
+ */
+
namespace Zotlabs\Widget;
require_once('include/attach.php');
@@ -99,7 +105,7 @@ class Album {
'$upload_form' => $upload_form,
'$usage' => $usage_message
));
-
+
return $o;
}
}
diff --git a/Zotlabs/Widget/Appcategories.php b/Zotlabs/Widget/Appcategories.php
index aebd144d0..31fb2542e 100644
--- a/Zotlabs/Widget/Appcategories.php
+++ b/Zotlabs/Widget/Appcategories.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: App categories
+ * * Description: Shows a menu with various app categories
+ * * Requires: apps
+ */
+
namespace Zotlabs\Widget;
class Appcategories {
@@ -40,7 +46,7 @@ class Appcategories {
$terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));
return replace_macros(get_markup_template('categories_widget.tpl'),array(
- '$title' => t('Categories'),
+ '$title' => t('App Categories'),
'$desc' => '',
'$sel_all' => (($selected == '') ? 'selected' : ''),
'$all' => t('Everything'),
diff --git a/Zotlabs/Widget/Appcloud.php b/Zotlabs/Widget/Appcloud.php
index 2a4671eee..791d534c2 100644
--- a/Zotlabs/Widget/Appcloud.php
+++ b/Zotlabs/Widget/Appcloud.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: App cloud
+ * * Description: Shows a cloud with various app categories
+ * * Requires: apps
+ */
+
namespace Zotlabs\Widget;
class Appcloud {
diff --git a/Zotlabs/Widget/Appstore.php b/Zotlabs/Widget/Appstore.php
index 6a00ac06a..d8499152a 100644
--- a/Zotlabs/Widget/Appstore.php
+++ b/Zotlabs/Widget/Appstore.php
@@ -1,17 +1,22 @@
<?php
+/**
+ * * Name: App store menu
+ * * Description: Shows a menu with links to installed and available apps
+ * * Requires: apps
+ */
+
namespace Zotlabs\Widget;
class Appstore {
function widget($arr) {
- $store = ((argc() > 1 && argv(1) === 'available') ? 1 : 0);
- return replace_macros(get_markup_template('appstore.tpl'), [
+ return replace_macros(get_markup_template('appstore.tpl'), [
'$title' => t('App Collections'),
'$options' => [
- [ z_root() . '/apps', t('Installed apps'), 1 - $store ],
- [ z_root() . '/apps/available', t('Available Apps'), $store ]
+ [z_root() . '/apps', t('Installed apps'), ((argc() == 1 && argv(0) === 'apps') ? 1 : 0)],
+ [z_root() . '/apps/available', t('Available Apps'), ((argc() > 1 && argv(1) === 'available') ? 1 : 0)]
]
]);
}
diff --git a/Zotlabs/Widget/Archive.php b/Zotlabs/Widget/Archive.php
index 9adaac38f..e712a8236 100644
--- a/Zotlabs/Widget/Archive.php
+++ b/Zotlabs/Widget/Archive.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Archive
+ * * Description: A menu with links to content sorted by years and months
+ * * Requires: channel, articles, cards
+ */
+
namespace Zotlabs\Widget;
diff --git a/Zotlabs/Widget/Bookmarkedchats.php b/Zotlabs/Widget/Bookmarkedchats.php
index d64bbdb4b..5d6d000c1 100644
--- a/Zotlabs/Widget/Bookmarkedchats.php
+++ b/Zotlabs/Widget/Bookmarkedchats.php
@@ -1,14 +1,15 @@
<?php
+/**
+ * * Name: Bookmarked chats
+ * * Description: A menu with bookmarked chats
+ */
+
namespace Zotlabs\Widget;
class Bookmarkedchats {
function widget($arr) {
-
- if(! feature_enabled(\App::$profile['profile_uid'],'ajaxchat'))
- return '';
-
$h = get_observer_hash();
if(! $h)
return;
diff --git a/Zotlabs/Widget/Catcloud.php b/Zotlabs/Widget/Catcloud.php
index c53f9bbf6..5740caab7 100644
--- a/Zotlabs/Widget/Catcloud.php
+++ b/Zotlabs/Widget/Catcloud.php
@@ -2,6 +2,13 @@
namespace Zotlabs\Widget;
+/**
+ * * Name: Category cloud
+ * * Description: Display category links in a cloud
+ * * Requires: channel, cards, articles
+ */
+
+
class Catcloud {
function widget($arr) {
@@ -22,7 +29,7 @@ class Catcloud {
return card_catblock(\App::$profile['profile_uid'], $limit, '', \App::$profile['channel_hash']);
case 'articles':
-
+
if(! perm_is_allowed(\App::$profile['profile_uid'], get_observer_hash(), 'view_pages'))
return '';
diff --git a/Zotlabs/Widget/Catcloud_wall.php b/Zotlabs/Widget/Catcloud_wall.php
index 3795987cc..4ee30d023 100644
--- a/Zotlabs/Widget/Catcloud_wall.php
+++ b/Zotlabs/Widget/Catcloud_wall.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Category cloud wall
+ * * Description: Display category links in a cloud restricted to wall posts
+ * * Requires: channel
+ */
+
namespace Zotlabs\Widget;
class Catcloud_wall {
diff --git a/Zotlabs/Widget/Categories.php b/Zotlabs/Widget/Categories.php
index 94ad469da..0c6996d55 100644
--- a/Zotlabs/Widget/Categories.php
+++ b/Zotlabs/Widget/Categories.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Categories
+ * * Description: Display a menu with links to categories
+ * * Requires: channel, articles, cards, cloud
+ */
+
namespace Zotlabs\Widget;
use App;
diff --git a/Zotlabs/Widget/Cdav.php b/Zotlabs/Widget/Cdav.php
index ce716b455..f84f5cb04 100644
--- a/Zotlabs/Widget/Cdav.php
+++ b/Zotlabs/Widget/Cdav.php
@@ -1,8 +1,12 @@
<?php
-namespace Zotlabs\Widget;
-
+/**
+ * * Name: CalDAV/CardDAV tools
+ * * Description: A widget with various CalDAV and CardDAV tools
+ * * Requires: cdav
+ */
+namespace Zotlabs\Widget;
class Cdav {
@@ -164,7 +168,7 @@ class Cdav {
'uri' => $sabreabook['uri'],
'displayname' => $sabreabook['{DAV:}displayname'],
'id' => $sabreabook['id']
-
+
];
}
diff --git a/Zotlabs/Widget/Chatroom_list.php b/Zotlabs/Widget/Chatroom_list.php
index e2aad0e05..d80e40bf9 100644
--- a/Zotlabs/Widget/Chatroom_list.php
+++ b/Zotlabs/Widget/Chatroom_list.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Chatroom list
+ * * Description: A menu with links to your chatrooms
+ * * Requires: chat, channel, articles, cards, wiki
+ */
+
namespace Zotlabs\Widget;
class Chatroom_list {
diff --git a/Zotlabs/Widget/Chatroom_members.php b/Zotlabs/Widget/Chatroom_members.php
index 8ed77fb3c..0846192ce 100644
--- a/Zotlabs/Widget/Chatroom_members.php
+++ b/Zotlabs/Widget/Chatroom_members.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Chatroom members
+ * * Description: A widget that shows members of a chatroom
+ * * Requires: chat
+ */
+
namespace Zotlabs\Widget;
class Chatroom_members {
diff --git a/Zotlabs/Widget/Clock.php b/Zotlabs/Widget/Clock.php
index b63b5f748..3b9751cc5 100644
--- a/Zotlabs/Widget/Clock.php
+++ b/Zotlabs/Widget/Clock.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: Clock
+ * * Description: A simple widget that shows the current time
+ */
+
namespace Zotlabs\Widget;
class Clock {
diff --git a/Zotlabs/Widget/Collections.php b/Zotlabs/Widget/Collections.php
deleted file mode 100644
index bc9c812c6..000000000
--- a/Zotlabs/Widget/Collections.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-namespace Zotlabs\Widget;
-
-require_once('include/group.php');
-
-class Collections {
-
- function widget($args) {
-
- if(argc() < 2)
- return;
-
- $mode = ((array_key_exists('mode',$args)) ? $args['mode'] : 'conversation');
- switch($mode) {
- case 'conversation':
- $every = argv(0);
- $each = argv(0);
- $edit = true;
- $current = $_REQUEST['gid'];
- $abook_id = 0;
- $wmode = 0;
- break;
- case 'connections':
- $every = 'connections';
- $each = 'group';
- $edit = true;
- $current = $_REQUEST['gid'];
- $abook_id = 0;
- $wmode = 0;
- case 'groups':
- $every = 'connections';
- $each = argv(0);
- $edit = false;
- $current = intval(argv(1));
- $abook_id = 0;
- $wmode = 1;
- break;
- case 'abook':
- $every = 'connections';
- $each = 'group';
- $edit = false;
- $current = 0;
- $abook_id = \App::$poi['abook_xchan'];
- $wmode = 1;
- break;
- default:
- return '';
- break;
- }
-
- return group_side($every, $each, $edit, $current, $abook_id, $wmode);
- }
-}
diff --git a/Zotlabs/Widget/Common_friends.php b/Zotlabs/Widget/Common_friends.php
index a67b9312c..6024f82f5 100644
--- a/Zotlabs/Widget/Common_friends.php
+++ b/Zotlabs/Widget/Common_friends.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Common friends
+ * * Description: Display common friends to visitors
+ * * Requires: channel, articles, cards, wiki
+ */
+
namespace Zotlabs\Widget;
require_once('include/contact_widgets.php');
@@ -8,7 +14,7 @@ class Common_friends {
function widget($arr) {
- if((! \App::$profile['profile_uid'])
+ if((! \App::$profile['profile_uid'])
|| (! perm_is_allowed(\App::$profile['profile_uid'],get_observer_hash(),'view_contacts'))) {
return '';
}
diff --git a/Zotlabs/Widget/Conversations.php b/Zotlabs/Widget/Conversations.php
deleted file mode 100644
index 267d50fa0..000000000
--- a/Zotlabs/Widget/Conversations.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-namespace Zotlabs\Widget;
-
-class Conversations {
-
- function widget($arr) {
-
- if (! local_channel())
- return;
-
- if(argc() > 1) {
-
- switch(argv(1)) {
- case 'inbox':
- $mailbox = 'inbox';
- $header = t('Received Messages');
- break;
- case 'outbox':
- $mailbox = 'outbox';
- $header = t('Sent Messages');
- break;
- default:
- $mailbox = 'combined';
- $header = t('Conversations');
- break;
- }
-
- 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']);
-
- if(! $r) {
- info( t('No messages.') . EOL);
- return $o;
- }
-
- $messages = [];
-
- foreach($r as $rr) {
-
- $selected = ((argc() == 3) ? intval(argv(2)) == intval($rr['id']) : $r[0]['id'] == $rr['id']);
-
- $messages[] = [
- 'mailbox' => $mailbox,
- 'id' => $rr['id'],
- 'from_name' => $rr['from']['xchan_name'],
- 'from_url' => chanlink_hash($rr['from_xchan']),
- 'from_photo' => $rr['from']['xchan_photo_s'],
- 'to_name' => $rr['to']['xchan_name'],
- 'to_url' => chanlink_hash($rr['to_xchan']),
- 'to_photo' => $rr['to']['xchan_photo_s'],
- 'subject' => (($rr['seen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>'),
- 'delete' => t('Delete conversation'),
- 'body' => $rr['body'],
- '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, [
- '$header' => $header,
- '$messages' => $messages
- ]);
-
- }
- return $o;
- }
-
-}
-
diff --git a/Zotlabs/Widget/Cover_photo.php b/Zotlabs/Widget/Cover_photo.php
index 97323ea8c..11d9c4715 100644
--- a/Zotlabs/Widget/Cover_photo.php
+++ b/Zotlabs/Widget/Cover_photo.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Cover photo
+ * * Description: Display a cover photo in the banner region
+ * * Requires: disabled_for_pdledit_gui
+ */
+
namespace Zotlabs\Widget;
class Cover_photo {
diff --git a/Zotlabs/Widget/Design_tools.php b/Zotlabs/Widget/Design_tools.php
index a15c0c98d..0f94577d8 100644
--- a/Zotlabs/Widget/Design_tools.php
+++ b/Zotlabs/Widget/Design_tools.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Design tools
+ * * Description: Links to useful tools for webpages
+ * * Requires: webpages
+ */
+
namespace Zotlabs\Widget;
class Design_tools {
@@ -11,4 +17,4 @@ class Design_tools {
return EMPTY_STR;
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Widget/Dirsort.php b/Zotlabs/Widget/Dirsort.php
index 2fb38b7df..569782bb9 100644
--- a/Zotlabs/Widget/Dirsort.php
+++ b/Zotlabs/Widget/Dirsort.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Dirsort
+ * * Description: Various options to provide different vies of the directory
+ * * Requires: directory
+ */
+
namespace Zotlabs\Widget;
use Zotlabs\Lib\Libzotdir;
diff --git a/Zotlabs/Widget/Dirtags.php b/Zotlabs/Widget/Dirtags.php
index f211d5942..183c2f20f 100644
--- a/Zotlabs/Widget/Dirtags.php
+++ b/Zotlabs/Widget/Dirtags.php
@@ -1,8 +1,12 @@
<?php
-namespace Zotlabs\Widget;
+/**
+ * * Name: Directory tags
+ * * Description: Show directory tags in a cloud
+ * * Requires: directory
+ */
-require_once('include/dir_fns.php');
+namespace Zotlabs\Widget;
class Dirtags {
diff --git a/Zotlabs/Widget/Eventstools.php b/Zotlabs/Widget/Eventstools.php
deleted file mode 100644
index 7efd3f72e..000000000
--- a/Zotlabs/Widget/Eventstools.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-namespace Zotlabs\Widget;
-
-class Eventstools {
-
- function widget($arr) {
-
- if(! local_channel())
- return;
-
- return replace_macros(get_markup_template('events_tools_side.tpl'), array(
- '$title' => t('Events Tools'),
- '$export' => t('Export Calendar'),
- '$import' => t('Import Calendar'),
- '$submit' => t('Submit')
- ));
- }
-}
diff --git a/Zotlabs/Widget/Filer.php b/Zotlabs/Widget/Filer.php
index 5d6f96a87..6c5ac47a9 100644
--- a/Zotlabs/Widget/Filer.php
+++ b/Zotlabs/Widget/Filer.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Saved folders
+ * * Description: A menu containing saved folders
+ * * Requires: network
+ */
+
namespace Zotlabs\Widget;
require_once('include/contact_widgets.php');
@@ -10,7 +16,6 @@ class Filer {
if(! local_channel())
return '';
-
$selected = ((x($_REQUEST,'file')) ? $_REQUEST['file'] : '');
$terms = array();
diff --git a/Zotlabs/Widget/Findpeople.php b/Zotlabs/Widget/Findpeople.php
index f450b96ae..45d62bb7f 100644
--- a/Zotlabs/Widget/Findpeople.php
+++ b/Zotlabs/Widget/Findpeople.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: Find channels
+ * * Description: A simple form to search for channels in the directory
+ */
+
namespace Zotlabs\Widget;
require_once('include/contact_widgets.php');
diff --git a/Zotlabs/Widget/Follow.php b/Zotlabs/Widget/Follow.php
index c4aecc8e1..2a0abb027 100644
--- a/Zotlabs/Widget/Follow.php
+++ b/Zotlabs/Widget/Follow.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: Follow
+ * * Description: A simple form which allows you to enter an address and send a follow request
+ */
+
namespace Zotlabs\Widget;
@@ -24,7 +29,7 @@ class Follow {
else {
$abook_usage_message = '';
}
-
+
return replace_macros(get_markup_template('follow.tpl'),array(
'$connect' => t('Add New Connection'),
'$desc' => t('Enter channel address'),
diff --git a/Zotlabs/Widget/Forums.php b/Zotlabs/Widget/Forums.php
index d3e2f2534..c40556273 100644
--- a/Zotlabs/Widget/Forums.php
+++ b/Zotlabs/Widget/Forums.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: Forums
+ * * Description: A list of forum channels with unseen item counts
+ */
+
namespace Zotlabs\Widget;
class Forums {
@@ -21,35 +26,7 @@ class Forums {
$unseen = 1;
$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);
- }
- }
- }
-
- $sql_extra = (($xf) ? " and ( xchan_hash in (" . $xf . ") or xchan_pubforum = 1 ) " : " and xchan_pubforum = 1 ");
-
-
+ $sql_extra = " 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 and abook_archived = 0 $sql_extra order by xchan_name $limit ",
intval(local_channel())
@@ -64,7 +41,7 @@ class Forums {
// There also should be a way to update this via ajax.
for($x = 0; $x < count($r1); $x ++) {
- $r = q("select sum(item_unseen) as unseen from item
+ $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'])
@@ -109,12 +86,12 @@ class Forums {
}
}
}
-
+
if($unseen && (! intval($rr['unseen'])))
continue;
- $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 .= '<li class="nav-item"><a class="nav-link" href="' . $link . '" ><span class="badge bg-secondary float-end">' . ((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/Fullprofile.php b/Zotlabs/Widget/Fullprofile.php
index d7340ef40..edff88e31 100644
--- a/Zotlabs/Widget/Fullprofile.php
+++ b/Zotlabs/Widget/Fullprofile.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Full profile
+ * * Description: Profile card with extended profile info
+ * * Requires: channel, articles, cards, wiki, cloud, photos
+ */
+
namespace Zotlabs\Widget;
class Fullprofile {
@@ -11,6 +17,6 @@ class Fullprofile {
$block = observer_prohibited();
- return profile_sidebar(\App::$profile, $block);
+ return profile_sidebar(\App::$profile, $block, true, true);
}
}
diff --git a/Zotlabs/Widget/Helpindex.php b/Zotlabs/Widget/Helpindex.php
index 6c8748194..fbcd8c8b2 100644
--- a/Zotlabs/Widget/Helpindex.php
+++ b/Zotlabs/Widget/Helpindex.php
@@ -1,11 +1,18 @@
<?php
+/**
+ * * Name: Help index
+ * * Description: Help pages index
+ */
+
namespace Zotlabs\Widget;
class Helpindex {
function widget($arr) {
+ require_once('include/help.php');
+
$o .= '<div class="widget">';
$level_0 = get_help_content('sitetoc');
diff --git a/Zotlabs/Widget/Hq_controls.php b/Zotlabs/Widget/Hq_controls.php
index 0caa54a1a..7b1fe817d 100644
--- a/Zotlabs/Widget/Hq_controls.php
+++ b/Zotlabs/Widget/Hq_controls.php
@@ -1,25 +1,51 @@
<?php
+/**
+ * * Name: HQ Controls
+ * * Description: Control buttons for the HQ module
+ * * Author: Mario Vavti
+ * * Requires: hq
+ */
+
namespace Zotlabs\Widget;
+use Zotlabs\Lib\Apps;
+
+
class Hq_controls {
- function widget($arr) {
+ function widget($options) {
if (! local_channel())
return;
+ $entries = [
+ 'toggle_editor' => [
+ 'label' => t('Toggle post editor'),
+ 'href' => '#',
+ 'class' => 'btn jot-toggle',
+ 'type' => 'button',
+ 'icon' => 'pencil',
+ 'extra' => 'data-toggle="button"'
+ ]
+ ];
+
+ if(Apps::system_app_installed(local_channel(), 'Notes')) {
+ $entries['toggle_notes'] = [
+ 'label' => t('Toggle personal notes'),
+ 'href' => '#',
+ 'class' => 'btn notes-toggle',
+ 'type' => 'button',
+ 'icon' => 'sticky-note-o',
+ 'extra' => 'data-toggle="button"'
+ ];
+ }
+
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' => ''
- ]
- ]
+ '$entries' => $entries,
+ '$wrapper_class' => $options['wrapper_class'],
+ '$entry_class' => $options['entry_class']
]
);
}
diff --git a/Zotlabs/Widget/Item.php b/Zotlabs/Widget/Item.php
index 273d5649c..9fd703dfe 100644
--- a/Zotlabs/Widget/Item.php
+++ b/Zotlabs/Widget/Item.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Item
+ * * Description: Display a webpage by title or mid,
+ * * Requires: channel, articles, cards, wiki
+ */
+
namespace Zotlabs\Widget;
require_once('include/security.php');
@@ -35,7 +41,7 @@ class Item {
);
}
else {
- $r = q("select * from item where mid = '%s' and uid = %d and item_type = "
+ $r = q("select * from item where mid = '%s' and uid = %d and item_type = "
. intval(ITEM_TYPE_WEBPAGE) . " $sql_extra limit 1",
dbesc($arr['mid']),
intval($channel_id)
diff --git a/Zotlabs/Widget/Mailmenu.php b/Zotlabs/Widget/Mailmenu.php
deleted file mode 100644
index 512f7d9c0..000000000
--- a/Zotlabs/Widget/Mailmenu.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-namespace Zotlabs\Widget;
-
-class Mailmenu {
-
- function widget($arr) {
-
- if (! local_channel())
- return;
-
- return replace_macros(get_markup_template('message_side.tpl'), array(
- '$title' => t('Private Mail Menu'),
- '$combined' => array(
- 'label' => t('Combined View'),
- 'url' => z_root() . '/mail/combined',
- 'sel' => (argv(1) == 'combined'),
- ),
- '$inbox' => array(
- 'label' => t('Inbox'),
- 'url' => z_root() . '/mail/inbox',
- 'sel' => (argv(1) == 'inbox'),
- ),
- '$outbox' => array(
- 'label' => t('Outbox'),
- 'url' => z_root() . '/mail/outbox',
- 'sel' => (argv(1) == 'outbox'),
- ),
- '$new' => array(
- 'label' => t('New Message'),
- 'url' => z_root() . '/mail/new',
- 'sel'=> (argv(1) == 'new'),
- )
- ));
- }
-}
diff --git a/Zotlabs/Widget/Menu_preview.php b/Zotlabs/Widget/Menu_preview.php
index 51218f6cf..ddeb4d12c 100644
--- a/Zotlabs/Widget/Menu_preview.php
+++ b/Zotlabs/Widget/Menu_preview.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Menu preview
+ * * Description: Shows a preview of the current menu
+ * * Requires: mitem
+ */
+
namespace Zotlabs\Widget;
require_once('include/menu.php');
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
new file mode 100644
index 000000000..d045ae85b
--- /dev/null
+++ b/Zotlabs/Widget/Messages.php
@@ -0,0 +1,251 @@
+<?php
+
+/**
+ * * Name: HQ Messages
+ * * Description: Quick access to messages, direct messages, starred messages (if enabled) and notifications
+ * * Author: Mario Vavti
+ * * Requires: hq
+ */
+
+
+namespace Zotlabs\Widget;
+
+use App;
+use Zotlabs\Lib\IConfig;
+
+class Messages {
+
+ public static function widget($arr) {
+ if (!local_channel())
+ return EMPTY_STR;
+
+ $page = self::get_messages_page([]);
+
+ $_SESSION['messages_loadtime'] = datetime_convert();
+
+ $tpl = get_markup_template('messages_widget.tpl');
+ $o = replace_macros($tpl, [
+ '$entries' => $page['entries'] ?? [],
+ '$offset' => $page['offset'] ?? 0,
+ '$feature_star' => feature_enabled(local_channel(), 'star_posts'),
+ '$strings' => [
+ 'messages_title' => t('Public and restricted messages'),
+ 'direct_messages_title' => t('Direct messages'),
+ 'starred_messages_title' => t('Starred messages'),
+ 'notice_messages_title' => t('Notices'),
+ 'loading' => t('Loading'),
+ 'empty' => t('No messages')
+ ]
+ ]);
+
+ return $o;
+ }
+
+ public static function get_messages_page($options) {
+ if (!local_channel())
+ return;
+
+ if (isset($options['offset']) && $options['offset'] == -1) {
+ return;
+ }
+
+ if (isset($options['type']) && $options['type'] == 'notification') {
+ return self::get_notices_page($options);
+ }
+
+ $channel = App::get_channel();
+ $item_normal = item_normal();
+ $entries = [];
+ $limit = 30;
+ $dummy_order_sql = '';
+
+ $offset = 0;
+ if ($options['offset']) {
+ $offset = intval($options['offset']);
+ }
+
+ $loadtime = (($offset) ? $_SESSION['messages_loadtime'] : datetime_convert());
+
+ switch($options['type']) {
+ case 'direct':
+ $type_sql = ' AND item_private = 2 ';
+ // $dummy_order_sql has no other meaning but to trick
+ // some mysql backends into using the right index.
+ $dummy_order_sql = ', received DESC ';
+ break;
+ case 'starred':
+ $type_sql = ' AND item_starred = 1 ';
+ break;
+ default:
+ $type_sql = ' AND item_private IN (0, 1) ';
+ }
+
+ $items = q("SELECT * FROM item WHERE uid = %d
+ AND created <= '%s'
+ $type_sql
+ AND item_thread_top = 1
+ $item_normal
+ ORDER BY created DESC $dummy_order_sql
+ LIMIT $limit OFFSET $offset",
+ intval(local_channel()),
+ dbescdate($loadtime)
+ );
+
+ xchan_query($items, false);
+
+ $i = 0;
+ $entries = [];
+
+ foreach($items as $item) {
+
+ $info = '';
+ if ($options['type'] == 'direct') {
+ $info .= self::get_dm_recipients($channel, $item);
+ }
+
+ if($item['owner_xchan'] !== $item['author_xchan']) {
+ $info .= t('via') . ' ' . $item['owner']['xchan_name'];
+ }
+
+ $summary = $item['title'];
+ if (!$summary) {
+ $summary = $item['summary'];
+ }
+
+ if (!$summary) {
+ $summary = html2plain(bbcode($item['body'], ['drop_media' => true]), 75, true);
+ if ($summary) {
+ $summary = htmlentities($summary, ENT_QUOTES, 'UTF-8', false);
+ }
+ }
+
+ if (!$summary) {
+ $summary = '...';
+ }
+ else {
+ $summary = substr_words($summary, 68);
+ }
+
+ switch(intval($item['item_private'])) {
+ case 1:
+ $icon = '<i class="fa fa-lock"></i>';
+ break;
+ case 2:
+ $icon = '<i class="fa fa-envelope-o"></i>';
+ break;
+ default:
+ $icon = '';
+ }
+
+ $entries[$i]['author_name'] = $item['author']['xchan_name'];
+ $entries[$i]['author_addr'] = (($item['author']['xchan_addr']) ? $item['author']['xchan_addr'] : $item['author']['xchan_url']);
+ $entries[$i]['info'] = $info;
+ $entries[$i]['created'] = datetime_convert('UTC', date_default_timezone_get(), $item['created']);
+ $entries[$i]['summary'] = $summary;
+ $entries[$i]['b64mid'] = gen_link_id($item['mid']);
+ $entries[$i]['href'] = z_root() . '/hq/' . gen_link_id($item['mid']);
+ $entries[$i]['icon'] = $icon;
+
+ $i++;
+ }
+
+ $result = [
+ 'offset' => ((count($entries) < $limit) ? -1 : intval($offset + $limit)),
+ 'entries' => $entries
+ ];
+
+ return $result;
+ }
+
+ public static function get_dm_recipients($channel, $item) {
+
+ if($channel['channel_hash'] === $item['owner']['xchan_hash']) {
+ // we are the owner, get the recipients from the item
+ $recips = expand_acl($item['allow_cid']);
+ if (is_array($recips)) {
+ array_unshift($recips, $item['owner']['xchan_hash']);
+ $column = 'xchan_hash';
+ }
+ }
+ else {
+ $recips = IConfig::Get($item, 'activitypub', 'recips');
+ if (isset($recips['to']) && is_array($recips['to'])) {
+ $recips = $recips['to'];
+ array_unshift($recips, $item['owner']['xchan_url']);
+ $column = 'xchan_url';
+ }
+ else {
+ $hookinfo = [
+ 'item' => $item,
+ 'recips' => null,
+ 'column' => ''
+ ];
+
+ call_hooks('direct_message_recipients', $hookinfo);
+
+ $recips = $hookinfo['recips'];
+ $column = $hookinfo['column'];
+ }
+ }
+
+ if(is_array($recips)) {
+ stringify_array_elms($recips, true);
+
+ $query_str = implode(',', $recips);
+ $xchans = dbq("SELECT DISTINCT xchan_name FROM xchan WHERE $column IN ($query_str) AND xchan_deleted = 0");
+ foreach($xchans as $xchan) {
+ $recipients .= $xchan['xchan_name'] . ', ';
+ }
+ }
+
+ return trim($recipients, ', ');
+ }
+
+ public static function get_notices_page($options) {
+
+ if (!local_channel())
+ return;
+
+ $limit = 30;
+
+ $offset = 0;
+ if ($options['offset']) {
+ $offset = intval($options['offset']);
+ }
+
+ $notices = q("SELECT * FROM notify WHERE uid = %d
+ ORDER BY created DESC LIMIT $limit OFFSET $offset",
+ intval(local_channel())
+ );
+
+ $i = 0;
+ $entries = [];
+
+ foreach($notices as $notice) {
+
+ $summary = trim(strip_tags(bbcode($notice['msg'])));
+
+ if(strpos($summary, $notice['xname']) === 0) {
+ $summary = substr($summary, strlen($notice['xname']) + 1);
+ }
+
+ $entries[$i]['author_name'] = $notice['xname'];
+ $entries[$i]['author_addr'] = $notice['url'];
+ $entries[$i]['info'] = '';
+ $entries[$i]['created'] = datetime_convert('UTC', date_default_timezone_get(), $notice['created']);
+ $entries[$i]['summary'] = $summary;
+ $entries[$i]['b64mid'] = (($notice['ntype'] & NOTIFY_INTRO) ? '' : basename($notice['link']));
+ $entries[$i]['href'] = (($notice['ntype'] & NOTIFY_INTRO) ? $notice['link'] : z_root() . '/hq/' . basename($notice['link']));
+ $entries[$i]['icon'] = (($notice['ntype'] & NOTIFY_INTRO) ? '<i class="fa fa-user-plus"></i>' : '');
+
+ $i++;
+ }
+
+ $result = [
+ 'offset' => ((count($entries) < $limit) ? -1 : intval($offset + $limit)),
+ 'entries' => $entries
+ ];
+
+ return $result;
+ }
+}
diff --git a/Zotlabs/Widget/Newmember.php b/Zotlabs/Widget/Newmember.php
index 224f7a8a2..70a858fb0 100644
--- a/Zotlabs/Widget/Newmember.php
+++ b/Zotlabs/Widget/Newmember.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: New member
+ * * Description: Display useful links for new members to help them get started
+ */
+
namespace Zotlabs\Widget;
class Newmember {
@@ -29,7 +34,7 @@ class Newmember {
$options = [
t('Profile Creation'),
- [
+ [
'profile_photo' => t('Upload profile photo'),
'cover_photo' => t('Upload cover photo'),
'profiles' => t('Edit your profile'),
@@ -84,4 +89,4 @@ class Newmember {
}
-
+
diff --git a/Zotlabs/Widget/Notes.php b/Zotlabs/Widget/Notes.php
index 238008d81..2e8e04e93 100644
--- a/Zotlabs/Widget/Notes.php
+++ b/Zotlabs/Widget/Notes.php
@@ -1,5 +1,13 @@
<?php
+/**
+ * * Name: Notes
+ * * Description: A simple notes widget, requires the Notes App
+ * * Author: Mike Macgirvin
+ * * Author: Mario Vavti
+ * * Maintainer: Mario Vavti
+ */
+
namespace Zotlabs\Widget;
use Zotlabs\Lib\Apps;
@@ -18,10 +26,19 @@ class Notes {
$tpl = get_markup_template('notes.tpl');
$o = replace_macros($tpl, array(
- '$banner' => t('Notes'),
'$text' => $text,
- '$save' => t('Save'),
- '$app' => ((isset($arr['app'])) ? true : false)
+ '$html' => bbcode($text),
+ '$app' => ((isset($arr['app'])) ? true : false),
+ '$hidden' => ((isset($arr['hidden'])) ? true : false),
+ '$strings' => [
+ 'title' => t('Notes'),
+ 'read' => t('Read mode'),
+ 'edit' => t('Edit mode'),
+ 'editing' => t('Editing'),
+ 'saving' => t('Saving'),
+ 'saved' => t('Saved'),
+ 'dots' => '<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>'
+ ]
));
return $o;
diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php
index dd5a6cd46..0e02d5cc1 100644
--- a/Zotlabs/Widget/Notifications.php
+++ b/Zotlabs/Widget/Notifications.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Notifications
+ * * Description: Shows all kind of notifications
+ * * Author: Mario Vavti
+ */
+
namespace Zotlabs\Widget;
class Notifications {
@@ -13,11 +19,11 @@ class Notifications {
'type' => 'network',
'icon' => 'th',
'severity' => 'secondary',
- 'label' => t('New Network Activity'),
- 'title' => t('New Network Activity Notifications'),
+ 'label' => t('Network'),
+ 'title' => t('New network activity notifications'),
'viewall' => [
'url' => 'network',
- 'label' => t('View your network activity')
+ 'label' => t('Network stream')
],
'markall' => [
'label' => t('Mark all notifications read')
@@ -33,11 +39,11 @@ class Notifications {
'type' => 'home',
'icon' => 'home',
'severity' => 'danger',
- 'label' => t('New Home Activity'),
- 'title' => t('New Home Activity Notifications'),
+ 'label' => t('Home'),
+ 'title' => t('New home activity notifications'),
'viewall' => [
'url' => 'channel/' . $channel['channel_address'],
- 'label' => t('View your home activity')
+ 'label' => t('Home stream')
],
'markall' => [
'label' => t('Mark all notifications seen')
@@ -52,11 +58,11 @@ class Notifications {
'type' => 'dm',
'icon' => 'envelope',
'severity' => 'danger',
- 'label' => t('New Direct Messages'),
- 'title' => t('New Direct Messages Notifications'),
+ 'label' => t('Direct Messages'),
+ 'title' => t('New direct messages notifications'),
'viewall' => [
'url' => 'network/?dm=1',
- 'label' => t('View your direct messages')
+ 'label' => t('Direct messages stream')
],
'markall' => [
'label' => t('Mark all notifications read')
@@ -68,26 +74,11 @@ class Notifications {
];
$notifications[] = [
- 'type' => 'mail',
- 'icon' => 'envelope',
- 'severity' => 'danger',
- 'label' => t('New Mails'),
- 'title' => t('New Mails Notifications'),
- 'viewall' => [
- 'url' => 'mail/combined',
- 'label' => t('View your private mails')
- ],
- 'markall' => [
- 'label' => t('Mark all messages seen')
- ]
- ];
-
- $notifications[] = [
'type' => 'all_events',
'icon' => 'calendar',
'severity' => 'secondary',
- 'label' => t('New Events'),
- 'title' => t('New Events Notifications'),
+ 'label' => t('Events'),
+ 'title' => t('New events notifications'),
'viewall' => [
'url' => 'cdav/calendar',
'label' => t('View events')
@@ -102,7 +93,7 @@ class Notifications {
'icon' => 'users',
'severity' => 'danger',
'label' => t('New Connections'),
- 'title' => t('New Connections Notifications'),
+ 'title' => t('New connections notifications'),
'viewall' => [
'url' => 'connections',
'label' => t('View all connections')
@@ -113,8 +104,8 @@ class Notifications {
'type' => 'files',
'icon' => 'folder',
'severity' => 'danger',
- 'label' => t('New Files'),
- 'title' => t('New Files Notifications'),
+ 'label' => t('Files'),
+ 'title' => t('New files notifications'),
];
$notifications[] = [
@@ -149,8 +140,8 @@ class Notifications {
'type' => 'register',
'icon' => 'user-o',
'severity' => 'danger',
- 'label' => t('New Registrations'),
- 'title' => t('New Registrations Notifications'),
+ 'label' => t('Registrations'),
+ 'title' => t('New registrations notifications'),
];
}
@@ -160,10 +151,10 @@ class Notifications {
'icon' => 'globe',
'severity' => 'secondary',
'label' => t('Public Stream'),
- 'title' => t('Public Stream Notifications'),
+ 'title' => t('New public stream notifications'),
'viewall' => [
'url' => 'pubstream',
- 'label' => t('View the public stream')
+ 'label' => t('Public stream')
],
'markall' => [
'label' => t('Mark all notifications seen')
@@ -176,15 +167,13 @@ class Notifications {
}
$o = replace_macros(get_markup_template('notifications_widget.tpl'), [
- '$module' => \App::$module,
'$notifications' => $notifications,
'$no_notifications' => t('Sorry, you have got no notifications at the moment'),
'$loading' => t('Loading'),
- '$startpage' => ($channel ? $channel['channel_startpage'] : '')
]);
return $o;
}
}
-
+
diff --git a/Zotlabs/Widget/Permcats.php b/Zotlabs/Widget/Permcats.php
new file mode 100644
index 000000000..9226b3c71
--- /dev/null
+++ b/Zotlabs/Widget/Permcats.php
@@ -0,0 +1,103 @@
+<?php
+
+/**
+ * * Name: Contact roles
+ * * Description: Display a menu with all defined contact roles and contacts which are assigned to the selected role
+ * * Author: Mario Vavti
+ * * Requires: permcats
+ */
+
+namespace Zotlabs\Widget;
+
+use Zotlabs\Lib\Permcat;
+use Zotlabs\Access\PermissionLimits;
+
+class Permcats {
+
+ function widget($arr) {
+ $pcat = new Permcat(local_channel());
+ $pcatlist = $pcat->listing();
+
+ if (!$pcatlist) {
+ return;
+ }
+
+ $roles = [];
+ $active_role = '';
+
+ foreach($pcatlist as $pc) {
+ if (!$active_role) {
+ $active_role = ((argc() > 1 && $pc['name'] === hex2bin(argv(1))) ? $pc['name'] : '');
+ }
+ $roles[] = [
+ 'name' => $pc['localname'],
+ 'url' => z_root() . '/permcats/' . bin2hex($pc['name']),
+ 'active' => (argc() > 1 && $pc['name'] === hex2bin(argv(1)))
+ ];
+ }
+
+ if($active_role) {
+
+ $roles[] = [
+ 'name' => '<i class="fa fa-plus"></i>&nbsp;' . t('Add new role'),
+ 'url' => z_root() . '/permcats',
+ 'active' => ''
+ ];
+
+/* get role members based on permissions
+ $test = $pcatlist[$active]['perms'];
+
+ $role_sql = '';
+ $count = 0;
+ foreach ($test as $t) {
+ $checkinherited = PermissionLimits::Get(local_channel(),$t['name']);
+
+ if($checkinherited & PERMS_SPECIFIC) {
+ $role_sql .= "( abconfig.k = '" . dbesc($t['name']) . "' AND abconfig.v = '" . intval($t['value']) . "' ) OR ";
+ $count++;
+ }
+ }
+
+ $role_sql = rtrim($role_sql, ' OR ');
+
+ $r = q("SELECT abconfig.xchan, xchan.xchan_name, abook.abook_id FROM abconfig LEFT JOIN xchan on abconfig.xchan = xchan.xchan_hash LEFT JOIN abook ON abconfig.xchan = abook.abook_xchan WHERE xchan.xchan_deleted = 0 and abconfig.chan = %d AND abconfig.cat = 'my_perms' AND ( $role_sql ) GROUP BY abconfig.xchan HAVING count(abconfig.xchan) = %d ORDER BY xchan.xchan_name",
+ intval(local_channel()),
+ intval($count)
+ );
+*/
+
+ // get role members based on abook_role
+
+ $r = q("SELECT abook.abook_id, abook.abook_role, xchan.xchan_name, xchan.xchan_addr, xchan.xchan_url, xchan.xchan_photo_s FROM abook
+ LEFT JOIN xchan on abook.abook_xchan = xchan.xchan_hash
+ WHERE abook.abook_channel = %d AND abook.abook_role = '%s' AND abook_self = 0 AND xchan_deleted = 0
+ ORDER BY xchan.xchan_name",
+ intval(local_channel()),
+ dbesc($active_role)
+ );
+
+ $members = [];
+
+ foreach ($r as $rr) {
+ $members[] = [
+ 'name' => $rr['xchan_name'],
+ 'addr' => (($rr['xchan_addr']) ? $rr['xchan_addr'] : $rr['xchan_url']),
+ 'url' => z_root() . '/connections#' . $rr['abook_id'],
+ 'photo' => $rr['xchan_photo_s']
+ ];
+ }
+ }
+
+ $tpl = get_markup_template("permcats_widget.tpl");
+ $o .= replace_macros($tpl, [
+ '$roles_label' => t('Contact roles'),
+ '$members_label' => t('Role members'),
+ '$roles' => $roles,
+ '$members' => $members
+
+ ]);
+
+ return $o;
+
+ }
+}
diff --git a/Zotlabs/Widget/Photo.php b/Zotlabs/Widget/Photo.php
index 10031f028..5ad6c604c 100644
--- a/Zotlabs/Widget/Photo.php
+++ b/Zotlabs/Widget/Photo.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Photo
+ * * Description: Displays a single photo
+ */
+
+
namespace Zotlabs\Widget;
diff --git a/Zotlabs/Widget/Photo_albums.php b/Zotlabs/Widget/Photo_albums.php
index 6df8ddf3c..2ce916048 100644
--- a/Zotlabs/Widget/Photo_albums.php
+++ b/Zotlabs/Widget/Photo_albums.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Photo albums
+ * * Description: Displays a menu with links to existing photo albums
+ * * Requires: photos
+ */
+
namespace Zotlabs\Widget;
require_once('include/photos.php');
diff --git a/Zotlabs/Widget/Photo_rand.php b/Zotlabs/Widget/Photo_rand.php
index af80a3b9f..cfe026b19 100644
--- a/Zotlabs/Widget/Photo_rand.php
+++ b/Zotlabs/Widget/Photo_rand.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: Random photo
+ * * Description: Display a random photo
+ */
+
namespace Zotlabs\Widget;
require_once('include/photos.php');
@@ -40,15 +45,15 @@ class Photo_rand {
if(strpos($url, 'http') !== 0)
return '';
-
+
if(array_key_exists('style', $arr) && isset($arr['style']))
$style = $arr['style'];
-
+
// ensure they can't sneak in an eval(js) function
if(strpos($style,'(') !== false)
return '';
-
+
$url = zid($url);
$o = '<div class="widget">';
diff --git a/Zotlabs/Widget/Pinned.php b/Zotlabs/Widget/Pinned.php
index cad139a91..83036e98c 100644
--- a/Zotlabs/Widget/Pinned.php
+++ b/Zotlabs/Widget/Pinned.php
@@ -1,11 +1,14 @@
<?php
namespace Zotlabs\Widget;
-/*
- * Show pinned content
- *
+/**
+ * * Name: Pinned items
+ * * Description: Display pinned items
+ * * Author: Max Kostikov
+ * * Requires: disabled_for_pdledit_gui
*/
+
class Pinned {
private $allowed_types = 0;
@@ -40,15 +43,15 @@ class Pinned {
$observer = \App::get_observer();
foreach($items as $item) {
-
- $midb64 = 'b64.' . base64url_encode($item['mid']);
-
+
+ $midb64 = gen_link_id($item['mid']);
+
if(isset($observer['xchan_hash']) && in_array($observer['xchan_hash'], get_pconfig($item['uid'], 'pinned_hide', $midb64, [])))
continue;
-
+
$author = channelx_by_hash($item['author_xchan']);
$owner = channelx_by_hash($item['owner_xchan']);
-
+
$profile_avatar = $author['xchan_photo_m'];
$profile_link = chanlink_hash($item['author_xchan']);
$profile_name = $author['xchan_name'];
@@ -71,7 +74,7 @@ class Pinned {
$isevent = true;
}
}
-
+
$consensus = (intval($item['item_consensus']) ? true : false);
if($consensus) {
$conv_responses['agree'] = [ 'title' => t('Agree','title') ];
@@ -87,7 +90,7 @@ class Pinned {
$verified = (intval($item['item_verified']) ? t('Message signature validated') : '');
$forged = ((! intval($item['item_verified']) && $item['sig']) ? t('Message signature incorrect') : '');
-
+
$shareable = ((local_channel() && \App::$profile_uid == local_channel() && $item['item_private'] != 1) ? true : false);
if ($shareable) {
// This actually turns out not to be possible in some protocol stacks without opening up hundreds of new issues.
@@ -102,9 +105,9 @@ class Pinned {
$is_new = boolval(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0);
$body = prepare_body($item,true);
-
+
$str = [
- 'item_type' => intval($item['item_type']),
+ 'item_type' => intval($item['item_type']),
'body' => $body['html'],
'tags' => $body['tags'],
'categories' => $body['categories'],
@@ -115,7 +118,7 @@ class Pinned {
'id' => $item['id'],
'mids' => json_encode([ $midb64 ]),
'isevent' => $isevent,
- 'attend' => $attend,
+ 'attend' => $attend,
'consensus' => $consensus,
'conlabels' => ($canvote ? $conlabels : []),
'canvote' => $canvote,
@@ -158,55 +161,55 @@ class Pinned {
'modal_dismiss' => t('Close'),
'responses' => $conv_responses
];
-
- $tpl = get_markup_template('pinned_item.tpl');
+
+ $tpl = get_markup_template('pinned_item.tpl');
$ret['html'] .= replace_macros($tpl, $str);
}
return $ret;
}
-
+
/*
* @brief List pinned items depend on type
*
* @param $types
* @return array of pinned items
*
- */
+ */
private function list($types) {
if(empty($types) || (! is_array($types)))
return [];
-
+
$item_types = array_intersect($this->allowed_types, $types);
if(empty($item_types))
return [];
-
+
$mids_list = [];
-
+
foreach($item_types as $type) {
-
+
$mids = get_pconfig($this->uid, 'pinned', $type, []);
foreach($mids as $mid) {
- if(! empty($mid) && strpos($mid,'b64.') === 0)
- $mids_list[] = @base64url_decode(substr($mid,4));
+ if(!empty($mid))
+ $mids_list[] = unpack_link_id($mid);
}
}
if(empty($mids_list))
return [];
-
+
$r = q("SELECT * FROM item WHERE mid IN ( '%s' ) AND uid = %d AND id = parent AND item_private = 0 ORDER BY created DESC",
dbesc(implode(",", $mids_list)),
intval($this->uid)
);
if($r)
return $r;
-
+
return [];
}
-
+
/*
* @brief List activities on item
*
@@ -214,7 +217,7 @@ class Pinned {
* @param array $conv_responses
* @return array
*
- */
+ */
private function activity($item, &$conv_responses) {
foreach(array_keys($conv_responses) as $verb) {
@@ -256,23 +259,23 @@ class Pinned {
unset($conv_responses[$verb]);
continue;
}
-
+
$conv_responses[$verb]['count'] = count($r);
$conv_responses[$verb]['button'] = get_response_button_text($verb, $conv_responses[$verb]['count']);
-
+
foreach($r as $rr) {
-
+
$author = q("SELECT * FROM xchan WHERE xchan_hash = '%s' LIMIT 1",
dbesc($rr['author_xchan'])
);
$name = (($author && $author[0]['xchan_name']) ? $author[0]['xchan_name'] : t('Unknown'));
$conv_responses[$verb]['list'][] = (($rr['author_xchan'] && $author && $author[0]['xchan_photo_s']) ?
- '<a class="dropdown-item" href="' . chanlink_hash($rr['author_xchan']) . '">' . '<img class="menu-img-1" src="' . zid($author[0]['xchan_photo_s']) . '" alt="' . urlencode($name) . '" /> ' . $name . '</a>' :
+ '<a class="dropdown-item" href="' . chanlink_hash($rr['author_xchan']) . '">' . '<img class="menu-img-1" src="' . zid($author[0]['xchan_photo_s']) . '" alt="' . urlencode($name) . '" /> ' . $name . '</a>' :
'<a class="dropdown-item" href="#" class="disabled">' . $name . '</a>'
);
}
}
-
+
$conv_responses['count'] = count($conv_responses);
}
}
diff --git a/Zotlabs/Widget/Portfolio.php b/Zotlabs/Widget/Portfolio.php
index 0cd043246..a06f56e30 100644
--- a/Zotlabs/Widget/Portfolio.php
+++ b/Zotlabs/Widget/Portfolio.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Portfolio
+ * * Description: Display a photo album in a portfolio style
+ * * Requires: channel, articles, cards, wiki
+ */
+
namespace Zotlabs\Widget;
require_once('include/attach.php');
@@ -8,11 +14,9 @@ class Portfolio {
function widget($args) {
-
$owner_uid = \App::$profile_uid;
$sql_extra = permissions_sql($owner_uid);
-
if(! perm_is_allowed($owner_uid,get_observer_hash(),'view_storage'))
return '';
@@ -112,7 +116,7 @@ class Portfolio {
'$upload_form' => $upload_form,
'$usage' => $usage_message
));
-
+
return $o;
}
}
diff --git a/Zotlabs/Widget/Privacygroups.php b/Zotlabs/Widget/Privacygroups.php
new file mode 100644
index 000000000..62f343ea6
--- /dev/null
+++ b/Zotlabs/Widget/Privacygroups.php
@@ -0,0 +1,62 @@
+<?php
+
+/**
+ * * Name: Privacy Groups
+ * * Description: Display a menu with links to existing privacy groups
+ * * Requires: group
+ */
+
+
+namespace Zotlabs\Widget;
+
+use Zotlabs\Lib\AccessList;
+
+class Privacygroups {
+
+ function widget($arr) {
+
+ $o = '';
+
+ $groups = q("SELECT id, gname FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
+ intval(local_channel())
+ );
+
+ if (!$groups) {
+ return $o;
+ }
+
+ $menu_items = [];
+ $z_root = z_root();
+ $active = argv(1) ?? '';
+
+ foreach($groups as $group) {
+ $menu_items[] = [
+ 'href' => $z_root . '/group/' . $group['id'],
+ 'label' => $group['gname'],
+ 'title' => '',
+ 'active' => ($active === $group['id']),
+ 'count' => count(AccessList::members(local_channel(), $group['id']))
+ ];
+ }
+
+ if ($active) {
+ $menu_items[] = [
+ 'href' => $z_root . '/group',
+ 'label' => '<i class="fa fa-plus"></i> &nbsp;' . t('Add new group'),
+ 'title' => '',
+ 'active' => '',
+ 'count' => ''
+ ];
+ }
+
+ $tpl = get_markup_template("widget_menu_count.tpl");
+ $o .= replace_macros($tpl, [
+ '$title' => t('Privacy groups'),
+ '$menu_items' => $menu_items,
+
+ ]);
+
+ return $o;
+
+ }
+}
diff --git a/Zotlabs/Widget/Profile.php b/Zotlabs/Widget/Profile.php
index bffd910b6..a0bb1a66a 100644
--- a/Zotlabs/Widget/Profile.php
+++ b/Zotlabs/Widget/Profile.php
@@ -1,13 +1,24 @@
<?php
+/**
+ * * Name: Profile
+ * * Description: Your profile card
+ * * Requires: channel, articles, cards, wiki, cloud, photos
+ */
+
+
namespace Zotlabs\Widget;
+use App;
class Profile {
-
function widget($args) {
+ if(!App::$profile['profile_uid']) {
+ return;
+ }
+
$block = observer_prohibited();
- return profile_sidebar(\App::$profile, $block, true);
- }
-} \ No newline at end of file
+ return profile_sidebar(App::$profile, $block, true, false);
+ }
+}
diff --git a/Zotlabs/Widget/Pubsites.php b/Zotlabs/Widget/Pubsites.php
deleted file mode 100644
index 958ba68c2..000000000
--- a/Zotlabs/Widget/Pubsites.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-namespace Zotlabs\Widget;
-
-class Pubsites {
-
- // used by site ratings pages to provide a return link
-
- function widget($arr) {
- if(\App::$poi)
- return;
- return '<div class="widget"><ul class="nav nav-pills"><li><a href="pubsites">' . t('Public Hubs') . '</a></li></ul></div>';
- }
-}
-
-
diff --git a/Zotlabs/Widget/Pubtagcloud.php b/Zotlabs/Widget/Pubtagcloud.php
index 826e3e6ae..db7ea02e7 100644
--- a/Zotlabs/Widget/Pubtagcloud.php
+++ b/Zotlabs/Widget/Pubtagcloud.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: Public stream tags
+ * * Description: Display public stream tags in a cloud
+ */
+
namespace Zotlabs\Widget;
class Pubtagcloud {
diff --git a/Zotlabs/Widget/Random_block.php b/Zotlabs/Widget/Random_block.php
index 465a51f97..9052bea03 100644
--- a/Zotlabs/Widget/Random_block.php
+++ b/Zotlabs/Widget/Random_block.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: Random block
+ * * Description: Display a random block item
+ */
+
namespace Zotlabs\Widget;
class Random_block {
diff --git a/Zotlabs/Widget/Rating.php b/Zotlabs/Widget/Rating.php
index 5e09f457b..20c27ff1c 100644
--- a/Zotlabs/Widget/Rating.php
+++ b/Zotlabs/Widget/Rating.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Rating
+ * * Description: Deprecated rating tool
+ * * Requires: disabled_for_pdledit_gui
+ */
+
namespace Zotlabs\Widget;
class Rating {
diff --git a/Zotlabs/Widget/Savedsearch.php b/Zotlabs/Widget/Savedsearch.php
index 378c27139..660fd6d81 100644
--- a/Zotlabs/Widget/Savedsearch.php
+++ b/Zotlabs/Widget/Savedsearch.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Saved searches
+ * * Description: A search form which also displays saved searches if the feature is enabled
+ * * Requires: network
+ */
+
namespace Zotlabs\Widget;
class Savedsearch {
diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php
index 25b80a4b4..ef269d84b 100644
--- a/Zotlabs/Widget/Settings_menu.php
+++ b/Zotlabs/Widget/Settings_menu.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: Settings menu
+ * * Description: Display the channel settings menu
+ */
+
namespace Zotlabs\Widget;
class Settings_menu {
@@ -40,6 +45,11 @@ class Settings_menu {
'selected' => ((argv(1) === 'channel') ? 'active' : ''),
),
+ array(
+ 'label' => t('Privacy settings'),
+ 'url' => z_root().'/settings/privacy',
+ 'selected' => ((argv(1) === 'privacy') ? 'active' : '')
+ )
);
$tabs[] = array(
diff --git a/Zotlabs/Widget/Shortprofile.php b/Zotlabs/Widget/Shortprofile.php
deleted file mode 100644
index 9c2a46e75..000000000
--- a/Zotlabs/Widget/Shortprofile.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-namespace Zotlabs\Widget;
-
-class Shortprofile {
-
- function widget($arr) {
-
- if(! \App::$profile['profile_uid'])
- return;
-
- $block = observer_prohibited();
-
- return profile_sidebar(\App::$profile, $block, true, true);
- }
-
-}
-
diff --git a/Zotlabs/Widget/Sitesearch.php b/Zotlabs/Widget/Sitesearch.php
index b3a25d76a..a5f1a5935 100644
--- a/Zotlabs/Widget/Sitesearch.php
+++ b/Zotlabs/Widget/Sitesearch.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Search
+ * * Description: A search form
+ * * Requires: search, network, channel
+ */
+
namespace Zotlabs\Widget;
diff --git a/Zotlabs/Widget/Suggestedchats.php b/Zotlabs/Widget/Suggestedchats.php
index 7df42944d..75df0c9e6 100644
--- a/Zotlabs/Widget/Suggestedchats.php
+++ b/Zotlabs/Widget/Suggestedchats.php
@@ -1,14 +1,18 @@
<?php
+/**
+ * * Name: Suggested chats
+ * * Description: A menu with chatroom suggestions
+ * * Requires: disabled_due_to_reasons
+ */
+
+
namespace Zotlabs\Widget;
class Suggestedchats {
function widget($arr) {
- if(! feature_enabled(\App::$profile['profile_uid'],'ajaxchat'))
- return '';
-
// There are reports that this tool does not ever remove chatrooms on dead sites,
// and also will happily link to private chats which you cannot enter.
// For those reasons, it will be disabled until somebody decides it's worth
diff --git a/Zotlabs/Widget/Suggestions.php b/Zotlabs/Widget/Suggestions.php
index b4f384e9d..e7d23bda4 100644
--- a/Zotlabs/Widget/Suggestions.php
+++ b/Zotlabs/Widget/Suggestions.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: Suggestions
+ * * Description: Display suggestions for new contacts
+ */
+
namespace Zotlabs\Widget;
use Zotlabs\Lib\Apps;
@@ -12,7 +17,7 @@ class Suggestions {
function widget($arr) {
- if((! local_channel()) || (! Apps::system_app_installed(local_channel(), 'Suggest Channels')))
+ if(! local_channel())
return EMPTY_STR;
$r = suggestion_query(local_channel(),get_observer_hash(),0,20);
@@ -23,14 +28,14 @@ class Suggestions {
$arr = array();
- // Get two random entries from the top 20 returned.
+ // Get four random entries from the top 20 returned.
// We'll grab the first one and the one immediately following.
// This will throw some entropy intot he situation so you won't
// be looking at the same two mug shots every time the widget runs
- $index = ((count($r) > 2) ? mt_rand(0,count($r) - 2) : 0);
+ $index = ((count($r) > 4) ? mt_rand(0,count($r) - 4) : 0);
- for($x = $index; $x <= ($index+1); $x ++) {
+ for($x = $index; $x <= ($index+3); $x ++) {
$rr = $r[$x];
if(! $rr['xchan_url'])
break;
diff --git a/Zotlabs/Widget/Tagcloud.php b/Zotlabs/Widget/Tagcloud.php
index f79bd59ad..00456f24f 100644
--- a/Zotlabs/Widget/Tagcloud.php
+++ b/Zotlabs/Widget/Tagcloud.php
@@ -2,6 +2,11 @@
namespace Zotlabs\Widget;
+/**
+ * * Name: Tag cloud
+ * * Description: Display hashtags of your network items in a cloud
+ * * Requires: network, hq
+ */
class Tagcloud {
diff --git a/Zotlabs/Widget/Tagcloud_wall.php b/Zotlabs/Widget/Tagcloud_wall.php
index 7cff6ce09..20def4ab1 100644
--- a/Zotlabs/Widget/Tagcloud_wall.php
+++ b/Zotlabs/Widget/Tagcloud_wall.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Tag cloud wall
+ * * Description: Display hashtags of your channel wall items in a cloud if the feature is enabled
+ * * Requires: channel
+ */
+
namespace Zotlabs\Widget;
class Tagcloud_wall {
diff --git a/Zotlabs/Widget/Tasklist.php b/Zotlabs/Widget/Tasklist.php
index 56342bd17..5ecfd5a27 100644
--- a/Zotlabs/Widget/Tasklist.php
+++ b/Zotlabs/Widget/Tasklist.php
@@ -1,8 +1,11 @@
<?php
-namespace Zotlabs\Widget;
+/**
+ * * Name: Task list
+ * * Description: Simple task list mangager
+ */
-require_once('include/event.php');
+namespace Zotlabs\Widget;
class Tasklist {
@@ -20,7 +23,7 @@ class Tasklist {
}
</script>';
- $o .= '<div class="widget">' . '<h3>' . t('Tasks') . '</h3><div class="tasklist-tasks">';
+ $o .= '<div class="widget">' . '<h3>' . t('Tasks') . '</h3><div class="tasklist-tasks mb-1">';
$o .= '</div><form id="tasklist-new-form" action="" ><input class="form-control" id="tasklist-new-summary" type="text" name="summary" value="" /></form>';
$o .= '</div>';
return $o;
diff --git a/Zotlabs/Widget/Tokens.php b/Zotlabs/Widget/Tokens.php
new file mode 100644
index 000000000..69452d628
--- /dev/null
+++ b/Zotlabs/Widget/Tokens.php
@@ -0,0 +1,57 @@
+<?php
+
+/**
+ * * Name: Tokens
+ * * Description: Display a menu with links to existing guest access tokens
+ * * Requires: tokens
+ */
+
+namespace Zotlabs\Widget;
+
+class Tokens {
+
+ function widget($arr) {
+
+ $o = '';
+
+ $tokens = q("SELECT atoken_id, atoken_name FROM atoken WHERE atoken_uid = %d",
+ intval(local_channel())
+ );
+
+ if (!$tokens) {
+ return $o;
+ }
+
+ $menu_items = [];
+ $z_root = z_root();
+ $active = argv(1) ?? '';
+
+ foreach($tokens as $token) {
+ $menu_items[] = [
+ 'href' => $z_root . '/tokens/' . $token['atoken_id'],
+ 'label' => $token['atoken_name'],
+ 'title' => '',
+ 'active' => ($active === $token['atoken_id'])
+ ];
+ }
+
+ if ($active) {
+ $menu_items[] = [
+ 'href' => $z_root . '/tokens',
+ 'label' => '<i class="fa fa-plus"></i> &nbsp;' . t('Add new guest'),
+ 'title' => '',
+ 'active' => ''
+ ];
+ }
+
+ $tpl = get_markup_template("widget_menu.tpl");
+ $o .= replace_macros($tpl, [
+ '$title' => t('Guest access'),
+ '$menu_items' => $menu_items,
+
+ ]);
+
+ return $o;
+
+ }
+}
diff --git a/Zotlabs/Widget/Vcard.php b/Zotlabs/Widget/Vcard.php
index cab05dfdd..25bb8592c 100644
--- a/Zotlabs/Widget/Vcard.php
+++ b/Zotlabs/Widget/Vcard.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: Vcard
+ * * Description: Your default profile card
+ */
+
namespace Zotlabs\Widget;
class Vcard {
diff --git a/Zotlabs/Widget/Website_portation_tools.php b/Zotlabs/Widget/Website_portation_tools.php
index 1cf3bb78a..61fe48169 100644
--- a/Zotlabs/Widget/Website_portation_tools.php
+++ b/Zotlabs/Widget/Website_portation_tools.php
@@ -1,7 +1,12 @@
<?php
-namespace Zotlabs\Widget;
+/**
+ * * Name: Website import/export
+ * * Description: Tools to import and export websites
+ * * Requires: website
+ */
+namespace Zotlabs\Widget;
class Website_portation_tools {
diff --git a/Zotlabs/Widget/Wiki_list.php b/Zotlabs/Widget/Wiki_list.php
index 64c988ee7..217ab8706 100644
--- a/Zotlabs/Widget/Wiki_list.php
+++ b/Zotlabs/Widget/Wiki_list.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: Wiki list
+ * * Description: A list of existing wikis
+ */
+
namespace Zotlabs\Widget;
class Wiki_list {
diff --git a/Zotlabs/Widget/Wiki_page_history.php b/Zotlabs/Widget/Wiki_page_history.php
index dbb322dc3..3c9f5ed1a 100644
--- a/Zotlabs/Widget/Wiki_page_history.php
+++ b/Zotlabs/Widget/Wiki_page_history.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Wiki page history
+ * * Description: History of an existing wiki page
+ * * Requires: wiki
+ */
+
namespace Zotlabs\Widget;
class Wiki_page_history {
@@ -10,7 +16,7 @@ class Wiki_page_history {
$resource_id = ((array_key_exists('resource_id', $arr)) ? $arr['resource_id'] : '');
$pageHistory = \Zotlabs\Lib\NativeWikiPage::page_history([
- 'channel_id' => \App::$profile_uid,
+ 'channel_id' => \App::$profile_uid,
'observer_hash' => get_observer_hash(),
'resource_id' => $resource_id,
'pageUrlName' => $pageUrlName
diff --git a/Zotlabs/Widget/Wiki_pages.php b/Zotlabs/Widget/Wiki_pages.php
index dee0a2229..ece712334 100644
--- a/Zotlabs/Widget/Wiki_pages.php
+++ b/Zotlabs/Widget/Wiki_pages.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * * Name: Wiki pages
+ * * Description: A list of existing pages of a wiki
+ * * Requires: wiki
+ */
+
namespace Zotlabs\Widget;
use Zotlabs\Lib\NativeWiki;
@@ -34,7 +40,7 @@ class Wiki_pages {
'$addnew' => t('Add new page'),
'$typelock' => $typelock,
'$lockedtype' => $w['mimeType'],
- '$mimetype' => mimetype_select(0,$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'],
@@ -91,7 +97,7 @@ class Wiki_pages {
'$addnew' => t('Add new page'),
'$typelock' => $typelock,
'$lockedtype' => $w['mimeType'],
- '$mimetype' => mimetype_select(0,$w['mimeType'],
+ '$mimetype' => mimetype_select(0,$w['mimeType'],
[ 'text/markdown' => t('Markdown'), 'text/bbcode' => t('BBcode'), 'text/plain' => t('Text') ]),
'$pageName' => array('pageName', t('Page name')),
'$refresh' => $arr['refresh'],
diff --git a/Zotlabs/Widget/Zcard.php b/Zotlabs/Widget/Zcard.php
index 12e53eaab..35362c50e 100644
--- a/Zotlabs/Widget/Zcard.php
+++ b/Zotlabs/Widget/Zcard.php
@@ -1,5 +1,10 @@
<?php
+/**
+ * * Name: Zcard
+ * * Description: Your default profile card including your cover photo
+ */
+
namespace Zotlabs\Widget;
class Zcard {