Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2340576
DrydockBlueprintCreateController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
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
,
'device'
=>
true
,
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Sep 16, 9:26 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
380982
Default Alt Text
DrydockBlueprintCreateController.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment