diff options
-rw-r--r-- | actions/subscribers.php | 92 | ||||
-rw-r--r-- | actions/subscriptions.php | 113 | ||||
-rw-r--r-- | actions/usergroups.php | 3 | ||||
-rw-r--r-- | lib/gallery.php | 346 | ||||
-rw-r--r-- | lib/galleryaction.php | 168 | ||||
-rw-r--r-- | lib/profilelist.php | 27 | ||||
-rw-r--r-- | lib/subgroupnav.php | 111 | ||||
-rw-r--r-- | theme/base/css/display.css | 84 |
8 files changed, 437 insertions, 507 deletions
diff --git a/actions/subscribers.php b/actions/subscribers.php index 31d0468d9..408829b54 100644 --- a/actions/subscribers.php +++ b/actions/subscribers.php @@ -1,9 +1,12 @@ <?php -/* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, Controlez-Vous, Inc. +/** + * Laconica, the distributed open-source microblogging tool * - * This program is free software: you can redistribute it and/or modify + * List a user's subscribers + * + * PHP version 5 + * + * LICENCE: This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. @@ -15,56 +18,85 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @category Social + * @package Laconica + * @author Evan Prodromou <evan@controlyourself.ca> + * @author Sarven Capadisli <csarven@controlyourself.ca> + * @copyright 2008-2009 Control Yourself, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('LACONICA')) { + exit(1); +} -require_once(INSTALLDIR.'/lib/gallery.php'); +/** + * List a user's subscribers + * + * @category Social + * @package Laconica + * @author Evan Prodromou <evan@controlyourself.ca> + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ class SubscribersAction extends GalleryAction { - - function gallery_type() + function title() { - return _('Subscribers'); + if ($this->page == 1) { + return sprintf(_('%s subscribers'), $this->user->nickname); + } else { + return sprintf(_('%s subscribers, page %d'), + $this->user->nickname, + $this->page); + } } - function get_instructions(&$profile) + function showPageNotice() { $user =& common_current_user(); - if ($user && ($user->id == $profile->id)) { - return _('These are the people who listen to your notices.'); + if ($user && ($user->id == $this->profile->id)) { + $this->element('p', null, + _('These are the people who listen to '. + 'your notices.')); } else { - return sprintf(_('These are the people who listen to %s\'s notices.'), $profile->nickname); + $this->element('p', null, + sprintf(_('These are the people who '. + 'listen to %s\'s notices.'), + $this->profile->nickname)); } } - function fields() + function showContent() { - return array('subscriber', 'subscribed'); - } + $offset = ($this->page-1) * PROFILES_PER_PAGE; + $limit = PROFILES_PER_PAGE + 1; - function div_class() - { - return 'subscribers'; - } + $subscribers = $this->user->getSubscribers($offset, $limit); - function get_other(&$subs) - { - return $subs->subscriber; - } + if ($subscribers) { + $subscribers_list = new SubscribersList($subscribers, $this->user, $this); + $subscribers_list->show(); + } - function profile_list_class() - { - return 'SubscribersList'; + $subscribers->free(); + + $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE, + $this->page, 'subscribers', + array('nickname' => $this->user->nickname)); } } class SubscribersList extends ProfileList { - function show_owner_controls($profile) + function showOwnerControls($profile) { - common_block_form($profile, array('action' => 'subscribers', - 'nickname' => $this->owner->nickname)); + $bf = new BlockForm($this->out, $profile, + array('action' => 'subscribers', + 'nickname' => $this->owner->nickname)); + $bf->show(); } } diff --git a/actions/subscriptions.php b/actions/subscriptions.php index 7a87a144f..8d1462d49 100644 --- a/actions/subscriptions.php +++ b/actions/subscriptions.php @@ -1,9 +1,12 @@ <?php -/* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, Controlez-Vous, Inc. +/** + * Laconica, the distributed open-source microblogging tool * - * This program is free software: you can redistribute it and/or modify + * List of a user's subscriptions + * + * PHP version 5 + * + * LICENCE: This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. @@ -15,73 +18,107 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @category Social + * @package Laconica + * @author Evan Prodromou <evan@controlyourself.ca> + * @author Sarven Capadisli <csarven@controlyourself.ca> + * @copyright 2008-2009 Control Yourself, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('LACONICA')) { + exit(1); +} -require_once(INSTALLDIR.'/lib/gallery.php'); +/** + * A list of the user's subscriptions + * + * @category Social + * @package Laconica + * @author Evan Prodromou <evan@controlyourself.ca> + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +if (!defined('LACONICA')) { exit(1); } class SubscriptionsAction extends GalleryAction { - - function gallery_type() + function title() { - return _('Subscriptions'); + if ($this->page == 1) { + return sprintf(_('%s subscriptions'), $this->user->nickname); + } else { + return sprintf(_('%s subscriptions, page %d'), + $this->user->nickname, + $this->page); + } } - function get_instructions(&$profile) + function showPageNotice() { $user =& common_current_user(); - if ($user && ($user->id == $profile->id)) { - return _('These are the people whose notices you listen to.'); + if ($user && ($user->id == $this->profile->id)) { + $this->element('p', null, + _('These are the people whose notices '. + 'you listen to.')); } else { - return sprintf(_('These are the people whose notices %s listens to.'), $profile->nickname); + $this->element('p', null, + sprintf(_('These are the people whose '. + 'notices %s listens to.'), + $this->profile->nickname)); } } - function fields() + function getAllTags() { - return array('subscribed', 'subscriber'); + return $this->getTags('subscribed', 'subscriber'); } - function div_class() + function showContent() { - return 'subscriptions'; - } + parent::showContent(); - function get_other(&$subs) - { - return $subs->subscribed; - } + $offset = ($this->page-1) * PROFILES_PER_PAGE; + $limit = PROFILES_PER_PAGE + 1; - function profile_list_class() - { - return 'SubscriptionsList'; + $subscriptions = $this->user->getSubscriptions($offset, $limit); + + if ($subscriptions) { + $subscriptions_list = new SubscriptionsList($subscriptions, $this->user, $this); + $subscriptions_list->show(); + } + + $subscriptions->free(); + + $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE, + $this->page, 'subscriptions', + array('nickname' => $this->user->nickname)); } } class SubscriptionsList extends ProfileList { - - function show_owner_controls($profile) + function showOwnerControls($profile) { - $sub = Subscription::pkeyGet(array('subscriber' => $this->owner->id, 'subscribed' => $profile->id)); if (!$sub) { return; } - $this->elementStart('form', array('id' => 'subedit-' . $profile->id, - 'method' => 'post', - 'class' => 'subedit', - 'action' => common_local_url('subedit'))); - $this->hidden('token', common_session_token()); - $this->hidden('profile', $profile->id); - $this->checkbox('jabber', _('Jabber'), $sub->jabber); - $this->checkbox('sms', _('SMS'), $sub->sms); - $this->submit('save', _('Save')); - $this->elementEnd('form'); + $this->out->elementStart('form', array('id' => 'subedit-' . $profile->id, + 'method' => 'post', + 'class' => 'subedit', + 'action' => common_local_url('subedit'))); + $this->out->hidden('token', common_session_token()); + $this->out->hidden('profile', $profile->id); + $this->out->checkbox('jabber', _('Jabber'), $sub->jabber); + $this->out->checkbox('sms', _('SMS'), $sub->sms); + $this->out->submit('save', _('Save')); + $this->out->elementEnd('form'); return; } } diff --git a/actions/usergroups.php b/actions/usergroups.php index 62ad3b3a2..f56f9c6b2 100644 --- a/actions/usergroups.php +++ b/actions/usergroups.php @@ -108,7 +108,8 @@ class UsergroupsAction extends Action function showLocalNav() { - // XXX: Add to the subscriptions tabset + $nav = new SubGroupNav($this, $this->user); + $nav->show(); } function showContent() diff --git a/lib/gallery.php b/lib/gallery.php deleted file mode 100644 index 34b58518c..000000000 --- a/lib/gallery.php +++ /dev/null @@ -1,346 +0,0 @@ -<?php -/** - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, Controlez-Vous, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -if (!defined('LACONICA')) { - exit(1); -} - -require_once INSTALLDIR.'/lib/profilelist.php'; - -// 10x8 - -define('AVATARS_PER_PAGE', 80); - -class GalleryAction extends Action -{ - function is_readonly() - { - return true; - } - - function handle($args) - { - parent::handle($args); - - // Post from the tag dropdown; redirect to a GET - - if ($_SERVER['REQUEST_METHOD'] == 'POST') { - common_redirect($this->self_url(), 307); - } - - $nickname = common_canonical_nickname($this->arg('nickname')); - - $user = User::staticGet('nickname', $nickname); - - if (!$user) { - $this->no_such_user(); - return; - } - - $profile = $user->getProfile(); - - if (!$profile) { - $this->server_error(_('User without matching profile in system.')); - return; - } - - $page = $this->arg('page'); - - if (!$page) { - $page = 1; - } - - $display = $this->arg('display'); - - if (!$display) { - $display = 'list'; - } - - $tag = $this->arg('tag'); - - common_show_header($profile->nickname . ": " . $this->gallery_type(), - null, $profile, - array($this, 'show_top')); - - $this->display_links($profile, $page, $display); - $this->show_tags_dropdown($profile); - - $this->show_gallery($profile, $page, $display, $tag); - common_show_footer(); - } - - function no_such_user() - { - $this->client_error(_('No such user.')); - } - - function show_tags_dropdown($profile) - { - $tag = $this->trimmed('tag'); - - list($lst, $usr) = $this->fields(); - - $tags = $this->get_all_tags($profile, $lst, $usr); - - $content = array(); - - foreach ($tags as $t) { - $content[$t] = $t; - } - if ($tags) { - common_element_start('dl', array('id'=>'filter_tags')); - common_element('dt', null, _('Filter tags')); - common_element_start('dd'); - common_element_start('ul'); - common_element_start('li', array('id' => 'filter_tags_all', - 'class' => 'child_1')); - common_element('a', - array('href' => - common_local_url($this->trimmed('action'), - array('nickname' => - $profile->nickname))), - _('All')); - common_element_end('li'); - common_element_start('li', array('id'=>'filter_tags_item')); - common_element_start('form', array('name' => 'bytag', - 'id' => 'bytag', - 'method' => 'post')); - common_dropdown('tag', _('Tag'), $content, - _('Choose a tag to narrow list'), false, $tag); - common_submit('go', _('Go')); - common_element_end('form'); - common_element_end('li'); - common_element_end('ul'); - common_element_end('dd'); - common_element_end('dl'); - } - } - - function show_top($profile) - { - common_element('div', 'instructions', - $this->get_instructions($profile)); - $this->show_menu(); - } - - function show_menu() - { - // action => array('prompt', 'title', $args) - $action = $this->trimmed('action'); - $nickname = $this->trimmed('nickname'); - - $menu = - array('subscriptions' => - array( _('Subscriptions'), - _('Subscriptions'), - array('nickname' => $nickname)), - 'subscribers' => - array( - _('Subscribers'), - _('Subscribers'), - array('nickname' => $nickname)), - ); - $this->nav_menu($menu); - } - - function show_gallery($profile, $page, $display='list', $tag=null) - { - $other = new Profile(); - - list($lst, $usr) = $this->fields(); - - $per_page = ($display == 'list') ? PROFILES_PER_PAGE : AVATARS_PER_PAGE; - - $offset = ($page-1)*$per_page; - $limit = $per_page + 1; - - if (common_config('db', 'type') == 'pgsql') { - $lim = ' LIMIT ' . $limit . ' OFFSET ' . $offset; - } else { - $lim = ' LIMIT ' . $offset . ', ' . $limit; - } - - // XXX: memcached results - // FIXME: SQL injection on $tag - - $other->query('SELECT profile.* ' . - 'FROM profile JOIN subscription ' . - 'ON profile.id = subscription.' . $lst . ' ' . - (($tag) ? 'JOIN profile_tag ON (profile.id = profile_tag.tagged AND subscription.'.$usr.'= profile_tag.tagger) ' : '') . - 'WHERE ' . $usr . ' = ' . $profile->id . ' ' . - 'AND subscriber != subscribed ' . - (($tag) ? 'AND profile_tag.tag= "' . $tag . '" ': '') . - 'ORDER BY subscription.created DESC, profile.id DESC ' . - $lim); - - if ($display == 'list') { - $cls = $this->profile_list_class(); - $profile_list = new $cls($other, $profile, $this->trimmed('action')); - $cnt = $profile_list->show_list(); - } else { - $cnt = $this->icon_list($other); - } - - // For building the pagination URLs - - $args = array('nickname' => $profile->nickname); - - if ($display != 'list') { - $args['display'] = $display; - } - - common_pagination($page > 1, - $cnt > $per_page, - $page, - $this->trimmed('action'), - $args); - } - - function profile_list_class() - { - return 'ProfileList'; - } - - function icon_list($other) - { - common_element_start('ul', $this->div_class()); - - $cnt = 0; - - while ($other->fetch()) { - - $cnt++; - - if ($cnt > AVATARS_PER_PAGE) { - break; - } - - common_element_start('li'); - - common_element_start('a', array('title' => ($other->fullname) ? - $other->fullname : - $other->nickname, - 'href' => $other->profileurl, - 'class' => 'subscription')); - $avatar = $other->getAvatar(AVATAR_STREAM_SIZE); - common_element('img', - array('src' => - (($avatar) ? common_avatar_display_url($avatar) : - common_default_avatar(AVATAR_STREAM_SIZE)), - 'width' => AVATAR_STREAM_SIZE, - 'height' => AVATAR_STREAM_SIZE, - 'class' => 'avatar stream', - 'alt' => ($other->fullname) ? - $other->fullname : - $other->nickname)); - common_element_end('a'); - - // XXX: subscribe form here - - common_element_end('li'); - } - - common_element_end('ul'); - - return $cnt; - } - - function gallery_type() - { - return null; - } - - function get_instructions(&$profile) - { - return null; - } - - function fields() - { - return null; - } - - function div_class() - { - return ''; - } - - function display_links($profile, $page, $display) - { - $tag = $this->trimmed('tag'); - - common_element_start('dl', array('id'=>'subscriptions_nav')); - common_element('dt', null, _('Subscriptions navigation')); - common_element_start('dd'); - common_element_start('ul', array('class'=>'nav')); - - switch ($display) { - case 'list': - common_element('li', array('class'=>'child_1'), _('List')); - common_element_start('li'); - $url_args = array('display' => 'icons', - 'nickname' => $profile->nickname, - 'page' => 1 + floor((($page - 1) * PROFILES_PER_PAGE) / AVATARS_PER_PAGE)); - if ($tag) { - $url_args['tag'] = $tag; - } - $url = common_local_url($this->trimmed('action'), $url_args); - common_element('a', array('href' => $url), - _('Icons')); - common_element_end('li'); - break; - default: - common_element_start('li', array('class'=>'child_1')); - $url_args = array('nickname' => $profile->nickname, - 'page' => 1 + floor((($page - 1) * AVATARS_PER_PAGE) / PROFILES_PER_PAGE)); - if ($tag) { - $url_args['tag'] = $tag; - } - $url = common_local_url($this->trimmed('action'), $url_args); - common_element('a', array('href' => $url), - _('List')); - common_element_end('li'); - common_element('li', null, _('Icons')); - break; - } - - common_element_end('ul'); - common_element_end('dd'); - common_element_end('dl'); - } - - // Get list of tags we tagged other users with - - function get_all_tags($profile, $lst, $usr) - { - $profile_tag = new Notice_tag(); - $profile_tag->query('SELECT DISTINCT(tag) ' . - 'FROM profile_tag, subscription ' . - 'WHERE tagger = ' . $profile->id . ' ' . - 'AND ' . $usr . ' = ' . $profile->id . ' ' . - 'AND ' . $lst . ' = tagged ' . - 'AND tagger != tagged'); - $tags = array(); - while ($profile_tag->fetch()) { - $tags[] = $profile_tag->tag; - } - $profile_tag->free(); - return $tags; - } -}
\ No newline at end of file diff --git a/lib/galleryaction.php b/lib/galleryaction.php new file mode 100644 index 000000000..a277762a6 --- /dev/null +++ b/lib/galleryaction.php @@ -0,0 +1,168 @@ +<?php +/** + * Laconica - a distributed open-source microblogging tool + * Copyright (C) 2008, Controlez-Vous, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +if (!defined('LACONICA')) { + exit(1); +} + +require_once INSTALLDIR.'/lib/profilelist.php'; + +// 10x8 + +define('AVATARS_PER_PAGE', 80); + +class GalleryAction extends Action +{ + var $profile = null; + var $user = null; + var $page = null; + + function prepare($args) + { + parent::prepare($args); + + // FIXME very similar code below + + $nickname_arg = $this->arg('nickname'); + $nickname = common_canonical_nickname($nickname_arg); + + // Permanent redirect on non-canonical nickname + + if ($nickname_arg != $nickname) { + $args = array('nickname' => $nickname); + if ($this->arg('page') && $this->arg('page') != 1) { + $args['page'] = $this->arg['page']; + } + common_redirect(common_local_url('subscriptions', $args), 301); + return false; + } + + $this->user = User::staticGet('nickname', $nickname); + + if (!$this->user) { + $this->clientError(_('No such user.'), 404); + return false; + } + + $this->profile = $this->user->getProfile(); + + if (!$this->profile) { + $this->serverError(_('User has no profile.')); + return false; + } + + $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; + + return true; + } + + function isReadOnly() + { + return true; + } + + function handle($args) + { + parent::handle($args); + + # Post from the tag dropdown; redirect to a GET + + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + common_redirect($this->self_url(), 307); + return; + } + + $this->showPage(); + } + + function showLocalNav() + { + $nav = new SubGroupNav($this, $this->user); + $nav->show(); + } + + function showContent() + { + $this->showTagsDropdown(); + } + + function showTagsDropdown() + { + $tag = $this->trimmed('tag'); + + $tags = $this->getAllTags(); + + $content = array(); + + foreach ($tags as $t) { + $content[$t] = $t; + } + if ($tags) { + $this->elementStart('dl', array('id'=>'filter_tags')); + $this->element('dt', null, _('Filter tags')); + $this->elementStart('dd'); + $this->elementStart('ul'); + $this->elementStart('li', array('id' => 'filter_tags_all', + 'class' => 'child_1')); + $this->element('a', + array('href' => + common_local_url($this->trimmed('action'), + array('nickname' => + $profile->nickname))), + _('All')); + $this->elementEnd('li'); + $this->elementStart('li', array('id'=>'filter_tags_item')); + $this->elementStart('form', array('name' => 'bytag', + 'id' => 'bytag', + 'method' => 'post')); + $this->dropdown('tag', _('Tag'), $content, + _('Choose a tag to narrow list'), false, $tag); + $this->submit('go', _('Go')); + $this->elementEnd('form'); + $this->elementEnd('li'); + $this->elementEnd('ul'); + $this->elementEnd('dd'); + $this->elementEnd('dl'); + } + } + + // Get list of tags we tagged other users with + + function getTags($lst, $usr) + { + $profile_tag = new Notice_tag(); + $profile_tag->query('SELECT DISTINCT(tag) ' . + 'FROM profile_tag, subscription ' . + 'WHERE tagger = ' . $this->profile->id . ' ' . + 'AND ' . $usr . ' = ' . $this->profile->id . ' ' . + 'AND ' . $lst . ' = tagged ' . + 'AND tagger != tagged'); + $tags = array(); + while ($profile_tag->fetch()) { + $tags[] = $profile_tag->tag; + } + $profile_tag->free(); + return $tags; + } + + function getAllTags() + { + return array(); + } +}
\ No newline at end of file diff --git a/lib/profilelist.php b/lib/profilelist.php index 73c129efe..a510c518c 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -92,25 +92,24 @@ class ProfileList extends Widget $user = common_current_user(); - $this->out->elementStart('div', 'entity_profile vcard'); $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE); $this->out->elementStart('a', array('href' => $this->profile->profileurl, 'class' => 'url')); $this->out->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE), - 'class' => 'photo avatar', - 'width' => AVATAR_STREAM_SIZE, - 'height' => AVATAR_STREAM_SIZE, - 'alt' => - ($this->profile->fullname) ? $this->profile->fullname : - $this->profile->nickname)); + 'class' => 'photo avatar', + 'width' => AVATAR_STREAM_SIZE, + 'height' => AVATAR_STREAM_SIZE, + 'alt' => + ($this->profile->fullname) ? $this->profile->fullname : + $this->profile->nickname)); $hasFN = ($this->profile->fullname) ? 'nickname' : 'fn nickname'; $this->out->elementStart('span', $hasFN); $this->out->raw($this->highlight($this->profile->nickname)); $this->out->elementEnd('span'); $this->out->elementEnd('a'); - + if ($this->profile->fullname) { $this->out->elementStart('dl', 'entity_fn'); $this->out->element('dt', null, 'Full name'); @@ -159,8 +158,8 @@ class ProfileList extends Widget $this->out->elementStart('dt'); if ($user->id == $this->owner->id) { $this->out->element('a', array('href' => common_local_url('tagother', - array('id' => $this->profile->id))), - _('Tags')); + array('id' => $this->profile->id))), + _('Tags')); } else { $this->out->text(_('Tags')); } @@ -172,10 +171,10 @@ class ProfileList extends Widget $this->out->elementStart('li'); $this->element('span', 'mark_hash', '#'); $this->out->element('a', array('rel' => 'tag', - 'href' => common_local_url($this->action, - array('nickname' => $this->owner->nickname, - 'tag' => $tag))), - $tag); + 'href' => common_local_url($this->action, + array('nickname' => $this->owner->nickname, + 'tag' => $tag))), + $tag); $this->out->elementEnd('li'); } $this->out->elementEnd('ul'); diff --git a/lib/subgroupnav.php b/lib/subgroupnav.php new file mode 100644 index 000000000..5fd8a72a2 --- /dev/null +++ b/lib/subgroupnav.php @@ -0,0 +1,111 @@ +<?php +/** + * Laconica, the distributed open-source microblogging tool + * + * Local navigation for subscriptions group of pages + * + * PHP version 5 + * + * LICENCE: This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @category Subs + * @package Laconica + * @author Evan Prodromou <evan@controlyourself.ca> + * @copyright 2008-2009 Control Yourself, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +if (!defined('LACONICA')) { + exit(1); +} + +require_once INSTALLDIR.'/lib/widget.php'; + +/** + * Local nav menu for subscriptions, subscribers + * + * @category Subs + * @package Laconica + * @author Evan Prodromou <evan@controlyourself.ca> + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +class SubGroupNav extends Widget +{ + var $action = null; + var $user = null; + + /** + * Construction + * + * @param Action $action current action, used for output + */ + + function __construct($action=null, $user=null) + { + parent::__construct($action); + $this->action = $action; + $this->user = $user; + } + + /** + * Show the menu + * + * @return void + */ + + function show() + { + $cur = common_current_user(); + $action = $this->action->trimmed('action'); + + $this->out->elementStart('ul', array('class' => 'nav')); + + $this->out->menuItem(common_local_url('subscriptions', + array('nickname' => + $this->user->nickname)), + _('Subscriptions'), + sprintf(_('People %s subscribes to'), + $this->user->nickname), + $action == 'subscriptions', + 'nav_subscriptions'); + $this->out->menuItem(common_local_url('subscribers', + array('nickname' => + $this->user->nickname)), + _('Subscribers'), + sprintf(_('People subscribed to %s'), + $this->user->nickname), + $action == 'subscribers', + 'nav_subscribers'); + $this->out->menuItem(common_local_url('usergroups', + array('nickname' => + $this->user->nickname)), + _('Groups'), + sprintf(_('Groups %s is a member of'), + $this->user->nickname), + $action == 'usergroups', + 'nav_usergroups'); + if ($this->user->id == $cur->id) { + $this->out->menuItem(common_local_url('invite'), + _('Invite'), + sprintf(_('Invite friends and colleagues to join you on %s'), + common_config('site', 'name')), + $action == 'invite', + 'nav_invite'); + } + $this->out->elementEnd('ul'); + } +} diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 91789f4f1..45affbaf6 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -36,7 +36,7 @@ font-weight:bold; } legend { -font-weight:bold; +font-weight:bold; font-size:1.3em; text-transform:uppercase; } @@ -99,9 +99,6 @@ display:none; margin-left:11px; } - - - /* FORM SETTINGS */ .form_settings fieldset { margin-bottom:29px; @@ -111,7 +108,6 @@ margin-bottom:29px; font-style:italic; } - .form_settings .form_data li { width:100%; float:left; @@ -179,7 +175,6 @@ width:90%; margin-left:0; } - .form_settings .form_note { border-radius:4px; -moz-border-radius:4px; @@ -187,13 +182,8 @@ border-radius:4px; padding:0 7px; } - - /* FORM SETTINGS */ - - - address { float:left; margin-bottom:18px; @@ -206,7 +196,6 @@ address .fn { font-weight:bold; } - #header { width:100%; position:relative; @@ -225,7 +214,6 @@ display:inline; margin-left:11px; } - .system_notice dt { font-weight:bold; text-transform:uppercase; @@ -244,17 +232,12 @@ clear:both; margin-bottom:18px; } - - - #footer { float:left; width:64%; padding:18px; } - - #site_nav_local_views { width:100%; float:left; @@ -286,7 +269,6 @@ float:left; width:100%; } - #site_nav_global_primary dt, #site_nav_global_secondary dt { display:none; @@ -315,8 +297,6 @@ padding-left:30px; padding-left:28px; } - - #export_data ul { display:inline; } @@ -329,8 +309,6 @@ margin-left:11px; margin-left:0; } - - #licenses { font-size:0.9em; } @@ -353,7 +331,6 @@ vertical-align:top; margin-right:4px; } - #wrap { float:left; margin:0 auto; @@ -361,7 +338,6 @@ margin-right:4px; width:71.714em; } - #core { position:relative; width:100%; @@ -396,9 +372,6 @@ border-radius:7px; -webkit-border-radius:7px; } - - - /*Start: FORM NOTICE*/ #form_notice { width:384px; @@ -501,10 +474,6 @@ float:left; /*end FORM NOTICE*/ - - - - /* entity_profile */ .entity_profile { position:relative; @@ -575,10 +544,6 @@ display:none; /* entity_profile */ - - - - /*entity_actions*/ .entity_actions { float:right; @@ -617,8 +582,6 @@ font-weight:bold; display:block; } - - .form_user_block input.submit, .form_user_unblock input.submit, #entity_send-a-message a, @@ -633,8 +596,6 @@ padding-left:20px; padding:4px 4px 4px 23px; } - - .entity_tags ul { list-style-type:none; } @@ -644,8 +605,6 @@ margin-right:1em; float:left; } - - .aside .section { margin-bottom:29px; clear:both; @@ -665,7 +624,6 @@ display:inline; content: ":"; } - #user_subscriptions, #user_subscribers, #user_groups, { @@ -692,8 +650,6 @@ display:none; clear:both; } - - .profile .entity_profile { margin-bottom:0; min-height:60px; @@ -708,7 +664,6 @@ float:right; display:none; } - .profiles { list-style-type:none; } @@ -730,8 +685,6 @@ display:block; width:auto; } - - /* NOTICE */ .notice, .profile { @@ -756,7 +709,6 @@ border-radius:4px; -webkit-border-radius:4px; } - /* NOTICES */ #notices_primary { float:left; @@ -773,7 +725,6 @@ display:block; padding-left:28px; } - .notice .author { margin-right:11px; } @@ -802,7 +753,6 @@ font-style:italic; } - .notice .entry-title { float:left; width:100%; @@ -875,8 +825,6 @@ text-transform:lowercase; .notice div.entry-content a:hover { } - - .notice-data { position:absolute; top:18px; @@ -966,10 +914,6 @@ padding:0; /*END: NOTICES */ - - - - .pagination dt { font-weight:bold; display:none; @@ -1010,11 +954,8 @@ padding-right:20px; border-right:0; } - /* END: NOTICE */ - - /*If there is hentry on #content_inner, then this doesn't need to be specific to #doc or any other section */ .hentry .entry-content p { margin-bottom:18px; @@ -1030,7 +971,6 @@ margin-bottom:18px; margin-left:18px; } - /*START: LOAD ALONG WITH JS*/ .notice .in-reply-to { width:98%; @@ -1046,8 +986,6 @@ background-color:#E4E9F0; background-color:#D1D9E4; } - - .entity_actions #user_subscribe .form_note, .entity_actions #user_subscribe .form_data, .entity_actions #user_subscribe .form_actions label { @@ -1079,8 +1017,6 @@ background-color:#fff; /*END: LOAD ALONG WITH JS*/ - - /* TOP_POSTERS */ #top-posters caption { text-align:left; @@ -1106,8 +1042,6 @@ height:24px; width:24px; } - - /* tagcloud */ .tag-cloud { list-style-type:none; @@ -1150,20 +1084,15 @@ font-size:4em; display:none; } - - - #form_settings_photo .form_data { clear:both; } - - #form_settings_avatar li { width:auto; } #form_settings_avatar input { -margin-left:0; +margin-left:0; } #avatar_original, #avatar_preview { @@ -1188,8 +1117,6 @@ clear:both; margin-bottom:0; } - - #groups_related ul, #users_featured ul { list-style-type:none; @@ -1223,8 +1150,6 @@ display:none; font-weight:bold; } - - #home.logged_out h1 { display:none; } @@ -1267,7 +1192,10 @@ font-weight:bold; text-align:center; } - #testimonials { clear:both; } + +.entity_tags dt { +display:block; +}
\ No newline at end of file |