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

This commit is contained in:
Brion Vibber 2011-02-07 12:20:12 -08:00
commit ac5e7b727a
3 changed files with 115 additions and 67 deletions

View File

@ -1090,3 +1090,10 @@ EndGroupActionsList: End the list of actions on a group profile page (before </u
- $action: action being executed (for output and params) - $action: action being executed (for output and params)
- $group: group for the page - $group: group for the page
StartGroupProfileElements: Start showing stuff about the group on its profile page
- $action: action being executed (for output and params)
- $group: group for the page
EndGroupProfileElements: Start showing stuff about the group on its profile page
- $action: action being executed (for output and params)
- $group: group for the page

View File

@ -181,6 +181,7 @@ class ShowgroupAction extends GroupDesignAction
function showContent() function showContent()
{ {
$this->showGroupProfile(); $this->showGroupProfile();
$this->showGroupActions();
$this->showGroupNotices(); $this->showGroupNotices();
} }
@ -216,88 +217,96 @@ class ShowgroupAction extends GroupDesignAction
$this->elementStart('div', array('id' => 'i', $this->elementStart('div', array('id' => 'i',
'class' => 'entity_profile vcard author')); 'class' => 'entity_profile vcard author'));
// TRANS: Group profile header (h2). Text hidden by default. if (Event::handle('StartGroupProfileElements', array($this, $this->group))) {
$this->element('h2', null, _('Group profile'));
$this->elementStart('dl', 'entity_depiction'); // TRANS: Group profile header (h2). Text hidden by default.
// TRANS: Label for group avatar (dt). Text hidden by default. $this->element('h2', null, _('Group profile'));
$this->element('dt', null, _('Avatar'));
$this->elementStart('dd');
$logo = ($this->group->homepage_logo) ? $this->elementStart('dl', 'entity_depiction');
$this->group->homepage_logo : User_group::defaultLogo(AVATAR_PROFILE_SIZE); // TRANS: Label for group avatar (dt). Text hidden by default.
$this->element('dt', null, _('Avatar'));
$this->element('img', array('src' => $logo,
'class' => 'photo avatar',
'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE,
'alt' => $this->group->nickname));
$this->elementEnd('dd');
$this->elementEnd('dl');
$this->elementStart('dl', 'entity_nickname');
// TRANS: Label for group nickname (dt). Text hidden by default.
$this->element('dt', null, _('Nickname'));
$this->elementStart('dd');
$hasFN = ($this->group->fullname) ? 'nickname url uid' : 'fn org nickname url uid';
$this->element('a', array('href' => $this->group->homeUrl(),
'rel' => 'me', 'class' => $hasFN),
$this->group->nickname);
$this->elementEnd('dd');
$this->elementEnd('dl');
if ($this->group->fullname) {
$this->elementStart('dl', 'entity_fn');
// TRANS: Label for full group name (dt). Text hidden by default.
$this->element('dt', null, _('Full name'));
$this->elementStart('dd'); $this->elementStart('dd');
$this->element('span', 'fn org', $this->group->fullname);
$logo = ($this->group->homepage_logo) ?
$this->group->homepage_logo : User_group::defaultLogo(AVATAR_PROFILE_SIZE);
$this->element('img', array('src' => $logo,
'class' => 'photo avatar',
'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE,
'alt' => $this->group->nickname));
$this->elementEnd('dd'); $this->elementEnd('dd');
$this->elementEnd('dl'); $this->elementEnd('dl');
}
if ($this->group->location) { $this->elementStart('dl', 'entity_nickname');
$this->elementStart('dl', 'entity_location'); // TRANS: Label for group nickname (dt). Text hidden by default.
// TRANS: Label for group location (dt). Text hidden by default. $this->element('dt', null, _('Nickname'));
$this->element('dt', null, _('Location'));
$this->element('dd', 'label', $this->group->location);
$this->elementEnd('dl');
}
if ($this->group->homepage) {
$this->elementStart('dl', 'entity_url');
// TRANS: Label for group URL (dt). Text hidden by default.
$this->element('dt', null, _('URL'));
$this->elementStart('dd'); $this->elementStart('dd');
$this->element('a', array('href' => $this->group->homepage, $hasFN = ($this->group->fullname) ? 'nickname url uid' : 'fn org nickname url uid';
'rel' => 'me', 'class' => 'url'), $this->element('a', array('href' => $this->group->homeUrl(),
$this->group->homepage); 'rel' => 'me', 'class' => $hasFN),
$this->group->nickname);
$this->elementEnd('dd'); $this->elementEnd('dd');
$this->elementEnd('dl'); $this->elementEnd('dl');
}
if ($this->group->description) { if ($this->group->fullname) {
$this->elementStart('dl', 'entity_note'); $this->elementStart('dl', 'entity_fn');
// TRANS: Label for group description or group note (dt). Text hidden by default. // TRANS: Label for full group name (dt). Text hidden by default.
$this->element('dt', null, _('Note')); $this->element('dt', null, _('Full name'));
$this->element('dd', 'note', $this->group->description); $this->elementStart('dd');
$this->elementEnd('dl'); $this->element('span', 'fn org', $this->group->fullname);
} $this->elementEnd('dd');
if (common_config('group', 'maxaliases') > 0) {
$aliases = $this->group->getAliases();
if (!empty($aliases)) {
$this->elementStart('dl', 'entity_aliases');
// TRANS: Label for group aliases (dt). Text hidden by default.
$this->element('dt', null, _('Aliases'));
$this->element('dd', 'aliases', implode(' ', $aliases));
$this->elementEnd('dl'); $this->elementEnd('dl');
} }
if ($this->group->location) {
$this->elementStart('dl', 'entity_location');
// TRANS: Label for group location (dt). Text hidden by default.
$this->element('dt', null, _('Location'));
$this->element('dd', 'label', $this->group->location);
$this->elementEnd('dl');
}
if ($this->group->homepage) {
$this->elementStart('dl', 'entity_url');
// TRANS: Label for group URL (dt). Text hidden by default.
$this->element('dt', null, _('URL'));
$this->elementStart('dd');
$this->element('a', array('href' => $this->group->homepage,
'rel' => 'me', 'class' => 'url'),
$this->group->homepage);
$this->elementEnd('dd');
$this->elementEnd('dl');
}
if ($this->group->description) {
$this->elementStart('dl', 'entity_note');
// TRANS: Label for group description or group note (dt). Text hidden by default.
$this->element('dt', null, _('Note'));
$this->element('dd', 'note', $this->group->description);
$this->elementEnd('dl');
}
if (common_config('group', 'maxaliases') > 0) {
$aliases = $this->group->getAliases();
if (!empty($aliases)) {
$this->elementStart('dl', 'entity_aliases');
// TRANS: Label for group aliases (dt). Text hidden by default.
$this->element('dt', null, _('Aliases'));
$this->element('dd', 'aliases', implode(' ', $aliases));
$this->elementEnd('dl');
}
}
Event::handle('EndGroupProfileElements', array($this, $this->group));
} }
$this->elementEnd('div'); $this->elementEnd('div');
}
function showGroupActions()
{
$cur = common_current_user(); $cur = common_current_user();
$this->elementStart('div', 'entity_actions'); $this->elementStart('div', 'entity_actions');
// TRANS: Group actions header (h2). Text hidden by default. // TRANS: Group actions header (h2). Text hidden by default.

View File

@ -460,6 +460,38 @@ class GroupPrivateMessagePlugin extends Plugin
return true; return true;
} }
/**
* Show an indicator that the group is (essentially) private on the group page
*
* @param Action $action The action being shown
* @param User_group $group The group being shown
*
* @return boolean hook value
*/
function onEndGroupProfileElements($action, $group)
{
$gps = Group_privacy_settings::forGroup($group);
if ($gps->allow_privacy == Group_privacy_settings::ALWAYS) {
$action->element('p', 'privategroupindicator', _('Private'));
}
return true;
}
function onStartShowExportData($action)
{
if ($action instanceof ShowgroupAction) {
$gps = Group_privacy_settings::forGroup($action->group);
if ($gps->allow_privacy == Group_privacy_settings::ALWAYS) {
return false;
}
}
return true;
}
function onPluginVersion(&$versions) function onPluginVersion(&$versions)
{ {
$versions[] = array('name' => 'GroupPrivateMessage', $versions[] = array('name' => 'GroupPrivateMessage',