X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FQnA%2Flib%2Fqnanewanswerform.php;h=e3ef9ba42c464fc52bbbb79e37d1634e45eff27c;hb=9758134d1afb44be2376efb8a560d3ce02d89fd3;hp=967b27e70cdcad868310c7a7be0c12b6ee163ccf;hpb=c4b9dc7a0ff2e41712715ac21bace067e8c02715;p=quix0rs-gnu-social.git diff --git a/plugins/QnA/lib/qnanewanswerform.php b/plugins/QnA/lib/qnanewanswerform.php index 967b27e70c..e3ef9ba42c 100644 --- a/plugins/QnA/lib/qnanewanswerform.php +++ b/plugins/QnA/lib/qnanewanswerform.php @@ -47,6 +47,7 @@ if (!defined('STATUSNET')) { class QnanewanswerForm extends Form { protected $question; + protected $showQuestion; /** * Construct a new answer form @@ -56,10 +57,11 @@ class QnanewanswerForm extends Form * * @return void */ - function __construct(QnA_Question $question, HTMLOutputter $out) + function __construct(HTMLOutputter $out, QnA_Question $question, $showQuestion = false) { parent::__construct($out); $this->question = $question; + $this->showQuestion = $showQuestion; } /** @@ -79,7 +81,7 @@ class QnanewanswerForm extends Form */ function formClass() { - return 'form_settings ajax'; + return 'form_settings qna_answer_form ajax-notice'; } /** @@ -103,9 +105,12 @@ class QnanewanswerForm extends Form $out = $this->out; $id = "question-" . $question->id; - $out->element('p', 'answer', $question->title); - $out->hidden('id', $id); - $out->element('input', array('type' => 'text', 'name' => 'answer')); + if ($this->showQuestion) { + $out->raw($this->question->asHTML()); + } + + $out->hidden('qna-question-id', $id, 'id'); + $out->textarea('qna-answer', _m('Enter your answer'), null, null, 'answer'); } /** @@ -116,7 +121,6 @@ class QnanewanswerForm extends Form function formActions() { // TRANS: Button text for submitting a poll response. - $this->out->submit('submit', _m('BUTTON', 'Submit')); + $this->out->submit('qna-answer-submit', _m('BUTTON', 'Answer'), 'submit', 'submit'); } } -