2012-08-10 10:44:04 -07: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-09-30 20:12:18 -07:00
|
|
|
$header = id(new PhabricatorHeaderView())
|
2013-05-20 07:55:23 -07:00
|
|
|
->setHeader(pht('Add Answer'));
|
2012-08-10 10:44:04 -07:00
|
|
|
|
|
|
|
$form = new AphrontFormView();
|
|
|
|
$form
|
2012-09-30 20:12:18 -07:00
|
|
|
->setFlexible(true)
|
2012-08-10 10:44:04 -07:00
|
|
|
->setUser($this->user)
|
|
|
|
->setAction($this->actionURI)
|
2012-09-17 13:48:36 -07:00
|
|
|
->setWorkflow(true)
|
2012-08-10 10:44:04 -07:00
|
|
|
->addHiddenInput('question_id', $question->getID())
|
|
|
|
->appendChild(
|
2012-09-19 12:27:28 -07:00
|
|
|
id(new PhabricatorRemarkupControl())
|
2012-08-10 10:44:04 -07:00
|
|
|
->setName('answer')
|
2013-05-20 07:55:23 -07:00
|
|
|
->setLabel(pht('Answer'))
|
2012-09-30 20:12:18 -07:00
|
|
|
->setError(true)
|
2012-11-27 14:06:31 -08:00
|
|
|
->setID('answer-content')
|
|
|
|
->setUser($this->user))
|
2012-08-10 10:44:04 -07:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSubmitControl())
|
2013-05-20 07:55:23 -07:00
|
|
|
->setValue($is_serious ?
|
|
|
|
pht('Submit') :
|
|
|
|
pht('Make it so')));
|
2012-08-10 10:44:04 -07:00
|
|
|
|
2012-09-30 20:12:18 -07:00
|
|
|
return id(new AphrontNullView())
|
|
|
|
->appendChild(
|
|
|
|
array(
|
|
|
|
$header,
|
|
|
|
$form,
|
|
|
|
))
|
|
|
|
->render();
|
2012-08-10 10:44:04 -07:00
|
|
|
}
|
|
|
|
}
|