@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
at upstream/main 122 lines 3.2 kB view raw
1<?php 2 3final class PhabricatorProjectColumnDetailController 4 extends PhabricatorProjectBoardController { 5 6 public function handleRequest(AphrontRequest $request) { 7 $viewer = $request->getViewer(); 8 $id = $request->getURIData('id'); 9 $project_id = $request->getURIData('projectID'); 10 11 $project = id(new PhabricatorProjectQuery()) 12 ->setViewer($viewer) 13 ->requireCapabilities( 14 array( 15 PhabricatorPolicyCapability::CAN_VIEW, 16 )) 17 ->withIDs(array($project_id)) 18 ->needImages(true) 19 ->executeOne(); 20 if (!$project) { 21 return new Aphront404Response(); 22 } 23 $this->setProject($project); 24 25 $project_id = $project->getID(); 26 27 $column = id(new PhabricatorProjectColumnQuery()) 28 ->setViewer($viewer) 29 ->withIDs(array($id)) 30 ->requireCapabilities( 31 array( 32 PhabricatorPolicyCapability::CAN_VIEW, 33 )) 34 ->executeOne(); 35 if (!$column) { 36 return new Aphront404Response(); 37 } 38 39 $timeline = $this->buildTransactionTimeline( 40 $column, 41 new PhabricatorProjectColumnTransactionQuery()); 42 $timeline->setShouldTerminate(true); 43 44 $title = $column->getDisplayName(); 45 46 $header = $this->buildHeaderView($column); 47 $properties = $this->buildPropertyView($column); 48 49 $crumbs = $this->buildApplicationCrumbs(); 50 $crumbs->addTextCrumb(pht('Workboard'), $project->getWorkboardURI()); 51 $crumbs->addTextCrumb(pht('Column: %s', $title)); 52 $crumbs->setBorder(true); 53 54 $nav = $this->newNavigation( 55 $project, 56 PhabricatorProject::ITEM_WORKBOARD); 57 require_celerity_resource('project-view-css'); 58 59 $view = id(new PHUITwoColumnView()) 60 ->setHeader($header) 61 ->addClass('project-view-home') 62 ->addClass('project-view-people-home') 63 ->setMainColumn(array( 64 $properties, 65 $timeline, 66 )); 67 68 return $this->newPage() 69 ->setTitle($title) 70 ->setNavigation($nav) 71 ->setCrumbs($crumbs) 72 ->appendChild($view); 73 } 74 75 private function buildHeaderView(PhabricatorProjectColumn $column) { 76 $viewer = $this->getViewer(); 77 78 $header = id(new PHUIHeaderView()) 79 ->setHeader(pht('Column: %s', $column->getDisplayName())) 80 ->setUser($viewer); 81 82 if ($column->isHidden()) { 83 $header->setStatus('fa-ban', 'dark', pht('Hidden')); 84 } 85 86 return $header; 87 } 88 89 private function buildPropertyView( 90 PhabricatorProjectColumn $column) { 91 $viewer = $this->getViewer(); 92 93 $properties = id(new PHUIPropertyListView()) 94 ->setUser($viewer) 95 ->setObject($column); 96 97 $limit = $column->getPointLimit(); 98 if ($limit === null) { 99 $limit_text = pht('No Limit'); 100 } else { 101 $limit_text = $limit; 102 } 103 104 // The "limit" has always had a dual purpose. 105 // Let's make it more obvious. 106 if (ManiphestTaskPoints::getIsEnabled()) { 107 $limit_label = pht('Point Limit'); 108 } else { 109 $limit_label = pht('Count Limit'); 110 } 111 112 $properties->addProperty($limit_label, $limit_text); 113 114 $box = id(new PHUIObjectBoxView()) 115 ->setHeaderText(pht('Details')) 116 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 117 ->appendChild($properties); 118 119 return $box; 120 } 121 122}