@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.

Add Projects to Phame Blog and Phame Post

Summary: Allows setting of Projects to Blogs and Posts.

Test Plan: Set a Project on a post and a blog, see on view page.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

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

+60 -10
+2
src/__phutil_library_map__.php
··· 6967 6967 'PhabricatorMarkupInterface', 6968 6968 'PhabricatorSubscribableInterface', 6969 6969 'PhabricatorFlaggableInterface', 6970 + 'PhabricatorProjectInterface', 6970 6971 'PhabricatorApplicationTransactionInterface', 6971 6972 ), 6972 6973 'PhameBlogDeleteController' => 'PhameController', ··· 6991 6992 'PhabricatorPolicyInterface', 6992 6993 'PhabricatorMarkupInterface', 6993 6994 'PhabricatorFlaggableInterface', 6995 + 'PhabricatorProjectInterface', 6994 6996 'PhabricatorApplicationTransactionInterface', 6995 6997 'PhabricatorSubscribableInterface', 6996 6998 'PhabricatorTokenReceiverInterface',
+21 -1
src/applications/phame/controller/blog/PhameBlogEditController.php
··· 5 5 6 6 public function handleRequest(AphrontRequest $request) { 7 7 $user = $request->getUser(); 8 - 9 8 $id = $request->getURIData('id'); 9 + 10 10 if ($id) { 11 11 $blog = id(new PhameBlogQuery()) 12 12 ->setViewer($user) ··· 23 23 $submit_button = pht('Save Changes'); 24 24 $page_title = pht('Edit Blog'); 25 25 $cancel_uri = $this->getApplicationURI('blog/view/'.$blog->getID().'/'); 26 + 27 + $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs( 28 + $blog->getPHID(), 29 + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); 30 + $v_projects = array_reverse($v_projects); 31 + 26 32 } else { 27 33 $blog = PhameBlog::initializeNewBlog($user); 28 34 29 35 $submit_button = pht('Create Blog'); 30 36 $page_title = pht('Create Blog'); 31 37 $cancel_uri = $this->getApplicationURI(); 38 + $v_projects = array(); 32 39 } 33 40 $name = $blog->getName(); 34 41 $description = $blog->getDescription(); ··· 50 57 $can_view = $request->getStr('can_view'); 51 58 $can_edit = $request->getStr('can_edit'); 52 59 $can_join = $request->getStr('can_join'); 60 + $v_projects = $request->getArr('projects'); 53 61 54 62 $xactions = array( 55 63 id(new PhameBlogTransaction()) ··· 75 83 ->setNewValue($can_join), 76 84 ); 77 85 86 + $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; 87 + $xactions[] = id(new PhameBlogTransaction()) 88 + ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 89 + ->setMetadataValue('edge:type', $proj_edge_type) 90 + ->setNewValue(array('=' => array_fuse($v_projects))); 91 + 78 92 $editor = id(new PhameBlogEditor()) 79 93 ->setActor($user) 80 94 ->setContentSourceFromRequest($request) ··· 147 161 ->setPolicies($policies) 148 162 ->setValue($can_join) 149 163 ->setName('can_join')) 164 + ->appendControl( 165 + id(new AphrontFormTokenizerControl()) 166 + ->setLabel(pht('Projects')) 167 + ->setName('projects') 168 + ->setValue($v_projects) 169 + ->setDatasource(new PhabricatorProjectDatasource())) 150 170 ->appendChild( 151 171 id(new AphrontFormTextControl()) 152 172 ->setLabel(pht('Custom Domain'))
+16 -9
src/applications/phame/controller/blog/PhameBlogViewController.php
··· 72 72 require_celerity_resource('aphront-tooltip-css'); 73 73 Javelin::initBehavior('phabricator-tooltips'); 74 74 75 - $properties = new PHUIPropertyListView(); 76 - $properties->setActionList($actions); 75 + $properties = id(new PHUIPropertyListView()) 76 + ->setUser($user) 77 + ->setObject($blog) 78 + ->setActionList($actions); 77 79 78 80 $properties->addProperty( 79 81 pht('Skin'), ··· 115 117 ->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION) 116 118 ->process(); 117 119 118 - $properties->addTextContent( 119 - phutil_tag( 120 - 'div', 121 - array( 122 - 'class' => 'phabricator-remarkup', 123 - ), 124 - $engine->getOutput($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION))); 120 + $properties->invokeWillRenderEvent(); 121 + 122 + if (strlen($blog->getDescription())) { 123 + $description = PhabricatorMarkupEngine::renderOneObject( 124 + id(new PhabricatorMarkupOneOff())->setContent($blog->getDescription()), 125 + 'default', 126 + $user); 127 + $properties->addSectionHeader( 128 + pht('Description'), 129 + PHUIPropertyListView::ICON_SUMMARY); 130 + $properties->addTextContent($description); 131 + } 125 132 126 133 return $properties; 127 134 }
+19
src/applications/phame/controller/post/PhamePostEditController.php
··· 22 22 $cancel_uri = $this->getApplicationURI('/post/view/'.$id.'/'); 23 23 $submit_button = pht('Save Changes'); 24 24 $page_title = pht('Edit Post'); 25 + 26 + $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs( 27 + $post->getPHID(), 28 + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); 29 + $v_projects = array_reverse($v_projects); 25 30 } else { 26 31 $blog = id(new PhameBlogQuery()) 27 32 ->setViewer($user) ··· 35 40 if (!$blog) { 36 41 return new Aphront404Response(); 37 42 } 43 + $v_projects = array(); 38 44 39 45 $post = PhamePost::initializePost($user, $blog); 40 46 $cancel_uri = $this->getApplicationURI('/blog/view/'.$blog->getID().'/'); ··· 57 63 $phame_title = PhabricatorSlug::normalize($phame_title); 58 64 $body = $request->getStr('body'); 59 65 $comments_widget = $request->getStr('comments_widget'); 66 + $v_projects = $request->getArr('projects'); 60 67 61 68 $xactions = array( 62 69 id(new PhamePostTransaction()) ··· 73 80 ->setNewValue($comments_widget), 74 81 ); 75 82 83 + $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; 84 + $xactions[] = id(new PhamePostTransaction()) 85 + ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 86 + ->setMetadataValue('edge:type', $proj_edge_type) 87 + ->setNewValue(array('=' => array_fuse($v_projects))); 88 + 76 89 $editor = id(new PhamePostEditor()) 77 90 ->setActor($user) 78 91 ->setContentSourceFromRequest($request) ··· 130 143 ->setID('post-body') 131 144 ->setUser($user) 132 145 ->setDisableMacros(true)) 146 + ->appendControl( 147 + id(new AphrontFormTokenizerControl()) 148 + ->setLabel(pht('Projects')) 149 + ->setName('projects') 150 + ->setValue($v_projects) 151 + ->setDatasource(new PhabricatorProjectDatasource())) 133 152 ->appendChild( 134 153 id(new AphrontFormSelectControl()) 135 154 ->setLabel(pht('Comments Widget'))
+1
src/applications/phame/storage/PhameBlog.php
··· 6 6 PhabricatorMarkupInterface, 7 7 PhabricatorSubscribableInterface, 8 8 PhabricatorFlaggableInterface, 9 + PhabricatorProjectInterface, 9 10 PhabricatorApplicationTransactionInterface { 10 11 11 12 const MARKUP_FIELD_DESCRIPTION = 'markup:description';
+1
src/applications/phame/storage/PhamePost.php
··· 5 5 PhabricatorPolicyInterface, 6 6 PhabricatorMarkupInterface, 7 7 PhabricatorFlaggableInterface, 8 + PhabricatorProjectInterface, 8 9 PhabricatorApplicationTransactionInterface, 9 10 PhabricatorSubscribableInterface, 10 11 PhabricatorTokenReceiverInterface {