Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F108045629
PhabricatorEditEngineConfigurationDisableController.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
Sun, Apr 13, 14:02
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Apr 15, 14:02 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
25516670
Attached To
rPH Phabricator
PhabricatorEditEngineConfigurationDisableController.php
View Options
<?php
final
class
PhabricatorEditEngineConfigurationDisableController
extends
PhabricatorEditEngineController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$this
->
getViewer
();
$config
=
$this
->
loadConfigForEdit
();
if
(!
$config
)
{
return
id
(
new
Aphront404Response
());
}
$engine_key
=
$config
->
getEngineKey
();
$key
=
$config
->
getIdentifier
();
$cancel_uri
=
"/transactions/editengine/{$engine_key}/view/{$key}/"
;
$type
=
PhabricatorEditEngineConfigurationTransaction
::
TYPE_DISABLE
;
if
(
$request
->
isFormPost
())
{
$xactions
=
array
();
$xactions
[]
=
id
(
new
PhabricatorEditEngineConfigurationTransaction
())
->
setTransactionType
(
$type
)
->
setNewValue
(!
$config
->
getIsDisabled
());
$editor
=
id
(
new
PhabricatorEditEngineConfigurationEditor
())
->
setActor
(
$viewer
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnMissingFields
(
true
)
->
setContinueOnNoEffect
(
true
);
$editor
->
applyTransactions
(
$config
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())
->
setURI
(
$cancel_uri
);
}
if
(
$config
->
getIsDisabled
())
{
$title
=
pht
(
'Enable Form'
);
$body
=
pht
(
'Enable this form? Users who can see it will be able to use it to '
.
'create objects.'
);
$button
=
pht
(
'Enable Form'
);
}
else
{
$title
=
pht
(
'Disable Form'
);
$body
=
pht
(
'Disable this form? Users will no longer be able to use it.'
);
$button
=
pht
(
'Disable Form'
);
}
return
$this
->
newDialog
()
->
setTitle
(
$title
)
->
appendParagraph
(
$body
)
->
addSubmitButton
(
$button
)
->
addCancelbutton
(
$cancel_uri
);
}
}
Event Timeline
Log In to Comment