3 final class NuanceSourceViewController
4 extends NuanceSourceController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $viewer = $this->getViewer();
9 $source = id(new NuanceSourceQuery())
11 ->withIDs(array($request->getURIData('id')))
14 return new Aphront404Response();
17 $source_id = $source->getID();
19 $header = $this->buildHeaderView($source);
20 $curtain = $this->buildCurtain($source);
21 $properties = $this->buildPropertyView($source);
23 $title = $source->getName();
25 $routing_list = id(new PHUIPropertyListView())
28 $viewer->renderHandle($source->getDefaultQueuePHID()));
30 $crumbs = $this->buildApplicationCrumbs();
31 $crumbs->addTextCrumb(pht('Sources'), $this->getApplicationURI('source/'));
32 $crumbs->addTextCrumb($title);
33 $crumbs->setBorder(true);
35 $timeline = $this->buildTransactionTimeline(
37 new NuanceSourceTransactionQuery());
38 $timeline->setShouldTerminate(true);
40 $view = id(new PHUITwoColumnView())
42 ->setCurtain($curtain)
43 ->addPropertySection(pht('Details'), $properties)
44 ->addPropertySection(pht('Routing'), $routing_list)
45 ->setMainColumn($timeline);
47 return $this->newPage()
53 private function buildHeaderView(NuanceSource
$source) {
54 $viewer = $this->getViewer();
56 $header = id(new PHUIHeaderView())
58 ->setHeader($source->getName())
59 ->setPolicyObject($source);
64 private function buildCurtain(NuanceSource
$source) {
65 $viewer = $this->getViewer();
66 $id = $source->getID();
68 $actions = id(new PhabricatorActionListView())
71 $can_edit = PhabricatorPolicyFilter
::hasCapability(
74 PhabricatorPolicyCapability
::CAN_EDIT
);
76 $curtain = $this->newCurtainView($source);
79 id(new PhabricatorActionView())
80 ->setName(pht('Edit Source'))
81 ->setIcon('fa-pencil')
82 ->setHref($this->getApplicationURI("source/edit/{$id}/"))
83 ->setDisabled(!$can_edit)
84 ->setWorkflow(!$can_edit));
86 $request = $this->getRequest();
87 $definition = $source->getDefinition();
93 $source_actions = $definition->getSourceViewActions($request);
94 foreach ($source_actions as $source_action) {
95 $curtain->addAction($source_action);
101 private function buildPropertyView(
102 NuanceSource
$source) {
103 $viewer = $this->getViewer();
105 $properties = id(new PHUIPropertyListView())
106 ->setViewer($viewer);
108 $definition = $source->getDefinition();
110 $properties->addProperty(
112 $definition->getName());