L10n and i18n updates.
Break long lines in README before or at 80 characters.
Superfluous whitespace removed.
'author' => 'Zach Copley',
'homepage' => 'http://status.net/wiki/Plugin:Echo',
'rawdescription' =>
+ // TRANS: Plugin description.
_m('Use <a href="http://aboutecho.com/">Echo</a>'.
' to add commenting to notice pages.'));
return true;
'author' => 'Craig Andrews',
'homepage' => 'http://status.net/wiki/Plugin:EmailAuthentication',
'rawdescription' =>
+ // TRANS: Plugin description.
_m('The Email Authentication plugin allows users to login using their email address.'));
return true;
}
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
============
-add "addPlugin('emailAuthentication');" to the bottom of your config.php
+add "addPlugin('emailAuthentication');" to the bottom of your config.php.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class EmailSummaryPlugin extends Plugin
{
/**
*
* @return boolean hook value
*/
-
function onCheckSchema()
{
$schema = Schema::get();
// For storing user-submitted flags on profiles
-
$schema->ensureTable('email_summary_status',
array(new ColumnDef('user_id', 'integer', null,
false, 'PRI'),
* @param string $cls Name of the class to be loaded
*
* @return boolean hook value; true means continue processing, false means stop.
- *
+ *
*/
-
function onAutoload($cls)
{
$dir = dirname(__FILE__);
* @param array &$versions array of version data
*
* @return boolean hook value; true means continue processing, false means stop.
- *
*/
-
function onPluginVersion(&$versions)
{
$versions[] = array('name' => 'EmailSummary',
'author' => 'Evan Prodromou',
'homepage' => 'http://status.net/wiki/Plugin:EmailSummary',
'rawdescription' =>
+ // TRANS: Plugin description.
_m('Send an email summary of the inbox to users.'));
return true;
}
/**
* Register our queue handlers
- *
+ *
* @param QueueManager $qm Current queue manager
- *
+ *
* @return boolean hook value
*/
-
function onEndInitializeQueueManager($qm)
{
$qm->connect('sitesum', 'SiteEmailSummaryHandler');
$qm->connect('usersum', 'UserEmailSummaryHandler');
return true;
}
-
+
/**
* Add a checkbox to turn off email summaries
- *
+ *
* @param Action $action Action being executed (emailsettings)
- *
+ *
* @return boolean hook value
*/
-
function onEndEmailFormData($action)
{
$user = common_current_user();
-
+
$action->elementStart('li');
$action->checkbox('emailsummary',
// 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));
$action->elementEnd('li');
return true;
}
-
+
/**
* Add a checkbox to turn off email summaries
- *
+ *
* @param Action $action Action being executed (emailsettings)
- *
+ *
* @return boolean hook value
*/
-
function onEndEmailSaveForm($action)
{
$sendSummary = $action->boolean('emailsummary');
-
+
$user = common_current_user();
-
+
if (!empty($user)) {
-
+
$ess = Email_summary_status::staticGet('user_id', $user->id);
-
+
if (empty($ess)) {
-
+
$ess = new Email_summary_status();
$ess->user_id = $user->id;
$ess->send_summary = $sendSummary;
$ess->created = common_sql_now();
$ess->modified = common_sql_now();
-
+
$ess->insert();
-
+
} else {
-
+
$orig = clone($ess);
-
+
$ess->send_summary = $sendSummary;
$ess->modified = common_sql_now();
-
+
$ess->update($orig);
}
}
-
+
return true;
}
}
/**
* Data class for email summaries
- *
+ *
* Email summary information for users
*
* @category Action
*
* @see DB_DataObject
*/
-
class Email_summary_status extends Memcached_DataObject
{
public $__table = 'email_summary_status'; // table name
*
* @return array array of column definitions
*/
-
function table()
{
return array('user_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
*
* @return array list of key field names
*/
-
function keys()
{
return array_keys($this->keyTypes());
*
* @return array magic three-false array that stops auto-incrementing.
*/
-
function sequenceKey()
{
return array(false, false, false);
*
* @return int flag for whether to send this user a summary email
*/
-
static function getSendSummary($user_id)
{
$ess = Email_summary_status::staticGet('user_id', $user_id);
*
* @return Email_summary_status instance for this user, with count already incremented.
*/
-
static function getLastSummaryID($user_id)
{
$ess = Email_summary_status::staticGet('user_id', $user_id);
-
+
if (!empty($ess)) {
return $ess->last_summary_id;
} else {
<?php
/*
* StatusNet - the distributed open-source microblogging tool
- *
+ *
* Handler for queue items of type 'sitesum', sends email summaries
* to all users on the site.
*
}
/**
- *
+ *
* Handler for queue items of type 'sitesum', sends email summaries
* to all users on the site.
*
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class SiteEmailSummaryHandler extends QueueHandler
{
*
* @return string
*/
-
function transport()
{
return 'sitesum';
/**
* Handle the site
- *
+ *
* @param mixed $object
* @return boolean true on success, false on failure
*/
-
function handle($object)
{
$qm = QueueManager::get();
try {
// Enqueue a summary for all users
-
+
$user = new User();
$user->find();
-
+
while ($user->fetch()) {
try {
$qm->enqueue($user->id, 'usersum');
} catch (Exception $e) {
common_log(LOG_WARNING, $e->getMessage());
}
-
+
return true;
}
}
-
<?php
/**
* StatusNet - the distributed open-source microblogging tool
- *
+ *
* Handler for queue items of type 'usersum', sends an email summaries
* to a particular user.
*
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class UserEmailSummaryHandler extends QueueHandler
{
// Maximum number of notices to include by default. This is probably too much.
-
const MAX_NOTICES = 200;
-
+
/**
* Return transport keyword which identifies items this queue handler
* services; must be defined for all subclasses.
*
* @return string
*/
-
function transport()
{
return 'sitesum';
/**
* Send a summary email to the user
- *
+ *
* @param mixed $object
* @return boolean true on success, false on failure
*/
-
function handle($user_id)
{
// Skip if they've asked not to get summaries
$ess = Email_summary_status::staticGet('user_id', $user_id);
-
+
if (!empty($ess) && !$ess->send_summary) {
common_log(LOG_INFO, sprintf('Not sending email summary for user %s by request.', $user_id));
return true;
}
$since_id = null;
-
+
if (!empty($ess)) {
$since_id = $ess->last_summary_id;
}
-
+
$user = User::staticGet('id', $user_id);
if (empty($user)) {
common_log(LOG_INFO, sprintf('Not sending email summary for user %s; no such user.', $user_id));
return true;
}
-
+
if (empty($user->email)) {
common_log(LOG_INFO, sprintf('Not sending email summary for user %s; no email address.', $user_id));
return true;
}
-
+
$profile = $user->getProfile();
-
+
if (empty($profile)) {
common_log(LOG_WARNING, sprintf('Not sending email summary for user %s; no profile.', $user_id));
return true;
}
-
+
$notice = $user->ownFriendsTimeline(0, self::MAX_NOTICES, $since_id);
if (empty($notice) || $notice->N == 0) {
// figuring out a better way. -ESP
$new_top = null;
-
+
if ($notice instanceof ArrayWrapper) {
$new_top = $notice->_items[0]->id;
}
-
+
$out = new XMLStringer();
$out->elementStart('div', array('width' => '100%',
'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->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'),
$profile->getBestName()));
$out->elementEnd('div');
'style' => 'border: none; border-collapse: collapse;', 'cellpadding' => '6'));
while ($notice->fetch()) {
-
$profile = Profile::staticGet('id', $notice->profile_id);
-
+
if (empty($profile)) {
continue;
}
-
+
$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
$out->elementStart('tr');
$out->elementEnd('td');
$out->elementEnd('tr');
}
-
+
$out->elementEnd('table');
$out->raw(sprintf(_m('<p><a href="%1s">change your email settings for %2s</a></p>'),
common_config('site', 'name')));
$out->elementEnd('div');
-
+
$body = $out->getString();
-
+
// FIXME: do something for people who don't like HTML email
-
+
mail_to_user($user, _m('Updates from your network'), $body,
array('Content-Type' => 'text/html; charset=UTF-8'));
if (empty($ess)) {
-
$ess = new Email_summary_status();
-
+
$ess->user_id = $user_id;
$ess->created = common_sql_now();
$ess->last_summary_id = $new_top;
$ess->modified = common_sql_now();
$ess->insert();
-
} else {
-
$orig = clone($ess);
-
+
$ess->last_summary_id = $new_top;
$ess->modified = common_sql_now();
$ess->update($orig);
}
-
+
return true;
}
}
/**
* 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
{
*
* @return boolean hook value; true means continue processing, false means stop.
*/
-
function onRouterInitialized($m)
{
$m->connect('main/event/new',
'author' => 'Evan Prodromou',
'homepage' => 'http://status.net/wiki/Plugin:Event',
'description' =>
+ // TRANS: Plugin description.
_m('Event invitations and RSVPs.'));
return true;
}
function appTitle() {
- return _m('Event');
+ // TRANS: Title for event application.
+ return _m('TITLE','Event');
}
function tag() {
function saveNoticeFromActivity($activity, $actor, $options=array())
{
if (count($activity->objects) != 1) {
- throw new Exception('Too many activity objects.');
+ throw new Exception(_('Too many activity objects.'));
}
$happeningObj = $activity->objects[0];
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.'));
}
switch ($activity->verb) {
case ActivityVerb::POST:
- $notice = Happening::saveNew($actor,
- $start_time,
+ $notice = Happening::saveNew($actor,
+ $start_time,
$end_time,
$happeningObj->title,
null,
$happening = Happening::staticGet('uri', $happeningObj->id);
if (empty($happening)) {
// FIXME: save the event
+ // TRANS: Exception thrown when trying to RSVP for an unknown event.
throw new Exception(_m('RSVP for unknown event.'));
}
$notice = RSVP::saveNew($actor, $happening, $activity->verb, $options);
break;
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 ActivityObject
*/
-
function activityObjectFromNotice($notice)
{
$happening = null;
}
if (empty($happening)) {
+ // TRANS: Exception thrown when event plugin comes across a unknown object type.
throw new Exception(_m('Unknown object type.'));
}
$notice = $happening->getNotice();
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.'));
}
*
* @return ActivityObject
*/
-
function onEndNoticeAsActivity($notice, &$act) {
switch ($notice->object_type) {
case RSVP::POSITIVE:
* @param Notice $notice
* @param HTMLOutputter $out
*/
-
function showNotice($notice, $out)
{
switch ($notice->object_type) {
$out->elementStart('div', 'event-times'); // VEVENT/EVENT-TIMES IN
+ // TRANS: Field label for event description.
$out->element('strong', null, _m('Time:'));
$out->element('abbr', array('class' => 'dtstart',
if (!empty($event->location)) {
$out->elementStart('div', 'event-location');
+ // TRANS: Field label for event description.
$out->element('strong', null, _m('Location:'));
$out->element('span', 'location', $event->location);
$out->elementEnd('div');
if (!empty($event->description)) {
$out->elementStart('div', 'event-description');
+ // TRANS: Field label for event description.
$out->element('strong', null, _m('Description:'));
$out->element('span', 'description', $event->description);
$out->elementEnd('div');
$rsvps = $event->getRSVPs();
$out->elementStart('div', 'event-rsvps');
+ // TRANS: Field label for event description.
$out->element('strong', null, _m('Attending:'));
$out->element('span', 'event-rsvps',
// TRANS: RSVP counts.
* @param HTMLOutputter $out
* @return Widget
*/
-
function entryForm($out)
{
return new EventForm($out);
*
* @param Notice $notice
*/
-
function deleteRelated($notice)
{
switch ($notice->object_type) {
*
* @see Managed_DataObject
*/
-
class Happening extends Managed_DataObject
{
const OBJECT_TYPE = 'http://activitystrea.ms/schema/1.0/event';
if (array_key_exists('uri', $options)) {
$other = Happening::staticGet('uri', $options['uri']);
if (!empty($other)) {
+ // TRANS: Client exception thrown when trying to create an event that already exists.
throw new ClientException(_m('Event already exists.'));
}
}
$location,
$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">'.
'<span class="summary">%1$s</span> '.
'<abbr class="dtstart" title="%2$s">%3$s</a> - '.
*
* @see Managed_DataObject
*/
-
class RSVP extends Managed_DataObject
{
const POSITIVE = 'http://activitystrea.ms/schema/1.0/rsvp-yes';
* @param mixed $v Value to lookup
*
* @return RSVP object found, or null for no hits
- *
*/
function staticGet($k, $v=null)
{
* @param array $kv array of key-value mappings
*
* @return Bookmark object found, or null for no hits
- *
*/
function pkeyGet($kv)
if (array_key_exists('uri', $options)) {
$other = RSVP::staticGet('uri', $options['uri']);
if (!empty($other)) {
+ // TRANS: Client exception thrown when trying to save an already existing RSVP ("please respond").
throw new ClientException(_m('RSVP already exists.'));
}
}
'event_id' => $event->id));
if (!empty($other)) {
+ // TRANS: Client exception thrown when trying to save an already existing RSVP ("please respond").
throw new ClientException(_m('RSVP already exists.'));
}
// XXX: come up with something sexier
$content = $rsvp->asString();
-
+
$rendered = $rsvp->asHTML();
$options = array_merge(array('object_type' => $verb),
return '?';
break;
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));
}
}
return RSVP::POSSIBLE;
break;
default:
+ // TRANS: Exception thrown when requesting an undefined code for RSVP.
throw new Exception(sprintf(_m('Unknown code "%s".'),$code));
}
}
{
$notice = Notice::staticGet('uri', $this->uri);
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));
}
return $notice;
{
$profile = Profile::staticGet('id', $this->profile_id);
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));
}
return $profile;
{
$event = Happening::staticGet('id', $this->event_id);
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));
}
return $event;
switch ($response) {
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>");
break;
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>");
break;
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>");
break;
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));
break;
}
if (empty($event)) {
$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');
} else {
$notice = $event->getNotice();
switch ($response) {
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.');
break;
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.');
break;
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.');
break;
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));
break;
}
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');
} else {
$notice = $event->getNotice();
* Copyright (C) 2011, StatusNet, Inc.
*
* Cancel the RSVP for an event
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
+
if (!defined('STATUSNET')) {
// This check helps protect against security problems;
// your code file can't be executed directly from the web.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class CancelrsvpAction extends Action
{
protected $user = null;
*
* @return string Action title
*/
-
function title()
{
- return _m('Cancel RSVP');
+ // TRANS: Title for RSVP ("please respond") action.
+ return _m('TITLE','Cancel RSVP');
}
/**
*
* @return boolean true
*/
-
function prepare($argarray)
{
parent::prepare($argarray);
$rsvpId = $this->trimmed('rsvp');
if (empty($rsvpId)) {
+ // TRANS: Client exception thrown when referring to a non-existing RSVP ("please respond") item.
throw new ClientException(_m('No such RSVP.'));
}
$this->rsvp = RSVP::staticGet('id', $rsvpId);
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.'));
}
$this->event = Happening::staticGet('id', $this->rsvp->event_id);
if (empty($this->event)) {
+ // TRANS: Client exception thrown when referring to a non-existing event.
throw new ClientException(_m('No such event.'));
}
$this->user = common_current_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.'));
}
*
* @return void
*/
-
function handle($argarray=null)
{
parent::handle($argarray);
*
* @return void
*/
-
function cancelRSVP()
{
try {
*
* @return void
*/
-
function showContent()
{
if (!empty($this->error)) {
*
* @return boolean is read only action?
*/
-
function isReadOnly($args)
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
* Copyright (C) 2011, StatusNet, Inc.
*
* Form to RSVP for an event
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class CancelRSVPForm extends Form
{
protected $rsvp = null;
*
* @return int ID of the form
*/
-
function id()
{
return 'form_event_rsvp';
*
* @return string class of the form
*/
-
function formClass()
{
return 'ajax';
*
* @return string URL of the action
*/
-
function action()
{
return common_local_url('cancelrsvp');
*
* @return void
*/
-
function formData()
{
$this->out->elementStart('fieldset', array('id' => 'new_rsvp_data'));
switch (RSVP::verbFor($this->rsvp->response)) {
case RSVP::POSITIVE:
+ // TRANS: Possible status for RSVP ("please respond") item.
$this->out->text(_m('You will attend this event.'));
break;
case RSVP::NEGATIVE:
+ // TRANS: Possible status for RSVP ("please respond") item.
$this->out->text(_m('You will not attend this event.'));
break;
case RSVP::POSSIBLE:
+ // TRANS: Possible status for RSVP ("please respond") item.
$this->out->text(_m('You might attend this event.'));
break;
}
*
* @return void
*/
-
function formActions()
{
+ // TRANS: Button text to cancel responding to an RSVP ("please respond") item.
$this->out->submit('cancel', _m('BUTTON', 'Cancel'));
}
}
.event-title { margin-left: 0px; }
#content .event .entry-title { margin-left: 0px; }
#content .event .entry-content { margin-left: 0px; }
-
* Copyright (C) 2011, StatusNet, Inc.
*
* Form for entering an event
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class EventForm extends Form
{
/**
*
* @return int ID of the form
*/
-
function id()
{
return 'form_new_event';
*
* @return string class of the form
*/
-
function formClass()
{
return 'form_settings ajax-notice';
*
* @return string URL of the action
*/
-
function action()
{
return common_local_url('newevent');
*
* @return void
*/
-
function formData()
{
$this->out->elementStart('fieldset', array('id' => 'new_bookmark_data'));
$this->li();
$this->out->input('title',
+ // TRANS: Field label on event form.
_m('LABEL','Title'),
null,
+ // TRANS: Field title on event form.
_m('Title of the event.'));
$this->unli();
$this->li();
$this->out->input('startdate',
+ // TRANS: Field label on event form.
_m('LABEL','Start date'),
null,
+ // TRANS: Field title on event form.
_m('Date the event starts.'));
$this->unli();
$this->li();
$this->out->input('starttime',
+ // TRANS: Field label on event form.
_m('LABEL','Start time'),
null,
+ // TRANS: Field title on event form.
_m('Time the event starts.'));
$this->unli();
$this->li();
$this->out->input('enddate',
+ // TRANS: Field label on event form.
_m('LABEL','End date'),
- null,
+ null,
+ // TRANS: Field title on event form.
_m('Date the event ends.'));
$this->unli();
$this->li();
$this->out->input('endtime',
+ // TRANS: Field label on event form.
_m('LABEL','End time'),
null,
+ // TRANS: Field title on event form.
_m('Time the event ends.'));
$this->unli();
$this->li();
$this->out->input('location',
+ // TRANS: Field label on event form.
_m('LABEL','Location'),
null,
+ // TRANS: Field title on event form.
_m('Event location.'));
$this->unli();
$this->li();
$this->out->input('url',
+ // TRANS: Field label on event form.
_m('LABEL','URL'),
null,
+ // TRANS: Field title on event form.
_m('URL for more information.'));
$this->unli();
$this->li();
$this->out->input('description',
+ // TRANS: Field label on event form.
_m('LABEL','Description'),
null,
+ // TRANS: Field title on event form.
_m('Description of the event.'));
$this->unli();
*
* @return void
*/
-
function formActions()
{
+ // TRANS: Button text to save an event..
$this->out->submit('submit', _m('BUTTON', 'Save'));
}
}
* Copyright (C) 2011, StatusNet, Inc.
*
* Add a new event
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
+
if (!defined('STATUSNET')) {
// This check helps protect against security problems;
// your code file can't be executed directly from the web.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class NeweventAction extends Action
{
protected $user = null;
*
* @return string Action title
*/
-
function title()
{
- return _m('New event');
+ // TRANS: Title for new event form.
+ return _m('TITLE','New event');
}
/**
*
* @return boolean true
*/
-
function prepare($argarray)
{
parent::prepare($argarray);
$this->user = common_current_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.'),
403);
}
$this->title = $this->trimmed('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.'));
}
$startDate = $this->trimmed('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.'));
}
$endDate = $this->trimmed('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.'));
}
$this->endTime = strtotime($end);
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".'),
$start));
}
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".'),
$end));
}
*
* @return void
*/
-
function handle($argarray=null)
{
parent::handle($argarray);
*
* @return void
*/
-
function newEvent()
{
try {
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.'));
}
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.'));
}
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.'));
}
// Does the heavy-lifting for getting "To:" information
ToSelector::fillOptions($this, $options);
-
+
$profile = $this->user->getProfile();
$saved = Happening::saveNew($profile,
*
* @return void
*/
-
function showContent()
{
if (!empty($this->error)) {
*
* @return boolean is read only action?
*/
-
function isReadOnly($args)
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
* Copyright (C) 2011, StatusNet, Inc.
*
* RSVP for an event
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
+
if (!defined('STATUSNET')) {
// This check helps protect against security problems;
// your code file can't be executed directly from the web.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class NewrsvpAction extends Action
{
protected $user = null;
*
* @return string Action title
*/
-
function title()
{
- return _m('New RSVP');
+ // TRANS: Title for RSVP ("please respond") action.
+ return _m('TITLE','New RSVP');
}
/**
*
* @return boolean true
*/
-
function prepare($argarray)
{
parent::prepare($argarray);
$eventId = $this->trimmed('event');
if (empty($eventId)) {
+ // TRANS: Client exception thrown when requesting a non-exsting event.
throw new ClientException(_m('No such event.'));
}
$this->event = Happening::staticGet('id', $eventId);
if (empty($this->event)) {
+ // TRANS: Client exception thrown when requesting a non-exsting event.
throw new ClientException(_m('No such event.'));
}
$this->user = common_current_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.'));
}
$this->verb = RSVP::POSSIBLE;
break;
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 void
*/
-
function handle($argarray=null)
{
parent::handle($argarray);
*
* @return void
*/
-
function newRSVP()
{
try {
$this->xw->startDocument('1.0', 'UTF-8');
$this->elementStart('html');
$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->elementEnd('head');
$this->elementStart('body');
*
* @return void
*/
-
function showContent()
{
if (!empty($this->error)) {
*
* @return boolean is read only action?
*/
-
function isReadOnly($args)
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
* Copyright (C) 2011, StatusNet, Inc.
*
* Form to RSVP for an event
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class RSVPForm extends Form
{
protected $event = null;
*
* @return int ID of the form
*/
-
function id()
{
return 'form_event_rsvp';
*
* @return string class of the form
*/
-
function formClass()
{
return 'ajax';
*
* @return string URL of the action
*/
-
function action()
{
return common_local_url('newrsvp');
*
* @return void
*/
-
function formData()
{
$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->hidden('event', $this->event->id);
*
* @return void
*/
-
function formActions()
{
+ // TRANS: Button text for RSVP ("please respond") reply to confirm attendence.
$this->submitButton('yes', _m('BUTTON', 'Yes'));
+ // TRANS: Button text for RSVP ("please respond") reply to deny attendence.
$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'));
}
-
+
function submitButton($id, $label)
{
$this->out->element('input', array('type' => 'submit',
* Copyright (C) 2011, StatusNet, Inc.
*
* Show a single event
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
* Copyright (C) 2010, StatusNet, Inc.
*
* Show a single RSVP
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify