]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
QnA
authorZach Copley <zach@status.net>
Tue, 5 Apr 2011 05:04:36 +0000 (22:04 -0700)
committerZach Copley <zach@status.net>
Tue, 5 Apr 2011 05:05:43 +0000 (22:05 -0700)
* show number of answers on question notices
* change label on answer submit button to "Answer"

plugins/QnA/classes/QnA_Question.php
plugins/QnA/lib/qnanewanswerform.php
plugins/QnA/lib/qnashowanswerform.php
plugins/QnA/lib/qnashowquestionform.php

index 70558763692bf1192a4115f80cd2ba907cf3aec8..157eaa7a18b99c511801cc58044bb46a107223a4 100644 (file)
@@ -189,9 +189,11 @@ class QnA_Question extends Managed_DataObject
 
     function countAnswers()
     {
-        $a              = new QnA_Answer();
+        $a = new QnA_Answer();
+
         $a->question_id = $this->id;
-        return $a-count();
+
+        return $a->count();
     }
 
     static function fromNotice($notice)
@@ -221,6 +223,14 @@ class QnA_Question extends Managed_DataObject
             $out->elementEnd('span');
         }
 
+        $cnt = $question->countAnswers();
+
+        if (!empty($cnt)) {
+            $out->elementStart('span', 'answer-count');
+            $out->text(sprintf(_m('%s answers'), $cnt));
+            $out->elementEnd('span');
+        }
+
         if (!empty($question->closed)) {
             $out->elementStart('span', 'question-closed');
             $out->text(_m('This question is closed.'));
index db4d1dfafc6a234e5e71613b0b3835faa2a5f549..a0f4cd4b2288fd8b73a1ee2fe764b535a44b5d63 100644 (file)
@@ -118,7 +118,7 @@ class QnanewanswerForm extends Form
     function formActions()
     {
         // TRANS: Button text for submitting a poll response.
-        $this->out->submit('submit', _m('BUTTON', 'Submit'));
+        $this->out->submit('submit', _m('BUTTON', 'Answer'));
     }
 }
 
index 5ec63e109673bad985b05cc7a9858d5c4abea117..890224ed69178410bc085852e6d2a88660949e5b 100644 (file)
@@ -65,8 +65,8 @@ class QnashowanswerForm extends Form
     {
         parent::__construct($out);
 
-        $this->answer       = $answer;
-        $this->question     = $answer->getQuestion();
+        $this->answer   = $answer;
+        $this->question = $answer->getQuestion();
     }
 
     /**
@@ -155,6 +155,13 @@ class QnashowanswerForm extends Form
         
                 }
             }
+
+            /*
+             * @fixme: Revise is disabled until we figure out the
+             *         Ostatus bits This comment is just a reminder
+             *         that the UI for this works.
+             */
+            /*
             if ($user->id == $this->answer->profile_id) {
                 $this->out->submit(
                     'revise',
@@ -166,6 +173,7 @@ class QnashowanswerForm extends Form
                     _('Revise your answer')
                 );
             }
+             */
         }
     }
 
index 71e644e2dc4fbec45d3e62e89396c95f068e7ce5..ad29d0d0189d7ad512290ccfea2f9e55ec6b53ca 100644 (file)
@@ -118,7 +118,7 @@ class QnashowquestionForm extends Form
             'question-' . $this->question->id
         );
 
-        $this->out->raw($this->question->asHTML());        
+        $this->out->raw($this->question->asHTML());
     }
 
     /**