Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F107381265
ReleephBranchAccessController.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
Mon, Apr 7, 15:35
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Apr 9, 15:35 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
25405730
Attached To
rPH Phabricator
ReleephBranchAccessController.php
View Options
<?php
final
class
ReleephBranchAccessController
extends
ReleephController
{
private
$action
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
action
=
$data
[
'action'
];
parent
::
willProcessRequest
(
$data
);
}
public
function
processRequest
()
{
$rph_branch
=
$this
->
getReleephBranch
();
$request
=
$this
->
getRequest
();
$active_uri
=
'/releeph/project/'
.
$rph_branch
->
getReleephProjectID
().
'/'
;
$inactive_uri
=
$active_uri
.
'inactive/'
;
switch
(
$this
->
action
)
{
case
'close'
:
$is_active
=
false
;
$origin_uri
=
$active_uri
;
break
;
case
're-open'
:
$is_active
=
true
;
$origin_uri
=
$inactive_uri
;
break
;
default
:
throw
new
Exception
(
"Unknown action '{$this->action}'!"
);
break
;
}
if
(
$request
->
isDialogFormPost
())
{
id
(
new
ReleephBranchEditor
())
->
setActor
(
$request
->
getUser
())
->
setReleephBranch
(
$rph_branch
)
->
changeBranchAccess
(
$is_active
?
1
:
0
);
return
id
(
new
AphrontRedirectResponse
())
->
setURI
(
$origin_uri
);
}
$button_text
=
ucfirst
(
$this
->
action
).
' Branch'
;
$message
=
hsprintf
(
'<p>Really %s the branch <i>%s</i>?</p>'
,
$this
->
action
,
$rph_branch
->
getBasename
());
$dialog
=
new
AphrontDialogView
();
$dialog
->
setUser
(
$request
->
getUser
())
->
setTitle
(
'Confirm'
)
->
appendChild
(
$message
)
->
addSubmitButton
(
$button_text
)
->
addCancelButton
(
$origin_uri
);
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
}
Event Timeline
Log In to Comment