Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93067151
PhabricatorDashboardArrangeController.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, Nov 25, 23:06
Size
2 KB
Mime Type
text/x-php
Expires
Wed, Nov 27, 23:06 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22568895
Attached To
rPH Phabricator
PhabricatorDashboardArrangeController.php
View Options
<?php
final
class
PhabricatorDashboardArrangeController
extends
PhabricatorDashboardProfileController
{
public
function
shouldAllowPublic
()
{
return
true
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$dashboard
=
id
(
new
PhabricatorDashboardQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
needPanels
(
true
)
->
executeOne
();
if
(!
$dashboard
)
{
return
new
Aphront404Response
();
}
$this
->
setDashboard
(
$dashboard
);
$can_edit
=
PhabricatorPolicyFilter
::
hasCapability
(
$viewer
,
$dashboard
,
PhabricatorPolicyCapability
::
CAN_EDIT
);
$title
=
$dashboard
->
getName
();
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addTextCrumb
(
pht
(
'Arrange'
));
$header
=
$this
->
buildHeaderView
();
$info_view
=
null
;
if
(!
$can_edit
)
{
$no_edit
=
pht
(
'You do not have permission to edit this dashboard.'
);
$info_view
=
id
(
new
PHUIInfoView
())
->
setSeverity
(
PHUIInfoView
::
SEVERITY_NOTICE
)
->
setErrors
(
array
(
$no_edit
));
}
$rendered_dashboard
=
id
(
new
PhabricatorDashboardRenderingEngine
())
->
setViewer
(
$viewer
)
->
setDashboard
(
$dashboard
)
->
setArrangeMode
(
$can_edit
)
->
renderDashboard
();
$dashboard_box
=
id
(
new
PHUIBoxView
())
->
addClass
(
'dashboard-preview-box'
)
->
appendChild
(
$rendered_dashboard
);
$install_button
=
id
(
new
PHUIButtonView
())
->
setTag
(
'a'
)
->
setText
(
'Install Dashboard'
)
->
setIcon
(
'fa-plus'
)
->
setWorkflow
(
true
)
->
setHref
(
$this
->
getApplicationURI
(
"/install/{$id}/"
));
$header
->
addActionLink
(
$install_button
);
$view
=
id
(
new
PHUITwoColumnView
())
->
setHeader
(
$header
)
->
setFooter
(
array
(
$info_view
,
$dashboard_box
,
));
$navigation
=
$this
->
buildSideNavView
(
'arrange'
);
return
$this
->
newPage
()
->
setTitle
(
$title
)
->
setCrumbs
(
$crumbs
)
->
setNavigation
(
$navigation
)
->
appendChild
(
$view
);
}
}
Event Timeline
Log In to Comment