3 final class PhabricatorPackagesPublisherViewController
4 extends PhabricatorPackagesPublisherController
{
6 public function shouldAllowPublic() {
10 public function handleRequest(AphrontRequest
$request) {
11 $viewer = $request->getViewer();
12 $publisher_key = $request->getURIData('publisherKey');
14 $publisher = id(new PhabricatorPackagesPublisherQuery())
16 ->withPublisherKeys(array($publisher_key))
19 return new Aphront404Response();
22 $crumbs = $this->buildApplicationCrumbs()
25 $this->getApplicationURI('publisher/'))
26 ->addTextCrumb($publisher->getName())
29 $header = $this->buildHeaderView($publisher);
30 $curtain = $this->buildCurtain($publisher);
32 $packages_view = $this->buildPackagesView($publisher);
34 $timeline = $this->buildTransactionTimeline(
36 new PhabricatorPackagesPublisherTransactionQuery());
37 $timeline->setShouldTerminate(true);
39 $publisher_view = id(new PHUITwoColumnView())
41 ->setCurtain($curtain)
48 return $this->newPage()
52 $publisher->getPHID(),
54 ->appendChild($publisher_view);
58 private function buildHeaderView(PhabricatorPackagesPublisher
$publisher) {
59 $viewer = $this->getViewer();
60 $name = $publisher->getName();
62 return id(new PHUIHeaderView())
65 ->setPolicyObject($publisher)
66 ->setHeaderIcon('fa-paw');
69 private function buildCurtain(PhabricatorPackagesPublisher
$publisher) {
70 $viewer = $this->getViewer();
71 $curtain = $this->newCurtainView($publisher);
73 $can_edit = PhabricatorPolicyFilter
::hasCapability(
76 PhabricatorPolicyCapability
::CAN_EDIT
);
78 $id = $publisher->getID();
79 $edit_uri = $this->getApplicationURI("publisher/edit/{$id}/");
82 id(new PhabricatorActionView())
83 ->setName(pht('Edit Publisher'))
84 ->setIcon('fa-pencil')
85 ->setDisabled(!$can_edit)
86 ->setHref($edit_uri));
91 private function buildPackagesView(PhabricatorPackagesPublisher
$publisher) {
92 $viewer = $this->getViewer();
94 $packages = id(new PhabricatorPackagesPackageQuery())
96 ->withPublisherPHIDs(array($publisher->getPHID()))
100 $packages_list = id(new PhabricatorPackagesPackageListView())
102 ->setPackages($packages);
104 $all_href = urisprintf(
105 'package/?publisher=%s#R',
106 $publisher->getPHID());
107 $all_href = $this->getApplicationURI($all_href);
109 $view_all = id(new PHUIButtonView())
111 ->setIcon('fa-search')
112 ->setText(pht('View All'))
113 ->setHref($all_href);
115 $header = id(new PHUIHeaderView())
116 ->setHeader(pht('Packages'))
117 ->addActionLink($view_all);
119 $packages_view = id(new PHUIObjectBoxView())
121 ->setBackground(PHUIObjectBoxView
::BLUE_PROPERTY
)
122 ->setObjectList($packages_list);
124 return $packages_view;