Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93075155
AlmanacNetworkViewController.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
Tue, Nov 26, 00:40
Size
2 KB
Mime Type
text/x-php
Expires
Thu, Nov 28, 00:40 (2 d)
Engine
blob
Format
Raw Data
Handle
22568216
Attached To
rPH Phabricator
AlmanacNetworkViewController.php
View Options
<?php
final
class
AlmanacNetworkViewController
extends
AlmanacNetworkController
{
public
function
shouldAllowPublic
()
{
return
true
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$network
=
id
(
new
AlmanacNetworkQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
executeOne
();
if
(!
$network
)
{
return
new
Aphront404Response
();
}
$title
=
pht
(
'Network %s'
,
$network
->
getName
());
$property_list
=
$this
->
buildPropertyList
(
$network
);
$action_list
=
$this
->
buildActionList
(
$network
);
$property_list
->
setActionList
(
$action_list
);
$header
=
id
(
new
PHUIHeaderView
())
->
setUser
(
$viewer
)
->
setHeader
(
$network
->
getName
())
->
setPolicyObject
(
$network
);
$box
=
id
(
new
PHUIObjectBoxView
())
->
setHeader
(
$header
)
->
addPropertyList
(
$property_list
);
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addTextCrumb
(
$network
->
getName
());
$timeline
=
$this
->
buildTransactionTimeline
(
$network
,
new
AlmanacNetworkTransactionQuery
());
$timeline
->
setShouldTerminate
(
true
);
return
$this
->
buildApplicationPage
(
array
(
$crumbs
,
$box
,
$timeline
,
),
array
(
'title'
=>
$title
,
));
}
private
function
buildPropertyList
(
AlmanacNetwork
$network
)
{
$viewer
=
$this
->
getViewer
();
$properties
=
id
(
new
PHUIPropertyListView
())
->
setUser
(
$viewer
);
return
$properties
;
}
private
function
buildActionList
(
AlmanacNetwork
$network
)
{
$viewer
=
$this
->
getViewer
();
$id
=
$network
->
getID
();
$can_edit
=
PhabricatorPolicyFilter
::
hasCapability
(
$viewer
,
$network
,
PhabricatorPolicyCapability
::
CAN_EDIT
);
$actions
=
id
(
new
PhabricatorActionListView
())
->
setUser
(
$viewer
);
$actions
->
addAction
(
id
(
new
PhabricatorActionView
())
->
setIcon
(
'fa-pencil'
)
->
setName
(
pht
(
'Edit Network'
))
->
setHref
(
$this
->
getApplicationURI
(
"network/edit/{$id}/"
))
->
setWorkflow
(!
$can_edit
)
->
setDisabled
(!
$can_edit
));
return
$actions
;
}
}
Event Timeline
Log In to Comment