Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F545789
DrydockBlueprintDisableController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
DrydockBlueprintDisableController.php
View Options
<?php
final
class
DrydockBlueprintDisableController
extends
DrydockBlueprintController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$blueprint
=
id
(
new
DrydockBlueprintQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$blueprint
)
{
return
new
Aphront404Response
();
}
$is_disable
=
(
$request
->
getURIData
(
'action'
)
==
'disable'
);
$id
=
$blueprint
->
getID
();
$cancel_uri
=
$this
->
getApplicationURI
(
"blueprint/{$id}/"
);
if
(
$request
->
isFormPost
())
{
$xactions
=
array
();
$xactions
[]
=
id
(
new
DrydockBlueprintTransaction
())
->
setTransactionType
(
DrydockBlueprintDisableTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
$is_disable
?
1
:
0
);
$editor
=
id
(
new
DrydockBlueprintEditor
())
->
setActor
(
$viewer
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
)
->
applyTransactions
(
$blueprint
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$cancel_uri
);
}
if
(
$is_disable
)
{
$title
=
pht
(
'Disable Blueprint'
);
$body
=
pht
(
'If you disable this blueprint, Drydock will no longer use it to '
.
'allocate new resources. Existing resources will not be affected.'
);
$button
=
pht
(
'Disable Blueprint'
);
}
else
{
$title
=
pht
(
'Enable Blueprint'
);
$body
=
pht
(
'If you enable this blueprint, Drydock will start using it to '
.
'allocate new resources.'
);
$button
=
pht
(
'Enable Blueprint'
);
}
return
$this
->
newDialog
()
->
setTitle
(
$title
)
->
appendParagraph
(
$body
)
->
addCancelButton
(
$cancel_uri
)
->
addSubmitButton
(
$button
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 1:00 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
120111
Default Alt Text
DrydockBlueprintDisableController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment