* Author: Mike Macgirvin <mike@macgirvin.com>
* based on pages plugin by
* Author: Michael Vogel <ike@piratenpartei.de>
+ * Status: Unsupported
*
*/
}
-function forumlist_getpage($uid,$showhidden = true,$randomise = false) {
+function forumlist_getpage($uid,$showhidden = true,$randomise = false, $showprivate = false) {
$forumlist = array();
$order = (($showhidden) ? '' : " and hidden = 0 ");
- $order .= (($randomise) ? ' order by rand() ' : ' order by name asc ');
+ $order .= (($randomise) ? ' order by rand() ' : ' 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 `forum` = 1 AND `uid` = %d
+ WHERE `network`= 'dfrn' AND $select AND `uid` = %d
and blocked = 0 and hidden = 0 and pending = 0 and archive = 0
$order ",
intval($uid)
$forumlist .= '<div id="hide-forum-list" class="fakelink" onclick="openClose(\'forum-list\');" >'
. t('show/hide') . '</div>'
- . '<div id="forum-list" style="display: none;">';
+ . '<div role="menu" id="forum-list" style="display: none;">';
$randomise = intval(get_pconfig(local_user(),'forumlist','randomise'));
- $contacts = forumlist_getpage($a->user['uid'],true,$randomise);
+ $contacts = forumlist_getpage($a->user['uid'],true,$randomise, true);
if(count($contacts)) {
foreach($contacts as $contact) {
- $forumlist .= '<a href="' . $a->get_baseurl() . '/redir/' . $contact["id"] . '" title="' . $contact['url'] . '" class="label sparkle" target="external-link"><img class="forumlist-img" height="20" width="20" src="' . $contact['micro'] .'" alt="' . $contact['url'] . '" /></a> <a href="' . $a->get_baseurl() . '/network?f=&cid=' . $contact['id'] . '" >' . $contact["name"]."</a><br />";
+ $forumlist .= '<div role="menuitem"><a href="' . $a->get_baseurl() . '/redir/' . $contact["id"] . '" title="'.t('External link to forum').'" class="label sparkle" target="_blank"><img class="forumlist-img" height="20" width="20" src="' . $contact['micro'] .'" alt="'.t('External link to forum').'" /></a> <a href="' . $a->get_baseurl() . '/network?f=&cid=' . $contact['id'] . '" >' . $contact["name"]."</a></div>";
}
}
else {
$forumlist .= t('No forum subscriptions');
}
-
+
$forumlist .= "</div></div>";
if (sizeof($contacts) > 0)
$a->page['aside'] = $forumlist . $a->page['aside'];
$randomise = true;
- $contacts = forumlist_getpage($a->user['uid'],false,$randomise);
+ $contacts = forumlist_getpage($a->user['uid'],false,$randomise,false);
$total_shown = 0;
$more = false;
function forumlist_plugin_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'forumlist-settings-submit')))
return;
-
// set_pconfig(local_user(),'forumlist','max_forumlists',intval($_POST['forumlist_max_forumlists']));
set_pconfig(local_user(),'forumlist','randomise',intval($_POST['forumlist_random']));
set_pconfig(local_user(),'forumlist','show_on_profile',intval($_POST['forumlist_profile']));
$network = intval(get_pconfig(local_user(),'forumlist','show_on_network'));
$network_checked = (($network) ? ' checked="checked" ' : '');
-
-
+
+
/* Add some HTML to the existing form */
+ $s .= '<span id="settings_forumlist_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_forumlist_expanded\'); openClose(\'settings_forumlist_inflated\');">';
+ $s .= '<h3>' . t('Forumlist') . '</h3>';
+ $s .= '</span>';
+ $s .= '<div id="settings_forumlist_expanded" class="settings-block" style="display: none;">';
+ $s .= '<span class="fakelink" onclick="openClose(\'settings_forumlist_expanded\'); openClose(\'settings_forumlist_inflated\');">';
+ $s .= '<h3>' . t('Forumlist') . '</h3>';
+ $s .= '</span>';
- $s .= '<div class="settings-block">';
- $s .= '<h3>' . t('Forumlist Settings') . '</h3>';
$s .= '<div id="forumlist-settings-wrapper">';
$s .= '<label id="forumlist-random-label" for="forumlist-random">' . t('Randomise forum list') . '</label>';
$s .= '<input id="forumlist-random" type="checkbox" name="forumlist_random" value="1" ' . $randomise_checked . '/>';
/* provide a submit button */
- $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="forumlist-settings-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
+ $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="forumlist-settings-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';
}