// Post composition
'composition' => array(
t('Post Composition Features'),
- array('richtext', t('Richtext Editor'), t('Enable richtext editor')),
- array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them')),
+ array('richtext', t('Richtext Editor'), t('Enable richtext editor')),
+ array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them')),
array('aclautomention', t('Auto-mention Forums'), t('Add/remove mention when a fourm page is selected/deselected in ACL window.')),
),
// Network sidebar widgets
'widgets' => array(
t('Network Sidebar Widgets'),
- array('archives', t('Search by Date'), t('Ability to select posts by date ranges')),
- array('groups', t('Group Filter'), t('Enable widget to display Network posts only from selected group')),
- array('networks', t('Network Filter'), t('Enable widget to display Network posts only from selected network')),
- array('savedsearch', t('Saved Searches'), t('Save search terms for re-use')),
+ array('archives', t('Search by Date'), t('Ability to select posts by date ranges')),
+ array('forumlist', t('List Forums'), t('Enable widget to display the forums your are connected with')),
+ array('groups', t('Group Filter'), t('Enable widget to display Network posts only from selected group')),
+ array('networks', t('Network Filter'), t('Enable widget to display Network posts only from selected network')),
+ array('savedsearch', t('Saved Searches'), t('Save search terms for re-use')),
),
// Network tabs
'net_tabs' => array(
t('Network Tabs'),
- array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on')),
- array('new_tab', t('Network New Tab'), t('Enable tab to display only new Network posts (from the last 12 hours)')),
- array('link_tab', t('Network Shared Links Tab'), t('Enable tab to display only Network posts with links in them')),
+ array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on')),
+ array('new_tab', t('Network New Tab'), t('Enable tab to display only new Network posts (from the last 12 hours)')),
+ array('link_tab', t('Network Shared Links Tab'), t('Enable tab to display only Network posts with links in them')),
),
// Item tools
'tools' => array(
t('Post/Comment Tools'),
- array('multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once')),
- array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending')),
- array('commtag', t('Tagging'), t('Ability to tag existing posts')),
- array('categories', t('Post Categories'), t('Add categories to your posts')),
- array('filing', t('Saved Folders'), t('Ability to file posts under folders')),
- array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments')),
- array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator')),
- array('ignore_posts', t('Mute Post Notifications'), t('Ability to mute notifications for a thread')),
+ array('multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once')),
+ array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending')),
+ array('commtag', t('Tagging'), t('Ability to tag existing posts')),
+ array('categories', t('Post Categories'), t('Add categories to your posts')),
+ array('filing', t('Saved Folders'), t('Ability to file posts under folders')),
+ array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments')),
+ array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator')),
+ array('ignore_posts', t('Mute Post Notifications'), t('Ability to mute notifications for a thread')),
+ ),
+
+ // Advanced Profile Settings
+ 'advanced_profile' => array(
+ t('Advanced Profile Settings'),
+ array('forumlist_profile', t('List Forums'), t('Show visitors public community forums at the Advanced Profile Page')),
),
);
--- /dev/null
+<?php
+
+/**
+ * @file include/forums.php
+ * @brief functions related to forum functionality *
+ */
+
+
+/**
+ * @brief function to list all forums a user is connected with
+ *
+ * @param int $uid of the profile owner
+ * @param boolean $showhidden
+ * show frorums which are not hidden
+ * @param boolean $lastitem
+ * sort by lastitem
+ * @param boolean $showprivate
+ * show private groups
+ *
+ * @returns array
+ * 'url' => forum url
+ * 'name' => forum name
+ * 'id' => number of the key from the array
+ * 'micro' => contact photo in format micro
+ */
+function get_forumlist($uid, $showhidden = true, $lastitem, $showprivate = false) {
+
+ $forumlist = array();
+
+ $order = (($showhidden) ? '' : " AND `hidden` = 0 ");
+ $order .= (($lastitem) ? ' ORDER BY `last-item` ASC ' : ' ORDER BY `name` ASC ');
+ $select = "`forum` = 1";
+ if ($showprivate) {
+ $select = "( `forum` = 1 OR `prv` = 1 )";
+ }
+
+ $contacts = q("SELECT `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`micro` FROM contact
+ WHERE `network`= 'dfrn' AND $select AND `uid` = %d
+ AND `blocked` = 0 AND `hidden` = 0 AND `pending` = 0 AND `archive` = 0
+ $order ",
+ intval($uid)
+ );
+
+ foreach($contacts as $contact) {
+ $forumlist[] = array(
+ 'url' => $contact['url'],
+ 'name' => $contact['name'],
+ 'id' => $contact['id'],
+ 'micro' => $contact['micro'],
+ );
+ }
+ return($forumlist);
+}
+
+
+/*
+ * @brief forumlist widget
+ *
+ * Sidebar widget to show subcribed friendica forums. If activated
+ * in the settings, it appears at the notwork page sidebar
+ *
+ * @param App $a
+ * @return string
+ */
+function widget_forumlist($a) {
+
+ if(! intval(feature_enabled(local_user(),'forumlist')))
+ return;
+
+ $o = '';
+
+ //sort by last updated item
+ $lastitem = true;
+
+ $contacts = get_forumlist($a->user['uid'],true,$lastitem, true);
+ $total = count($contacts);
+ $visible_forums = 10;
+
+ if(count($contacts)) {
+
+ $id = 0;
+
+ foreach($contacts as $contact) {
+
+ $entry = array(
+ 'url' => $a->get_baseurl() . '/network?f=&cid=' . $contact['id'],
+ 'external_url' => $a->get_baseurl() . '/redir/' . $contact['id'],
+ 'name' => $contact['name'],
+ 'micro' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO),
+ 'id' => ++$id,
+ );
+ $entries[] = $entry;
+ }
+
+ $tpl = get_markup_template('widget_forumlist.tpl');
+
+ $o .= replace_macros($tpl,array(
+ '$title' => t("Forums"),
+ '$forums' => $entries,
+ '$link_desc' => t('External link to forum'),
+ '$total' => $total,
+ '$visible_forums' => $visible_forums,
+ '$showmore' => t('show more'),
+ ));
+ }
+
+ return $o;
+}
+
+/*
+ * @brief format forumlist as contact block
+ *
+ * This function is used to show the forumlist in
+ * the advanced profile.
+ *
+ * @param int $uid
+ * @return string
+ *
+ */
+function forumlist_profile_advanced($uid) {
+
+ $profile = intval(feature_enabled($uid,'forumlist_profile'));
+ if(! $profile)
+ return;
+
+ $o = '';
+
+ // place holder in case somebody wants configurability
+ $show_total = 9999;
+
+ //don't sort by last updated item
+ $lastitem = false;
+
+ $contacts = get_forumlist($uid,false,$lastitem,false);
+
+ $total_shown = 0;
+
+ foreach($contacts as $contact) {
+ $forumlist .= micropro($contact,false,'forumlist-profile-advanced');
+ $total_shown ++;
+ if($total_shown == $show_total)
+ break;
+ }
+
+ if(count($contacts) > 0)
+ $o .= $forumlist;
+ return $o;
+}
\ No newline at end of file
function advanced_profile(&$a) {
$o = '';
+ $uid = $a->profile['uid'];
$o .= replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => t('Profile')
if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt);
if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt );
+
+ //show subcribed forum if it is enabled in the usersettings
+ if (feature_enabled($uid,'forumlist_profile')) {
+ require_once('include/forums.php');
+ $show_forumlist = true;
+ $profile['forumlist'] = array( t('Forums:'), forumlist_profile_advanced($uid));
+ }
if ($a->profile['uid'] == local_user())
$profile['edit'] = array($a->get_baseurl(). '/profiles/'.$a->profile['id'], t('Edit profile'),"", t('Edit profile'));
require_once('include/group.php');
require_once('include/contact_widgets.php');
require_once('include/items.php');
+ require_once('include/forums.php');
if(! x($a->page,'aside'))
$a->page['aside'] = '';
}
$a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network',true,$group_id) : '');
+ $a->page['aside'] .= (feature_enabled(local_user(),'forumlist') ? widget_forumlist($a) : '');
$a->page['aside'] .= posted_date_widget($a->get_baseurl() . '/network',local_user(),false);
$a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
$a->page['aside'] .= saved_searches($search);
}
/* poke */
#poke-desc {
- margin: 5px 0 10px;
+ margin: 5px 0 10px;
}
#poke-wrapper {
- padding: 10px 0 0px;
+ padding: 10px 0 0px;
}
#poke-recipient, #poke-action, #poke-privacy-settings {
- margin: 10px 0 30px;
+ margin: 10px 0 30px;
}
#poke-recip-label, #poke-action-label, #prvmail-message-label {
- margin: 10px 0 10px;
+ margin: 10px 0 10px;
}
ul.credits {
- list-style: none;
+ list-style: none;
}
ul.credits li {
- float: left;
- width: 240px;
+ float: left;
+ width: 240px;
}
.contact-entry-photo img {
max-width: 80px;
max-height: 80px;
}
+
+/* forumlist widget */
+#hide-forum-list {
+ opacity: 0.3;
+ filter:alpha(opacity=30);
+}
+
+#hide-forum-list:hover {
+ opacity: 1.0;
+ filter:alpha(opacity=100);
+}
+
+
+#forumlist-settings-label, #forumlist-random-label, #forumlist-profile-label, #forumlist-network-label {
+ float: left;
+ width: 200px;
+ margin-bottom: 25px;
+}
+
+#forumlist-max-forumlists, #forumlist-random, #forumlist-profile, #forumlist-network {
+ float: left;
+}
+
+.forumlist-img {
+ height: 20px;
+ width: 20px;
+}
\ No newline at end of file
{{/if}}
+{{if $profile.forumlist}}
+<dl id="aprofile-forumlist" class="aprofile">
+ <dt>{{$profile.forumlist.0}}</dt>
+ <dd>{{$profile.forumlist.1}}</dd>
+</dl>
+{{/if}}
--- /dev/null
+<script>
+
+function showHideForumlist() {
+ if( $('#forum-widget-entry-extended').is(':visible')) {
+ $('#forum-widget-entry-extended').hide();
+ $('#forum-widget-collapse').html(window.showMore);
+
+ }
+ else {
+ $('#forum-widget-entry-extended').show();
+ $('#forum-widget-collapse').html(window.showFewer);
+ }
+ }
+</script>
+
+<div id="forumlist-sidebar" class="widget">
+ <h3 id="forumlist">{{$title}}</h3>
+
+ {{foreach $forums as $forum}}
+ {{if $forum.id <= $visible_forums}}
+ <div class="forum-widget-entry" id="forum-widget-entry role="menuitem">
+ <a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank">
+ <img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" />
+ </a>
+ <a class="forum-widget-link" id="forum-widget-link-{{$forum.id}}" href="{{$forum.url}}" >{{$forum.name}}</a>
+ </div>
+ {{/if}}
+
+ {{if $forum.id > $visible_forums}}
+ <div class="forum-widget-entry" id="forum-widget-entry-extended" role="menuitem" style="display: none;">
+ <a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank">
+ <img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" />
+ </a>
+ <a class="forum-widget-link" id="forum-widget-link-{{$forum.id}}" href="{{$forum.url}}" >{{$forum.name}}</a>
+ </div>
+ {{/if}}
+ {{/foreach}}
+
+ {{if $total > $visible_forums }}
+ <ul class="forum-widget-ul">
+ <li onclick="showHideForumlist(); return false;" id="forum-widget-collapse" class="fakelink tool">{{$showmore}}</li>
+ </ul>
+ {{/if}}
+
+</div>
\ No newline at end of file