Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93610854
PhabricatorPackagesPackageViewController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 30, 03:46
Size
2 KB
Mime Type
text/x-php
Expires
Mon, Dec 2, 03:46 (2 d)
Engine
blob
Format
Raw Data
Handle
22673581
Attached To
rPH Phabricator
PhabricatorPackagesPackageViewController.php
View Options
<?php
final
class
PhabricatorPackagesPackageViewController
extends
PhabricatorPackagesPackageController
{
public
function
shouldAllowPublic
()
{
return
true
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$publisher_key
=
$request
->
getURIData
(
'publisherKey'
);
$package_key
=
$request
->
getURIData
(
'packageKey'
);
$full_key
=
$publisher_key
.
'/'
.
$package_key
;
$package
=
id
(
new
PhabricatorPackagesPackageQuery
())
->
setViewer
(
$viewer
)
->
withFullKeys
(
array
(
$full_key
))
->
executeOne
();
if
(!
$package
)
{
return
new
Aphront404Response
();
}
$publisher
=
$package
->
getPublisher
();
$crumbs
=
$this
->
buildApplicationCrumbs
()
->
addTextCrumb
(
$publisher
->
getName
(),
$publisher
->
getURI
())
->
addTextCrumb
(
$package
->
getName
())
->
setBorder
(
true
);
$header
=
$this
->
buildHeaderView
(
$package
);
$curtain
=
$this
->
buildCurtain
(
$package
);
$timeline
=
$this
->
buildTransactionTimeline
(
$package
,
new
PhabricatorPackagesPackageTransactionQuery
());
$package_view
=
id
(
new
PHUITwoColumnView
())
->
setHeader
(
$header
)
->
setCurtain
(
$curtain
)
->
setMainColumn
(
$timeline
);
return
$this
->
newPage
()
->
setCrumbs
(
$crumbs
)
->
setPageObjectPHIDs
(
array
(
$package
->
getPHID
(),
))
->
appendChild
(
$package_view
);
}
private
function
buildHeaderView
(
PhabricatorPackagesPackage
$package
)
{
$viewer
=
$this
->
getViewer
();
$name
=
$package
->
getName
();
return
id
(
new
PHUIHeaderView
())
->
setViewer
(
$viewer
)
->
setHeader
(
$name
)
->
setPolicyObject
(
$package
)
->
setHeaderIcon
(
'fa-gift'
);
}
private
function
buildCurtain
(
PhabricatorPackagesPackage
$package
)
{
$viewer
=
$this
->
getViewer
();
$curtain
=
$this
->
newCurtainView
(
$package
);
$can_edit
=
PhabricatorPolicyFilter
::
hasCapability
(
$viewer
,
$package
,
PhabricatorPolicyCapability
::
CAN_EDIT
);
$id
=
$package
->
getID
();
$edit_uri
=
$this
->
getApplicationURI
(
"package/edit/{$id}/"
);
$curtain
->
addAction
(
id
(
new
PhabricatorActionView
())
->
setName
(
pht
(
'Edit Package'
))
->
setIcon
(
'fa-pencil'
)
->
setDisabled
(!
$can_edit
)
->
setHref
(
$edit_uri
));
return
$curtain
;
}
}
Event Timeline
Log In to Comment