$this->user = common_current_user();
if (empty($this->user)) {
- // TRANS: Client exception thrown trying to answer a question while not logged in.
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."),
403
);
$id = substr($this->trimmed('id'), 9);
- $this->question = QnA_Question::staticGet('id', $id);
+ $this->question = QnA_Question::getKV('id', $id);
if (empty($this->question)) {
- // TRANS: Client exception thrown trying to respond to a non-existing question.
throw new ClientException(
+ // TRANS: Client exception thrown trying to respond to a non-existing question.
_m('Invalid or missing question.'),
404
);
if ($this->boolean('ajax')) {
common_debug("ajaxy part");
$answer = $this->question->getAnswer($profile);
- header('Content-Type: text/xml;charset=utf-8');
- $this->xw->startDocument('1.0', 'UTF-8');
- $this->elementStart('html');
+ $this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
// TRANS: Page title after sending an answer.
$this->element('title', null, _m('Answers'));
$this->elementStart('body');
-
$nli = new NoticeAnswerListItem($notice, $this, $this->question, $answer);
$nli->show();
$this->elementEnd('body');
- $this->elementEnd('html');
+ $this->endHTML();
} else {
common_debug("not ajax");
- common_redirect($this->question->bestUrl(), 303);
+ common_redirect($this->question->getUrl(), 303);
}
}
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
$_SERVER['REQUEST_METHOD'] == 'HEAD') {
$this->elementStart('body');
$this->element('p', array('id' => 'error'), $msg);
$this->elementEnd('body');
- $this->elementEnd('html');
+ $this->endHTML();
}
/**
$form->show();
$this->elementEnd('body');
- $this->elementEnd('html');
+ $this->endHTML();
}
/**
$this->msg = $msg;
$this->showPage();
}
-
}
class NoticeAnswerListItem extends NoticeListItem
*/
function showContent()
{
- $this->out->elementStart('p', array('class' => 'entry-content answer-content'));
+ $this->out->elementStart('p', array('class' => 'e-content answer-content'));
if ($this->notice->rendered) {
$this->out->raw($this->notice->rendered);
} else {
$form = new QnashowanswerForm($this->out, $this->answer);
$form->show();
} else {
+ // TRANS: Error message displayed when an answer has no content.
$out->text(_m('Answer data is missing.'));
}
$this->out->elementEnd('p');
}
-
-}
\ No newline at end of file
+}