Update translator documentation.
Update whitespace. L10n/i18n updates.
This commit is contained in:
parent
323f7f1e9c
commit
9758134d1a
|
@ -80,7 +80,8 @@ class EmailregisterAction extends Action
|
||||||
parent::prepare($argarray);
|
parent::prepare($argarray);
|
||||||
|
|
||||||
if (common_config('site', 'closed')) {
|
if (common_config('site', 'closed')) {
|
||||||
throw new ClientException(_('Registration not allowed.'), 403);
|
// TRANS: Client exception trown when registration by e-mail is not allowed.
|
||||||
|
throw new ClientException(_m('Registration not allowed.'), 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
|
@ -91,7 +92,8 @@ class EmailregisterAction extends Action
|
||||||
|
|
||||||
if (!empty($this->email)) {
|
if (!empty($this->email)) {
|
||||||
if (common_config('site', 'inviteonly')) {
|
if (common_config('site', 'inviteonly')) {
|
||||||
throw new ClientException(_('Sorry, only invited people can register.'), 403);
|
// TRANS: Client exception trown when trying to register without an invitation.
|
||||||
|
throw new ClientException(_m('Sorry, only invited people can register.'), 403);
|
||||||
}
|
}
|
||||||
$this->email = common_canonical_email($this->email);
|
$this->email = common_canonical_email($this->email);
|
||||||
$this->state = self::NEWEMAIL;
|
$this->state = self::NEWEMAIL;
|
||||||
|
@ -109,6 +111,7 @@ class EmailregisterAction extends Action
|
||||||
|
|
||||||
if (!empty($this->invitation)) {
|
if (!empty($this->invitation)) {
|
||||||
if (!empty($this->invitation->registered_user_id)) {
|
if (!empty($this->invitation->registered_user_id)) {
|
||||||
|
// TRANS: Client exception trown when using an invitation multiple times.
|
||||||
throw new ClientException(_m('Invitation already used.'), 403);
|
throw new ClientException(_m('Invitation already used.'), 403);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -131,13 +134,15 @@ class EmailregisterAction extends Action
|
||||||
|
|
||||||
if (empty($this->code)) {
|
if (empty($this->code)) {
|
||||||
if (common_config('site', 'inviteonly')) {
|
if (common_config('site', 'inviteonly')) {
|
||||||
throw new ClientException(_('Sorry, only invited people can register.'), 403);
|
// TRANS: Client exception trown when trying to register without an invitation.
|
||||||
|
throw new ClientException(_m('Sorry, only invited people can register.'), 403);
|
||||||
}
|
}
|
||||||
$this->state = self::NEWREGISTER;
|
$this->state = self::NEWREGISTER;
|
||||||
} else {
|
} else {
|
||||||
$this->invitation = Invitation::staticGet('code', $this->code);
|
$this->invitation = Invitation::staticGet('code', $this->code);
|
||||||
if (!empty($this->invitation)) {
|
if (!empty($this->invitation)) {
|
||||||
if (!empty($this->invitation->registered_user_id)) {
|
if (!empty($this->invitation->registered_user_id)) {
|
||||||
|
// TRANS: Client exception trown when using an invitation multiple times.
|
||||||
throw new ClientException(_m('Invitation already used.'), 403);
|
throw new ClientException(_m('Invitation already used.'), 403);
|
||||||
}
|
}
|
||||||
$this->state = self::CONFIRMINVITE;
|
$this->state = self::CONFIRMINVITE;
|
||||||
|
@ -180,7 +185,6 @@ class EmailregisterAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($argarray=null)
|
function handle($argarray=null)
|
||||||
{
|
{
|
||||||
$cur = common_current_user();
|
$cur = common_current_user();
|
||||||
|
@ -263,7 +267,8 @@ class EmailregisterAction extends Action
|
||||||
} else if (!empty($this->confirmation)) {
|
} else if (!empty($this->confirmation)) {
|
||||||
$email = trim($this->confirmation->address);
|
$email = trim($this->confirmation->address);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('No confirmation thing.');
|
// TRANS: Client exception trown when trying to set password with an invalid confirmation code.
|
||||||
|
throw new Exception(_m('No confirmation thing.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->tos) {
|
if (!$this->tos) {
|
||||||
|
@ -308,7 +313,8 @@ class EmailregisterAction extends Action
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
throw new Exception('Failed to register user.');
|
// TRANS: Exception trown when using an invitation multiple times.
|
||||||
|
throw new Exception(_m('Failed to register user.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
common_set_user($this->user);
|
common_set_user($this->user);
|
||||||
|
@ -346,8 +352,8 @@ class EmailregisterAction extends Action
|
||||||
|
|
||||||
$confirmUrl = common_local_url('register', array('code' => $confirm->code));
|
$confirmUrl = common_local_url('register', array('code' => $confirm->code));
|
||||||
|
|
||||||
// TRANS: Body for confirmation e-mail.
|
// TRANS: Body for confirmation e-mail.
|
||||||
// TRANS: %1$s is the StatusNet sitename, %2$s is the confirmation URL.
|
// TRANS: %1$s is the StatusNet sitename, %2$s is the confirmation URL.
|
||||||
$body = sprintf(_m('Someone (probably you) has requested an account on %1$s using this email address.'.
|
$body = sprintf(_m('Someone (probably you) has requested an account on %1$s using this email address.'.
|
||||||
"\n".
|
"\n".
|
||||||
'To confirm the address, click the following URL or copy it into the address bar of your browser.'.
|
'To confirm the address, click the following URL or copy it into the address bar of your browser.'.
|
||||||
|
|
|
@ -175,7 +175,7 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
|
|
||||||
function appTitle() {
|
function appTitle() {
|
||||||
// TRANS: Application title.
|
// TRANS: Application title.
|
||||||
return _m('Question');
|
return _m('TITLE','Question');
|
||||||
}
|
}
|
||||||
|
|
||||||
function tag() {
|
function tag() {
|
||||||
|
@ -202,12 +202,14 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
function saveNoticeFromActivity($activity, $actor, $options=array())
|
function saveNoticeFromActivity($activity, $actor, $options=array())
|
||||||
{
|
{
|
||||||
if (count($activity->objects) != 1) {
|
if (count($activity->objects) != 1) {
|
||||||
|
// TRANS: Exception thrown when there are too many activity objects.
|
||||||
throw new Exception(_m('Too many activity objects.'));
|
throw new Exception(_m('Too many activity objects.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$questionObj = $activity->objects[0];
|
$questionObj = $activity->objects[0];
|
||||||
|
|
||||||
if ($questionObj->type != QnA_Question::OBJECT_TYPE) {
|
if ($questionObj->type != QnA_Question::OBJECT_TYPE) {
|
||||||
|
// TRANS: Exception thrown when an incorrect object type is encountered.
|
||||||
throw new Exception(_m('Wrong type for object.'));
|
throw new Exception(_m('Wrong type for object.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,12 +228,14 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
$question = QnA_Question::staticGet('uri', $questionObj->id);
|
$question = QnA_Question::staticGet('uri', $questionObj->id);
|
||||||
if (empty($question)) {
|
if (empty($question)) {
|
||||||
// FIXME: save the question
|
// FIXME: save the question
|
||||||
|
// TRANS: Exception thrown when answering a non-existing question.
|
||||||
throw new Exception(_m('Answer to unknown question.'));
|
throw new Exception(_m('Answer to unknown question.'));
|
||||||
}
|
}
|
||||||
$notice = QnA_Answer::saveNew($actor, $question, $options);
|
$notice = QnA_Answer::saveNew($actor, $question, $options);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception(_m('Unknown object type received by QnA Plugin.'));
|
// TRANS: Exception thrown when an object type is encountered that cannot be handled.
|
||||||
|
throw new Exception(_m('Unknown object type.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $notice;
|
return $notice;
|
||||||
|
@ -260,12 +264,14 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($question)) {
|
if (empty($question)) {
|
||||||
|
// TRANS: Exception thrown when an object type is encountered that cannot be handled.
|
||||||
throw new Exception(_m('Unknown object type.'));
|
throw new Exception(_m('Unknown object type.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$notice = $question->getNotice();
|
$notice = $question->getNotice();
|
||||||
|
|
||||||
if (empty($notice)) {
|
if (empty($notice)) {
|
||||||
|
// TRANS: Exception thrown when requesting a non-existing question notice.
|
||||||
throw new Exception(_m('Unknown question notice.'));
|
throw new Exception(_m('Unknown question notice.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,6 +393,7 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
$form->show();
|
$form->show();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// TRANS: Error message displayed when question data is not present.
|
||||||
$out->text(_m('Question data is missing.'));
|
$out->text(_m('Question data is missing.'));
|
||||||
}
|
}
|
||||||
$out->elementEnd('div');
|
$out->elementEnd('div');
|
||||||
|
@ -395,7 +402,6 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
$out->elementStart('div', array('class' => 'entry-content'));
|
$out->elementStart('div', array('class' => 'entry-content'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output the HTML for this kind of object in a list
|
* Output the HTML for this kind of object in a list
|
||||||
*
|
*
|
||||||
|
@ -403,7 +409,7 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*
|
*
|
||||||
* @fixme WARNING WARNING WARNING this closes a 'div' that is implicitly opened in BookmarkPlugin's showNotice implementation
|
* @todo FIXME: WARNING WARNING WARNING this closes a 'div' that is implicitly opened in BookmarkPlugin's showNotice implementation
|
||||||
*/
|
*/
|
||||||
function onStartShowNoticeItem($nli)
|
function onStartShowNoticeItem($nli)
|
||||||
{
|
{
|
||||||
|
@ -427,12 +433,10 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
$nli->showNoticeOptions();
|
$nli->showNoticeOptions();
|
||||||
|
|
||||||
if ($notice->object_type == QnA_Question::OBJECT_TYPE) {
|
if ($notice->object_type == QnA_Question::OBJECT_TYPE) {
|
||||||
|
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
$question = QnA_Question::getByNotice($notice);
|
$question = QnA_Question::getByNotice($notice);
|
||||||
|
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
|
|
||||||
$profile = $user->getProfile();
|
$profile = $user->getProfile();
|
||||||
$answer = $question->getAnswer($profile);
|
$answer = $question->getAnswer($profile);
|
||||||
|
|
||||||
|
@ -447,6 +451,8 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
'input',
|
'input',
|
||||||
array(
|
array(
|
||||||
'class' => 'placeholder',
|
'class' => 'placeholder',
|
||||||
|
// TRANS: Placeholder value for a possible answer to a question
|
||||||
|
// TRANS: by the logged in user.
|
||||||
'value' => _m('Your answer...')
|
'value' => _m('Your answer...')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -459,7 +465,6 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function showNoticeAnswer($notice, $out)
|
function showNoticeAnswer($notice, $out)
|
||||||
{
|
{
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
|
@ -476,12 +481,13 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
$form = new QnashowanswerForm($out, $answer);
|
$form = new QnashowanswerForm($out, $answer);
|
||||||
$form->show();
|
$form->show();
|
||||||
} else {
|
} else {
|
||||||
|
// TRANS: Error message displayed when answer data is not present.
|
||||||
$out->text(_m('Answer data is missing.'));
|
$out->text(_m('Answer data is missing.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$out->elementEnd('div');
|
$out->elementEnd('div');
|
||||||
|
|
||||||
// @fixme
|
// @todo FIXME
|
||||||
$out->elementStart('div', array('class' => 'entry-content'));
|
$out->elementStart('div', array('class' => 'entry-content'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,14 +498,15 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
if (Notice::contentTooLong($content)) {
|
if (Notice::contentTooLong($content)) {
|
||||||
common_debug("content too long");
|
common_debug("content too long");
|
||||||
$max = Notice::maxContent();
|
$max = Notice::maxContent();
|
||||||
|
// TRANS: Link description for link to full notice text if it is longer than
|
||||||
|
// TRANS: what will be dispplayed.
|
||||||
|
$ellipsis = _m('…');
|
||||||
$short = mb_substr($content, 0, $max - 1);
|
$short = mb_substr($content, 0, $max - 1);
|
||||||
$short .= sprintf(
|
$short .= sprintf('<a href="%1$s" rel="more" title="%2$s">%3$s</a>',
|
||||||
// TRANS: Link to full notice text if it is longer than what will be dispplayed.
|
$notice->uri,
|
||||||
// TRANS: %s a notice URI.
|
// TRANS: Title for link that is an ellipsis in English.
|
||||||
_m('<a href="%s" rel="more" title="%s">…</a>'),
|
_m('more...'),
|
||||||
$notice->uri,
|
$ellipsis);
|
||||||
_m('more...')
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
$short = $content;
|
$short = $content;
|
||||||
}
|
}
|
||||||
|
@ -513,7 +520,6 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
* @param HTMLOutputter $out
|
* @param HTMLOutputter $out
|
||||||
* @return Widget
|
* @return Widget
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function entryForm($out)
|
function entryForm($out)
|
||||||
{
|
{
|
||||||
return new QnanewquestionForm($out);
|
return new QnanewquestionForm($out);
|
||||||
|
@ -524,7 +530,6 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
*
|
*
|
||||||
* @param Notice $notice
|
* @param Notice $notice
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function deleteRelated($notice)
|
function deleteRelated($notice)
|
||||||
{
|
{
|
||||||
switch ($notice->object_type) {
|
switch ($notice->object_type) {
|
||||||
|
|
|
@ -80,8 +80,8 @@ class QnaclosequestionAction extends Action
|
||||||
$this->user = common_current_user();
|
$this->user = common_current_user();
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
// TRANS: Client exception thrown trying to close a question when not logged in
|
|
||||||
throw new ClientException(
|
throw new ClientException(
|
||||||
|
// TRANS: Client exception thrown trying to close a question when not logged in
|
||||||
_m("You must be logged in to close a question."),
|
_m("You must be logged in to close a question."),
|
||||||
403
|
403
|
||||||
);
|
);
|
||||||
|
@ -128,13 +128,12 @@ class QnaclosequestionAction extends Action
|
||||||
*/
|
*/
|
||||||
function closeQuestion()
|
function closeQuestion()
|
||||||
{
|
{
|
||||||
|
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if ($user->id != $this->question->profile_id) {
|
if ($user->id != $this->question->profile_id) {
|
||||||
throw new Exception(_m('You didn\'t ask this question.'));
|
// TRANS: Exception thrown trying to close another user's question.
|
||||||
|
throw new Exception(_m('You did not ask this question.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$orig = clone($this->question);
|
$orig = clone($this->question);
|
||||||
|
|
|
@ -80,8 +80,8 @@ class QnanewanswerAction extends Action
|
||||||
$this->user = common_current_user();
|
$this->user = common_current_user();
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
// TRANS: Client exception thrown trying to answer a question while not logged in.
|
|
||||||
throw new ClientException(
|
throw new ClientException(
|
||||||
|
// TRANS: Client exception thrown trying to answer a question while not logged in.
|
||||||
_m("You must be logged in to answer to a question."),
|
_m("You must be logged in to answer to a question."),
|
||||||
403
|
403
|
||||||
);
|
);
|
||||||
|
@ -96,8 +96,8 @@ class QnanewanswerAction extends Action
|
||||||
$this->question = QnA_Question::staticGet('id', $id);
|
$this->question = QnA_Question::staticGet('id', $id);
|
||||||
|
|
||||||
if (empty($this->question)) {
|
if (empty($this->question)) {
|
||||||
// TRANS: Client exception thrown trying to respond to a non-existing question.
|
|
||||||
throw new ClientException(
|
throw new ClientException(
|
||||||
|
// TRANS: Client exception thrown trying to respond to a non-existing question.
|
||||||
_m('Invalid or missing question.'),
|
_m('Invalid or missing question.'),
|
||||||
404
|
404
|
||||||
);
|
);
|
||||||
|
@ -162,7 +162,6 @@ class QnanewanswerAction extends Action
|
||||||
|
|
||||||
$this->elementStart('body');
|
$this->elementStart('body');
|
||||||
|
|
||||||
|
|
||||||
$nli = new NoticeAnswerListItem($notice, $this, $this->question, $answer);
|
$nli = new NoticeAnswerListItem($notice, $this, $this->question, $answer);
|
||||||
$nli->show();
|
$nli->show();
|
||||||
|
|
||||||
|
@ -278,7 +277,6 @@ class QnanewanswerAction extends Action
|
||||||
$this->msg = $msg;
|
$this->msg = $msg;
|
||||||
$this->showPage();
|
$this->showPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class NoticeAnswerListItem extends NoticeListItem
|
class NoticeAnswerListItem extends NoticeListItem
|
||||||
|
@ -344,10 +342,10 @@ class NoticeAnswerListItem extends NoticeListItem
|
||||||
$form = new QnashowanswerForm($this->out, $this->answer);
|
$form = new QnashowanswerForm($this->out, $this->answer);
|
||||||
$form->show();
|
$form->show();
|
||||||
} else {
|
} else {
|
||||||
|
// TRANS: Error message displayed when an answer has no content.
|
||||||
$out->text(_m('Answer data is missing.'));
|
$out->text(_m('Answer data is missing.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out->elementEnd('p');
|
$this->out->elementEnd('p');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -76,8 +76,8 @@ class QnanewquestionAction extends Action
|
||||||
$this->user = common_current_user();
|
$this->user = common_current_user();
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
// TRANS: Client exception thrown trying to create a Question while not logged in.
|
|
||||||
throw new ClientException(
|
throw new ClientException(
|
||||||
|
// TRANS: Client exception thrown trying to create a Question while not logged in.
|
||||||
_m('You must be logged in to post a question.'),
|
_m('You must be logged in to post a question.'),
|
||||||
403
|
403
|
||||||
);
|
);
|
||||||
|
@ -240,5 +240,4 @@ class NoticeQuestionListItem extends NoticeListItem
|
||||||
$this->out->element('ul', 'notices threaded-replies xoxo');
|
$this->out->element('ul', 'notices threaded-replies xoxo');
|
||||||
parent::showEnd();
|
parent::showEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -79,8 +79,8 @@ class QnareviseanswerAction extends Action
|
||||||
$this->user = common_current_user();
|
$this->user = common_current_user();
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
// TRANS: Client exception thrown trying to answer a question while not logged in.
|
|
||||||
throw new ClientException(
|
throw new ClientException(
|
||||||
|
// TRANS: Client exception thrown trying to answer a question while not logged in.
|
||||||
_m("You must be logged in to answer to a question."),
|
_m("You must be logged in to answer to a question."),
|
||||||
403
|
403
|
||||||
);
|
);
|
||||||
|
@ -92,8 +92,8 @@ class QnareviseanswerAction extends Action
|
||||||
$this->question = $this->answer->getQuestion();
|
$this->question = $this->answer->getQuestion();
|
||||||
|
|
||||||
if (empty($this->answer) || empty($this->question)) {
|
if (empty($this->answer) || empty($this->question)) {
|
||||||
// TRANS: Client exception thrown trying to respond to a non-existing question.
|
|
||||||
throw new ClientException(
|
throw new ClientException(
|
||||||
|
// TRANS: Client exception thrown trying to respond to a non-existing question.
|
||||||
_m('Invalid or missing answer.'),
|
_m('Invalid or missing answer.'),
|
||||||
404
|
404
|
||||||
);
|
);
|
||||||
|
@ -243,7 +243,8 @@ class QnareviseanswerAction 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');
|
||||||
$this->element('title', null, _m('Answer'));
|
// TRANS: Form title for sending an answer.
|
||||||
|
$this->element('title', null, _m('TITLE','Answer'));
|
||||||
$this->elementEnd('head');
|
$this->elementEnd('head');
|
||||||
$this->elementStart('body');
|
$this->elementStart('body');
|
||||||
$form = new QnareviseanswerForm($this->answer, $this);
|
$form = new QnareviseanswerForm($this->answer, $this);
|
||||||
|
|
|
@ -64,31 +64,35 @@ class QnashowanswerAction extends ShownoticeAction
|
||||||
$this->answer = QnA_Answer::staticGet('id', $this->id);
|
$this->answer = QnA_Answer::staticGet('id', $this->id);
|
||||||
|
|
||||||
if (empty($this->answer)) {
|
if (empty($this->answer)) {
|
||||||
|
// TRANS: Client exception thrown when requesting a non-existing answer.
|
||||||
throw new ClientException(_m('No such answer.'), 404);
|
throw new ClientException(_m('No such answer.'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->question = $this->answer->getQuestion();
|
$this->question = $this->answer->getQuestion();
|
||||||
|
|
||||||
if (empty($this->question)) {
|
if (empty($this->question)) {
|
||||||
|
// TRANS: Client exception thrown when requesting an answer that has no connected question.
|
||||||
throw new ClientException(_m('No question for this answer.'), 404);
|
throw new ClientException(_m('No question for this answer.'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->notice = Notice::staticGet('uri', $this->answer->uri);
|
$this->notice = Notice::staticGet('uri', $this->answer->uri);
|
||||||
|
|
||||||
if (empty($this->notice)) {
|
if (empty($this->notice)) {
|
||||||
// Did we used to have it, and it got deleted?
|
// TRANS: Did we used to have it, and it got deleted?
|
||||||
throw new ClientException(_m('No such answer.'), 404);
|
throw new ClientException(_m('No such answer.'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->user = User::staticGet('id', $this->answer->profile_id);
|
$this->user = User::staticGet('id', $this->answer->profile_id);
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client exception thrown when requesting answer data for a non-existing user.
|
||||||
throw new ClientException(_m('No such user.'), 404);
|
throw new ClientException(_m('No such user.'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->profile = $this->user->getProfile();
|
$this->profile = $this->user->getProfile();
|
||||||
|
|
||||||
if (empty($this->profile)) {
|
if (empty($this->profile)) {
|
||||||
|
// TRANS: Client exception thrown when requesting answer data for a user without a profile.
|
||||||
throw new ServerException(_m('User without a profile.'));
|
throw new ServerException(_m('User without a profile.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,9 +151,9 @@ class QnashowquestionAction extends ShownoticeAction
|
||||||
*/
|
*/
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
// TRANS: Page title for a question.
|
|
||||||
// TRANS: %1$s is the nickname of the user who asked the question, %2$s is the question.
|
|
||||||
return sprintf(
|
return sprintf(
|
||||||
|
// TRANS: Page title for a question.
|
||||||
|
// TRANS: %1$s is the nickname of the user who asked the question, %2$s is the question.
|
||||||
_m('%1$s\'s question: %2$s'),
|
_m('%1$s\'s question: %2$s'),
|
||||||
$this->user->nickname,
|
$this->user->nickname,
|
||||||
$this->question->title
|
$this->question->title
|
||||||
|
@ -168,7 +168,6 @@ class QnashowquestionAction extends ShownoticeAction
|
||||||
return Action::lastModified();
|
return Action::lastModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fixme combine the notice time with question update time
|
* @fixme combine the notice time with question update time
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* StatusNet - the distributed open-source microblogging tool
|
* StatusNet - the distributed open-source microblogging tool
|
||||||
* Copyright (C) 2011, StatusNet, Inc.
|
* Copyright (C) 2011, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* Vote on a questino or answer
|
* Vote on a question or answer
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
|
@ -81,7 +81,7 @@ class Qnavote extends Action
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
// TRANS: Client exception thrown trying to answer a question while not logged in.
|
// TRANS: Client exception thrown trying to answer a question while not logged in.
|
||||||
throw new ClientException(_m("You must be logged in to answer to a question."),
|
throw new ClientException(_m('You must be logged in to answer to a question.'),
|
||||||
403);
|
403);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ class Qnavote 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 an answer.
|
// TRANS: Page title after sending in a vote for a question or answer.
|
||||||
$this->element('title', null, _m('Answers'));
|
$this->element('title', null, _m('Answers'));
|
||||||
$this->elementEnd('head');
|
$this->elementEnd('head');
|
||||||
$this->elementStart('body');
|
$this->elementStart('body');
|
||||||
|
|
|
@ -174,7 +174,9 @@ class QnA_Answer extends Managed_DataObject
|
||||||
{
|
{
|
||||||
$question = QnA_Question::staticGet('id', $this->question_id);
|
$question = QnA_Question::staticGet('id', $this->question_id);
|
||||||
if (empty($question)) {
|
if (empty($question)) {
|
||||||
throw new Exception("No question with ID {$this->question_id}");
|
// TRANS: Exception thown when getting a question with a non-existing ID.
|
||||||
|
// TRANS: %s is the non-existing question ID.
|
||||||
|
throw new Exception(sprintf(_m('No question with ID %s'),$this->question_id));
|
||||||
}
|
}
|
||||||
return $question;
|
return $question;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +185,9 @@ class QnA_Answer extends Managed_DataObject
|
||||||
{
|
{
|
||||||
$profile = Profile::staticGet('id', $this->profile_id);
|
$profile = Profile::staticGet('id', $this->profile_id);
|
||||||
if (empty($profile)) {
|
if (empty($profile)) {
|
||||||
throw new Exception("No profile with ID {$this->profile_id}");
|
// TRANS: Exception thown when getting a profile with a non-existing ID.
|
||||||
|
// TRANS: %s is the non-existing profile ID.
|
||||||
|
throw new Exception(sprintf(_m('No profile with ID %s'),$this->profile_id));
|
||||||
}
|
}
|
||||||
return $profile;
|
return $profile;
|
||||||
}
|
}
|
||||||
|
@ -226,7 +230,9 @@ class QnA_Answer extends Managed_DataObject
|
||||||
$out->elementstart('span', 'answer-revisions');
|
$out->elementstart('span', 'answer-revisions');
|
||||||
$out->text(
|
$out->text(
|
||||||
htmlspecialchars(
|
htmlspecialchars(
|
||||||
sprintf(_m('%s revisions'), $answer->revisions)
|
// Notification of how often an answer was revised.
|
||||||
|
// TRANS: %s is the number of answer revisions.
|
||||||
|
sprintf(_m('%s revision','%s revisions',$answer->revisions), $answer->revisions)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$out->elementEnd('span');
|
$out->elementEnd('span');
|
||||||
|
@ -239,14 +245,14 @@ class QnA_Answer extends Managed_DataObject
|
||||||
|
|
||||||
static function toString($profile, $question, $answer)
|
static function toString($profile, $question, $answer)
|
||||||
{
|
{
|
||||||
|
// @todo FIXME: unused variable?
|
||||||
$notice = $question->getNotice();
|
$notice = $question->getNotice();
|
||||||
|
|
||||||
$fmt = _m(
|
|
||||||
'%1$s answered the question "%2$s": %3$s'
|
|
||||||
);
|
|
||||||
|
|
||||||
return sprintf(
|
return sprintf(
|
||||||
$fmt,
|
// TRANS: Text for a question that was answered.
|
||||||
|
// TRANS: %1$s is the user that answered, %2$s is the question title,
|
||||||
|
// TRANS: %2$s is the answer content.
|
||||||
|
_m('%1$s answered the question "%2$s": %3$s'),
|
||||||
htmlspecialchars($profile->getBestName()),
|
htmlspecialchars($profile->getBestName()),
|
||||||
htmlspecialchars($question->title),
|
htmlspecialchars($question->title),
|
||||||
htmlspecialchars($answer->content)
|
htmlspecialchars($answer->content)
|
||||||
|
@ -285,6 +291,8 @@ class QnA_Answer extends Managed_DataObject
|
||||||
$answer->insert();
|
$answer->insert();
|
||||||
|
|
||||||
$content = sprintf(
|
$content = sprintf(
|
||||||
|
// TRANS: Text for a question that was answered.
|
||||||
|
// TRANS: %s is the question title.
|
||||||
_m('answered "%s"'),
|
_m('answered "%s"'),
|
||||||
$question->title
|
$question->title
|
||||||
);
|
);
|
||||||
|
|
|
@ -42,7 +42,6 @@ if (!defined('STATUSNET')) {
|
||||||
*
|
*
|
||||||
* @see DB_DataObject
|
* @see DB_DataObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class QnA_Question extends Managed_DataObject
|
class QnA_Question extends Managed_DataObject
|
||||||
{
|
{
|
||||||
const OBJECT_TYPE = 'http://activityschema.org/object/question';
|
const OBJECT_TYPE = 'http://activityschema.org/object/question';
|
||||||
|
@ -150,7 +149,9 @@ class QnA_Question extends Managed_DataObject
|
||||||
{
|
{
|
||||||
$profile = Profile::staticGet('id', $this->profile_id);
|
$profile = Profile::staticGet('id', $this->profile_id);
|
||||||
if (empty($profile)) {
|
if (empty($profile)) {
|
||||||
throw new Exception("No profile with ID {$this->profile_id}");
|
// TRANS: Exception trown when getting a profile for a non-existing ID.
|
||||||
|
// TRANS: %s is the provided profile ID.
|
||||||
|
throw new Exception(sprintf(_m('No profile with ID %s'),$this->profile_id));
|
||||||
}
|
}
|
||||||
return $profile;
|
return $profile;
|
||||||
}
|
}
|
||||||
|
@ -235,12 +236,15 @@ class QnA_Question extends Managed_DataObject
|
||||||
|
|
||||||
if (!empty($cnt)) {
|
if (!empty($cnt)) {
|
||||||
$out->elementStart('span', 'answer-count');
|
$out->elementStart('span', 'answer-count');
|
||||||
$out->text(sprintf(_m('%s answers'), $cnt));
|
// TRANS: Number of given answers to a question.
|
||||||
|
// TRANS: %d is the number of given answers.
|
||||||
|
$out->text(sprintf(_m('%s answer','%s answers'), $cnt));
|
||||||
$out->elementEnd('span');
|
$out->elementEnd('span');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($question->closed)) {
|
if (!empty($question->closed)) {
|
||||||
$out->elementStart('span', 'question-closed');
|
$out->elementStart('span', 'question-closed');
|
||||||
|
// TRANS: Notification that a question cannot be answered anymore because it is closed.
|
||||||
$out->text(_m('This question is closed.'));
|
$out->text(_m('This question is closed.'));
|
||||||
$out->elementEnd('span');
|
$out->elementEnd('span');
|
||||||
}
|
}
|
||||||
|
@ -298,7 +302,6 @@ class QnA_Question extends Managed_DataObject
|
||||||
$uriLen = mb_strlen($q->uri);
|
$uriLen = mb_strlen($q->uri);
|
||||||
$targetLen = $max - ($uriLen + 15);
|
$targetLen = $max - ($uriLen + 15);
|
||||||
$title = mb_substr($q->title, 0, $targetLen) . '…';
|
$title = mb_substr($q->title, 0, $targetLen) . '…';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = $title . ' ' . $q->uri;
|
$content = $title . ' ' . $q->uri;
|
||||||
|
|
|
@ -124,4 +124,3 @@ class QnanewanswerForm extends Form
|
||||||
$this->out->submit('qna-answer-submit', _m('BUTTON', 'Answer'), 'submit', 'submit');
|
$this->out->submit('qna-answer-submit', _m('BUTTON', 'Answer'), 'submit', 'submit');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,18 +106,22 @@ class QnanewquestionForm extends Form
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->input(
|
$this->out->input(
|
||||||
'qna-question-title',
|
'qna-question-title',
|
||||||
_m('Title'),
|
// TRANS: Field label for a new question.
|
||||||
|
_m('LABEL','Title'),
|
||||||
$this->title,
|
$this->title,
|
||||||
_m('Title of your question'),
|
// TRANS: Field title for a new question.
|
||||||
|
_m('The title of your question.'),
|
||||||
'title'
|
'title'
|
||||||
);
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->textarea(
|
$this->out->textarea(
|
||||||
'qna-question-description',
|
'qna-question-description',
|
||||||
_m('Description'),
|
// TRANS: Field label for question details.
|
||||||
|
_m('LABEL','Description'),
|
||||||
$this->description,
|
$this->description,
|
||||||
_m('Your question in detail'),
|
// TRANS: Field title for question details.
|
||||||
|
_m('Your question in detail.'),
|
||||||
'description'
|
'description'
|
||||||
);
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
|
@ -115,7 +115,7 @@ class QnareviseanswerForm extends Form
|
||||||
*/
|
*/
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
// TRANS: Button text for submitting a poll response.
|
// TRANS: Button text for submitting a revised answer.
|
||||||
$this->out->submit('submit', _m('BUTTON', 'Submit'));
|
$this->out->submit('submit', _m('BUTTON', 'Submit'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,19 +146,19 @@ class QnashowanswerForm extends Form
|
||||||
if (empty($this->answer->best)) {
|
if (empty($this->answer->best)) {
|
||||||
$this->out->submit(
|
$this->out->submit(
|
||||||
'qna-best-answer',
|
'qna-best-answer',
|
||||||
// TRANS: Button text for marking an answer as "best"
|
// TRANS: Button text for marking an answer as "best".
|
||||||
_m('BUTTON', 'Best'),
|
_m('BUTTON', 'Best'),
|
||||||
'submit',
|
'submit',
|
||||||
'best',
|
'best',
|
||||||
// TRANS: Title for button text marking an answer as "best"
|
// TRANS: Title for button text marking an answer as "best".
|
||||||
_m('Mark as best answer')
|
_m('Mark this answer as the best answer.')
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @fixme: Revise is disabled until we figure out the
|
* @todo FIXME: Revise is disabled until we figure out the
|
||||||
* Ostatus bits This comment is just a reminder
|
* Ostatus bits This comment is just a reminder
|
||||||
* that the UI for this works.
|
* that the UI for this works.
|
||||||
*/
|
*/
|
||||||
|
@ -166,12 +166,12 @@ class QnashowanswerForm extends Form
|
||||||
if ($user->id == $this->answer->profile_id) {
|
if ($user->id == $this->answer->profile_id) {
|
||||||
$this->out->submit(
|
$this->out->submit(
|
||||||
'revise',
|
'revise',
|
||||||
// TRANS: Button text for revising an answer
|
// TRANS: Button text for revising an answer.
|
||||||
_m('BUTTON', 'Revise'),
|
_m('BUTTON', 'Revise'),
|
||||||
'submit',
|
'submit',
|
||||||
null,
|
null,
|
||||||
// TRANS: Title for button text for revising an answer
|
// TRANS: Title for button text for revising an answer.
|
||||||
_m('Revise your answer')
|
_m('Revise your answer.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -103,7 +103,7 @@ class QnashowquestionForm extends Form
|
||||||
function formLegend()
|
function formLegend()
|
||||||
{
|
{
|
||||||
// TRANS: Form legend for revising the answer.
|
// TRANS: Form legend for revising the answer.
|
||||||
$this->out->element('legend', null, _m('Question'));
|
$this->out->element('legend', null, _m('LEGEND','Question'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,7 +114,7 @@ class QnashowquestionForm extends Form
|
||||||
function formData()
|
function formData()
|
||||||
{
|
{
|
||||||
$this->out->hidden(
|
$this->out->hidden(
|
||||||
'qna-quesiton-id',
|
'qna-question-id',
|
||||||
'question-' . $this->question->id,
|
'question-' . $this->question->id,
|
||||||
'id'
|
'id'
|
||||||
);
|
);
|
||||||
|
@ -147,12 +147,12 @@ class QnashowquestionForm extends Form
|
||||||
if ($user->id == $this->question->profile_id) {
|
if ($user->id == $this->question->profile_id) {
|
||||||
$this->out->submit(
|
$this->out->submit(
|
||||||
'qna-question-close',
|
'qna-question-close',
|
||||||
// TRANS: Button text for closing a question
|
// TRANS: Button text for closing a question.
|
||||||
_m('BUTTON', 'Close'),
|
_m('BUTTON', 'Close'),
|
||||||
'submit',
|
'submit',
|
||||||
'submit',
|
'submit',
|
||||||
// TRANS: Title for button text for closing a question
|
// TRANS: Title for button text for closing a question.
|
||||||
_m('Close the question')
|
_m('Close the question to no one can answer it anymore.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,4 +118,3 @@ class QnavoteForm extends Form
|
||||||
$this->out->submit('submit', _m('BUTTON', 'Submit'));
|
$this->out->submit('submit', _m('BUTTON', 'Submit'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user