Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93536163
ReleephProjectActionController.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, Nov 29, 13:18
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Dec 1, 13:18 (2 d)
Engine
blob
Format
Raw Data
Handle
22661529
Attached To
rPH Phabricator
ReleephProjectActionController.php
View Options
<?php
final
class
ReleephProjectActionController
extends
ReleephProjectController
{
private
$action
;
public
function
willProcessRequest
(
array
$data
)
{
parent
::
willProcessRequest
(
$data
);
$this
->
action
=
$data
[
'action'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
$action
=
$this
->
action
;
$project
=
id
(
new
ReleephProjectQuery
())
->
withIDs
(
array
(
$this
->
getReleephProject
()->
getID
()))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
setViewer
(
$viewer
)
->
executeOne
();
if
(!
$project
)
{
return
new
Aphront404Response
();
}
$project_id
=
$project
->
getID
();
$project_uri
=
$this
->
getApplicationURI
(
"project/{$project_id}/"
);
switch
(
$action
)
{
case
'deactivate'
:
if
(
$request
->
isDialogFormPost
())
{
$project
->
deactivate
(
$viewer
)->
save
();
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$project_uri
);
}
$dialog
=
id
(
new
AphrontDialogView
())
->
setUser
(
$request
->
getUser
())
->
setTitle
(
pht
(
'Really deactivate Releeph Project?'
))
->
appendChild
(
phutil_tag
(
'p'
,
array
(),
pht
(
'Really deactivate the Releeph project: %s?'
,
$project
->
getName
())))
->
addSubmitButton
(
pht
(
'Deactivate Project'
))
->
addCancelButton
(
$project_uri
);
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
case
'activate'
:
$project
->
setIsActive
(
1
)->
save
();
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$project_uri
);
}
}
}
Event Timeline
Log In to Comment