@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Basic Answer Wiki for Ponder

Summary: Adds an additional field for questions, an answer wiki, should should usually be community editable.

Test Plan: New question, edit question, no wiki, lots of wiki.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14003

+57 -1
+2
resources/sql/autopatches/20150828.ponder.wiki.1.sql
··· 1 + ALTER TABLE {$NAMESPACE}_ponder.ponder_question 2 + ADD answerWiki LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL;
+21 -1
src/applications/ponder/controller/PonderQuestionEditController.php
··· 32 32 33 33 $v_title = $question->getTitle(); 34 34 $v_content = $question->getContent(); 35 + $v_wiki = $question->getAnswerWiki(); 35 36 $v_view = $question->getViewPolicy(); 36 37 $v_space = $question->getSpacePHID(); 37 38 $v_status = $question->getStatus(); ··· 42 43 if ($request->isFormPost()) { 43 44 $v_title = $request->getStr('title'); 44 45 $v_content = $request->getStr('content'); 46 + $v_wiki = $request->getStr('answerWiki'); 45 47 $v_projects = $request->getArr('projects'); 46 48 $v_view = $request->getStr('viewPolicy'); 47 49 $v_space = $request->getStr('spacePHID'); ··· 67 69 $xactions[] = id(clone $template) 68 70 ->setTransactionType(PonderQuestionTransaction::TYPE_CONTENT) 69 71 ->setNewValue($v_content); 72 + 73 + $xactions[] = id(clone $template) 74 + ->setTransactionType(PonderQuestionTransaction::TYPE_ANSWERWIKI) 75 + ->setNewValue($v_wiki); 70 76 71 77 if (!$is_new) { 72 78 $xactions[] = id(clone $template) ··· 119 125 ->setName('content') 120 126 ->setID('content') 121 127 ->setValue($v_content) 122 - ->setLabel(pht('Description')) 128 + ->setLabel(pht('Question Details')) 129 + ->setUser($viewer)) 130 + ->appendChild( 131 + id(new PhabricatorRemarkupControl()) 132 + ->setUser($viewer) 133 + ->setName('answerWiki') 134 + ->setID('answerWiki') 135 + ->setValue($v_wiki) 136 + ->setLabel(pht('Answer Summary')) 123 137 ->setUser($viewer)) 124 138 ->appendControl( 125 139 id(new AphrontFormPolicyControl()) ··· 157 171 ->setControlID('content') 158 172 ->setPreviewURI($this->getApplicationURI('preview/')); 159 173 174 + $answer_preview = id(new PHUIRemarkupPreviewPanel()) 175 + ->setHeader(pht('Answer Summary Preview')) 176 + ->setControlID('answerWiki') 177 + ->setPreviewURI($this->getApplicationURI('preview/')); 178 + 160 179 $crumbs = $this->buildApplicationCrumbs(); 161 180 162 181 $id = $question->getID(); ··· 179 198 $crumbs, 180 199 $form_box, 181 200 $preview, 201 + $answer_preview, 182 202 ), 183 203 array( 184 204 'title' => $title,
+10
src/applications/ponder/controller/PonderQuestionViewController.php
··· 98 98 $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView()); 99 99 $crumbs->addTextCrumb('Q'.$id, '/Q'.$id); 100 100 101 + $answer_wiki = null; 102 + if ($question->getAnswerWiki()) { 103 + $answer = phutil_tag_div('mlt mlb msr msl', $question->getAnswerWiki()); 104 + $answer_wiki = id(new PHUIObjectBoxView()) 105 + ->setHeaderText(pht('Answer Summary')) 106 + ->setColor(PHUIObjectBoxView::COLOR_BLUE) 107 + ->appendChild($answer); 108 + } 109 + 101 110 $ponder_view = id(new PHUITwoColumnView()) 102 111 ->setMainColumn(array( 103 112 $object_box, 104 113 $comment_view, 114 + $answer_wiki, 105 115 $answers, 106 116 $answer_add_panel, 107 117 ))
+8
src/applications/ponder/editor/PonderQuestionEditor.php
··· 74 74 $types[] = PonderQuestionTransaction::TYPE_CONTENT; 75 75 $types[] = PonderQuestionTransaction::TYPE_ANSWERS; 76 76 $types[] = PonderQuestionTransaction::TYPE_STATUS; 77 + $types[] = PonderQuestionTransaction::TYPE_ANSWERWIKI; 77 78 78 79 return $types; 79 80 } ··· 91 92 return mpull($object->getAnswers(), 'getPHID'); 92 93 case PonderQuestionTransaction::TYPE_STATUS: 93 94 return $object->getStatus(); 95 + case PonderQuestionTransaction::TYPE_ANSWERWIKI: 96 + return $object->getAnswerWiki(); 94 97 } 95 98 } 96 99 ··· 102 105 case PonderQuestionTransaction::TYPE_TITLE: 103 106 case PonderQuestionTransaction::TYPE_CONTENT: 104 107 case PonderQuestionTransaction::TYPE_STATUS: 108 + case PonderQuestionTransaction::TYPE_ANSWERWIKI: 105 109 return $xaction->getNewValue(); 106 110 case PonderQuestionTransaction::TYPE_ANSWERS: 107 111 $raw_new_value = $xaction->getNewValue(); ··· 136 140 case PonderQuestionTransaction::TYPE_STATUS: 137 141 $object->setStatus($xaction->getNewValue()); 138 142 break; 143 + case PonderQuestionTransaction::TYPE_ANSWERWIKI: 144 + $object->setAnswerWiki($xaction->getNewValue()); 145 + break; 139 146 case PonderQuestionTransaction::TYPE_ANSWERS: 140 147 $old = $xaction->getOldValue(); 141 148 $new = $xaction->getNewValue(); ··· 167 174 case PonderQuestionTransaction::TYPE_TITLE: 168 175 case PonderQuestionTransaction::TYPE_CONTENT: 169 176 case PonderQuestionTransaction::TYPE_STATUS: 177 + case PonderQuestionTransaction::TYPE_ANSWERWIKI: 170 178 return $v; 171 179 } 172 180
+2
src/applications/ponder/storage/PonderQuestion.php
··· 20 20 protected $authorPHID; 21 21 protected $status; 22 22 protected $content; 23 + protected $answerWiki; 23 24 protected $contentSource; 24 25 protected $viewPolicy; 25 26 protected $spacePHID; ··· 56 57 'title' => 'text255', 57 58 'status' => 'text32', 58 59 'content' => 'text', 60 + 'answerWiki' => 'text', 59 61 'answerCount' => 'uint32', 60 62 'mailKey' => 'bytes20', 61 63
+14
src/applications/ponder/storage/PonderQuestionTransaction.php
··· 7 7 const TYPE_CONTENT = 'ponder.question:content'; 8 8 const TYPE_ANSWERS = 'ponder.question:answer'; 9 9 const TYPE_STATUS = 'ponder.question:status'; 10 + const TYPE_ANSWERWIKI = 'ponder.question:wiki'; 10 11 11 12 const MAILTAG_DETAILS = 'question:details'; 12 13 const MAILTAG_COMMENT = 'question:comment'; ··· 78 79 return pht( 79 80 '%s edited the question description.', 80 81 $this->renderHandleLink($author_phid)); 82 + case self::TYPE_ANSWERWIKI: 83 + return pht( 84 + '%s edited the question answer wiki.', 85 + $this->renderHandleLink($author_phid)); 81 86 case self::TYPE_ANSWERS: 82 87 $answer_handle = $this->getHandle($this->getNewAnswerPHID()); 83 88 $question_handle = $this->getHandle($object_phid); ··· 120 125 case self::TYPE_TITLE: 121 126 case self::TYPE_CONTENT: 122 127 case self::TYPE_STATUS: 128 + case self::TYPE_ANSWERWIKI: 123 129 $tags[] = self::MAILTAG_DETAILS; 124 130 break; 125 131 case self::TYPE_ANSWERS: ··· 139 145 switch ($this->getTransactionType()) { 140 146 case self::TYPE_TITLE: 141 147 case self::TYPE_CONTENT: 148 + case self::TYPE_ANSWERWIKI: 142 149 return 'fa-pencil'; 143 150 case self::TYPE_STATUS: 144 151 return PonderQuestionStatus::getQuestionStatusIcon($new); ··· 156 163 switch ($this->getTransactionType()) { 157 164 case self::TYPE_TITLE: 158 165 case self::TYPE_CONTENT: 166 + case self::TYPE_ANSWERWIKI: 159 167 return PhabricatorTransactions::COLOR_BLUE; 160 168 case self::TYPE_ANSWERS: 161 169 return PhabricatorTransactions::COLOR_GREEN; ··· 167 175 public function hasChangeDetails() { 168 176 switch ($this->getTransactionType()) { 169 177 case self::TYPE_CONTENT: 178 + case self::TYPE_ANSWERWIKI: 170 179 return true; 171 180 } 172 181 return parent::hasChangeDetails(); ··· 251 260 case self::TYPE_CONTENT: 252 261 return pht( 253 262 '%s edited the description of %s', 263 + $this->renderHandleLink($author_phid), 264 + $this->renderHandleLink($object_phid)); 265 + case self::TYPE_ANSWERWIKI: 266 + return pht( 267 + '%s edited the answer wiki for %s', 254 268 $this->renderHandleLink($author_phid), 255 269 $this->renderHandleLink($object_phid)); 256 270 case self::TYPE_ANSWERS: