3 final class PhabricatorPackagesVersionViewController
4 extends PhabricatorPackagesVersionController
{
6 public function shouldAllowPublic() {
10 public function handleRequest(AphrontRequest
$request) {
11 $viewer = $request->getViewer();
13 $publisher_key = $request->getURIData('publisherKey');
14 $package_key = $request->getURIData('packageKey');
15 $full_key = $publisher_key.'/'.$package_key;
16 $version_key = $request->getURIData('versionKey');
18 $version = id(new PhabricatorPackagesVersionQuery())
20 ->withFullKeys(array($full_key))
21 ->withNames(array($version_key))
24 return new Aphront404Response();
27 $package = $version->getPackage();
28 $publisher = $package->getPublisher();
30 $crumbs = $this->buildApplicationCrumbs()
31 ->addTextCrumb($publisher->getName(), $publisher->getURI())
32 ->addTextCrumb($package->getName(), $package->getURI())
33 ->addTextCrumb($version->getName())
36 $header = $this->buildHeaderView($version);
37 $curtain = $this->buildCurtain($version);
39 $timeline = $this->buildTransactionTimeline(
41 new PhabricatorPackagesVersionTransactionQuery());
42 $timeline->setShouldTerminate(true);
44 $version_view = id(new PHUITwoColumnView())
46 ->setCurtain($curtain)
47 ->setMainColumn($timeline);
49 return $this->newPage()
55 ->appendChild($version_view);
59 private function buildHeaderView(PhabricatorPackagesVersion
$version) {
60 $viewer = $this->getViewer();
61 $name = $version->getName();
63 return id(new PHUIHeaderView())
66 ->setPolicyObject($version)
67 ->setHeaderIcon('fa-tag');
70 private function buildCurtain(PhabricatorPackagesVersion
$version) {
71 $viewer = $this->getViewer();
72 $curtain = $this->newCurtainView($version);
74 $can_edit = PhabricatorPolicyFilter
::hasCapability(
77 PhabricatorPolicyCapability
::CAN_EDIT
);
79 $id = $version->getID();
80 $edit_uri = $this->getApplicationURI("version/edit/{$id}/");
83 id(new PhabricatorActionView())
84 ->setName(pht('Edit Version'))
85 ->setIcon('fa-pencil')
86 ->setDisabled(!$can_edit)
87 ->setHref($edit_uri));