Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93878347
PhabricatorPackagesPublisherViewController.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
Mon, Dec 2, 05:20
Size
2 KB
Mime Type
text/x-php
Expires
Wed, Dec 4, 05:20 (2 d)
Engine
blob
Format
Raw Data
Handle
22718321
Attached To
rPH Phabricator
PhabricatorPackagesPublisherViewController.php
View Options
<?php
final
class
PhabricatorPackagesPublisherViewController
extends
PhabricatorPackagesPublisherController
{
public
function
shouldAllowPublic
()
{
return
true
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$publisher_key
=
$request
->
getURIData
(
'publisherKey'
);
$publisher
=
id
(
new
PhabricatorPackagesPublisherQuery
())
->
setViewer
(
$viewer
)
->
withPublisherKeys
(
array
(
$publisher_key
))
->
executeOne
();
if
(!
$publisher
)
{
return
new
Aphront404Response
();
}
$crumbs
=
$this
->
buildApplicationCrumbs
()
->
addTextCrumb
(
pht
(
'Publishers'
),
$this
->
getApplicationURI
(
'publisher/'
))
->
addTextCrumb
(
$publisher
->
getName
())
->
setBorder
(
true
);
$header
=
$this
->
buildHeaderView
(
$publisher
);
$curtain
=
$this
->
buildCurtain
(
$publisher
);
$timeline
=
$this
->
buildTransactionTimeline
(
$publisher
,
new
PhabricatorPackagesPublisherTransactionQuery
());
$publisher_view
=
id
(
new
PHUITwoColumnView
())
->
setHeader
(
$header
)
->
setCurtain
(
$curtain
)
->
setMainColumn
(
$timeline
);
return
$this
->
newPage
()
->
setCrumbs
(
$crumbs
)
->
setPageObjectPHIDs
(
array
(
$publisher
->
getPHID
(),
))
->
appendChild
(
$publisher_view
);
}
private
function
buildHeaderView
(
PhabricatorPackagesPublisher
$publisher
)
{
$viewer
=
$this
->
getViewer
();
$name
=
$publisher
->
getName
();
return
id
(
new
PHUIHeaderView
())
->
setViewer
(
$viewer
)
->
setHeader
(
$name
)
->
setPolicyObject
(
$publisher
)
->
setHeaderIcon
(
'fa-paw'
);
}
private
function
buildCurtain
(
PhabricatorPackagesPublisher
$publisher
)
{
$viewer
=
$this
->
getViewer
();
$curtain
=
$this
->
newCurtainView
(
$publisher
);
$can_edit
=
PhabricatorPolicyFilter
::
hasCapability
(
$viewer
,
$publisher
,
PhabricatorPolicyCapability
::
CAN_EDIT
);
$id
=
$publisher
->
getID
();
$edit_uri
=
$this
->
getApplicationURI
(
"publisher/edit/{$id}/"
);
$curtain
->
addAction
(
id
(
new
PhabricatorActionView
())
->
setName
(
pht
(
'Edit Publisher'
))
->
setIcon
(
'fa-pencil'
)
->
setDisabled
(!
$can_edit
)
->
setHref
(
$edit_uri
));
return
$curtain
;
}
}
Event Timeline
Log In to Comment