Update translator documentation.
Whitespace updates. Header updates. Break long lines in README. Indentation updates.
This commit is contained in:
parent
b77531897a
commit
ea82086297
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
StatusNet Plugin: 0.9
|
* StatusNet Plugin: 0.9
|
||||||
Plugin Name: FirePHP
|
* Plugin Name: FirePHP
|
||||||
Description: Sends StatusNet log output to FirePHP
|
* Description: Sends StatusNet log output to FirePHP
|
||||||
Version: 0.1
|
* Version: 0.1
|
||||||
Author: Craig Andrews <candrews@integralblue.com>
|
* Author: Craig Andrews <candrews@integralblue.com>
|
||||||
Author URI: http://candrews.integralblue.com/
|
* Author URI: http://candrews.integralblue.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -65,6 +65,7 @@ class FirePHPPlugin extends Plugin
|
||||||
'author' => 'Craig Andrews',
|
'author' => 'Craig Andrews',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:FirePHP',
|
'homepage' => 'http://status.net/wiki/Plugin:FirePHP',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin description.
|
||||||
_m('The FirePHP plugin writes StatusNet\'s log output to FirePHP.'));
|
_m('The FirePHP plugin writes StatusNet\'s log output to FirePHP.'));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
The FirePHP plugin writes StatusNet's log output to FirePHP.
|
The FirePHP plugin writes StatusNet's log output to FirePHP.
|
||||||
|
|
||||||
Using FirePHP on production sites can expose sensitive information.
|
Using FirePHP on production sites can expose sensitive information.
|
||||||
You must protect the security of your application by disabling FirePHP
|
|
||||||
logging on your live site.
|
You must protect the security of your application by disabling FirePHP logging
|
||||||
|
on your live site!
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
|
@ -18,4 +19,3 @@ Example
|
||||||
=======
|
=======
|
||||||
|
|
||||||
addPlugin('FirePHP', array());
|
addPlugin('FirePHP', array());
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,6 @@ class FollowEveryonePlugin extends Plugin
|
||||||
* @param User &$newUser The new user
|
* @param User &$newUser The new user
|
||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function onEndUserRegister(&$newProfile, &$newUser)
|
function onEndUserRegister(&$newProfile, &$newUser)
|
||||||
{
|
{
|
||||||
|
@ -115,7 +114,6 @@ class FollowEveryonePlugin extends Plugin
|
||||||
$schema = Schema::get();
|
$schema = Schema::get();
|
||||||
|
|
||||||
// For storing user-submitted flags on profiles
|
// For storing user-submitted flags on profiles
|
||||||
|
|
||||||
$schema->ensureTable('user_followeveryone_prefs',
|
$schema->ensureTable('user_followeveryone_prefs',
|
||||||
array(new ColumnDef('user_id', 'integer', null,
|
array(new ColumnDef('user_id', 'integer', null,
|
||||||
true, 'PRI'),
|
true, 'PRI'),
|
||||||
|
@ -200,6 +198,7 @@ class FollowEveryonePlugin extends Plugin
|
||||||
'author' => 'Evan Prodromou',
|
'author' => 'Evan Prodromou',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:FollowEveryone',
|
'homepage' => 'http://status.net/wiki/Plugin:FollowEveryone',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin description.
|
||||||
_m('New users follow everyone at registration and are followed in return.'));
|
_m('New users follow everyone at registration and are followed in return.'));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,11 @@ class ForceGroupPlugin extends Plugin
|
||||||
* List by local nickname.
|
* List by local nickname.
|
||||||
*/
|
*/
|
||||||
public $post = array();
|
public $post = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* New user registrations will automatically join these groups on
|
* New user registrations will automatically join these groups on
|
||||||
* registration. They're not prevented from leaving, however.
|
* registration. They're not prevented from leaving, however.
|
||||||
*
|
*
|
||||||
* List by local nickname.
|
* List by local nickname.
|
||||||
*/
|
*/
|
||||||
public $join = array();
|
public $join = array();
|
||||||
|
|
|
@ -121,6 +121,7 @@ class GeoURLPlugin extends Plugin
|
||||||
'author' => 'Evan Prodromou',
|
'author' => 'Evan Prodromou',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:GeoURL',
|
'homepage' => 'http://status.net/wiki/Plugin:GeoURL',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin description.
|
||||||
_m('Ping <a href="http://geourl.org/">GeoURL</a> when '.
|
_m('Ping <a href="http://geourl.org/">GeoURL</a> when '.
|
||||||
'new geolocation-enhanced notices are posted.'));
|
'new geolocation-enhanced notices are posted.'));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -435,7 +435,8 @@ class GeonamesPlugin extends Plugin
|
||||||
function getGeonames($method, $params)
|
function getGeonames($method, $params)
|
||||||
{
|
{
|
||||||
if ($this->lastTimeout && (time() - $this->lastTimeout < $this->timeoutWindow)) {
|
if ($this->lastTimeout && (time() - $this->lastTimeout < $this->timeoutWindow)) {
|
||||||
throw new Exception("skipping due to recent web service timeout");
|
// TRANS: Exception thrown when a geo names service is not used because of a recent timeout.
|
||||||
|
throw new Exception(_m('Skipping due to recent web service timeout.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$client = HTTPClient::start();
|
$client = HTTPClient::start();
|
||||||
|
@ -451,13 +452,16 @@ class GeonamesPlugin extends Plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$result->isOk()) {
|
if (!$result->isOk()) {
|
||||||
throw new Exception("HTTP error code " . $result->getStatus());
|
// TRANS: Exception thrown when a geo names service does not return an expected response.
|
||||||
|
// TRANS: %s is an HTTP error code.
|
||||||
|
throw new Exception(sprintf(_m('HTTP error code %s.'),$result->getStatus()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$body = $result->getBody();
|
$body = $result->getBody();
|
||||||
|
|
||||||
if (empty($body)) {
|
if (empty($body)) {
|
||||||
throw new Exception("Empty HTTP body in response");
|
// TRANS: Exception thrown when a geo names service returns an empty body.
|
||||||
|
throw new Exception(_m('Empty HTTP body in response.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will throw an exception if the XML is mal-formed
|
// This will throw an exception if the XML is mal-formed
|
||||||
|
@ -473,7 +477,9 @@ class GeonamesPlugin extends Plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($document->status)) {
|
if (isset($document->status)) {
|
||||||
throw new Exception("Error #".$document->status['value']." ('".$document->status['message']."')");
|
// TRANS: Exception thrown when a geo names service return a specific error number and error text.
|
||||||
|
// TRANS: %1$s is an error code, %2$s is an error message.
|
||||||
|
throw new Exception(sprintf(_m('Error #%1$s ("%2$s").'),$document->status['value'],$document->status['message']));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Array of elements, >0 elements
|
// Array of elements, >0 elements
|
||||||
|
@ -488,6 +494,7 @@ class GeonamesPlugin extends Plugin
|
||||||
'author' => 'Evan Prodromou',
|
'author' => 'Evan Prodromou',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:Geonames',
|
'homepage' => 'http://status.net/wiki/Plugin:Geonames',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin description.
|
||||||
_m('Uses <a href="http://geonames.org/">Geonames</a> service to get human-readable '.
|
_m('Uses <a href="http://geonames.org/">Geonames</a> service to get human-readable '.
|
||||||
'names for locations based on user-provided lat/long pairs.'));
|
'names for locations based on user-provided lat/long pairs.'));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -77,6 +77,7 @@ class GoogleAnalyticsPlugin extends Plugin
|
||||||
'author' => 'Evan Prodromou',
|
'author' => 'Evan Prodromou',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:GoogleAnalytics',
|
'homepage' => 'http://status.net/wiki/Plugin:GoogleAnalytics',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin description.
|
||||||
_m('Use <a href="http://www.google.com/analytics/">Google Analytics</a>'.
|
_m('Use <a href="http://www.google.com/analytics/">Google Analytics</a>'.
|
||||||
' to track web access.'));
|
' to track web access.'));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -57,15 +57,18 @@ class GravatarPlugin extends Plugin
|
||||||
'action' =>
|
'action' =>
|
||||||
common_local_url('avatarsettings')));
|
common_local_url('avatarsettings')));
|
||||||
$action->elementStart('fieldset', array('id' => 'settings_gravatar_add'));
|
$action->elementStart('fieldset', array('id' => 'settings_gravatar_add'));
|
||||||
|
// TRANS: Fieldset legend. Gravatar is an avatar service.
|
||||||
$action->element('legend', null, _m('Set Gravatar'));
|
$action->element('legend', null, _m('Set Gravatar'));
|
||||||
$action->hidden('token', common_session_token());
|
$action->hidden('token', common_session_token());
|
||||||
$action->element('p', 'form_guide',
|
$action->element('p', 'form_guide',
|
||||||
|
// TRANS: Form guide. Gravatar is an avatar service.
|
||||||
_m('If you want to use your Gravatar image, click "Add".'));
|
_m('If you want to use your Gravatar image, click "Add".'));
|
||||||
$action->element('input', array('type' => 'submit',
|
$action->element('input', array('type' => 'submit',
|
||||||
'id' => 'settings_gravatar_add_action-submit',
|
'id' => 'settings_gravatar_add_action-submit',
|
||||||
'name' => 'add',
|
'name' => 'add',
|
||||||
'class' => 'submit',
|
'class' => 'submit',
|
||||||
'value' => _m('Add')));
|
// TRANS: Button text to add a Gravatar. Gravatar is an avatar service.
|
||||||
|
'value' => _m('BUTTON','Add')));
|
||||||
$action->elementEnd('fieldset');
|
$action->elementEnd('fieldset');
|
||||||
$action->elementEnd('form');
|
$action->elementEnd('form');
|
||||||
} elseif($hasGravatar) {
|
} elseif($hasGravatar) {
|
||||||
|
@ -75,19 +78,23 @@ class GravatarPlugin extends Plugin
|
||||||
'action' =>
|
'action' =>
|
||||||
common_local_url('avatarsettings')));
|
common_local_url('avatarsettings')));
|
||||||
$action->elementStart('fieldset', array('id' => 'settings_gravatar_remove'));
|
$action->elementStart('fieldset', array('id' => 'settings_gravatar_remove'));
|
||||||
|
// TRANS: Fieldset legend. Gravatar is an avatar service.
|
||||||
$action->element('legend', null, _m('Remove Gravatar'));
|
$action->element('legend', null, _m('Remove Gravatar'));
|
||||||
$action->hidden('token', common_session_token());
|
$action->hidden('token', common_session_token());
|
||||||
$action->element('p', 'form_guide',
|
$action->element('p', 'form_guide',
|
||||||
|
// TRANS: Form guide. Gravatar is an avatar service.
|
||||||
_m('If you want to remove your Gravatar image, click "Remove".'));
|
_m('If you want to remove your Gravatar image, click "Remove".'));
|
||||||
$action->element('input', array('type' => 'submit',
|
$action->element('input', array('type' => 'submit',
|
||||||
'id' => 'settings_gravatar_remove_action-submit',
|
'id' => 'settings_gravatar_remove_action-submit',
|
||||||
'name' => 'remove',
|
'name' => 'remove',
|
||||||
'class' => 'submit',
|
'class' => 'submit',
|
||||||
|
// TRANS: Button text to remove a Gravatar. Gravatar is an avatar service.
|
||||||
'value' => _m('Remove')));
|
'value' => _m('Remove')));
|
||||||
$action->elementEnd('fieldset');
|
$action->elementEnd('fieldset');
|
||||||
$action->elementEnd('form');
|
$action->elementEnd('form');
|
||||||
} else {
|
} else {
|
||||||
$action->element('p', 'form_guide',
|
$action->element('p', 'form_guide',
|
||||||
|
// TRANS: Form guide. Gravatar is an avatar service.
|
||||||
_m('To use a Gravatar first enter in an email address.'));
|
_m('To use a Gravatar first enter in an email address.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,6 +144,7 @@ class GravatarPlugin extends Plugin
|
||||||
$cur = common_current_user();
|
$cur = common_current_user();
|
||||||
|
|
||||||
if(empty($cur->email)) {
|
if(empty($cur->email)) {
|
||||||
|
// TRANS: Message displayed when no e-mail address was set when saving Gravatar setting. Gravatar is an avatar service.
|
||||||
return array('message' => _m('You do not have an email address set in your profile.'),
|
return array('message' => _m('You do not have an email address set in your profile.'),
|
||||||
'success' => false);
|
'success' => false);
|
||||||
}
|
}
|
||||||
|
@ -155,10 +163,12 @@ class GravatarPlugin extends Plugin
|
||||||
$gravatar->created = DB_DataObject_Cast::dateTime(); # current time
|
$gravatar->created = DB_DataObject_Cast::dateTime(); # current time
|
||||||
|
|
||||||
if (!$gravatar->insert()) {
|
if (!$gravatar->insert()) {
|
||||||
|
// TRANS: Message displayed when saving Gravatar setting fails. Gravatar is an avatar service.
|
||||||
return array('message' => _m('Failed to save Gravatar to the database.'),
|
return array('message' => _m('Failed to save Gravatar to the database.'),
|
||||||
'success' => false);
|
'success' => false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TRANS: Message displayed when Gravatar was added. Gravatar is an avatar service.
|
||||||
return array('message' => _m('Gravatar added.'),
|
return array('message' => _m('Gravatar added.'),
|
||||||
'success' => true);
|
'success' => true);
|
||||||
}
|
}
|
||||||
|
@ -177,6 +187,7 @@ class GravatarPlugin extends Plugin
|
||||||
$avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
|
$avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
|
||||||
if($avatar) $avatar->delete();
|
if($avatar) $avatar->delete();
|
||||||
|
|
||||||
|
// TRANS: Message displayed when Gravatar was removed. Gravatar is an avatar service.
|
||||||
return array('message' => _m('Gravatar removed.'),
|
return array('message' => _m('Gravatar removed.'),
|
||||||
'success' => true);
|
'success' => true);
|
||||||
}
|
}
|
||||||
|
@ -197,6 +208,7 @@ class GravatarPlugin extends Plugin
|
||||||
'author' => 'Eric Helgeson',
|
'author' => 'Eric Helgeson',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:Gravatar',
|
'homepage' => 'http://status.net/wiki/Plugin:Gravatar',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin decsription.
|
||||||
_m('The Gravatar plugin allows users to use their <a href="http://www.gravatar.com/">Gravatar</a> with StatusNet.'));
|
_m('The Gravatar plugin allows users to use their <a href="http://www.gravatar.com/">Gravatar</a> with StatusNet.'));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
GravatarPlugin 0.1
|
GravatarPlugin 0.1
|
||||||
|
|
||||||
About
|
About:
|
||||||
This will allow users to use their Gravatar Avatar with your StatusNet install.
|
This will allow users to use their Gravatar Avatar with your StatusNet install.
|
||||||
|
|
||||||
Configuration
|
Configuration:
|
||||||
add this to your config.php:
|
add this to your config.php:
|
||||||
addPlugin('Gravatar', array());
|
addPlugin('Gravatar', array());
|
||||||
|
|
||||||
ToDo:
|
To do:
|
||||||
Site default all on for gravatar by default
|
Site default all on for gravatar by default
|
||||||
Migration Script
|
Migration Script
|
||||||
Localize
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class GroupPrivateMessagePlugin extends Plugin
|
class GroupPrivateMessagePlugin extends Plugin
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +56,6 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onCheckSchema()
|
function onCheckSchema()
|
||||||
{
|
{
|
||||||
$schema = Schema::get();
|
$schema = Schema::get();
|
||||||
|
@ -78,7 +76,7 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
'datetime'),
|
'datetime'),
|
||||||
new ColumnDef('modified',
|
new ColumnDef('modified',
|
||||||
'timestamp')));
|
'timestamp')));
|
||||||
|
|
||||||
$schema->ensureTable('group_message',
|
$schema->ensureTable('group_message',
|
||||||
array(new ColumnDef('id',
|
array(new ColumnDef('id',
|
||||||
'char',
|
'char',
|
||||||
|
@ -136,7 +134,6 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onAutoload($cls)
|
function onAutoload($cls)
|
||||||
{
|
{
|
||||||
$dir = dirname(__FILE__);
|
$dir = dirname(__FILE__);
|
||||||
|
@ -171,7 +168,6 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onRouterInitialized($m)
|
function onRouterInitialized($m)
|
||||||
{
|
{
|
||||||
$m->connect('group/:nickname/inbox',
|
$m->connect('group/:nickname/inbox',
|
||||||
|
@ -199,7 +195,6 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
*
|
*
|
||||||
* @see Action
|
* @see Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndGroupGroupNav($groupnav)
|
function onEndGroupGroupNav($groupnav)
|
||||||
{
|
{
|
||||||
$action = $groupnav->action;
|
$action = $groupnav->action;
|
||||||
|
@ -207,7 +202,9 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
|
|
||||||
$action->menuItem(common_local_url('groupinbox',
|
$action->menuItem(common_local_url('groupinbox',
|
||||||
array('nickname' => $group->nickname)),
|
array('nickname' => $group->nickname)),
|
||||||
|
// TRANS: Menu item in group page.
|
||||||
_m('MENU','Inbox'),
|
_m('MENU','Inbox'),
|
||||||
|
// TRANS: Menu title in group page.
|
||||||
_m('Private messages for this group.'),
|
_m('Private messages for this group.'),
|
||||||
$action->trimmed('action') == 'groupinbox',
|
$action->trimmed('action') == 'groupinbox',
|
||||||
'nav_group_inbox');
|
'nav_group_inbox');
|
||||||
|
@ -221,7 +218,6 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
*
|
*
|
||||||
* @result boolean hook value
|
* @result boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndGroupSave($group)
|
function onEndGroupSave($group)
|
||||||
{
|
{
|
||||||
$gps = new Group_privacy_settings();
|
$gps = new Group_privacy_settings();
|
||||||
|
@ -244,7 +240,6 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
*
|
*
|
||||||
* @param GroupEditForm $form form being shown
|
* @param GroupEditForm $form form being shown
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndGroupEditFormData($form)
|
function onEndGroupEditFormData($form)
|
||||||
{
|
{
|
||||||
$gps = null;
|
$gps = null;
|
||||||
|
@ -255,20 +250,30 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
|
|
||||||
$form->out->elementStart('li');
|
$form->out->elementStart('li');
|
||||||
$form->out->dropdown('allow_privacy',
|
$form->out->dropdown('allow_privacy',
|
||||||
|
// TRANS: Dropdown label in group settings page for if group allows private messages.
|
||||||
_m('Private messages'),
|
_m('Private messages'),
|
||||||
|
// TRANS: Dropdown option in group settings page for allowing private messages.
|
||||||
array(Group_privacy_settings::SOMETIMES => _m('Sometimes'),
|
array(Group_privacy_settings::SOMETIMES => _m('Sometimes'),
|
||||||
|
// TRANS: Dropdown option in group settings page for allowing private messages.
|
||||||
Group_privacy_settings::ALWAYS => _m('Always'),
|
Group_privacy_settings::ALWAYS => _m('Always'),
|
||||||
|
// TRANS: Dropdown option in group settings page for allowing private messages.
|
||||||
Group_privacy_settings::NEVER => _m('Never')),
|
Group_privacy_settings::NEVER => _m('Never')),
|
||||||
|
// TRANS: Dropdown title in group settings page for if group allows private messages.
|
||||||
_m('Whether to allow private messages to this group.'),
|
_m('Whether to allow private messages to this group.'),
|
||||||
false,
|
false,
|
||||||
(empty($gps)) ? Group_privacy_settings::SOMETIMES : $gps->allow_privacy);
|
(empty($gps)) ? Group_privacy_settings::SOMETIMES : $gps->allow_privacy);
|
||||||
$form->out->elementEnd('li');
|
$form->out->elementEnd('li');
|
||||||
$form->out->elementStart('li');
|
$form->out->elementStart('li');
|
||||||
$form->out->dropdown('allow_sender',
|
$form->out->dropdown('allow_sender',
|
||||||
|
// TRANS: Dropdown label in group settings page for who can send private messages to the group.
|
||||||
_m('Private senders'),
|
_m('Private senders'),
|
||||||
|
// TRANS: Dropdown option in group settings page for who can send private messages.
|
||||||
array(Group_privacy_settings::EVERYONE => _m('Everyone'),
|
array(Group_privacy_settings::EVERYONE => _m('Everyone'),
|
||||||
|
// TRANS: Dropdown option in group settings page for who can send private messages.
|
||||||
Group_privacy_settings::MEMBER => _m('Member'),
|
Group_privacy_settings::MEMBER => _m('Member'),
|
||||||
|
// TRANS: Dropdown option in group settings page for who can send private messages.
|
||||||
Group_privacy_settings::ADMIN => _m('Admin')),
|
Group_privacy_settings::ADMIN => _m('Admin')),
|
||||||
|
// TRANS: Dropdown title in group settings page for who can send private messages to the group.
|
||||||
_m('Who can send private messages to the group.'),
|
_m('Who can send private messages to the group.'),
|
||||||
false,
|
false,
|
||||||
(empty($gps)) ? Group_privacy_settings::MEMBER : $gps->allow_sender);
|
(empty($gps)) ? Group_privacy_settings::MEMBER : $gps->allow_sender);
|
||||||
|
@ -292,7 +297,7 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
} else {
|
} else {
|
||||||
$orig = clone($gps);
|
$orig = clone($gps);
|
||||||
}
|
}
|
||||||
|
|
||||||
$gps->allow_privacy = $action->trimmed('allow_privacy');
|
$gps->allow_privacy = $action->trimmed('allow_privacy');
|
||||||
$gps->allow_sender = $action->trimmed('allow_sender');
|
$gps->allow_sender = $action->trimmed('allow_sender');
|
||||||
|
|
||||||
|
@ -302,21 +307,21 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
} else {
|
} else {
|
||||||
$gps->update($orig);
|
$gps->update($orig);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overload 'd' command to send private messages to groups.
|
* Overload 'd' command to send private messages to groups.
|
||||||
*
|
*
|
||||||
* 'd !group word word word' will send the private message
|
* 'd !group word word word' will send the private message
|
||||||
* 'word word word' to the group 'group'.
|
* 'word word word' to the group 'group'.
|
||||||
*
|
*
|
||||||
* @param string $cmd Command being run
|
* @param string $cmd Command being run
|
||||||
* @param string $arg Rest of the message (including address)
|
* @param string $arg Rest of the message (including address)
|
||||||
* @param User $user User sending the message
|
* @param User $user User sending the message
|
||||||
* @param Command &$result The resulting command object to be run.
|
* @param Command &$result The resulting command object to be run.
|
||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
function onStartIntepretCommand($cmd, $arg, $user, &$result)
|
function onStartIntepretCommand($cmd, $arg, $user, &$result)
|
||||||
|
@ -350,7 +355,7 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
*
|
*
|
||||||
* @param Widget $widget The showgroup action being shown
|
* @param Widget $widget The showgroup action being shown
|
||||||
* @param User_group $group The current group
|
* @param User_group $group The current group
|
||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
function onEndGroupActionsList($widget, $group)
|
function onEndGroupActionsList($widget, $group)
|
||||||
|
@ -370,8 +375,10 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
|
|
||||||
$action->elementStart('li', 'entity_send-a-message');
|
$action->elementStart('li', 'entity_send-a-message');
|
||||||
$action->element('a', array('href' => common_local_url('newgroupmessage', array('nickname' => $group->nickname)),
|
$action->element('a', array('href' => common_local_url('newgroupmessage', array('nickname' => $group->nickname)),
|
||||||
|
// TRANS: Title for action in group actions list.
|
||||||
'title' => _m('Send a direct message to this group.')),
|
'title' => _m('Send a direct message to this group.')),
|
||||||
_m('Message'));
|
// TRANS: Link text for action in group actions list to send a private message to a group.
|
||||||
|
_m('LINKTEXT','Message'));
|
||||||
// $form = new GroupMessageForm($action, $group);
|
// $form = new GroupMessageForm($action, $group);
|
||||||
// $form->hidden = true;
|
// $form->hidden = true;
|
||||||
// $form->show();
|
// $form->show();
|
||||||
|
@ -384,12 +391,9 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
* privacy == always, force a group private message to all mentioned groups.
|
* privacy == always, force a group private message to all mentioned groups.
|
||||||
* If any of the groups disallows private messages, skip it.
|
* If any of the groups disallows private messages, skip it.
|
||||||
*
|
*
|
||||||
* @param
|
* @param
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onStartNoticeSave(&$notice) {
|
function onStartNoticeSave(&$notice) {
|
||||||
|
|
||||||
// Look for group tags
|
// Look for group tags
|
||||||
// FIXME: won't work for remote groups
|
// FIXME: won't work for remote groups
|
||||||
// @fixme if Notice::saveNew is refactored so we can just pull its list
|
// @fixme if Notice::saveNew is refactored so we can just pull its list
|
||||||
|
@ -406,11 +410,9 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
$profile = $notice->getProfile();
|
$profile = $notice->getProfile();
|
||||||
|
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
|
|
||||||
/* Add them to the database */
|
/* Add them to the database */
|
||||||
|
|
||||||
foreach (array_unique($match[1]) as $nickname) {
|
foreach (array_unique($match[1]) as $nickname) {
|
||||||
|
|
||||||
$group = User_group::getForNickname($nickname, $profile);
|
$group = User_group::getForNickname($nickname, $profile);
|
||||||
|
|
||||||
if (empty($group)) {
|
if (empty($group)) {
|
||||||
|
@ -433,7 +435,6 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($forcePrivate) {
|
if ($forcePrivate) {
|
||||||
|
|
||||||
foreach ($ignored as $group) {
|
foreach ($ignored as $group) {
|
||||||
common_log(LOG_NOTICE,
|
common_log(LOG_NOTICE,
|
||||||
"Notice forced to group direct message ".
|
"Notice forced to group direct message ".
|
||||||
|
@ -454,11 +455,12 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
|
|
||||||
// Don't save the notice!
|
// Don't save the notice!
|
||||||
// FIXME: this is probably cheating.
|
// FIXME: this is probably cheating.
|
||||||
|
// TRANS: Client exception thrown when a private group message has to be forced.
|
||||||
throw new ClientException(sprintf(_m('Forced notice to private group message.')),
|
throw new ClientException(sprintf(_m('Forced notice to private group message.')),
|
||||||
200);
|
200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,12 +472,12 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndGroupProfileElements($action, $group)
|
function onEndGroupProfileElements($action, $group)
|
||||||
{
|
{
|
||||||
$gps = Group_privacy_settings::forGroup($group);
|
$gps = Group_privacy_settings::forGroup($group);
|
||||||
|
|
||||||
if ($gps->allow_privacy == Group_privacy_settings::ALWAYS) {
|
if ($gps->allow_privacy == Group_privacy_settings::ALWAYS) {
|
||||||
|
// TRANS: Indicator on the group page that the group is (essentially) private.
|
||||||
$action->element('p', 'privategroupindicator', _m('Private'));
|
$action->element('p', 'privategroupindicator', _m('Private'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +488,7 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
{
|
{
|
||||||
if ($action instanceof ShowgroupAction) {
|
if ($action instanceof ShowgroupAction) {
|
||||||
$gps = Group_privacy_settings::forGroup($action->group);
|
$gps = Group_privacy_settings::forGroup($action->group);
|
||||||
|
|
||||||
if ($gps->allow_privacy == Group_privacy_settings::ALWAYS) {
|
if ($gps->allow_privacy == Group_privacy_settings::ALWAYS) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -501,6 +503,7 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||||
'author' => 'Evan Prodromou',
|
'author' => 'Evan Prodromou',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:GroupPrivateMessage',
|
'homepage' => 'http://status.net/wiki/Plugin:GroupPrivateMessage',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin description.
|
||||||
_m('Allow posting private messages to groups.'));
|
_m('Allow posting private messages to groups.'));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||||
*
|
*
|
||||||
* @see DB_DataObject
|
* @see DB_DataObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Group_message extends Memcached_DataObject
|
class Group_message extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
public $__table = 'group_message'; // table name
|
public $__table = 'group_message'; // table name
|
||||||
|
@ -66,7 +65,6 @@ class Group_message extends Memcached_DataObject
|
||||||
* @param mixed $v Value to lookup
|
* @param mixed $v Value to lookup
|
||||||
*
|
*
|
||||||
* @return Group_message object found, or null for no hits
|
* @return Group_message object found, or null for no hits
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function staticGet($k, $v=null)
|
function staticGet($k, $v=null)
|
||||||
{
|
{
|
||||||
|
@ -123,6 +121,8 @@ class Group_message extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
if (!$user->hasRight(Right::NEWMESSAGE)) {
|
if (!$user->hasRight(Right::NEWMESSAGE)) {
|
||||||
// XXX: maybe break this out into a separate right
|
// XXX: maybe break this out into a separate right
|
||||||
|
// TRANS: Exception thrown when trying to send group private message without having the right to do that.
|
||||||
|
// TRANS: %s is a user nickname.
|
||||||
throw new Exception(sprintf(_m('User %s is not allowed to send private messages.'),
|
throw new Exception(sprintf(_m('User %s is not allowed to send private messages.'),
|
||||||
$user->nickname));
|
$user->nickname));
|
||||||
}
|
}
|
||||||
|
@ -134,6 +134,8 @@ class Group_message extends Memcached_DataObject
|
||||||
// We use the same limits as for 'regular' private messages.
|
// We use the same limits as for 'regular' private messages.
|
||||||
|
|
||||||
if (Message::contentTooLong($text)) {
|
if (Message::contentTooLong($text)) {
|
||||||
|
// TRANS: Exception thrown when trying to send group private message that is too long.
|
||||||
|
// TRANS: %d is the maximum meggage length.
|
||||||
throw new Exception(sprintf(_m('That\'s too long. Maximum message size is %d character.',
|
throw new Exception(sprintf(_m('That\'s too long. Maximum message size is %d character.',
|
||||||
'That\'s too long. Maximum message size is %d characters.',
|
'That\'s too long. Maximum message size is %d characters.',
|
||||||
Message::maxContent()),
|
Message::maxContent()),
|
||||||
|
@ -143,7 +145,7 @@ class Group_message extends Memcached_DataObject
|
||||||
// Valid! Let's do this thing!
|
// Valid! Let's do this thing!
|
||||||
|
|
||||||
$gm = new Group_message();
|
$gm = new Group_message();
|
||||||
|
|
||||||
$gm->id = UUID::gen();
|
$gm->id = UUID::gen();
|
||||||
$gm->uri = common_local_url('showgroupmessage', array('id' => $gm->id));
|
$gm->uri = common_local_url('showgroupmessage', array('id' => $gm->id));
|
||||||
$gm->from_profile = $user->id;
|
$gm->from_profile = $user->id;
|
||||||
|
@ -165,7 +167,7 @@ class Group_message extends Memcached_DataObject
|
||||||
function distribute()
|
function distribute()
|
||||||
{
|
{
|
||||||
$group = User_group::staticGet('id', $this->to_group);
|
$group = User_group::staticGet('id', $this->to_group);
|
||||||
|
|
||||||
$member = $group->getMembers();
|
$member = $group->getMembers();
|
||||||
|
|
||||||
while ($member->fetch()) {
|
while ($member->fetch()) {
|
||||||
|
@ -177,6 +179,7 @@ class Group_message extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
$group = User_group::staticGet('id', $this->to_group);
|
$group = User_group::staticGet('id', $this->to_group);
|
||||||
if (empty($group)) {
|
if (empty($group)) {
|
||||||
|
// TRANS: Exception thrown when trying to send group private message to a non-existing group.
|
||||||
throw new ServerException(_m('No group for group message.'));
|
throw new ServerException(_m('No group for group message.'));
|
||||||
}
|
}
|
||||||
return $group;
|
return $group;
|
||||||
|
@ -186,6 +189,7 @@ class Group_message extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
$sender = Profile::staticGet('id', $this->from_profile);
|
$sender = Profile::staticGet('id', $this->from_profile);
|
||||||
if (empty($sender)) {
|
if (empty($sender)) {
|
||||||
|
// TRANS: Exception thrown when trying to send group private message without having a sender.
|
||||||
throw new ServerException(_m('No sender for group message.'));
|
throw new ServerException(_m('No sender for group message.'));
|
||||||
}
|
}
|
||||||
return $sender;
|
return $sender;
|
||||||
|
@ -204,5 +208,4 @@ class Group_message extends Memcached_DataObject
|
||||||
|
|
||||||
return $gm;
|
return $gm;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||||
*
|
*
|
||||||
* @see DB_DataObject
|
* @see DB_DataObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Group_message_profile extends Memcached_DataObject
|
class Group_message_profile extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
public $__table = 'group_message_profile'; // table name
|
public $__table = 'group_message_profile'; // table name
|
||||||
|
@ -61,7 +60,6 @@ class Group_message_profile extends Memcached_DataObject
|
||||||
* @param mixed $v Value to lookup
|
* @param mixed $v Value to lookup
|
||||||
*
|
*
|
||||||
* @return Group_message object found, or null for no hits
|
* @return Group_message object found, or null for no hits
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function staticGet($k, $v=null)
|
function staticGet($k, $v=null)
|
||||||
{
|
{
|
||||||
|
@ -120,7 +118,7 @@ class Group_message_profile extends Memcached_DataObject
|
||||||
function send($gm, $profile)
|
function send($gm, $profile)
|
||||||
{
|
{
|
||||||
$gmp = new Group_message_profile();
|
$gmp = new Group_message_profile();
|
||||||
|
|
||||||
$gmp->group_message_id = $gm->id;
|
$gmp->group_message_id = $gm->id;
|
||||||
$gmp->to_profile = $profile->id;
|
$gmp->to_profile = $profile->id;
|
||||||
$gmp->created = common_sql_now();
|
$gmp->created = common_sql_now();
|
||||||
|
@ -138,7 +136,7 @@ class Group_message_profile extends Memcached_DataObject
|
||||||
$this->notifyByMail();
|
$this->notifyByMail();
|
||||||
}
|
}
|
||||||
|
|
||||||
function notifyByMail()
|
function notifyByMail()
|
||||||
{
|
{
|
||||||
$to = User::staticGet('id', $this->to_profile);
|
$to = User::staticGet('id', $this->to_profile);
|
||||||
|
|
||||||
|
@ -163,14 +161,14 @@ class Group_message_profile extends Memcached_DataObject
|
||||||
// TRANS: %3$s is the message content, %4$s a URL to the message,
|
// TRANS: %3$s is the message content, %4$s a URL to the message,
|
||||||
// TRANS: %5$s is the StatusNet sitename.
|
// TRANS: %5$s is the StatusNet sitename.
|
||||||
$body = sprintf(_m("%1\$s (%2\$s) sent a private message to group %3\$s:\n\n".
|
$body = sprintf(_m("%1\$s (%2\$s) sent a private message to group %3\$s:\n\n".
|
||||||
"------------------------------------------------------\n".
|
"------------------------------------------------------\n".
|
||||||
"%4\$s\n".
|
"%4\$s\n".
|
||||||
"------------------------------------------------------\n\n".
|
"------------------------------------------------------\n\n".
|
||||||
"You can reply to their message here:\n\n".
|
"You can reply to their message here:\n\n".
|
||||||
"%5\$s\n\n".
|
"%5\$s\n\n".
|
||||||
"Do not reply to this email; it will not get to them.\n\n".
|
"Do not reply to this email; it will not get to them.\n\n".
|
||||||
"With kind regards,\n".
|
"With kind regards,\n".
|
||||||
"%6\$s"),
|
"%6\$s"),
|
||||||
$from_profile->getBestName(),
|
$from_profile->getBestName(),
|
||||||
$from_profile->nickname,
|
$from_profile->nickname,
|
||||||
$group->nickname,
|
$group->nickname,
|
||||||
|
|
|
@ -44,16 +44,15 @@ if (!defined('STATUSNET')) {
|
||||||
*
|
*
|
||||||
* @see DB_DataObject
|
* @see DB_DataObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Group_privacy_settings extends Memcached_DataObject
|
class Group_privacy_settings extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
public $__table = 'group_privacy_settings';
|
public $__table = 'group_privacy_settings';
|
||||||
/** ID of the group. */
|
/** ID of the group. */
|
||||||
public $group_id;
|
public $group_id;
|
||||||
/** When to allow privacy: always, sometimes, or never. */
|
/** When to allow privacy: always, sometimes, or never. */
|
||||||
public $allow_privacy;
|
public $allow_privacy;
|
||||||
/** Who can send private messages: everyone, member, admin */
|
/** Who can send private messages: everyone, member, admin */
|
||||||
public $allow_sender;
|
public $allow_sender;
|
||||||
/** row creation timestamp */
|
/** row creation timestamp */
|
||||||
public $created;
|
public $created;
|
||||||
/** Last-modified timestamp */
|
/** Last-modified timestamp */
|
||||||
|
@ -81,7 +80,6 @@ class Group_privacy_settings extends Memcached_DataObject
|
||||||
*
|
*
|
||||||
* @return User_greeting_count object found, or null for no hits
|
* @return User_greeting_count object found, or null for no hits
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function staticGet($k, $v=null)
|
function staticGet($k, $v=null)
|
||||||
{
|
{
|
||||||
return Memcached_DataObject::staticGet('Group_privacy_settings', $k, $v);
|
return Memcached_DataObject::staticGet('Group_privacy_settings', $k, $v);
|
||||||
|
@ -95,7 +93,6 @@ class Group_privacy_settings extends Memcached_DataObject
|
||||||
*
|
*
|
||||||
* @return array array of column definitions
|
* @return array array of column definitions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function table()
|
function table()
|
||||||
{
|
{
|
||||||
return array('group_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
|
return array('group_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
|
||||||
|
@ -103,7 +100,7 @@ class Group_privacy_settings extends Memcached_DataObject
|
||||||
'allow_sender' => DB_DATAOBJECT_INT,
|
'allow_sender' => DB_DATAOBJECT_INT,
|
||||||
'created' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL,
|
'created' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL,
|
||||||
'modified' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL);
|
'modified' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,7 +112,6 @@ class Group_privacy_settings extends Memcached_DataObject
|
||||||
*
|
*
|
||||||
* @return array list of key field names
|
* @return array list of key field names
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function keys()
|
function keys()
|
||||||
{
|
{
|
||||||
return array_keys($this->keyTypes());
|
return array_keys($this->keyTypes());
|
||||||
|
@ -128,7 +124,6 @@ class Group_privacy_settings extends Memcached_DataObject
|
||||||
* 'K' for primary key: for compound keys, add an entry for each component;
|
* 'K' for primary key: for compound keys, add an entry for each component;
|
||||||
* 'U' for unique keys: compound keys are not well supported here.
|
* 'U' for unique keys: compound keys are not well supported here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function keyTypes()
|
function keyTypes()
|
||||||
{
|
{
|
||||||
return array('group_id' => 'K');
|
return array('group_id' => 'K');
|
||||||
|
@ -139,7 +134,6 @@ class Group_privacy_settings extends Memcached_DataObject
|
||||||
*
|
*
|
||||||
* @return array magic three-false array that stops auto-incrementing.
|
* @return array magic three-false array that stops auto-incrementing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function sequenceKey()
|
function sequenceKey()
|
||||||
{
|
{
|
||||||
return array(false, false, false);
|
return array(false, false, false);
|
||||||
|
@ -164,6 +158,7 @@ class Group_privacy_settings extends Memcached_DataObject
|
||||||
$gps = self::forGroup($group);
|
$gps = self::forGroup($group);
|
||||||
|
|
||||||
if ($gps->allow_privacy == Group_privacy_settings::NEVER) {
|
if ($gps->allow_privacy == Group_privacy_settings::NEVER) {
|
||||||
|
// TRANS: Exception thrown when trying to set group privacy setting if group %s does not allow private messages.
|
||||||
throw new Exception(sprintf(_m('Group %s does not allow private messages.'),
|
throw new Exception(sprintf(_m('Group %s does not allow private messages.'),
|
||||||
$group->nickname));
|
$group->nickname));
|
||||||
}
|
}
|
||||||
|
@ -172,6 +167,8 @@ class Group_privacy_settings extends Memcached_DataObject
|
||||||
case Group_privacy_settings::EVERYONE:
|
case Group_privacy_settings::EVERYONE:
|
||||||
$profile = $user->getProfile();
|
$profile = $user->getProfile();
|
||||||
if (Group_block::isBlocked($group, $profile)) {
|
if (Group_block::isBlocked($group, $profile)) {
|
||||||
|
// TRANS: Exception thrown when trying to send group private message while blocked from that group.
|
||||||
|
// TRANS: %1$s is a user nickname, %2$s is a group nickname.
|
||||||
throw new Exception(sprintf(_m('User %1$s is blocked from group %2$s.'),
|
throw new Exception(sprintf(_m('User %1$s is blocked from group %2$s.'),
|
||||||
$user->nickname,
|
$user->nickname,
|
||||||
$group->nickname));
|
$group->nickname));
|
||||||
|
@ -179,6 +176,8 @@ class Group_privacy_settings extends Memcached_DataObject
|
||||||
break;
|
break;
|
||||||
case Group_privacy_settings::MEMBER:
|
case Group_privacy_settings::MEMBER:
|
||||||
if (!$user->isMember($group)) {
|
if (!$user->isMember($group)) {
|
||||||
|
// TRANS: Exception thrown when trying to send group private message while not a member.
|
||||||
|
// TRANS: %1$s is a user nickname, %2$s is a group nickname.
|
||||||
throw new Exception(sprintf(_m('User %1$s is not a member of group %2$s.'),
|
throw new Exception(sprintf(_m('User %1$s is not a member of group %2$s.'),
|
||||||
$user->nickname,
|
$user->nickname,
|
||||||
$group->nickname));
|
$group->nickname));
|
||||||
|
@ -186,12 +185,16 @@ class Group_privacy_settings extends Memcached_DataObject
|
||||||
break;
|
break;
|
||||||
case Group_privacy_settings::ADMIN:
|
case Group_privacy_settings::ADMIN:
|
||||||
if (!$user->isAdmin($group)) {
|
if (!$user->isAdmin($group)) {
|
||||||
|
// TRANS: Exception thrown when trying to send group private message while not a group administrator.
|
||||||
|
// TRANS: %1$s is a user nickname, %2$s is a group nickname.
|
||||||
throw new Exception(sprintf(_m('User %1$s is not an administrator of group %2$s.'),
|
throw new Exception(sprintf(_m('User %1$s is not an administrator of group %2$s.'),
|
||||||
$user->nickname,
|
$user->nickname,
|
||||||
$group->nickname));
|
$group->nickname));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
// TRANS: Exception thrown when encountering undefined group privacy settings.
|
||||||
|
// TRANS: %s is a group nickname.
|
||||||
throw new Exception(sprintf(_m('Unknown privacy settings for group %s.'),
|
throw new Exception(sprintf(_m('Unknown privacy settings for group %s.'),
|
||||||
$group->nickname));
|
$group->nickname));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (C) 2011, StatusNet, Inc.
|
* Copyright (C) 2011, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* List of private messages to this group
|
* List of private messages to this group
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class GroupinboxAction extends GroupDesignAction
|
class GroupinboxAction extends GroupDesignAction
|
||||||
{
|
{
|
||||||
var $gm;
|
var $gm;
|
||||||
|
@ -63,6 +62,7 @@ class GroupinboxAction extends GroupDesignAction
|
||||||
$cur = common_current_user();
|
$cur = common_current_user();
|
||||||
|
|
||||||
if (empty($cur)) {
|
if (empty($cur)) {
|
||||||
|
// TRANS: Client exception thrown when trying to view group inbox while not logged in.
|
||||||
throw new ClientException(_m('Only for logged-in users.'), 403);
|
throw new ClientException(_m('Only for logged-in users.'), 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,16 +79,19 @@ class GroupinboxAction extends GroupDesignAction
|
||||||
$localGroup = Local_group::staticGet('nickname', $nickname);
|
$localGroup = Local_group::staticGet('nickname', $nickname);
|
||||||
|
|
||||||
if (empty($localGroup)) {
|
if (empty($localGroup)) {
|
||||||
|
// TRANS: Client exception thrown when trying to view group inbox for non-existing group.
|
||||||
throw new ClientException(_m('No such group.'), 404);
|
throw new ClientException(_m('No such group.'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->group = User_group::staticGet('id', $localGroup->group_id);
|
$this->group = User_group::staticGet('id', $localGroup->group_id);
|
||||||
|
|
||||||
if (empty($this->group)) {
|
if (empty($this->group)) {
|
||||||
|
// TRANS: Client exception thrown when trying to view group inbox for non-existing group.
|
||||||
throw new ClientException(_m('No such group.'), 404);
|
throw new ClientException(_m('No such group.'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$cur->isMember($this->group)) {
|
if (!$cur->isMember($this->group)) {
|
||||||
|
// TRANS: Client exception thrown when trying to view group inbox while not a member.
|
||||||
throw new ClientException(_m('Only for members.'), 403);
|
throw new ClientException(_m('Only for members.'), 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,8 +100,8 @@ class GroupinboxAction extends GroupDesignAction
|
||||||
if (!$this->page) {
|
if (!$this->page) {
|
||||||
$this->page = 1;
|
$this->page = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->gm = Group_message::forGroup($this->group,
|
$this->gm = Group_message::forGroup($this->group,
|
||||||
($this->page - 1) * MESSAGES_PER_PAGE,
|
($this->page - 1) * MESSAGES_PER_PAGE,
|
||||||
MESSAGES_PER_PAGE + 1);
|
MESSAGES_PER_PAGE + 1);
|
||||||
return true;
|
return true;
|
||||||
|
@ -122,6 +125,7 @@ class GroupinboxAction extends GroupDesignAction
|
||||||
$cnt = $gml->show();
|
$cnt = $gml->show();
|
||||||
|
|
||||||
if ($cnt == 0) {
|
if ($cnt == 0) {
|
||||||
|
// TRANS: Text of group inbox if no private messages were sent to it.
|
||||||
$this->element('p', 'guide', _m('This group has not received any private messages.'));
|
$this->element('p', 'guide', _m('This group has not received any private messages.'));
|
||||||
}
|
}
|
||||||
$this->pagination($this->page > 1,
|
$this->pagination($this->page > 1,
|
||||||
|
@ -167,6 +171,7 @@ class GroupinboxAction extends GroupDesignAction
|
||||||
$base = $this->group->getFancyName();
|
$base = $this->group->getFancyName();
|
||||||
|
|
||||||
if ($this->page == 1) {
|
if ($this->page == 1) {
|
||||||
|
// TRANS: Title of inbox for group %s.
|
||||||
return sprintf(_m('%s group inbox'), $base);
|
return sprintf(_m('%s group inbox'), $base);
|
||||||
} else {
|
} else {
|
||||||
// TRANS: Page title for any but first group page.
|
// TRANS: Page title for any but first group page.
|
||||||
|
@ -184,7 +189,6 @@ class GroupinboxAction extends GroupDesignAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showPageNotice()
|
function showPageNotice()
|
||||||
{
|
{
|
||||||
$instr = $this->getInstructions();
|
$instr = $this->getInstructions();
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (C) 2011, StatusNet, Inc.
|
* Copyright (C) 2011, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* Command object for messages to groups
|
* Command object for messages to groups
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class GroupMessageCommand extends Command
|
class GroupMessageCommand extends Command
|
||||||
{
|
{
|
||||||
/** User sending the message. */
|
/** User sending the message. */
|
||||||
|
@ -61,7 +60,6 @@ class GroupMessageCommand extends Command
|
||||||
* @param string $nickname Nickname of the group
|
* @param string $nickname Nickname of the group
|
||||||
* @param string $text Text of message
|
* @param string $text Text of message
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($user, $nickname, $text)
|
function __construct($user, $nickname, $text)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
@ -76,8 +74,9 @@ class GroupMessageCommand extends Command
|
||||||
|
|
||||||
$gm = Group_message::send($this->user, $group, $this->text);
|
$gm = Group_message::send($this->user, $group, $this->text);
|
||||||
|
|
||||||
$channel->output($this->user,
|
$channel->output($this->user,
|
||||||
sprintf(_m('Direct message to group %s sent.'),
|
// TRANS: Succes message after sending private group message to group %s.
|
||||||
|
sprintf(_m('Direct message to group %s sent.'),
|
||||||
$group->nickname));
|
$group->nickname));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (C) 2011, StatusNet, Inc.
|
* Copyright (C) 2011, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* Form for posting a group message
|
* Form for posting a group message
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class GroupMessageForm extends Form
|
class GroupMessageForm extends Form
|
||||||
{
|
{
|
||||||
var $group;
|
var $group;
|
||||||
|
@ -58,7 +57,6 @@ class GroupMessageForm extends Form
|
||||||
*
|
*
|
||||||
* @todo add a drop-down list to post to any group
|
* @todo add a drop-down list to post to any group
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($out, $group, $content=null)
|
function __construct($out, $group, $content=null)
|
||||||
{
|
{
|
||||||
parent::__construct($out);
|
parent::__construct($out);
|
||||||
|
@ -71,7 +69,7 @@ class GroupMessageForm extends Form
|
||||||
* Action for the form
|
* Action for the form
|
||||||
*/
|
*/
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
return common_local_url('newgroupmessage',
|
return common_local_url('newgroupmessage',
|
||||||
array('nickname' => $this->group->nickname));
|
array('nickname' => $this->group->nickname));
|
||||||
}
|
}
|
||||||
|
@ -87,6 +85,7 @@ class GroupMessageForm extends Form
|
||||||
{
|
{
|
||||||
$this->out->element('legend',
|
$this->out->element('legend',
|
||||||
null,
|
null,
|
||||||
|
// TRANS: Form legend for sending private message to group %s.
|
||||||
sprintf(_m('Message to %s'), $this->group->nickname));
|
sprintf(_m('Message to %s'), $this->group->nickname));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +96,6 @@ class GroupMessageForm extends Form
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function id()
|
function id()
|
||||||
{
|
{
|
||||||
return 'form_notice-group-message';
|
return 'form_notice-group-message';
|
||||||
|
@ -110,7 +108,6 @@ class GroupMessageForm extends Form
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_notice';
|
return 'form_notice';
|
||||||
|
@ -123,11 +120,11 @@ class GroupMessageForm extends Form
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formData()
|
function formData()
|
||||||
{
|
{
|
||||||
$this->out->element('label', array('for' => 'notice_data-text',
|
$this->out->element('label', array('for' => 'notice_data-text',
|
||||||
'id' => 'notice_data-text-label'),
|
'id' => 'notice_data-text-label'),
|
||||||
|
// TRANS: Field label for private group message to group %s.
|
||||||
sprintf(_m('Direct message to %s'), $this->group->nickname));
|
sprintf(_m('Direct message to %s'), $this->group->nickname));
|
||||||
|
|
||||||
$this->out->element('textarea', array('id' => 'notice_data-text',
|
$this->out->element('textarea', array('id' => 'notice_data-text',
|
||||||
|
@ -140,6 +137,7 @@ class GroupMessageForm extends Form
|
||||||
|
|
||||||
if ($contentLimit > 0) {
|
if ($contentLimit > 0) {
|
||||||
$this->out->elementStart('dl', 'form_note');
|
$this->out->elementStart('dl', 'form_note');
|
||||||
|
// TRANS: Indicator for number of chatacters still available for notice.
|
||||||
$this->out->element('dt', null, _m('Available characters'));
|
$this->out->element('dt', null, _m('Available characters'));
|
||||||
$this->out->element('dd', array('class' => 'count'),
|
$this->out->element('dd', array('class' => 'count'),
|
||||||
$contentLimit);
|
$contentLimit);
|
||||||
|
@ -154,13 +152,13 @@ class GroupMessageForm extends Form
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
$this->out->element('input', array('id' => 'notice_action-submit',
|
$this->out->element('input', array('id' => 'notice_action-submit',
|
||||||
'class' => 'submit',
|
'class' => 'submit',
|
||||||
'name' => 'message_send',
|
'name' => 'message_send',
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
|
// TRANS: Send button text for sending private group notice.
|
||||||
'value' => _m('Send button for sending notice', 'Send')));
|
'value' => _m('Send button for sending notice', 'Send')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (C) 2011, StatusNet, Inc.
|
* Copyright (C) 2011, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* Widget for showing list of group messages
|
* Widget for showing list of group messages
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (C) 2011, StatusNet, Inc.
|
* Copyright (C) 2011, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* Widget for showing an individual group message
|
* Widget for showing an individual group message
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -69,13 +69,13 @@ class GroupMessageListItem extends Widget
|
||||||
{
|
{
|
||||||
$group = $this->gm->getGroup();
|
$group = $this->gm->getGroup();
|
||||||
$sender = $this->gm->getSender();
|
$sender = $this->gm->getSender();
|
||||||
|
|
||||||
$this->out->elementStart('li', array('class' => 'hentry notice message group-message',
|
$this->out->elementStart('li', array('class' => 'hentry notice message group-message',
|
||||||
'id' => 'message-' . $this->gm->id));
|
'id' => 'message-' . $this->gm->id));
|
||||||
|
|
||||||
$this->out->elementStart('div', 'entry-title');
|
$this->out->elementStart('div', 'entry-title');
|
||||||
$this->out->elementStart('span', 'vcard author');
|
$this->out->elementStart('span', 'vcard author');
|
||||||
$this->out->elementStart('a',
|
$this->out->elementStart('a',
|
||||||
array('href' => $sender->profileurl,
|
array('href' => $sender->profileurl,
|
||||||
'class' => 'url'));
|
'class' => 'url'));
|
||||||
$avatar = $sender->getAvatar(AVATAR_STREAM_SIZE);
|
$avatar = $sender->getAvatar(AVATAR_STREAM_SIZE);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (C) 2011, StatusNet, Inc.
|
* Copyright (C) 2011, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* Action for adding a new group message
|
* Action for adding a new group message
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class NewgroupmessageAction extends Action
|
class NewgroupmessageAction extends Action
|
||||||
{
|
{
|
||||||
var $group;
|
var $group;
|
||||||
|
@ -58,7 +57,6 @@ class NewgroupmessageAction extends Action
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($argarray)
|
function prepare($argarray)
|
||||||
{
|
{
|
||||||
parent::prepare($argarray);
|
parent::prepare($argarray);
|
||||||
|
@ -66,10 +64,12 @@ class NewgroupmessageAction extends Action
|
||||||
$this->user = common_current_user();
|
$this->user = common_current_user();
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client exception thrown when trying to send a private group message while not logged in.
|
||||||
throw new ClientException(_m('Must be logged in.'), 403);
|
throw new ClientException(_m('Must be logged in.'), 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->user->hasRight(Right::NEWMESSAGE)) {
|
if (!$this->user->hasRight(Right::NEWMESSAGE)) {
|
||||||
|
// TRANS: Exception thrown when user %s is not allowed to send a private group message.
|
||||||
throw new Exception(sprintf(_m('User %s is not allowed to send private messages.'),
|
throw new Exception(sprintf(_m('User %s is not allowed to send private messages.'),
|
||||||
$this->user->nickname));
|
$this->user->nickname));
|
||||||
}
|
}
|
||||||
|
@ -87,21 +87,21 @@ class NewgroupmessageAction extends Action
|
||||||
$localGroup = Local_group::staticGet('nickname', $nickname);
|
$localGroup = Local_group::staticGet('nickname', $nickname);
|
||||||
|
|
||||||
if (empty($localGroup)) {
|
if (empty($localGroup)) {
|
||||||
|
// TRANS: Client exception thrown when trying to send a private group message to a non-existing group.
|
||||||
throw new ClientException(_m('No such group.'), 404);
|
throw new ClientException(_m('No such group.'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->group = User_group::staticGet('id', $localGroup->group_id);
|
$this->group = User_group::staticGet('id', $localGroup->group_id);
|
||||||
|
|
||||||
if (empty($this->group)) {
|
if (empty($this->group)) {
|
||||||
|
// TRANS: Client exception thrown when trying to send a private group message to a non-existing group.
|
||||||
throw new ClientException(_m('No such group.'), 404);
|
throw new ClientException(_m('No such group.'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This throws an exception on error
|
// This throws an exception on error
|
||||||
|
|
||||||
Group_privacy_settings::ensurePost($this->user, $this->group);
|
Group_privacy_settings::ensurePost($this->user, $this->group);
|
||||||
|
|
||||||
// If we're posted to, check session token and get text
|
// If we're posted to, check session token and get text
|
||||||
|
|
||||||
if ($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
$this->checkSessionToken();
|
$this->checkSessionToken();
|
||||||
$this->text = $this->trimmed('content');
|
$this->text = $this->trimmed('content');
|
||||||
|
@ -117,7 +117,6 @@ class NewgroupmessageAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($argarray=null)
|
function handle($argarray=null)
|
||||||
{
|
{
|
||||||
if ($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
|
@ -140,11 +139,13 @@ class NewgroupmessageAction extends Action
|
||||||
if ($this->boolean('ajax')) {
|
if ($this->boolean('ajax')) {
|
||||||
$this->startHTML('text/xml;charset=utf-8');
|
$this->startHTML('text/xml;charset=utf-8');
|
||||||
$this->elementStart('head');
|
$this->elementStart('head');
|
||||||
|
// TRANS: Title after sending a private group message.
|
||||||
$this->element('title', null, _m('Message sent'));
|
$this->element('title', null, _m('Message sent'));
|
||||||
$this->elementEnd('head');
|
$this->elementEnd('head');
|
||||||
$this->elementStart('body');
|
$this->elementStart('body');
|
||||||
$this->element('p',
|
$this->element('p',
|
||||||
array('id' => 'command_result'),
|
array('id' => 'command_result'),
|
||||||
|
// TRANS: Succes text after sending a direct message to group %s.
|
||||||
sprintf(_m('Direct message to %s sent.'),
|
sprintf(_m('Direct message to %s sent.'),
|
||||||
$this->group->nickname));
|
$this->group->nickname));
|
||||||
$this->elementEnd('body');
|
$this->elementEnd('body');
|
||||||
|
@ -156,6 +157,7 @@ class NewgroupmessageAction extends Action
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
|
// TRANS: Title of form for new private group message.
|
||||||
return sprintf(_m('New message to group %s'), $this->group->nickname);
|
return sprintf(_m('New message to group %s'), $this->group->nickname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (C) 2011, StatusNet, Inc.
|
* Copyright (C) 2011, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* Show a single group message
|
* Show a single group message
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ShowgroupmessageAction extends Action
|
class ShowgroupmessageAction extends Action
|
||||||
{
|
{
|
||||||
var $gm;
|
var $gm;
|
||||||
|
@ -59,7 +58,6 @@ class ShowgroupmessageAction extends Action
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($argarray)
|
function prepare($argarray)
|
||||||
{
|
{
|
||||||
parent::prepare($argarray);
|
parent::prepare($argarray);
|
||||||
|
@ -67,6 +65,7 @@ class ShowgroupmessageAction extends Action
|
||||||
$this->user = common_current_user();
|
$this->user = common_current_user();
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client exception thrown when trying to view group private messages without being logged in.
|
||||||
throw new ClientException(_m('Only logged-in users can view private messages.'),
|
throw new ClientException(_m('Only logged-in users can view private messages.'),
|
||||||
403);
|
403);
|
||||||
}
|
}
|
||||||
|
@ -76,22 +75,26 @@ class ShowgroupmessageAction extends Action
|
||||||
$this->gm = Group_message::staticGet('id', $id);
|
$this->gm = Group_message::staticGet('id', $id);
|
||||||
|
|
||||||
if (empty($this->gm)) {
|
if (empty($this->gm)) {
|
||||||
|
// TRANS: Client exception thrown when trying to view a non-existing group private message.
|
||||||
throw new ClientException(_m('No such message.'), 404);
|
throw new ClientException(_m('No such message.'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->group = User_group::staticGet('id', $this->gm->to_group);
|
$this->group = User_group::staticGet('id', $this->gm->to_group);
|
||||||
|
|
||||||
if (empty($this->group)) {
|
if (empty($this->group)) {
|
||||||
|
// TRANS: Server exception thrown when trying to view group private messages for a non-exsting group.
|
||||||
throw new ServerException(_m('Group not found.'));
|
throw new ServerException(_m('Group not found.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->user->isMember($this->group)) {
|
if (!$this->user->isMember($this->group)) {
|
||||||
|
// TRANS: Client exception thrown when trying to view a group private message without being a group member.
|
||||||
throw new ClientException(_m('Cannot read message.'), 403);
|
throw new ClientException(_m('Cannot read message.'), 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->sender = Profile::staticGet('id', $this->gm->from_profile);
|
$this->sender = Profile::staticGet('id', $this->gm->from_profile);
|
||||||
|
|
||||||
if (empty($this->sender)) {
|
if (empty($this->sender)) {
|
||||||
|
// TRANS: Server exception thrown when trying to view a group private message without a sender.
|
||||||
throw new ServerException(_m('No sender found.'));
|
throw new ServerException(_m('No sender found.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +108,6 @@ class ShowgroupmessageAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($argarray=null)
|
function handle($argarray=null)
|
||||||
{
|
{
|
||||||
$this->showPage();
|
$this->showPage();
|
||||||
|
@ -114,9 +116,10 @@ class ShowgroupmessageAction extends Action
|
||||||
/**
|
/**
|
||||||
* Title of the page
|
* Title of the page
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
|
// TRANS: Title for private group message.
|
||||||
|
// TRANS: %1$s is the sender name, %2$s is the group name, %3$s is a timestamp.
|
||||||
return sprintf(_m('Message from %1$s to group %2$s on %3$s'),
|
return sprintf(_m('Message from %1$s to group %2$s on %3$s'),
|
||||||
$this->sender->nickname,
|
$this->sender->nickname,
|
||||||
$this->group->nickname,
|
$this->group->nickname,
|
||||||
|
@ -126,7 +129,6 @@ class ShowgroupmessageAction extends Action
|
||||||
/**
|
/**
|
||||||
* Show the content area.
|
* Show the content area.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showContent()
|
function showContent()
|
||||||
{
|
{
|
||||||
$this->elementStart('ul', 'notices messages');
|
$this->elementStart('ul', 'notices messages');
|
||||||
|
@ -144,7 +146,6 @@ class ShowgroupmessageAction extends Action
|
||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user