Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92295095
PhabricatorDashboardPanelCreateController.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 19, 04:16
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Nov 21, 04:16 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22415657
Attached To
rPH Phabricator
PhabricatorDashboardPanelCreateController.php
View Options
<?php
final
class
PhabricatorDashboardPanelCreateController
extends
PhabricatorDashboardController
{
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
$types
=
PhabricatorDashboardPanelType
::
getAllPanelTypes
();
$v_type
=
null
;
$errors
=
array
();
if
(
$request
->
isFormPost
())
{
$v_type
=
$request
->
getStr
(
'type'
);
if
(!
isset
(
$types
[
$v_type
]))
{
$errors
[]
=
pht
(
'You must select a type of panel to create.'
);
}
if
(!
$errors
)
{
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$this
->
getApplicationURI
(
'panel/edit/?type='
.
$v_type
));
}
}
$cancel_uri
=
$this
->
getApplicationURI
(
'panel/'
);
if
(!
$v_type
)
{
$v_type
=
key
(
$types
);
}
$panel_types
=
id
(
new
AphrontFormRadioButtonControl
())
->
setName
(
'type'
)
->
setValue
(
$v_type
);
foreach
(
$types
as
$key
=>
$type
)
{
$panel_types
->
addButton
(
$key
,
$type
->
getPanelTypeName
(),
$type
->
getPanelTypeDescription
());
}
$form
=
id
(
new
AphrontFormView
())
->
setUser
(
$viewer
)
->
appendChild
(
$panel_types
)
->
appendChild
(
id
(
new
AphrontFormSubmitControl
())
->
setValue
(
pht
(
'Continue'
))
->
addCancelButton
(
$cancel_uri
));
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addTextCrumb
(
pht
(
'Panels'
),
$this
->
getApplicationURI
(
'panel/'
));
$crumbs
->
addTextCrumb
(
pht
(
'New Panel'
));
$title
=
pht
(
'Create Dashboard Panel'
);
$box
=
id
(
new
PHUIObjectBoxView
())
->
setHeaderText
(
$title
)
->
setFormErrors
(
$errors
)
->
setForm
(
$form
);
return
$this
->
buildApplicationPage
(
array
(
$crumbs
,
$box
,
),
array
(
'title'
=>
$title
,
'device'
=>
true
,
));
}
}
Event Timeline
Log In to Comment