Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97206560
DrydockBlueprintCreateController.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
Fri, Jan 3, 10:43
Size
2 KB
Mime Type
text/x-php
Expires
Sun, Jan 5, 10:43 (2 d)
Engine
blob
Format
Raw Data
Handle
23354310
Attached To
rPH Phabricator
DrydockBlueprintCreateController.php
View Options
<?php
final
class
DrydockBlueprintCreateController
extends
DrydockBlueprintController
{
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
$this
->
requireApplicationCapability
(
DrydockCapabilityCreateBlueprints
::
CAPABILITY
);
$implementations
=
DrydockBlueprintImplementation
::
getAllBlueprintImplementations
();
$errors
=
array
();
$e_blueprint
=
null
;
if
(
$request
->
isFormPost
())
{
$class
=
$request
->
getStr
(
'blueprint-type'
);
if
(!
isset
(
$implementations
[
$class
]))
{
$e_blueprint
=
pht
(
'Required'
);
$errors
[]
=
pht
(
'You must choose a blueprint type.'
);
}
if
(!
$errors
)
{
$edit_uri
=
$this
->
getApplicationURI
(
'blueprint/edit/?class='
.
$class
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$edit_uri
);
}
}
$control
=
id
(
new
AphrontFormRadioButtonControl
())
->
setName
(
'blueprint-type'
)
->
setLabel
(
pht
(
'Blueprint Type'
))
->
setError
(
$e_blueprint
);
foreach
(
$implementations
as
$implementation_name
=>
$implementation
)
{
$disabled
=
!
$implementation
->
isEnabled
();
$control
->
addButton
(
$implementation_name
,
$implementation
->
getBlueprintName
(),
array
(
pht
(
'Provides: %s'
,
$implementation
->
getType
()),
phutil_tag
(
'br'
),
phutil_tag
(
'br'
),
$implementation
->
getDescription
(),
),
$disabled
?
'disabled'
:
null
,
$disabled
);
}
$title
=
pht
(
'Create New Blueprint'
);
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addTextCrumb
(
pht
(
'New Blueprint'
));
$form
=
id
(
new
AphrontFormView
())
->
setUser
(
$viewer
)
->
appendChild
(
$control
)
->
appendChild
(
id
(
new
AphrontFormSubmitControl
())
->
addCancelButton
(
$this
->
getApplicationURI
(
'blueprint/'
))
->
setValue
(
pht
(
'Continue'
)));
$box
=
id
(
new
PHUIObjectBoxView
())
->
setFormErrors
(
$errors
)
->
setHeaderText
(
$title
)
->
setForm
(
$form
);
return
$this
->
buildApplicationPage
(
array
(
$crumbs
,
$box
,
),
array
(
'title'
=>
$title
,
));
}
}
Event Timeline
Log In to Comment