Changeset View
Changeset View
Standalone View
Standalone View
src/applications/ponder/view/PonderAddAnswerView.php
Show All 28 Lines | if (isset($authors[$viewer->getPHID()])) { | ||||
pht( | pht( | ||||
'You have already answered this question. You can not answer '. | 'You have already answered this question. You can not answer '. | ||||
'twice, but you can edit your existing answer.')); | 'twice, but you can edit your existing answer.')); | ||||
} | } | ||||
$info_panel = null; | $info_panel = null; | ||||
if ($question->getStatus() != PonderQuestionStatus::STATUS_OPEN) { | if ($question->getStatus() != PonderQuestionStatus::STATUS_OPEN) { | ||||
$info_panel = id(new PHUIInfoView()) | $info_panel = id(new PHUIInfoView()) | ||||
->setSeverity(PHUIInfoView::SEVERITY_WARNING) | ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) | ||||
->appendChild( | ->appendChild( | ||||
pht( | pht( | ||||
'This question has been marked as closed, | 'This question has been marked as closed, | ||||
but you can still leave a new answer.')); | but you can still leave a new answer.')); | ||||
} | } | ||||
$box_style = null; | |||||
$own_question = null; | |||||
$hide_action_id = celerity_generate_unique_node_id(); | |||||
$show_action_id = celerity_generate_unique_node_id(); | |||||
if ($question->getAuthorPHID() == $viewer->getPHID()) { | |||||
$box_style = 'display: none;'; | |||||
$open_link = javelin_tag( | |||||
'a', | |||||
array( | |||||
'sigil' => 'reveal-content', | |||||
'class' => 'mml', | |||||
'id' => $hide_action_id, | |||||
'href' => '#', | |||||
'meta' => array( | |||||
'showIDs' => array($show_action_id), | |||||
'hideIDs' => array($hide_action_id), | |||||
), | |||||
), | |||||
pht('Add an answer.')); | |||||
$own_question = id(new PHUIInfoView()) | |||||
->setSeverity(PHUIInfoView::SEVERITY_WARNING) | |||||
->setID($hide_action_id) | |||||
->appendChild( | |||||
pht( | |||||
'This is your own question. You are welcome to provide | |||||
an answer if you have found a resolution.')) | |||||
->appendChild($open_link); | |||||
} | |||||
$header = id(new PHUIHeaderView()) | $header = id(new PHUIHeaderView()) | ||||
->setHeader(pht('Add Answer')); | ->setHeader(pht('Add Answer')); | ||||
$form = new AphrontFormView(); | $form = new AphrontFormView(); | ||||
$form | $form | ||||
->setUser($this->user) | ->setUser($this->user) | ||||
->setAction($this->actionURI) | ->setAction($this->actionURI) | ||||
->setWorkflow(true) | ->setWorkflow(true) | ||||
Show All 12 Lines | public function render() { | ||||
$box = id(new PHUIObjectBoxView()) | $box = id(new PHUIObjectBoxView()) | ||||
->setHeader($header) | ->setHeader($header) | ||||
->appendChild($form); | ->appendChild($form); | ||||
if ($info_panel) { | if ($info_panel) { | ||||
$box->setInfoView($info_panel); | $box->setInfoView($info_panel); | ||||
} | } | ||||
return $box; | $box = phutil_tag( | ||||
'div', | |||||
array( | |||||
'style' => $box_style, | |||||
'class' => 'mlt', | |||||
'id' => $show_action_id, | |||||
), | |||||
$box); | |||||
return array($own_question, $box); | |||||
} | } | ||||
} | } |