Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92977766
NuanceSourceEditController.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, Nov 25, 07:41
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Nov 27, 07:41 (2 d)
Engine
blob
Format
Raw Data
Handle
22548825
Attached To
rPH Phabricator
NuanceSourceEditController.php
View Options
<?php
final
class
NuanceSourceEditController
extends
NuanceController
{
private
$sourceID
;
public
function
setSourceID
(
$source_id
)
{
$this
->
sourceID
=
$source_id
;
return
$this
;
}
public
function
getSourceID
()
{
return
$this
->
sourceID
;
}
public
function
willProcessRequest
(
array
$data
)
{
$this
->
setSourceID
(
idx
(
$data
,
'id'
));
}
public
function
processRequest
()
{
$can_edit
=
$this
->
requireApplicationCapability
(
NuanceCapabilitySourceManage
::
CAPABILITY
);
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$source_id
=
$this
->
getSourceID
();
$is_new
=
!
$source_id
;
if
(
$is_new
)
{
$source
=
NuanceSource
::
initializeNewSource
(
$user
);
}
else
{
$source
=
id
(
new
NuanceSourceQuery
())
->
setViewer
(
$user
)
->
withIDs
(
array
(
$source_id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
}
if
(!
$source
)
{
return
new
Aphront404Response
();
}
$definition
=
NuanceSourceDefinition
::
getDefinitionForSource
(
$source
);
$definition
->
setActor
(
$user
);
$response
=
$definition
->
buildEditLayout
(
$request
);
if
(
$response
instanceof
AphrontResponse
)
{
return
$response
;
}
$layout
=
$response
;
$crumbs
=
$this
->
buildApplicationCrumbs
();
return
$this
->
buildApplicationPage
(
array
(
$crumbs
,
$layout
,
),
array
(
'title'
=>
$definition
->
getEditTitle
(),
));
}
}
Event Timeline
Log In to Comment