]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/QnA/QnAPlugin.php
Mats Sjöberg's merge request no.5 from Gitorious
[quix0rs-gnu-social.git] / plugins / QnA / QnAPlugin.php
index ec1b16b872c5c3871c0f46efa7241f91b1a94a29..1cbab3b60b30d19ce9b98e3b2b89185476b771f9 100644 (file)
@@ -316,57 +316,6 @@ class QnAPlugin extends MicroAppPlugin
         return true;
     }
 
-    /**
-     * Custom HTML output for our notices
-     *
-     * @param Notice $notice
-     * @param HTMLOutputter $out
-     */
-    function showNoticeContent(Notice $notice, $out)
-    {
-        switch ($notice->object_type) {
-        case QnA_Question::OBJECT_TYPE:
-            return $this->showNoticeQuestion($notice, $out);
-        case QnA_Answer::OBJECT_TYPE:
-            return $this->showNoticeAnswer($notice, $out);
-        default:
-            throw new Exception(
-                // TRANS: Exception thrown when performing an unexpected action on a question.
-                // TRANS: %s is the unpexpected object type.
-                sprintf(_m('Unexpected type for QnA plugin: %s.'),
-                        $notice->object_type
-                )
-            );
-        }
-    }
-
-    function showNoticeQuestion(Notice $notice, $out)
-    {
-        $user = common_current_user();
-
-        // @hack we want regular rendering, then just add stuff after that
-        $nli = new NoticeListItem($notice, $out);
-        $nli->showNotice();
-
-        $out->elementStart('div', array('class' => 'e-content question-description'));
-
-        $question = QnA_Question::getByNotice($notice);
-
-        if (!empty($question)) {
-
-            $form = new QnashowquestionForm($out, $question);
-            $form->show();
-
-        } else {
-            // TRANS: Error message displayed when question data is not present.
-            $out->text(_m('Question data is missing.'));
-        }
-        $out->elementEnd('div');
-
-        // @fixme
-        $out->elementStart('div', array('class' => 'e-content'));
-    }
-
     /**
      * Output the HTML for this kind of object in a list
      *
@@ -385,7 +334,7 @@ class QnAPlugin extends MicroAppPlugin
         $out = $nli->out;
         $notice = $nli->notice;
 
-        $this->showNotice($notice, $out);
+        $nli->showNotice($notice, $out);
 
         $nli->showNoticeLink();
         $nli->showNoticeSource();
@@ -393,8 +342,6 @@ class QnAPlugin extends MicroAppPlugin
         $nli->showContext();
         $nli->showRepeat();
 
-        $out->elementEnd('div');
-
         $nli->showNoticeOptions();
 
         if ($notice->object_type == QnA_Question::OBJECT_TYPE) {
@@ -430,30 +377,8 @@ class QnAPlugin extends MicroAppPlugin
         return false;
     }
 
-    function showNoticeAnswer(Notice $notice, $out)
-    {
-        $user = common_current_user();
-
-        $answer   = QnA_Answer::getByNotice($notice);
-        $question = $answer->getQuestion();
-
-        $nli = new NoticeListItem($notice, $out);
-        $nli->showNotice();
-
-        $out->elementStart('div', array('class' => 'e-content answer-content'));
-
-        if (!empty($answer)) {
-            $form = new QnashowanswerForm($out, $answer);
-            $form->show();
-        } else {
-            // TRANS: Error message displayed when answer data is not present.
-            $out->text(_m('Answer data is missing.'));
-        }
-
-        $out->elementEnd('div');
-
-        // @todo FIXME
-        $out->elementStart('div', array('class' => 'e-content'));
+    function adaptNoticeListItem($nli) {
+        return new QnAListItem($nli);
     }
 
     static function shorten($content, $notice)