Update translator documentation.

L10n and i18n updates.
Break long lines in README before or at 80 characters.
Superfluous whitespace removed.
This commit is contained in:
Siebrand Mazeland 2011-04-07 14:01:40 +02:00
parent f9f437f5da
commit 2640232c68
20 changed files with 182 additions and 155 deletions

View File

@ -108,6 +108,7 @@ class EchoPlugin extends Plugin
'author' => 'Zach Copley', 'author' => 'Zach Copley',
'homepage' => 'http://status.net/wiki/Plugin:Echo', 'homepage' => 'http://status.net/wiki/Plugin:Echo',
'rawdescription' => 'rawdescription' =>
// TRANS: Plugin description.
_m('Use <a href="http://aboutecho.com/">Echo</a>'. _m('Use <a href="http://aboutecho.com/">Echo</a>'.
' to add commenting to notice pages.')); ' to add commenting to notice pages.'));
return true; return true;

View File

@ -57,6 +57,7 @@ class EmailAuthenticationPlugin extends Plugin
'author' => 'Craig Andrews', 'author' => 'Craig Andrews',
'homepage' => 'http://status.net/wiki/Plugin:EmailAuthentication', 'homepage' => 'http://status.net/wiki/Plugin:EmailAuthentication',
'rawdescription' => 'rawdescription' =>
// TRANS: Plugin description.
_m('The Email Authentication plugin allows users to login using their email address.')); _m('The Email Authentication plugin allows users to login using their email address.'));
return true; return true;
} }

View File

@ -1,7 +1,8 @@
The Email Authentication plugin allows users to login using their email address. The Email Authentication plugin allows users to login using their email address.
The provided email address is used to lookup the user's nickname, then that nickname and the provided password is checked. The provided email address is used to lookup the user's nickname, then that
nickname and the provided password is checked.
Installation Installation
============ ============
add "addPlugin('emailAuthentication');" to the bottom of your config.php add "addPlugin('emailAuthentication');" to the bottom of your config.php.

View File

@ -43,7 +43,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 EmailSummaryPlugin extends Plugin class EmailSummaryPlugin extends Plugin
{ {
/** /**
@ -51,13 +50,11 @@ class EmailSummaryPlugin extends Plugin
* *
* @return boolean hook value * @return boolean hook value
*/ */
function onCheckSchema() function onCheckSchema()
{ {
$schema = Schema::get(); $schema = Schema::get();
// For storing user-submitted flags on profiles // For storing user-submitted flags on profiles
$schema->ensureTable('email_summary_status', $schema->ensureTable('email_summary_status',
array(new ColumnDef('user_id', 'integer', null, array(new ColumnDef('user_id', 'integer', null,
false, 'PRI'), false, 'PRI'),
@ -80,9 +77,8 @@ class EmailSummaryPlugin extends Plugin
* @param string $cls Name of the class to be loaded * @param string $cls Name of the class to be loaded
* *
* @return boolean hook value; true means continue processing, false means stop. * @return boolean hook value; true means continue processing, false means stop.
* *
*/ */
function onAutoload($cls) function onAutoload($cls)
{ {
$dir = dirname(__FILE__); $dir = dirname(__FILE__);
@ -107,9 +103,7 @@ class EmailSummaryPlugin extends Plugin
* @param array &$versions array of version data * @param array &$versions array of version data
* *
* @return boolean hook value; true means continue processing, false means stop. * @return boolean hook value; true means continue processing, false means stop.
*
*/ */
function onPluginVersion(&$versions) function onPluginVersion(&$versions)
{ {
$versions[] = array('name' => 'EmailSummary', $versions[] = array('name' => 'EmailSummary',
@ -117,86 +111,84 @@ class EmailSummaryPlugin extends Plugin
'author' => 'Evan Prodromou', 'author' => 'Evan Prodromou',
'homepage' => 'http://status.net/wiki/Plugin:EmailSummary', 'homepage' => 'http://status.net/wiki/Plugin:EmailSummary',
'rawdescription' => 'rawdescription' =>
// TRANS: Plugin description.
_m('Send an email summary of the inbox to users.')); _m('Send an email summary of the inbox to users.'));
return true; return true;
} }
/** /**
* Register our queue handlers * Register our queue handlers
* *
* @param QueueManager $qm Current queue manager * @param QueueManager $qm Current queue manager
* *
* @return boolean hook value * @return boolean hook value
*/ */
function onEndInitializeQueueManager($qm) function onEndInitializeQueueManager($qm)
{ {
$qm->connect('sitesum', 'SiteEmailSummaryHandler'); $qm->connect('sitesum', 'SiteEmailSummaryHandler');
$qm->connect('usersum', 'UserEmailSummaryHandler'); $qm->connect('usersum', 'UserEmailSummaryHandler');
return true; return true;
} }
/** /**
* Add a checkbox to turn off email summaries * Add a checkbox to turn off email summaries
* *
* @param Action $action Action being executed (emailsettings) * @param Action $action Action being executed (emailsettings)
* *
* @return boolean hook value * @return boolean hook value
*/ */
function onEndEmailFormData($action) function onEndEmailFormData($action)
{ {
$user = common_current_user(); $user = common_current_user();
$action->elementStart('li'); $action->elementStart('li');
$action->checkbox('emailsummary', $action->checkbox('emailsummary',
// TRANS: Checkbox label in e-mail preferences form. // TRANS: Checkbox label in e-mail preferences form.
_m('Send me a periodic summary of updates from my network.'), _m('Send me a periodic summary of updates from my network'),
Email_summary_status::getSendSummary($user->id)); Email_summary_status::getSendSummary($user->id));
$action->elementEnd('li'); $action->elementEnd('li');
return true; return true;
} }
/** /**
* Add a checkbox to turn off email summaries * Add a checkbox to turn off email summaries
* *
* @param Action $action Action being executed (emailsettings) * @param Action $action Action being executed (emailsettings)
* *
* @return boolean hook value * @return boolean hook value
*/ */
function onEndEmailSaveForm($action) function onEndEmailSaveForm($action)
{ {
$sendSummary = $action->boolean('emailsummary'); $sendSummary = $action->boolean('emailsummary');
$user = common_current_user(); $user = common_current_user();
if (!empty($user)) { if (!empty($user)) {
$ess = Email_summary_status::staticGet('user_id', $user->id); $ess = Email_summary_status::staticGet('user_id', $user->id);
if (empty($ess)) { if (empty($ess)) {
$ess = new Email_summary_status(); $ess = new Email_summary_status();
$ess->user_id = $user->id; $ess->user_id = $user->id;
$ess->send_summary = $sendSummary; $ess->send_summary = $sendSummary;
$ess->created = common_sql_now(); $ess->created = common_sql_now();
$ess->modified = common_sql_now(); $ess->modified = common_sql_now();
$ess->insert(); $ess->insert();
} else { } else {
$orig = clone($ess); $orig = clone($ess);
$ess->send_summary = $sendSummary; $ess->send_summary = $sendSummary;
$ess->modified = common_sql_now(); $ess->modified = common_sql_now();
$ess->update($orig); $ess->update($orig);
} }
} }
return true; return true;
} }
} }

View File

@ -35,7 +35,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
/** /**
* Data class for email summaries * Data class for email summaries
* *
* Email summary information for users * Email summary information for users
* *
* @category Action * @category Action
@ -46,7 +46,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
* *
* @see DB_DataObject * @see DB_DataObject
*/ */
class Email_summary_status extends Memcached_DataObject class Email_summary_status extends Memcached_DataObject
{ {
public $__table = 'email_summary_status'; // table name public $__table = 'email_summary_status'; // table name
@ -78,7 +77,6 @@ class Email_summary_status extends Memcached_DataObject
* *
* @return array array of column definitions * @return array array of column definitions
*/ */
function table() function table()
{ {
return array('user_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, return array('user_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
@ -93,7 +91,6 @@ class Email_summary_status 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());
@ -121,7 +118,6 @@ class Email_summary_status 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);
@ -134,7 +130,6 @@ class Email_summary_status extends Memcached_DataObject
* *
* @return int flag for whether to send this user a summary email * @return int flag for whether to send this user a summary email
*/ */
static function getSendSummary($user_id) static function getSendSummary($user_id)
{ {
$ess = Email_summary_status::staticGet('user_id', $user_id); $ess = Email_summary_status::staticGet('user_id', $user_id);
@ -153,11 +148,10 @@ class Email_summary_status extends Memcached_DataObject
* *
* @return Email_summary_status instance for this user, with count already incremented. * @return Email_summary_status instance for this user, with count already incremented.
*/ */
static function getLastSummaryID($user_id) static function getLastSummaryID($user_id)
{ {
$ess = Email_summary_status::staticGet('user_id', $user_id); $ess = Email_summary_status::staticGet('user_id', $user_id);
if (!empty($ess)) { if (!empty($ess)) {
return $ess->last_summary_id; return $ess->last_summary_id;
} else { } else {

View File

@ -1,7 +1,7 @@
<?php <?php
/* /*
* StatusNet - the distributed open-source microblogging tool * StatusNet - the distributed open-source microblogging tool
* *
* Handler for queue items of type 'sitesum', sends email summaries * Handler for queue items of type 'sitesum', sends email summaries
* to all users on the site. * to all users on the site.
* *
@ -31,7 +31,7 @@ if (!defined('STATUSNET')) {
} }
/** /**
* *
* Handler for queue items of type 'sitesum', sends email summaries * Handler for queue items of type 'sitesum', sends email summaries
* to all users on the site. * to all users on the site.
* *
@ -42,7 +42,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 SiteEmailSummaryHandler extends QueueHandler class SiteEmailSummaryHandler extends QueueHandler
{ {
@ -55,7 +54,6 @@ class SiteEmailSummaryHandler extends QueueHandler
* *
* @return string * @return string
*/ */
function transport() function transport()
{ {
return 'sitesum'; return 'sitesum';
@ -63,21 +61,20 @@ class SiteEmailSummaryHandler extends QueueHandler
/** /**
* Handle the site * Handle the site
* *
* @param mixed $object * @param mixed $object
* @return boolean true on success, false on failure * @return boolean true on success, false on failure
*/ */
function handle($object) function handle($object)
{ {
$qm = QueueManager::get(); $qm = QueueManager::get();
try { try {
// Enqueue a summary for all users // Enqueue a summary for all users
$user = new User(); $user = new User();
$user->find(); $user->find();
while ($user->fetch()) { while ($user->fetch()) {
try { try {
$qm->enqueue($user->id, 'usersum'); $qm->enqueue($user->id, 'usersum');
@ -89,8 +86,7 @@ class SiteEmailSummaryHandler extends QueueHandler
} catch (Exception $e) { } catch (Exception $e) {
common_log(LOG_WARNING, $e->getMessage()); common_log(LOG_WARNING, $e->getMessage());
} }
return true; return true;
} }
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/** /**
* StatusNet - the distributed open-source microblogging tool * StatusNet - the distributed open-source microblogging tool
* *
* Handler for queue items of type 'usersum', sends an email summaries * Handler for queue items of type 'usersum', sends an email summaries
* to a particular user. * to a particular user.
* *
@ -41,13 +41,11 @@ 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 UserEmailSummaryHandler extends QueueHandler class UserEmailSummaryHandler extends QueueHandler
{ {
// Maximum number of notices to include by default. This is probably too much. // Maximum number of notices to include by default. This is probably too much.
const MAX_NOTICES = 200; const MAX_NOTICES = 200;
/** /**
* Return transport keyword which identifies items this queue handler * Return transport keyword which identifies items this queue handler
* services; must be defined for all subclasses. * services; must be defined for all subclasses.
@ -57,7 +55,6 @@ class UserEmailSummaryHandler extends QueueHandler
* *
* @return string * @return string
*/ */
function transport() function transport()
{ {
return 'sitesum'; return 'sitesum';
@ -65,47 +62,46 @@ class UserEmailSummaryHandler extends QueueHandler
/** /**
* Send a summary email to the user * Send a summary email to the user
* *
* @param mixed $object * @param mixed $object
* @return boolean true on success, false on failure * @return boolean true on success, false on failure
*/ */
function handle($user_id) function handle($user_id)
{ {
// Skip if they've asked not to get summaries // Skip if they've asked not to get summaries
$ess = Email_summary_status::staticGet('user_id', $user_id); $ess = Email_summary_status::staticGet('user_id', $user_id);
if (!empty($ess) && !$ess->send_summary) { if (!empty($ess) && !$ess->send_summary) {
common_log(LOG_INFO, sprintf('Not sending email summary for user %s by request.', $user_id)); common_log(LOG_INFO, sprintf('Not sending email summary for user %s by request.', $user_id));
return true; return true;
} }
$since_id = null; $since_id = null;
if (!empty($ess)) { if (!empty($ess)) {
$since_id = $ess->last_summary_id; $since_id = $ess->last_summary_id;
} }
$user = User::staticGet('id', $user_id); $user = User::staticGet('id', $user_id);
if (empty($user)) { if (empty($user)) {
common_log(LOG_INFO, sprintf('Not sending email summary for user %s; no such user.', $user_id)); common_log(LOG_INFO, sprintf('Not sending email summary for user %s; no such user.', $user_id));
return true; return true;
} }
if (empty($user->email)) { if (empty($user->email)) {
common_log(LOG_INFO, sprintf('Not sending email summary for user %s; no email address.', $user_id)); common_log(LOG_INFO, sprintf('Not sending email summary for user %s; no email address.', $user_id));
return true; return true;
} }
$profile = $user->getProfile(); $profile = $user->getProfile();
if (empty($profile)) { if (empty($profile)) {
common_log(LOG_WARNING, sprintf('Not sending email summary for user %s; no profile.', $user_id)); common_log(LOG_WARNING, sprintf('Not sending email summary for user %s; no profile.', $user_id));
return true; return true;
} }
$notice = $user->ownFriendsTimeline(0, self::MAX_NOTICES, $since_id); $notice = $user->ownFriendsTimeline(0, self::MAX_NOTICES, $since_id);
if (empty($notice) || $notice->N == 0) { if (empty($notice) || $notice->N == 0) {
@ -117,18 +113,20 @@ class UserEmailSummaryHandler extends QueueHandler
// figuring out a better way. -ESP // figuring out a better way. -ESP
$new_top = null; $new_top = null;
if ($notice instanceof ArrayWrapper) { if ($notice instanceof ArrayWrapper) {
$new_top = $notice->_items[0]->id; $new_top = $notice->_items[0]->id;
} }
$out = new XMLStringer(); $out = new XMLStringer();
$out->elementStart('div', array('width' => '100%', $out->elementStart('div', array('width' => '100%',
'style' => 'background-color: #ffffff; border: 4px solid #4c609a; padding: 10px;')); 'style' => 'background-color: #ffffff; border: 4px solid #4c609a; padding: 10px;'));
$out->elementStart('div', array('style' => 'color: #ffffff; background-color: #4c609a; font-weight: bold; margin-bottom: 10px; padding: 4px;')); $out->elementStart('div', array('style' => 'color: #ffffff; background-color: #4c609a; font-weight: bold; margin-bottom: 10px; padding: 4px;'));
$out->raw(sprintf(_m('Recent updates from %1s for %2s:'), // TRANS: Text in e-mail summary.
// TRANS: %1$s is the StatusNet sitename, %2$s is the recipient's profile name.
$out->raw(sprintf(_m('Recent updates from %1$s for %2s:'),
common_config('site', 'name'), common_config('site', 'name'),
$profile->getBestName())); $profile->getBestName()));
$out->elementEnd('div'); $out->elementEnd('div');
@ -137,13 +135,12 @@ class UserEmailSummaryHandler extends QueueHandler
'style' => 'border: none; border-collapse: collapse;', 'cellpadding' => '6')); 'style' => 'border: none; border-collapse: collapse;', 'cellpadding' => '6'));
while ($notice->fetch()) { while ($notice->fetch()) {
$profile = Profile::staticGet('id', $notice->profile_id); $profile = Profile::staticGet('id', $notice->profile_id);
if (empty($profile)) { if (empty($profile)) {
continue; continue;
} }
$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
$out->elementStart('tr'); $out->elementStart('tr');
@ -191,7 +188,7 @@ class UserEmailSummaryHandler extends QueueHandler
$out->elementEnd('td'); $out->elementEnd('td');
$out->elementEnd('tr'); $out->elementEnd('tr');
} }
$out->elementEnd('table'); $out->elementEnd('table');
$out->raw(sprintf(_m('<p><a href="%1s">change your email settings for %2s</a></p>'), $out->raw(sprintf(_m('<p><a href="%1s">change your email settings for %2s</a></p>'),
@ -199,35 +196,32 @@ class UserEmailSummaryHandler extends QueueHandler
common_config('site', 'name'))); common_config('site', 'name')));
$out->elementEnd('div'); $out->elementEnd('div');
$body = $out->getString(); $body = $out->getString();
// FIXME: do something for people who don't like HTML email // FIXME: do something for people who don't like HTML email
mail_to_user($user, _m('Updates from your network'), $body, mail_to_user($user, _m('Updates from your network'), $body,
array('Content-Type' => 'text/html; charset=UTF-8')); array('Content-Type' => 'text/html; charset=UTF-8'));
if (empty($ess)) { if (empty($ess)) {
$ess = new Email_summary_status(); $ess = new Email_summary_status();
$ess->user_id = $user_id; $ess->user_id = $user_id;
$ess->created = common_sql_now(); $ess->created = common_sql_now();
$ess->last_summary_id = $new_top; $ess->last_summary_id = $new_top;
$ess->modified = common_sql_now(); $ess->modified = common_sql_now();
$ess->insert(); $ess->insert();
} else { } else {
$orig = clone($ess); $orig = clone($ess);
$ess->last_summary_id = $new_top; $ess->last_summary_id = $new_top;
$ess->modified = common_sql_now(); $ess->modified = common_sql_now();
$ess->update($orig); $ess->update($orig);
} }
return true; return true;
} }
} }

View File

@ -23,7 +23,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
/** /**
* Queue handler for watching new notices and posting to enjit. * Queue handler for watching new notices and posting to enjit.
* @fixme is this actually being used/functional atm? * @todo FIXME: Is this actually being used/functional atm?
*/ */
class EnjitQueueHandler extends QueueHandler class EnjitQueueHandler extends QueueHandler
{ {

View File

@ -105,7 +105,6 @@ class EventPlugin extends MicroappPlugin
* *
* @return boolean hook value; true means continue processing, false means stop. * @return boolean hook value; true means continue processing, false means stop.
*/ */
function onRouterInitialized($m) function onRouterInitialized($m)
{ {
$m->connect('main/event/new', $m->connect('main/event/new',
@ -130,12 +129,14 @@ class EventPlugin extends MicroappPlugin
'author' => 'Evan Prodromou', 'author' => 'Evan Prodromou',
'homepage' => 'http://status.net/wiki/Plugin:Event', 'homepage' => 'http://status.net/wiki/Plugin:Event',
'description' => 'description' =>
// TRANS: Plugin description.
_m('Event invitations and RSVPs.')); _m('Event invitations and RSVPs.'));
return true; return true;
} }
function appTitle() { function appTitle() {
return _m('Event'); // TRANS: Title for event application.
return _m('TITLE','Event');
} }
function tag() { function tag() {
@ -162,12 +163,13 @@ class EventPlugin extends MicroappPlugin
function saveNoticeFromActivity($activity, $actor, $options=array()) function saveNoticeFromActivity($activity, $actor, $options=array())
{ {
if (count($activity->objects) != 1) { if (count($activity->objects) != 1) {
throw new Exception('Too many activity objects.'); throw new Exception(_('Too many activity objects.'));
} }
$happeningObj = $activity->objects[0]; $happeningObj = $activity->objects[0];
if ($happeningObj->type != Happening::OBJECT_TYPE) { if ($happeningObj->type != Happening::OBJECT_TYPE) {
// TRANS: Exception thrown when event plugin comes across a non-event type object.
throw new Exception(_m('Wrong type for object.')); throw new Exception(_m('Wrong type for object.'));
} }
@ -175,8 +177,8 @@ class EventPlugin extends MicroappPlugin
switch ($activity->verb) { switch ($activity->verb) {
case ActivityVerb::POST: case ActivityVerb::POST:
$notice = Happening::saveNew($actor, $notice = Happening::saveNew($actor,
$start_time, $start_time,
$end_time, $end_time,
$happeningObj->title, $happeningObj->title,
null, null,
@ -189,12 +191,14 @@ class EventPlugin extends MicroappPlugin
$happening = Happening::staticGet('uri', $happeningObj->id); $happening = Happening::staticGet('uri', $happeningObj->id);
if (empty($happening)) { if (empty($happening)) {
// FIXME: save the event // FIXME: save the event
// TRANS: Exception thrown when trying to RSVP for an unknown event.
throw new Exception(_m('RSVP for unknown event.')); throw new Exception(_m('RSVP for unknown event.'));
} }
$notice = RSVP::saveNew($actor, $happening, $activity->verb, $options); $notice = RSVP::saveNew($actor, $happening, $activity->verb, $options);
break; break;
default: default:
throw new Exception(_m('Unknown verb for events')); // TRANS: Exception thrown when event plugin comes across a undefined verb.
throw new Exception(_m('Unknown verb for events.'));
} }
return $notice; return $notice;
@ -207,7 +211,6 @@ class EventPlugin extends MicroappPlugin
* *
* @return ActivityObject * @return ActivityObject
*/ */
function activityObjectFromNotice($notice) function activityObjectFromNotice($notice)
{ {
$happening = null; $happening = null;
@ -225,12 +228,14 @@ class EventPlugin extends MicroappPlugin
} }
if (empty($happening)) { if (empty($happening)) {
// TRANS: Exception thrown when event plugin comes across a unknown object type.
throw new Exception(_m('Unknown object type.')); throw new Exception(_m('Unknown object type.'));
} }
$notice = $happening->getNotice(); $notice = $happening->getNotice();
if (empty($notice)) { if (empty($notice)) {
// TRANS: Exception thrown when referring to a notice that is not an event an in event context.
throw new Exception(_m('Unknown event notice.')); throw new Exception(_m('Unknown event notice.'));
} }
@ -264,7 +269,6 @@ class EventPlugin extends MicroappPlugin
* *
* @return ActivityObject * @return ActivityObject
*/ */
function onEndNoticeAsActivity($notice, &$act) { function onEndNoticeAsActivity($notice, &$act) {
switch ($notice->object_type) { switch ($notice->object_type) {
case RSVP::POSITIVE: case RSVP::POSITIVE:
@ -282,7 +286,6 @@ class EventPlugin extends MicroappPlugin
* @param Notice $notice * @param Notice $notice
* @param HTMLOutputter $out * @param HTMLOutputter $out
*/ */
function showNotice($notice, $out) function showNotice($notice, $out)
{ {
switch ($notice->object_type) { switch ($notice->object_type) {
@ -365,6 +368,7 @@ class EventPlugin extends MicroappPlugin
$out->elementStart('div', 'event-times'); // VEVENT/EVENT-TIMES IN $out->elementStart('div', 'event-times'); // VEVENT/EVENT-TIMES IN
// TRANS: Field label for event description.
$out->element('strong', null, _m('Time:')); $out->element('strong', null, _m('Time:'));
$out->element('abbr', array('class' => 'dtstart', $out->element('abbr', array('class' => 'dtstart',
@ -385,6 +389,7 @@ class EventPlugin extends MicroappPlugin
if (!empty($event->location)) { if (!empty($event->location)) {
$out->elementStart('div', 'event-location'); $out->elementStart('div', 'event-location');
// TRANS: Field label for event description.
$out->element('strong', null, _m('Location:')); $out->element('strong', null, _m('Location:'));
$out->element('span', 'location', $event->location); $out->element('span', 'location', $event->location);
$out->elementEnd('div'); $out->elementEnd('div');
@ -392,6 +397,7 @@ class EventPlugin extends MicroappPlugin
if (!empty($event->description)) { if (!empty($event->description)) {
$out->elementStart('div', 'event-description'); $out->elementStart('div', 'event-description');
// TRANS: Field label for event description.
$out->element('strong', null, _m('Description:')); $out->element('strong', null, _m('Description:'));
$out->element('span', 'description', $event->description); $out->element('span', 'description', $event->description);
$out->elementEnd('div'); $out->elementEnd('div');
@ -400,6 +406,7 @@ class EventPlugin extends MicroappPlugin
$rsvps = $event->getRSVPs(); $rsvps = $event->getRSVPs();
$out->elementStart('div', 'event-rsvps'); $out->elementStart('div', 'event-rsvps');
// TRANS: Field label for event description.
$out->element('strong', null, _m('Attending:')); $out->element('strong', null, _m('Attending:'));
$out->element('span', 'event-rsvps', $out->element('span', 'event-rsvps',
// TRANS: RSVP counts. // TRANS: RSVP counts.
@ -433,7 +440,6 @@ class EventPlugin extends MicroappPlugin
* @param HTMLOutputter $out * @param HTMLOutputter $out
* @return Widget * @return Widget
*/ */
function entryForm($out) function entryForm($out)
{ {
return new EventForm($out); return new EventForm($out);
@ -444,7 +450,6 @@ class EventPlugin extends MicroappPlugin
* *
* @param Notice $notice * @param Notice $notice
*/ */
function deleteRelated($notice) function deleteRelated($notice)
{ {
switch ($notice->object_type) { switch ($notice->object_type) {

View File

@ -47,7 +47,6 @@ if (!defined('STATUSNET')) {
* *
* @see Managed_DataObject * @see Managed_DataObject
*/ */
class Happening extends Managed_DataObject class Happening extends Managed_DataObject
{ {
const OBJECT_TYPE = 'http://activitystrea.ms/schema/1.0/event'; const OBJECT_TYPE = 'http://activitystrea.ms/schema/1.0/event';
@ -122,6 +121,7 @@ class Happening extends Managed_DataObject
if (array_key_exists('uri', $options)) { if (array_key_exists('uri', $options)) {
$other = Happening::staticGet('uri', $options['uri']); $other = Happening::staticGet('uri', $options['uri']);
if (!empty($other)) { if (!empty($other)) {
// TRANS: Client exception thrown when trying to create an event that already exists.
throw new ClientException(_m('Event already exists.')); throw new ClientException(_m('Event already exists.'));
} }
} }
@ -163,6 +163,9 @@ class Happening extends Managed_DataObject
$location, $location,
$description); $description);
// TRANS: Rendered event description. %1$s is a title, %2$s is start time, %3$s is start time,
// TRANS: %4$s is end time, %5$s is end time, %6$s is location, %7$s is description.
// TRANS: Class names should not be translated.
$rendered = sprintf(_m('<span class="vevent">'. $rendered = sprintf(_m('<span class="vevent">'.
'<span class="summary">%1$s</span> '. '<span class="summary">%1$s</span> '.
'<abbr class="dtstart" title="%2$s">%3$s</a> - '. '<abbr class="dtstart" title="%2$s">%3$s</a> - '.

View File

@ -42,7 +42,6 @@ if (!defined('STATUSNET')) {
* *
* @see Managed_DataObject * @see Managed_DataObject
*/ */
class RSVP extends Managed_DataObject class RSVP extends Managed_DataObject
{ {
const POSITIVE = 'http://activitystrea.ms/schema/1.0/rsvp-yes'; const POSITIVE = 'http://activitystrea.ms/schema/1.0/rsvp-yes';
@ -64,7 +63,6 @@ class RSVP extends Managed_DataObject
* @param mixed $v Value to lookup * @param mixed $v Value to lookup
* *
* @return RSVP object found, or null for no hits * @return RSVP object found, or null for no hits
*
*/ */
function staticGet($k, $v=null) function staticGet($k, $v=null)
{ {
@ -77,7 +75,6 @@ class RSVP extends Managed_DataObject
* @param array $kv array of key-value mappings * @param array $kv array of key-value mappings
* *
* @return Bookmark object found, or null for no hits * @return Bookmark object found, or null for no hits
*
*/ */
function pkeyGet($kv) function pkeyGet($kv)
@ -141,6 +138,7 @@ class RSVP extends Managed_DataObject
if (array_key_exists('uri', $options)) { if (array_key_exists('uri', $options)) {
$other = RSVP::staticGet('uri', $options['uri']); $other = RSVP::staticGet('uri', $options['uri']);
if (!empty($other)) { if (!empty($other)) {
// TRANS: Client exception thrown when trying to save an already existing RSVP ("please respond").
throw new ClientException(_m('RSVP already exists.')); throw new ClientException(_m('RSVP already exists.'));
} }
} }
@ -149,6 +147,7 @@ class RSVP extends Managed_DataObject
'event_id' => $event->id)); 'event_id' => $event->id));
if (!empty($other)) { if (!empty($other)) {
// TRANS: Client exception thrown when trying to save an already existing RSVP ("please respond").
throw new ClientException(_m('RSVP already exists.')); throw new ClientException(_m('RSVP already exists.'));
} }
@ -179,7 +178,7 @@ class RSVP extends Managed_DataObject
// XXX: come up with something sexier // XXX: come up with something sexier
$content = $rsvp->asString(); $content = $rsvp->asString();
$rendered = $rsvp->asHTML(); $rendered = $rsvp->asHTML();
$options = array_merge(array('object_type' => $verb), $options = array_merge(array('object_type' => $verb),
@ -217,7 +216,8 @@ class RSVP extends Managed_DataObject
return '?'; return '?';
break; break;
default: default:
throw new Exception(sprintf(_m('Unknown verb "%s"'),$verb)); // TRANS: Exception thrown when requesting an undefined verb for RSVP.
throw new Exception(sprintf(_m('Unknown verb "%s".'),$verb));
} }
} }
@ -234,6 +234,7 @@ class RSVP extends Managed_DataObject
return RSVP::POSSIBLE; return RSVP::POSSIBLE;
break; break;
default: default:
// TRANS: Exception thrown when requesting an undefined code for RSVP.
throw new Exception(sprintf(_m('Unknown code "%s".'),$code)); throw new Exception(sprintf(_m('Unknown code "%s".'),$code));
} }
} }
@ -242,6 +243,8 @@ class RSVP extends Managed_DataObject
{ {
$notice = Notice::staticGet('uri', $this->uri); $notice = Notice::staticGet('uri', $this->uri);
if (empty($notice)) { if (empty($notice)) {
// TRANS: Server exception thrown when requesting a non-exsting notice for an RSVP ("please respond").
// TRANS: %s is the RSVP with the missing notice.
throw new ServerException(sprintf(_m('RSVP %s does not correspond to a notice in the database.'),$this->id)); throw new ServerException(sprintf(_m('RSVP %s does not correspond to a notice in the database.'),$this->id));
} }
return $notice; return $notice;
@ -297,6 +300,8 @@ class RSVP extends Managed_DataObject
{ {
$profile = Profile::staticGet('id', $this->profile_id); $profile = Profile::staticGet('id', $this->profile_id);
if (empty($profile)) { if (empty($profile)) {
// TRANS: Exception thrown when requesting a non-existing profile.
// TRANS: %s is the ID of the non-existing profile.
throw new Exception(sprintf(_m('No profile with ID %s.'),$this->profile_id)); throw new Exception(sprintf(_m('No profile with ID %s.'),$this->profile_id));
} }
return $profile; return $profile;
@ -306,6 +311,8 @@ class RSVP extends Managed_DataObject
{ {
$event = Happening::staticGet('id', $this->event_id); $event = Happening::staticGet('id', $this->event_id);
if (empty($event)) { if (empty($event)) {
// TRANS: Exception thrown when requesting a non-existing event.
// TRANS: %s is the ID of the non-existing event.
throw new Exception(sprintf(_m('No event with ID %s.'),$this->event_id)); throw new Exception(sprintf(_m('No event with ID %s.'),$this->event_id));
} }
return $event; return $event;
@ -335,21 +342,34 @@ class RSVP extends Managed_DataObject
switch ($response) { switch ($response) {
case 'Y': case 'Y':
// TRANS: HTML version of an RSVP ("please respond") status for a user.
// TRANS: %1$s is a profile URL, %2$s a profile name,
// TRANS: %3$s is an event URL, %4$s an event title.
$fmt = _m("<span class='automatic event-rsvp'><a href='%1\$s'>%2\$s</a> is attending <a href='%3\$s'>%4\$s</a>.</span>"); $fmt = _m("<span class='automatic event-rsvp'><a href='%1\$s'>%2\$s</a> is attending <a href='%3\$s'>%4\$s</a>.</span>");
break; break;
case 'N': case 'N':
// TRANS: HTML version of an RSVP ("please respond") status for a user.
// TRANS: %1$s is a profile URL, %2$s a profile name,
// TRANS: %3$s is an event URL, %4$s an event title.
$fmt = _m("<span class='automatic event-rsvp'><a href='%1\$s'>%2\$s</a> is not attending <a href='%3\$s'>%4\$s</a>.</span>"); $fmt = _m("<span class='automatic event-rsvp'><a href='%1\$s'>%2\$s</a> is not attending <a href='%3\$s'>%4\$s</a>.</span>");
break; break;
case '?': case '?':
// TRANS: HTML version of an RSVP ("please respond") status for a user.
// TRANS: %1$s is a profile URL, %2$s a profile name,
// TRANS: %3$s is an event URL, %4$s an event title.
$fmt = _m("<span class='automatic event-rsvp'><a href='%1\$s'>%2\$s</a> might attend <a href='%3\$s'>%4\$s</a>.</span>"); $fmt = _m("<span class='automatic event-rsvp'><a href='%1\$s'>%2\$s</a> might attend <a href='%3\$s'>%4\$s</a>.</span>");
break; break;
default: default:
// TRANS: Exception thrown when requesting a user's RSVP status for a non-existing response code.
// TRANS: %s is the non-existing response code.
throw new Exception(sprintf(_m('Unknown response code %s.'),$response)); throw new Exception(sprintf(_m('Unknown response code %s.'),$response));
break; break;
} }
if (empty($event)) { if (empty($event)) {
$eventUrl = '#'; $eventUrl = '#';
// TRANS: Used as event title when not event title is available.
// TRANS: Used as: Username [is [not ] attending|might attend] an unknown event.
$eventTitle = _m('an unknown event'); $eventTitle = _m('an unknown event');
} else { } else {
$notice = $event->getNotice(); $notice = $event->getNotice();
@ -370,20 +390,30 @@ class RSVP extends Managed_DataObject
switch ($response) { switch ($response) {
case 'Y': case 'Y':
// TRANS: Plain text version of an RSVP ("please respond") status for a user.
// TRANS: %1$s is a profile name, %2$s is an event title.
$fmt = _m('%1$s is attending %2$s.'); $fmt = _m('%1$s is attending %2$s.');
break; break;
case 'N': case 'N':
// TRANS: Plain text version of an RSVP ("please respond") status for a user.
// TRANS: %1$s is a profile name, %2$s is an event title.
$fmt = _m('%1$s is not attending %2$s.'); $fmt = _m('%1$s is not attending %2$s.');
break; break;
case '?': case '?':
// TRANS: Plain text version of an RSVP ("please respond") status for a user.
// TRANS: %1$s is a profile name, %2$s is an event title.
$fmt = _m('%1$s might attend %2$s.'); $fmt = _m('%1$s might attend %2$s.');
break; break;
default: default:
// TRANS: Exception thrown when requesting a user's RSVP status for a non-existing response code.
// TRANS: %s is the non-existing response code.
throw new Exception(sprintf(_m('Unknown response code %s.'),$response)); throw new Exception(sprintf(_m('Unknown response code %s.'),$response));
break; break;
} }
if (empty($event)) { if (empty($event)) {
// TRANS: Used as event title when not event title is available.
// TRANS: Used as: Username [is [not ] attending|might attend] an unknown event.
$eventTitle = _m('an unknown event'); $eventTitle = _m('an unknown event');
} else { } else {
$notice = $event->getNotice(); $notice = $event->getNotice();

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc. * Copyright (C) 2011, StatusNet, Inc.
* *
* Cancel the RSVP for an event * Cancel the RSVP for an event
* *
* 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
@ -27,6 +27,7 @@
* @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/
*/ */
if (!defined('STATUSNET')) { if (!defined('STATUSNET')) {
// This check helps protect against security problems; // This check helps protect against security problems;
// your code file can't be executed directly from the web. // your code file can't be executed directly from the web.
@ -43,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 CancelrsvpAction extends Action class CancelrsvpAction extends Action
{ {
protected $user = null; protected $user = null;
@ -55,10 +55,10 @@ class CancelrsvpAction extends Action
* *
* @return string Action title * @return string Action title
*/ */
function title() function title()
{ {
return _m('Cancel RSVP'); // TRANS: Title for RSVP ("please respond") action.
return _m('TITLE','Cancel RSVP');
} }
/** /**
@ -68,7 +68,6 @@ class CancelrsvpAction extends Action
* *
* @return boolean true * @return boolean true
*/ */
function prepare($argarray) function prepare($argarray)
{ {
parent::prepare($argarray); parent::prepare($argarray);
@ -79,24 +78,28 @@ class CancelrsvpAction extends Action
$rsvpId = $this->trimmed('rsvp'); $rsvpId = $this->trimmed('rsvp');
if (empty($rsvpId)) { if (empty($rsvpId)) {
// TRANS: Client exception thrown when referring to a non-existing RSVP ("please respond") item.
throw new ClientException(_m('No such RSVP.')); throw new ClientException(_m('No such RSVP.'));
} }
$this->rsvp = RSVP::staticGet('id', $rsvpId); $this->rsvp = RSVP::staticGet('id', $rsvpId);
if (empty($this->rsvp)) { if (empty($this->rsvp)) {
// TRANS: Client exception thrown when referring to a non-existing RSVP ("please respond") item.
throw new ClientException(_m('No such RSVP.')); throw new ClientException(_m('No such RSVP.'));
} }
$this->event = Happening::staticGet('id', $this->rsvp->event_id); $this->event = Happening::staticGet('id', $this->rsvp->event_id);
if (empty($this->event)) { if (empty($this->event)) {
// TRANS: Client exception thrown when referring to a non-existing event.
throw new ClientException(_m('No such event.')); throw new ClientException(_m('No such event.'));
} }
$this->user = common_current_user(); $this->user = common_current_user();
if (empty($this->user)) { if (empty($this->user)) {
// TRANS: Client exception thrown when trying tp RSVP ("please respond") while not logged in.
throw new ClientException(_m('You must be logged in to RSVP for an event.')); throw new ClientException(_m('You must be logged in to RSVP for an event.'));
} }
@ -110,7 +113,6 @@ class CancelrsvpAction extends Action
* *
* @return void * @return void
*/ */
function handle($argarray=null) function handle($argarray=null)
{ {
parent::handle($argarray); parent::handle($argarray);
@ -129,7 +131,6 @@ class CancelrsvpAction extends Action
* *
* @return void * @return void
*/ */
function cancelRSVP() function cancelRSVP()
{ {
try { try {
@ -171,7 +172,6 @@ class CancelrsvpAction extends Action
* *
* @return void * @return void
*/ */
function showContent() function showContent()
{ {
if (!empty($this->error)) { if (!empty($this->error)) {
@ -194,7 +194,6 @@ class CancelrsvpAction extends Action
* *
* @return boolean is read only action? * @return boolean is read only action?
*/ */
function isReadOnly($args) function isReadOnly($args)
{ {
if ($_SERVER['REQUEST_METHOD'] == 'GET' || if ($_SERVER['REQUEST_METHOD'] == 'GET' ||

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc. * Copyright (C) 2011, StatusNet, Inc.
* *
* Form to RSVP for an event * Form to RSVP for an event
* *
* 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 CancelRSVPForm extends Form class CancelRSVPForm extends Form
{ {
protected $rsvp = null; protected $rsvp = null;
@ -60,7 +59,6 @@ class CancelRSVPForm extends Form
* *
* @return int ID of the form * @return int ID of the form
*/ */
function id() function id()
{ {
return 'form_event_rsvp'; return 'form_event_rsvp';
@ -71,7 +69,6 @@ class CancelRSVPForm extends Form
* *
* @return string class of the form * @return string class of the form
*/ */
function formClass() function formClass()
{ {
return 'ajax'; return 'ajax';
@ -82,7 +79,6 @@ class CancelRSVPForm extends Form
* *
* @return string URL of the action * @return string URL of the action
*/ */
function action() function action()
{ {
return common_local_url('cancelrsvp'); return common_local_url('cancelrsvp');
@ -93,7 +89,6 @@ class CancelRSVPForm extends Form
* *
* @return void * @return void
*/ */
function formData() function formData()
{ {
$this->out->elementStart('fieldset', array('id' => 'new_rsvp_data')); $this->out->elementStart('fieldset', array('id' => 'new_rsvp_data'));
@ -102,12 +97,15 @@ class CancelRSVPForm extends Form
switch (RSVP::verbFor($this->rsvp->response)) { switch (RSVP::verbFor($this->rsvp->response)) {
case RSVP::POSITIVE: case RSVP::POSITIVE:
// TRANS: Possible status for RSVP ("please respond") item.
$this->out->text(_m('You will attend this event.')); $this->out->text(_m('You will attend this event.'));
break; break;
case RSVP::NEGATIVE: case RSVP::NEGATIVE:
// TRANS: Possible status for RSVP ("please respond") item.
$this->out->text(_m('You will not attend this event.')); $this->out->text(_m('You will not attend this event.'));
break; break;
case RSVP::POSSIBLE: case RSVP::POSSIBLE:
// TRANS: Possible status for RSVP ("please respond") item.
$this->out->text(_m('You might attend this event.')); $this->out->text(_m('You might attend this event.'));
break; break;
} }
@ -120,9 +118,9 @@ class CancelRSVPForm extends Form
* *
* @return void * @return void
*/ */
function formActions() function formActions()
{ {
// TRANS: Button text to cancel responding to an RSVP ("please respond") item.
$this->out->submit('cancel', _m('BUTTON', 'Cancel')); $this->out->submit('cancel', _m('BUTTON', 'Cancel'));
} }
} }

View File

@ -6,4 +6,3 @@
.event-title { margin-left: 0px; } .event-title { margin-left: 0px; }
#content .event .entry-title { margin-left: 0px; } #content .event .entry-title { margin-left: 0px; }
#content .event .entry-content { margin-left: 0px; } #content .event .entry-content { margin-left: 0px; }

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc. * Copyright (C) 2011, StatusNet, Inc.
* *
* Form for entering an event * Form for entering an event
* *
* 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 EventForm extends Form class EventForm extends Form
{ {
/** /**
@ -52,7 +51,6 @@ class EventForm extends Form
* *
* @return int ID of the form * @return int ID of the form
*/ */
function id() function id()
{ {
return 'form_new_event'; return 'form_new_event';
@ -63,7 +61,6 @@ class EventForm extends Form
* *
* @return string class of the form * @return string class of the form
*/ */
function formClass() function formClass()
{ {
return 'form_settings ajax-notice'; return 'form_settings ajax-notice';
@ -74,7 +71,6 @@ class EventForm extends Form
* *
* @return string URL of the action * @return string URL of the action
*/ */
function action() function action()
{ {
return common_local_url('newevent'); return common_local_url('newevent');
@ -85,7 +81,6 @@ class EventForm extends Form
* *
* @return void * @return void
*/ */
function formData() function formData()
{ {
$this->out->elementStart('fieldset', array('id' => 'new_bookmark_data')); $this->out->elementStart('fieldset', array('id' => 'new_bookmark_data'));
@ -93,57 +88,73 @@ class EventForm extends Form
$this->li(); $this->li();
$this->out->input('title', $this->out->input('title',
// TRANS: Field label on event form.
_m('LABEL','Title'), _m('LABEL','Title'),
null, null,
// TRANS: Field title on event form.
_m('Title of the event.')); _m('Title of the event.'));
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->input('startdate', $this->out->input('startdate',
// TRANS: Field label on event form.
_m('LABEL','Start date'), _m('LABEL','Start date'),
null, null,
// TRANS: Field title on event form.
_m('Date the event starts.')); _m('Date the event starts.'));
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->input('starttime', $this->out->input('starttime',
// TRANS: Field label on event form.
_m('LABEL','Start time'), _m('LABEL','Start time'),
null, null,
// TRANS: Field title on event form.
_m('Time the event starts.')); _m('Time the event starts.'));
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->input('enddate', $this->out->input('enddate',
// TRANS: Field label on event form.
_m('LABEL','End date'), _m('LABEL','End date'),
null, null,
// TRANS: Field title on event form.
_m('Date the event ends.')); _m('Date the event ends.'));
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->input('endtime', $this->out->input('endtime',
// TRANS: Field label on event form.
_m('LABEL','End time'), _m('LABEL','End time'),
null, null,
// TRANS: Field title on event form.
_m('Time the event ends.')); _m('Time the event ends.'));
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->input('location', $this->out->input('location',
// TRANS: Field label on event form.
_m('LABEL','Location'), _m('LABEL','Location'),
null, null,
// TRANS: Field title on event form.
_m('Event location.')); _m('Event location.'));
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->input('url', $this->out->input('url',
// TRANS: Field label on event form.
_m('LABEL','URL'), _m('LABEL','URL'),
null, null,
// TRANS: Field title on event form.
_m('URL for more information.')); _m('URL for more information.'));
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->input('description', $this->out->input('description',
// TRANS: Field label on event form.
_m('LABEL','Description'), _m('LABEL','Description'),
null, null,
// TRANS: Field title on event form.
_m('Description of the event.')); _m('Description of the event.'));
$this->unli(); $this->unli();
@ -162,9 +173,9 @@ class EventForm extends Form
* *
* @return void * @return void
*/ */
function formActions() function formActions()
{ {
// TRANS: Button text to save an event..
$this->out->submit('submit', _m('BUTTON', 'Save')); $this->out->submit('submit', _m('BUTTON', 'Save'));
} }
} }

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc. * Copyright (C) 2011, StatusNet, Inc.
* *
* Add a new event * Add a new event
* *
* 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
@ -27,6 +27,7 @@
* @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/
*/ */
if (!defined('STATUSNET')) { if (!defined('STATUSNET')) {
// This check helps protect against security problems; // This check helps protect against security problems;
// your code file can't be executed directly from the web. // your code file can't be executed directly from the web.
@ -43,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 NeweventAction extends Action class NeweventAction extends Action
{ {
protected $user = null; protected $user = null;
@ -60,10 +60,10 @@ class NeweventAction extends Action
* *
* @return string Action title * @return string Action title
*/ */
function title() function title()
{ {
return _m('New event'); // TRANS: Title for new event form.
return _m('TITLE','New event');
} }
/** /**
@ -73,7 +73,6 @@ class NeweventAction extends Action
* *
* @return boolean true * @return boolean true
*/ */
function prepare($argarray) function prepare($argarray)
{ {
parent::prepare($argarray); parent::prepare($argarray);
@ -81,6 +80,7 @@ class NeweventAction 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 post an event while not logged in.
throw new ClientException(_m('Must be logged in to post a event.'), throw new ClientException(_m('Must be logged in to post a event.'),
403); 403);
} }
@ -92,6 +92,7 @@ class NeweventAction extends Action
$this->title = $this->trimmed('title'); $this->title = $this->trimmed('title');
if (empty($this->title)) { if (empty($this->title)) {
// TRANS: Client exception thrown when trying to post an event without providing a title.
throw new ClientException(_m('Title required.')); throw new ClientException(_m('Title required.'));
} }
@ -102,6 +103,7 @@ class NeweventAction extends Action
$startDate = $this->trimmed('startdate'); $startDate = $this->trimmed('startdate');
if (empty($startDate)) { if (empty($startDate)) {
// TRANS: Client exception thrown when trying to post an event without providing a start date.
throw new ClientException(_m('Start date required.')); throw new ClientException(_m('Start date required.'));
} }
@ -114,6 +116,7 @@ class NeweventAction extends Action
$endDate = $this->trimmed('enddate'); $endDate = $this->trimmed('enddate');
if (empty($endDate)) { if (empty($endDate)) {
// TRANS: Client exception thrown when trying to post an event without providing an end date.
throw new ClientException(_m('End date required.')); throw new ClientException(_m('End date required.'));
} }
@ -135,12 +138,16 @@ class NeweventAction extends Action
$this->endTime = strtotime($end); $this->endTime = strtotime($end);
if ($this->startTime == 0) { if ($this->startTime == 0) {
// TRANS: Client exception thrown when trying to post an event with a date that cannot be processed.
// TRANS: %s is the data that could not be processed.
throw new Exception(sprintf(_m('Could not parse date "%s".'), throw new Exception(sprintf(_m('Could not parse date "%s".'),
$start)); $start));
} }
if ($this->endTime == 0) { if ($this->endTime == 0) {
// TRANS: Client exception thrown when trying to post an event with a date that cannot be processed.
// TRANS: %s is the data that could not be processed.
throw new Exception(sprintf(_m('Could not parse date "%s".'), throw new Exception(sprintf(_m('Could not parse date "%s".'),
$end)); $end));
} }
@ -155,7 +162,6 @@ class NeweventAction extends Action
* *
* @return void * @return void
*/ */
function handle($argarray=null) function handle($argarray=null)
{ {
parent::handle($argarray); parent::handle($argarray);
@ -174,19 +180,21 @@ class NeweventAction extends Action
* *
* @return void * @return void
*/ */
function newEvent() function newEvent()
{ {
try { try {
if (empty($this->title)) { if (empty($this->title)) {
// TRANS: Client exception thrown when trying to post an event without providing a title.
throw new ClientException(_m('Event must have a title.')); throw new ClientException(_m('Event must have a title.'));
} }
if (empty($this->startTime)) { if (empty($this->startTime)) {
// TRANS: Client exception thrown when trying to post an event without providing a start time.
throw new ClientException(_m('Event must have a start time.')); throw new ClientException(_m('Event must have a start time.'));
} }
if (empty($this->endTime)) { if (empty($this->endTime)) {
// TRANS: Client exception thrown when trying to post an event without providing an end time.
throw new ClientException(_m('Event must have an end time.')); throw new ClientException(_m('Event must have an end time.'));
} }
@ -195,7 +203,7 @@ class NeweventAction extends Action
// Does the heavy-lifting for getting "To:" information // Does the heavy-lifting for getting "To:" information
ToSelector::fillOptions($this, $options); ToSelector::fillOptions($this, $options);
$profile = $this->user->getProfile(); $profile = $this->user->getProfile();
$saved = Happening::saveNew($profile, $saved = Happening::saveNew($profile,
@ -239,7 +247,6 @@ class NeweventAction extends Action
* *
* @return void * @return void
*/ */
function showContent() function showContent()
{ {
if (!empty($this->error)) { if (!empty($this->error)) {
@ -262,7 +269,6 @@ class NeweventAction extends Action
* *
* @return boolean is read only action? * @return boolean is read only action?
*/ */
function isReadOnly($args) function isReadOnly($args)
{ {
if ($_SERVER['REQUEST_METHOD'] == 'GET' || if ($_SERVER['REQUEST_METHOD'] == 'GET' ||

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc. * Copyright (C) 2011, StatusNet, Inc.
* *
* RSVP for an event * RSVP for an event
* *
* 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
@ -27,6 +27,7 @@
* @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/
*/ */
if (!defined('STATUSNET')) { if (!defined('STATUSNET')) {
// This check helps protect against security problems; // This check helps protect against security problems;
// your code file can't be executed directly from the web. // your code file can't be executed directly from the web.
@ -43,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 NewrsvpAction extends Action class NewrsvpAction extends Action
{ {
protected $user = null; protected $user = null;
@ -55,10 +55,10 @@ class NewrsvpAction extends Action
* *
* @return string Action title * @return string Action title
*/ */
function title() function title()
{ {
return _m('New RSVP'); // TRANS: Title for RSVP ("please respond") action.
return _m('TITLE','New RSVP');
} }
/** /**
@ -68,7 +68,6 @@ class NewrsvpAction extends Action
* *
* @return boolean true * @return boolean true
*/ */
function prepare($argarray) function prepare($argarray)
{ {
parent::prepare($argarray); parent::prepare($argarray);
@ -79,18 +78,21 @@ class NewrsvpAction extends Action
$eventId = $this->trimmed('event'); $eventId = $this->trimmed('event');
if (empty($eventId)) { if (empty($eventId)) {
// TRANS: Client exception thrown when requesting a non-exsting event.
throw new ClientException(_m('No such event.')); throw new ClientException(_m('No such event.'));
} }
$this->event = Happening::staticGet('id', $eventId); $this->event = Happening::staticGet('id', $eventId);
if (empty($this->event)) { if (empty($this->event)) {
// TRANS: Client exception thrown when requesting a non-exsting event.
throw new ClientException(_m('No such event.')); throw new ClientException(_m('No such event.'));
} }
$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 RSVP ("please respond") while not logged in.
throw new ClientException(_m('You must be logged in to RSVP for an event.')); throw new ClientException(_m('You must be logged in to RSVP for an event.'));
} }
@ -107,7 +109,8 @@ class NewrsvpAction extends Action
$this->verb = RSVP::POSSIBLE; $this->verb = RSVP::POSSIBLE;
break; break;
default: default:
throw new ClientException('Unknown submit value.'); // TRANS: Client exception thrown when using an invalud value for RSVP ("please respond").
throw new ClientException(_('Unknown submit value.'));
} }
return true; return true;
@ -120,7 +123,6 @@ class NewrsvpAction extends Action
* *
* @return void * @return void
*/ */
function handle($argarray=null) function handle($argarray=null)
{ {
parent::handle($argarray); parent::handle($argarray);
@ -139,7 +141,6 @@ class NewrsvpAction extends Action
* *
* @return void * @return void
*/ */
function newRSVP() function newRSVP()
{ {
try { try {
@ -158,7 +159,7 @@ class NewrsvpAction extends Action
$this->xw->startDocument('1.0', 'UTF-8'); $this->xw->startDocument('1.0', 'UTF-8');
$this->elementStart('html'); $this->elementStart('html');
$this->elementStart('head'); $this->elementStart('head');
// TRANS: Page title after sending a notice. // TRANS: Page title after creating an event.
$this->element('title', null, _m('Event saved')); $this->element('title', null, _m('Event saved'));
$this->elementEnd('head'); $this->elementEnd('head');
$this->elementStart('body'); $this->elementStart('body');
@ -178,7 +179,6 @@ class NewrsvpAction extends Action
* *
* @return void * @return void
*/ */
function showContent() function showContent()
{ {
if (!empty($this->error)) { if (!empty($this->error)) {
@ -201,7 +201,6 @@ class NewrsvpAction extends Action
* *
* @return boolean is read only action? * @return boolean is read only action?
*/ */
function isReadOnly($args) function isReadOnly($args)
{ {
if ($_SERVER['REQUEST_METHOD'] == 'GET' || if ($_SERVER['REQUEST_METHOD'] == 'GET' ||

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc. * Copyright (C) 2011, StatusNet, Inc.
* *
* Form to RSVP for an event * Form to RSVP for an event
* *
* 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 RSVPForm extends Form class RSVPForm extends Form
{ {
protected $event = null; protected $event = null;
@ -60,7 +59,6 @@ class RSVPForm extends Form
* *
* @return int ID of the form * @return int ID of the form
*/ */
function id() function id()
{ {
return 'form_event_rsvp'; return 'form_event_rsvp';
@ -71,7 +69,6 @@ class RSVPForm extends Form
* *
* @return string class of the form * @return string class of the form
*/ */
function formClass() function formClass()
{ {
return 'ajax'; return 'ajax';
@ -82,7 +79,6 @@ class RSVPForm extends Form
* *
* @return string URL of the action * @return string URL of the action
*/ */
function action() function action()
{ {
return common_local_url('newrsvp'); return common_local_url('newrsvp');
@ -93,11 +89,11 @@ class RSVPForm extends Form
* *
* @return void * @return void
*/ */
function formData() function formData()
{ {
$this->out->elementStart('fieldset', array('id' => 'new_rsvp_data')); $this->out->elementStart('fieldset', array('id' => 'new_rsvp_data'));
// TRANS: Field label on form to RSVP ("please respond") for an event.
$this->out->text(_m('RSVP:')); $this->out->text(_m('RSVP:'));
$this->out->hidden('event', $this->event->id); $this->out->hidden('event', $this->event->id);
@ -111,14 +107,16 @@ class RSVPForm extends Form
* *
* @return void * @return void
*/ */
function formActions() function formActions()
{ {
// TRANS: Button text for RSVP ("please respond") reply to confirm attendence.
$this->submitButton('yes', _m('BUTTON', 'Yes')); $this->submitButton('yes', _m('BUTTON', 'Yes'));
// TRANS: Button text for RSVP ("please respond") reply to deny attendence.
$this->submitButton('no', _m('BUTTON', 'No')); $this->submitButton('no', _m('BUTTON', 'No'));
// TRANS: Button text for RSVP ("please respond") reply to indicate one might attend.
$this->submitButton('maybe', _m('BUTTON', 'Maybe')); $this->submitButton('maybe', _m('BUTTON', 'Maybe'));
} }
function submitButton($id, $label) function submitButton($id, $label)
{ {
$this->out->element('input', array('type' => 'submit', $this->out->element('input', array('type' => 'submit',

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc. * Copyright (C) 2011, StatusNet, Inc.
* *
* Show a single event * Show a single event
* *
* 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

View File

@ -4,7 +4,7 @@
* Copyright (C) 2010, StatusNet, Inc. * Copyright (C) 2010, StatusNet, Inc.
* *
* Show a single RSVP * Show a single RSVP
* *
* 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