3 final class PhabricatorSpacesViewController
4 extends PhabricatorSpacesController
{
6 public function shouldAllowPublic() {
10 public function handleRequest(AphrontRequest
$request) {
11 $viewer = $this->getViewer();
13 $space = id(new PhabricatorSpacesNamespaceQuery())
15 ->withIDs(array($request->getURIData('id')))
18 return new Aphront404Response();
21 $curtain = $this->buildCurtain($space);
22 $property_list = $this->buildPropertyListView($space);
23 $title = array($space->getMonogram(), $space->getNamespaceName());
25 $xactions = id(new PhabricatorSpacesNamespaceTransactionQuery())
27 ->withObjectPHIDs(array($space->getPHID()))
30 $timeline = $this->buildTransactionTimeline(
32 new PhabricatorSpacesNamespaceTransactionQuery());
33 $timeline->setShouldTerminate(true);
35 $header = id(new PHUIHeaderView())
37 ->setHeader($space->getNamespaceName())
38 ->setPolicyObject($space)
39 ->setHeaderIcon('fa-th-large');
41 if ($space->getIsArchived()) {
42 $header->setStatus('fa-ban', 'indigo', pht('Archived'));
44 $header->setStatus('fa-check', 'bluegrey', pht('Active'));
47 $box = id(new PHUIObjectBoxView())
48 ->setHeaderText(pht('Details'))
49 ->setBackground(PHUIObjectBoxView
::BLUE_PROPERTY
)
50 ->addPropertyList($property_list);
52 $crumbs = $this->buildApplicationCrumbs();
53 $crumbs->addTextCrumb($space->getMonogram());
54 $crumbs->setBorder(true);
56 $view = id(new PHUITwoColumnView())
58 ->setMainColumn(array(
62 ->setCurtain($curtain);
64 return $this->newPage()
71 private function buildPropertyListView(PhabricatorSpacesNamespace
$space) {
72 $viewer = $this->getRequest()->getUser();
74 $list = id(new PHUIPropertyListView())
79 $space->getIsDefaultNamespace()
83 $description = $space->getDescription();
84 if (strlen($description)) {
85 $description = new PHUIRemarkupView($viewer, $description);
86 $list->addSectionHeader(
88 PHUIPropertyListView
::ICON_SUMMARY
);
89 $list->addTextContent($description);
95 private function buildCurtain(PhabricatorSpacesNamespace
$space) {
96 $viewer = $this->getRequest()->getUser();
98 $curtain = $this->newCurtainView($space);
100 $can_edit = PhabricatorPolicyFilter
::hasCapability(
103 PhabricatorPolicyCapability
::CAN_EDIT
);
106 id(new PhabricatorActionView())
107 ->setName(pht('Edit Space'))
108 ->setIcon('fa-pencil')
109 ->setHref($this->getApplicationURI('edit/'.$space->getID().'/'))
110 ->setWorkflow(!$can_edit)
111 ->setDisabled(!$can_edit));
113 $id = $space->getID();
115 if ($space->getIsArchived()) {
117 id(new PhabricatorActionView())
118 ->setName(pht('Activate Space'))
119 ->setIcon('fa-check')
120 ->setHref($this->getApplicationURI("activate/{$id}/"))
121 ->setDisabled(!$can_edit)
122 ->setWorkflow(true));
125 id(new PhabricatorActionView())
126 ->setName(pht('Archive Space'))
128 ->setHref($this->getApplicationURI("archive/{$id}/"))
129 ->setDisabled(!$can_edit)
130 ->setWorkflow(true));