Commit e26d3b0e authored by Zach Copley's avatar Zach Copley

Merge branch '1.0.x' of gitorious.org:statusnet/mainline into 1.0.x

* '1.0.x' of gitorious.org:statusnet/mainline:
  Issue #546: enable case-insensitive searching in MySQL
  remove more groupnav
  remove group nav
  shorter title for tag cloud section on groups
  remove group nav
  move pending queue to sidebar
  Move group logo edit from object nav to block actions
  Show blocked users from group in section
parents e565477e db9ac1a5
......@@ -122,12 +122,6 @@ class BlockedfromgroupAction extends GroupAction
_('A list of the users blocked from joining this group.'));
}
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();
}
function showContent()
{
$offset = ($this->page-1) * PROFILES_PER_PAGE;
......
......@@ -139,12 +139,6 @@ class EditgroupAction extends GroupAction
$this->showPage();
}
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();
}
function showContent()
{
$form = new GroupEditForm($this, $this->group);
......
......@@ -457,10 +457,4 @@ class GrouplogoAction extends GroupAction
$this->autofocus('avatarfile');
}
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();
}
}
......@@ -132,12 +132,6 @@ class GroupqueueAction extends GroupAction
_('A list of users awaiting approval to join this group.'));
}
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();
}
function showContent()
{
$offset = ($this->page-1) * PROFILES_PER_PAGE;
......
......@@ -92,7 +92,7 @@ class Notice extends Managed_DataObject
'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'),
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'who made the update'),
'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universally unique identifier, usually a tag URI'),
'content' => array('type' => 'text', 'description' => 'update content'),
'content' => array('type' => 'text', 'description' => 'update content', 'collate' => 'utf8_general_ci'),
'rendered' => array('type' => 'text', 'description' => 'HTML version of the content'),
'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL of any attachment (image, video, bookmark, whatever)'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
......
......@@ -55,12 +55,12 @@ class Profile extends Managed_DataObject
'description' => 'local and remote users have profiles',
'fields' => array(
'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'),
'nickname' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'nickname or username'),
'fullname' => array('type' => 'varchar', 'length' => 255, 'description' => 'display name'),
'nickname' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'nickname or username', 'collate' => 'utf8_general_ci'),
'fullname' => array('type' => 'varchar', 'length' => 255, 'description' => 'display name', 'collate' => 'utf8_general_ci'),
'profileurl' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL, cached so we dont regenerate'),
'homepage' => array('type' => 'varchar', 'length' => 255, 'description' => 'identifying URL'),
'bio' => array('type' => 'text', 'description' => 'descriptive biography'),
'location' => array('type' => 'varchar', 'length' => 255, 'description' => 'physical location'),
'homepage' => array('type' => 'varchar', 'length' => 255, 'description' => 'identifying URL', 'collate' => 'utf8_general_ci'),
'bio' => array('type' => 'text', 'description' => 'descriptive biography', 'collate' => 'utf8_general_ci'),
'location' => array('type' => 'varchar', 'length' => 255, 'description' => 'physical location', 'collate' => 'utf8_general_ci'),
'lat' => array('type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'latitude'),
'lon' => array('type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'longitude'),
'location_id' => array('type' => 'int', 'description' => 'location id if possible'),
......
......@@ -209,6 +209,26 @@ class User_group extends Managed_DataObject
return $member_count;
}
function getBlockedCount()
{
// XXX: WORM cache this
$block = new Group_block();
$block->group_id = $this->id;
return $block->count();
}
function getQueueCount()
{
// XXX: WORM cache this
$queue = new Group_join_queue();
$queue->group_id = $this->id;
return $queue->count();
}
function getAdmins($offset=0, $limit=null)
{
$qry =
......
......@@ -105,19 +105,6 @@ class GroupAction extends Action
$block->show();
}
/**
* Local menu
*
* @return void
*/
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();
}
/**
* Fill in the sidebar.
*
......@@ -126,6 +113,11 @@ class GroupAction extends Action
function showSections()
{
$this->showMembers();
$cur = common_current_user();
if ($cur && $cur->isAdmin($this->group)) {
$this->showPending();
$this->showBlocked();
}
$this->showAdmins();
$cloud = new GroupTagCloudSection($this, $this->group);
$cloud->show();
......@@ -184,6 +176,98 @@ class GroupAction extends Action
$this->elementEnd('div');
}
function showPending()
{
if ($this->group->join_policy != User_group::JOIN_POLICY_MODERATE) {
return;
}
$pending = $this->group->getQueueCount();
if (!$pending) {
return;
}
$request = $this->group->getRequests(0, MEMBERS_PER_SECTION);
if (!$request) {
return;
}
$this->elementStart('div', array('id' => 'entity_pending',
'class' => 'section'));
if (Event::handle('StartShowGroupPendingMiniList', array($this))) {
$this->elementStart('h2');
$this->element('a', array('href' => common_local_url('groupqueue', array('nickname' =>
$this->group->nickname))),
_('Pending'));
$this->text(' ');
$this->text($pending);
$this->elementEnd('h2');
$gmml = new ProfileMiniList($request, $this);
$gmml->show();
Event::handle('EndShowGroupPendingMiniList', array($this));
}
$this->elementEnd('div');
}
function showBlocked()
{
$blocked = $this->group->getBlocked(0, MEMBERS_PER_SECTION);
if (!$blocked) {
return;
}
$this->elementStart('div', array('id' => 'entity_blocked',
'class' => 'section'));
if (Event::handle('StartShowGroupBlockedMiniList', array($this))) {
$this->elementStart('h2');
$this->element('a', array('href' => common_local_url('blockedfromgroup', array('nickname' =>
$this->group->nickname))),
_('Blocked'));
$this->text(' ');
$this->text($this->group->getBlockedCount());
$this->elementEnd('h2');
$gmml = new GroupBlockedMiniList($blocked, $this);
$cnt = $gmml->show();
if ($cnt == 0) {
// TRANS: Description for mini list of group members on a group page when the group has no members.
$this->element('p', null, _('(None)'));
}
// @todo FIXME: Should be shown if a group has more than 27 members, but I do not see it displayed at
// for example http://identi.ca/group/statusnet. Broken?
if ($cnt > MEMBERS_PER_SECTION) {
$this->element('a', array('href' => common_local_url('blockedfromgroup',
array('nickname' => $this->group->nickname))),
// TRANS: Link to all group members from mini list of group members if group has more than n members.
_('All members'));
}
Event::handle('EndShowGroupBlockedMiniList', array($this));
}
$this->elementEnd('div');
}
/**
* Show list of admins
*
......@@ -263,6 +347,28 @@ class GroupMembersMiniListItem extends ProfileMiniListItem
}
}
class GroupBlockedMiniList extends ProfileMiniList
{
function newListItem($profile)
{
return new GroupBlockedMiniListItem($profile, $this->action);
}
}
class GroupBlockedMiniListItem extends ProfileMiniListItem
{
function linkAttributes()
{
$aAttrs = parent::linkAttributes();
if (common_config('nofollow', 'members')) {
$aAttrs['rel'] .= ' nofollow';
}
return $aAttrs;
}
}
class ThreadingGroupNoticeStream extends ThreadingNoticeStream
{
function __construct($group, $profile)
......
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Tabset for a particular group
*
* 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 Action
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Sarven Capadisli <csarven@status.net>
* @copyright 2008 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
require_once INSTALLDIR.'/lib/widget.php';
/**
* Tabset for a group
*
* Shows a group of tabs for a particular user group
*
* @category Output
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Sarven Capadisli <csarven@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*
* @see HTMLOutputter
*/
class GroupNav extends Menu
{
var $group = null;
/**
* Construction
*
* @param Action $action current action, used for output
*/
function __construct($action=null, $group=null)
{
parent::__construct($action);
$this->group = $group;
}
/**
* Show the menu
*
* @return void
*/
function show()
{
$action_name = $this->action->trimmed('action');
$nickname = $this->group->nickname;
$this->out->elementStart('ul', array('class' => 'nav'));
if (Event::handle('StartGroupGroupNav', array($this))) {
$cur = common_current_user();
if ($cur && $cur->isAdmin($this->group)) {
$pending = $this->countPendingMembers();
if ($pending || $this->group->join_policy == User_group::JOIN_POLICY_MODERATE) {
$this->out->menuItem(common_local_url('groupqueue', array('nickname' =>
$nickname)),
// TRANS: Menu item in the group navigation page. Only shown for group administrators.
// TRANS: %d is the number of pending members.
sprintf(_m('MENU','Pending members (%d)','Pending members (%d)',$pending), $pending),
// TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators.
// TRANS: %s is the nickname of the group.
sprintf(_m('TOOLTIP','%s pending members'), $nickname),
$action_name == 'groupqueue',
'nav_group_pending');
}
$this->out->menuItem(common_local_url('blockedfromgroup', array('nickname' =>
$nickname)),
// TRANS: Menu item in the group navigation page. Only shown for group administrators.
_m('MENU','Blocked'),
// TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators.
// TRANS: %s is the nickname of the group.
sprintf(_m('TOOLTIP','%s blocked users'), $nickname),
$action_name == 'blockedfromgroup',
'nav_group_blocked');
$this->out->menuItem(common_local_url('grouplogo', array('nickname' =>
$nickname)),
// TRANS: Menu item in the group navigation page. Only shown for group administrators.
_m('MENU','Logo'),
// TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators.
// TRANS: %s is the nickname of the group.
sprintf(_m('TOOLTIP','Add or edit %s logo'), $nickname),
$action_name == 'grouplogo',
'nav_group_logo');
}
Event::handle('EndGroupGroupNav', array($this));
}
$this->out->elementEnd('ul');
}
function countPendingMembers()
{
$req = new Group_join_queue();
$req->group_id = $this->group->id;
return $req->count();
}
}
......@@ -122,6 +122,15 @@ class GroupProfileBlock extends ProfileBlock
// TRANS: Link text for link on user profile.
_m('BUTTON','Edit'));
$this->out->elementEnd('li');
$this->out->elementStart('li', 'entity_edit');
$this->out->element('a', array('href' => common_local_url('grouplogo',
array('nickname' => $this->group->nickname)),
// TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators.
// TRANS: %s is the nickname of the group.
'title' => sprintf(_m('TOOLTIP','Add or edit %s logo'), $nickname)),
// TRANS: Link text for link on user profile.
_m('MENU','Logo'));
$this->out->elementEnd('li');
}
if ($cur && $cur->hasRight(Right::DELETEGROUP)) {
$this->out->elementStart('li', 'entity_delete');
......
......@@ -54,7 +54,7 @@ class GroupTagCloudSection extends TagCloudSection
{
// TRANS: Title for group tag cloud section.
// TRANS: %s is a group name.
return sprintf(_('Tags in %s group\'s notices'), $this->group->nickname);
return _('Tags');
}
function getTags()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment