diff --git a/actions/all.php b/actions/all.php index 5fd2475e49..a77d6014f4 100644 --- a/actions/all.php +++ b/actions/all.php @@ -183,6 +183,16 @@ class AllAction extends ProfileAction } } + function showSections() + { + $this->showSubscriptions(); + $ibs = new InviteButtonSection($this); + $ibs->show(); + $this->showSubscribers(); + $this->showGroups(); + $this->showLists(); + } + function showPageTitle() { $user = common_current_user(); diff --git a/actions/invite.php b/actions/invite.php index be2228e703..9522cac900 100644 --- a/actions/invite.php +++ b/actions/invite.php @@ -296,10 +296,4 @@ class InviteAction extends CurrentUserDesignAction mail_send($recipients, $headers, $body); } - - function showObjectNav() - { - $nav = new SubGroupNav($this, common_current_user()); - $nav->show(); - } } diff --git a/actions/public.php b/actions/public.php index 100f8d1194..d906d65501 100644 --- a/actions/public.php +++ b/actions/public.php @@ -222,14 +222,12 @@ class PublicAction extends Action function showSections() { - // $top = new TopPostersSection($this); - // $top->show(); $pop = new PopularNoticeSection($this); $pop->show(); + $ibs = new InviteButtonSection($this); + $ibs->show(); $gbp = new GroupsByMembersSection($this); $gbp->show(); - $ptp = new PeopletagsBySubsSection($this); - $ptp->show(); $feat = new FeaturedUsersSection($this); $feat->show(); } diff --git a/classes/Profile.php b/classes/Profile.php index 44ab210c15..b9c50905a7 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -1352,7 +1352,11 @@ class Profile extends Memcached_DataObject $lists = array(); foreach ($ids as $id) { - $lists[] = Profile_list::staticGet('id', $id); + $list = Profile_list::staticGet('id', $id); + if (!empty($list) && + ($showPrivate || !$list->private)) { + $lists[] = $list; + } } return new ArrayWrapper($lists); diff --git a/lib/groupsbymemberssection.php b/lib/groupsbymemberssection.php index 5cf1a563c0..4cb8ed46f0 100644 --- a/lib/groupsbymemberssection.php +++ b/lib/groupsbymemberssection.php @@ -68,7 +68,7 @@ class GroupsByMembersSection extends GroupSection function title() { // TRANS: Title for groups with the most members section. - return _('Groups with most members'); + return _('Popular groups'); } function divId() diff --git a/lib/groupsbypostssection.php b/lib/groupsbypostssection.php index 50d60e87cb..c338ab7e97 100644 --- a/lib/groupsbypostssection.php +++ b/lib/groupsbypostssection.php @@ -68,7 +68,7 @@ class GroupsByPostsSection extends GroupSection function title() { // TRANS: Title for groups with the most posts section. - return _('Groups with most posts'); + return _('Active groups'); } function divId() diff --git a/lib/invitebuttonsection.php b/lib/invitebuttonsection.php new file mode 100644 index 0000000000..4812e47880 --- /dev/null +++ b/lib/invitebuttonsection.php @@ -0,0 +1,63 @@ +. + * + * @category Section + * @package StatusNet + * @author Evan Prodromou + * @copyright 2011 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + // This check helps protect against security problems; + // your code file can't be executed directly from the web. + exit(1); +} + +/** + * Invite button + * + * @category Section + * @package StatusNet + * @author Evan Prodromou + * @copyright 2011 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +class InviteButtonSection extends Section +{ + function showTitle() + { + return false; + } + + function showContent() + { + $this->out->element('a', + array('href' => common_local_url('invite'), + 'class' => 'invite_button'), + _('Invite more colleagues')); + return false; + } +} \ No newline at end of file diff --git a/lib/profileaction.php b/lib/profileaction.php index 52c471909b..c919cb6bed 100644 --- a/lib/profileaction.php +++ b/lib/profileaction.php @@ -271,13 +271,6 @@ class ProfileAction extends OwnerDesignAction } } - if ($cnt > GROUPS_PER_MINILIST) { - $this->elementStart('p'); - // TRANS: Text for user group membership statistics if user has more subscriptions than displayed. - $this->statsSectionLink('usergroups', _('All groups'), 'more'); - $this->elementEnd('p'); - } - Event::handle('EndShowGroupsMiniList', array($this)); } $this->elementEnd('div'); @@ -285,7 +278,10 @@ class ProfileAction extends OwnerDesignAction function showLists() { - $lists = $this->profile->getLists(); + $cur = common_current_user(); + $showPrivate = (!empty($cur) && $cur->id == $this->profile->id); + + $lists = $this->profile->getLists($showPrivate); if ($lists->N > 0) { $this->elementStart('div', array('id' => 'entity_lists', @@ -293,38 +289,39 @@ class ProfileAction extends OwnerDesignAction if (Event::handle('StartShowListsMiniList', array($this))) { + $url = common_local_url('peopletagsbyuser', + array('nickname' => $this->profile->nickname)); + $this->elementStart('h2'); // TRANS: H2 text for user list membership statistics. - $this->statsSectionLink('userlists', _('Lists')); + $this->element('a', + array('href' => $url), + _('Lists')); $this->text(' '); $this->text($lists->N); $this->elementEnd('h2'); $this->elementStart('ul'); - $cur = common_current_user(); $first = true; while ($lists->fetch()) { - if (!$lists->private || - ($lists->private && !empty($cur) && $cur->id == $profile->id)) { - if (!empty($lists->mainpage)) { - $url = $lists->mainpage; - } else { - $url = common_local_url('showprofiletag', - array('tagger' => $this->profile->nickname, - 'tag' => $lists->tag)); - } - if (!$first) { - $this->text(', '); - } else { - $first = false; - } - - $this->element('a', array('href' => $url), - $lists->tag); + if (!empty($lists->mainpage)) { + $url = $lists->mainpage; + } else { + $url = common_local_url('showprofiletag', + array('tagger' => $this->profile->nickname, + 'tag' => $lists->tag)); } + if (!$first) { + $this->text(', '); + } else { + $first = false; + } + + $this->element('a', array('href' => $url), + $lists->tag); } $this->elementEnd('ul'); diff --git a/lib/section.php b/lib/section.php index d77673898a..2d8d6f3673 100644 --- a/lib/section.php +++ b/lib/section.php @@ -61,6 +61,19 @@ class Section extends Widget array('id' => $this->divId(), 'class' => 'section')); + $this->showTitle(); + + $have_more = $this->showContent(); + + if ($have_more) { + $this->showMore(); + } + + $this->out->elementEnd('div'); + } + + function showTitle() + { $link = $this->link(); if (!empty($link)) { $this->out->elementStart('h2'); @@ -70,18 +83,15 @@ class Section extends Widget $this->out->element('h2', null, $this->title()); } + } - $have_more = $this->showContent(); - - if ($have_more) { - $this->out->elementStart('p'); - $this->out->element('a', array('href' => $this->moreUrl(), - 'class' => 'more'), - $this->moreTitle()); - $this->out->elementEnd('p'); - } - - $this->out->elementEnd('div'); + function showMore() + { + $this->out->elementStart('p'); + $this->out->element('a', array('href' => $this->moreUrl(), + 'class' => 'more'), + $this->moreTitle()); + $this->out->elementEnd('p'); } function divId()