2012-08-10 19:44:04 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PonderAddAnswerView extends AphrontView {
|
|
|
|
|
|
|
|
private $question;
|
|
|
|
private $actionURI;
|
|
|
|
private $draft;
|
|
|
|
|
|
|
|
public function setQuestion($question) {
|
|
|
|
$this->question = $question;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setActionURI($uri) {
|
|
|
|
$this->actionURI = $uri;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render() {
|
|
|
|
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
|
|
|
|
|
|
|
|
$question = $this->question;
|
|
|
|
|
2012-10-01 05:12:18 +02:00
|
|
|
$header = id(new PhabricatorHeaderView())
|
2013-05-20 16:55:23 +02:00
|
|
|
->setHeader(pht('Add Answer'));
|
2012-08-10 19:44:04 +02:00
|
|
|
|
|
|
|
$form = new AphrontFormView();
|
|
|
|
$form
|
2012-10-01 05:12:18 +02:00
|
|
|
->setFlexible(true)
|
2012-08-10 19:44:04 +02:00
|
|
|
->setUser($this->user)
|
|
|
|
->setAction($this->actionURI)
|
2012-09-17 22:48:36 +02:00
|
|
|
->setWorkflow(true)
|
2012-08-10 19:44:04 +02:00
|
|
|
->addHiddenInput('question_id', $question->getID())
|
|
|
|
->appendChild(
|
2012-09-19 21:27:28 +02:00
|
|
|
id(new PhabricatorRemarkupControl())
|
2012-08-10 19:44:04 +02:00
|
|
|
->setName('answer')
|
2013-05-20 16:55:23 +02:00
|
|
|
->setLabel(pht('Answer'))
|
2012-10-01 05:12:18 +02:00
|
|
|
->setError(true)
|
2012-11-27 23:06:31 +01:00
|
|
|
->setID('answer-content')
|
|
|
|
->setUser($this->user))
|
2012-08-10 19:44:04 +02:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSubmitControl())
|
2013-05-20 16:55:23 +02:00
|
|
|
->setValue($is_serious ?
|
|
|
|
pht('Submit') :
|
|
|
|
pht('Make it so')));
|
2012-08-10 19:44:04 +02:00
|
|
|
|
2012-10-01 05:12:18 +02:00
|
|
|
return id(new AphrontNullView())
|
|
|
|
->appendChild(
|
|
|
|
array(
|
|
|
|
$header,
|
|
|
|
$form,
|
|
|
|
))
|
|
|
|
->render();
|
2012-08-10 19:44:04 +02:00
|
|
|
}
|
|
|
|
}
|