diff options
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r-- | Zotlabs/Widget/Categories.php | 15 | ||||
-rw-r--r-- | Zotlabs/Widget/Common_friends.php | 19 | ||||
-rw-r--r-- | Zotlabs/Widget/Helpindex.php | 14 | ||||
-rw-r--r-- | Zotlabs/Widget/Notifications.php | 150 | ||||
-rw-r--r-- | Zotlabs/Widget/Wiki_pages.php | 9 |
5 files changed, 201 insertions, 6 deletions
diff --git a/Zotlabs/Widget/Categories.php b/Zotlabs/Widget/Categories.php index d1dcfda93..305869706 100644 --- a/Zotlabs/Widget/Categories.php +++ b/Zotlabs/Widget/Categories.php @@ -8,16 +8,25 @@ class Categories { function widget($arr) { + $cards = ((array_key_exists('cards',$arr) && $arr['cards']) ? true : false); + + if(($cards) && (! feature_enabled(\App::$profile['profile_uid'],'cards'))) + return ''; + if((! \App::$profile['profile_uid']) - || (! perm_is_allowed(\App::$profile['profile_uid'],get_observer_hash(),'view_stream'))) { + || (! perm_is_allowed(\App::$profile['profile_uid'],get_observer_hash(),(($cards) ? 'view_pages' : 'view_stream')))) { return ''; } $cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : ''); - $srchurl = \App::$query_string; + $srchurl = (($cards) ? \App::$argv[0] . '/' . \App::$argv[1] : \App::$query_string); $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&'); $srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl); - return categories_widget($srchurl, $cat); + if($cards) + return cardcategories_widget($srchurl, $cat); + else + return categories_widget($srchurl, $cat); + } } diff --git a/Zotlabs/Widget/Common_friends.php b/Zotlabs/Widget/Common_friends.php new file mode 100644 index 000000000..a67b9312c --- /dev/null +++ b/Zotlabs/Widget/Common_friends.php @@ -0,0 +1,19 @@ +<?php + +namespace Zotlabs\Widget; + +require_once('include/contact_widgets.php'); + +class Common_friends { + + function widget($arr) { + + if((! \App::$profile['profile_uid']) + || (! perm_is_allowed(\App::$profile['profile_uid'],get_observer_hash(),'view_contacts'))) { + return ''; + } + + return common_friends_visitor_widget(\App::$profile['profile_uid']); + + } +} diff --git a/Zotlabs/Widget/Helpindex.php b/Zotlabs/Widget/Helpindex.php index f23e73e75..6c8748194 100644 --- a/Zotlabs/Widget/Helpindex.php +++ b/Zotlabs/Widget/Helpindex.php @@ -9,14 +9,23 @@ class Helpindex { $o .= '<div class="widget">'; $level_0 = get_help_content('sitetoc'); - if(! $level_0) - $level_0 = get_help_content('toc'); + if(! $level_0) { + $path = 'toc'; + $x = determine_help_language(); + $lang = $x['language']; + if($lang !== 'en') { + $path = $lang . '/toc'; + } + $level_0 = get_help_content($path); + } $level_0 = preg_replace('/\<ul(.*?)\>/','<ul class="nav nav-pills flex-column">',$level_0); $levels = array(); + // TODO: Implement support for translations in hierarchical table of content files + /* if(argc() > 2) { $path = ''; for($x = 1; $x < argc(); $x ++) { @@ -28,6 +37,7 @@ class Helpindex { $levels[] = preg_replace('/\<ul(.*?)\>/','<ul class="nav nav-pills flex-column">',$y); } } + */ if($level_0) $o .= $level_0; diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php new file mode 100644 index 000000000..a857f1ad9 --- /dev/null +++ b/Zotlabs/Widget/Notifications.php @@ -0,0 +1,150 @@ +<?php + +namespace Zotlabs\Widget; + +class Notifications { + + function widget($arr) { + + $channel = \App::get_channel(); + + if(local_channel()) { + $notifications[] = [ + 'type' => 'network', + 'icon' => 'th', + 'severity' => 'secondary', + 'label' => t('New Network Activity'), + 'title' => t('New Network Activity Notifications'), + 'viewall' => [ + 'url' => 'network', + 'label' => t('View your network activity') + ], + 'markall' => [ + 'url' => '#', + 'label' => t('Mark all notifications read') + ] + ]; + + $notifications[] = [ + 'type' => 'home', + 'icon' => 'home', + 'severity' => 'danger', + 'label' => t('New Home Activity'), + 'title' => t('New Home Activity Notifications'), + 'viewall' => [ + 'url' => 'channel/' . $channel['channel_address'], + 'label' => t('View your home activity') + ], + 'markall' => [ + 'url' => '#', + 'label' => t('Mark all notifications seen') + ] + ]; + + $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' => [ + 'url' => '#', + 'label' => t('Mark all messages seen') + ] + ]; + + $notifications[] = [ + 'type' => 'all_events', + 'icon' => 'calendar', + 'severity' => 'secondary', + 'label' => t('New Events'), + 'title' => t('New Events Notifications'), + 'viewall' => [ + 'url' => 'mail/combined', + 'label' => t('View events') + ], + 'markall' => [ + 'url' => '#', + 'label' => t('Mark all events seen') + ] + ]; + + $notifications[] = [ + 'type' => 'intros', + 'icon' => 'users', + 'severity' => 'danger', + 'label' => t('New Connections'), + 'title' => t('New Connections Notifications'), + 'viewall' => [ + 'url' => 'connections', + 'label' => t('View all connections') + ] + ]; + + $notifications[] = [ + 'type' => 'files', + 'icon' => 'folder', + 'severity' => 'danger', + 'label' => t('New Files'), + 'title' => t('New Files Notifications'), + ]; + + $notifications[] = [ + 'type' => 'notify', + 'icon' => 'exclamation', + 'severity' => 'danger', + 'label' => t('Notices'), + 'title' => t('Notices'), + 'viewall' => [ + 'url' => 'notifications/system', + 'label' => t('View all notices') + ], + 'markall' => [ + 'url' => '#', + 'label' => t('Mark all notices seen') + ] + ]; + } + + if(local_channel() && is_site_admin()) { + $notifications[] = [ + 'type' => 'register', + 'icon' => 'user-o', + 'severity' => 'danger', + 'label' => t('New Registrations'), + 'title' => t('New Registrations Notifications'), + ]; + } + + if(get_config('system', 'disable_discover_tab') != 1) { + $notifications[] = [ + 'type' => 'pubs', + 'icon' => 'globe', + 'severity' => 'secondary', + 'label' => t('Public Stream'), + 'title' => t('Public Stream Notifications'), + 'viewall' => [ + 'url' => 'pubstream', + 'label' => t('View the public stream') + ], + 'markall' => [ + 'url' => '#', + 'label' => t('Mark all notifications seen') + ] + ]; + } + + $o = replace_macros(get_markup_template('notifications_widget.tpl'), array( + '$notifications' => $notifications, + '$loading' => t('Loading...') + )); + + return $o; + + } +} + diff --git a/Zotlabs/Widget/Wiki_pages.php b/Zotlabs/Widget/Wiki_pages.php index a07c348ff..6e3a22551 100644 --- a/Zotlabs/Widget/Wiki_pages.php +++ b/Zotlabs/Widget/Wiki_pages.php @@ -37,6 +37,7 @@ class Wiki_pages { if (!$wikiname) { $wikiname = ''; } + $typelock = $w['typelock']; } $can_create = perm_is_allowed(\App::$profile['uid'],get_observer_hash(),'write_wiki'); @@ -52,8 +53,14 @@ class Wiki_pages { '$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('pageName', t('Page name')), - '$refresh' => $arr['refresh'] + '$refresh' => $arr['refresh'], + '$options' => t('Options'), + '$submit' => t('Submit') )); } } |