Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93665667
NuanceSourceViewController.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
Sat, Nov 30, 13:49
Size
2 KB
Mime Type
text/x-php
Expires
Mon, Dec 2, 13:49 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22683424
Attached To
rPH Phabricator
NuanceSourceViewController.php
View Options
<?php
final
class
NuanceSourceViewController
extends
NuanceSourceController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$this
->
getViewer
();
$source
=
id
(
new
NuanceSourceQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$request
->
getURIData
(
'id'
)))
->
executeOne
();
if
(!
$source
)
{
return
new
Aphront404Response
();
}
$source_id
=
$source
->
getID
();
$header
=
$this
->
buildHeaderView
(
$source
);
$curtain
=
$this
->
buildCurtain
(
$source
);
$properties
=
$this
->
buildPropertyView
(
$source
);
$title
=
$source
->
getName
();
$routing_list
=
id
(
new
PHUIPropertyListView
())
->
addProperty
(
pht
(
'Default Queue'
),
$viewer
->
renderHandle
(
$source
->
getDefaultQueuePHID
()));
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addTextCrumb
(
pht
(
'Sources'
),
$this
->
getApplicationURI
(
'source/'
));
$crumbs
->
addTextCrumb
(
$title
);
$crumbs
->
setBorder
(
true
);
$timeline
=
$this
->
buildTransactionTimeline
(
$source
,
new
NuanceSourceTransactionQuery
());
$timeline
->
setShouldTerminate
(
true
);
$view
=
id
(
new
PHUITwoColumnView
())
->
setHeader
(
$header
)
->
setCurtain
(
$curtain
)
->
addPropertySection
(
pht
(
'DETAILS'
),
$properties
)
->
addPropertySection
(
pht
(
'ROUTING'
),
$routing_list
)
->
setMainColumn
(
$timeline
);
return
$this
->
newPage
()
->
setTitle
(
$title
)
->
setCrumbs
(
$crumbs
)
->
appendChild
(
$view
);
}
private
function
buildHeaderView
(
NuanceSource
$source
)
{
$viewer
=
$this
->
getViewer
();
$header
=
id
(
new
PHUIHeaderView
())
->
setUser
(
$viewer
)
->
setHeader
(
$source
->
getName
())
->
setPolicyObject
(
$source
);
return
$header
;
}
private
function
buildCurtain
(
NuanceSource
$source
)
{
$viewer
=
$this
->
getViewer
();
$id
=
$source
->
getID
();
$actions
=
id
(
new
PhabricatorActionListView
())
->
setUser
(
$viewer
);
$can_edit
=
PhabricatorPolicyFilter
::
hasCapability
(
$viewer
,
$source
,
PhabricatorPolicyCapability
::
CAN_EDIT
);
$curtain
=
$this
->
newCurtainView
(
$source
);
$curtain
->
addAction
(
id
(
new
PhabricatorActionView
())
->
setName
(
pht
(
'Edit Source'
))
->
setIcon
(
'fa-pencil'
)
->
setHref
(
$this
->
getApplicationURI
(
"source/edit/{$id}/"
))
->
setDisabled
(!
$can_edit
)
->
setWorkflow
(!
$can_edit
));
$request
=
$this
->
getRequest
();
$definition
=
$source
->
getDefinition
();
$definition
->
setViewer
(
$viewer
)
->
setSource
(
$source
);
$source_actions
=
$definition
->
getSourceViewActions
(
$request
);
foreach
(
$source_actions
as
$source_action
)
{
$curtain
->
addAction
(
$source_action
);
}
return
$curtain
;
}
private
function
buildPropertyView
(
NuanceSource
$source
)
{
$viewer
=
$this
->
getViewer
();
$properties
=
id
(
new
PHUIPropertyListView
())
->
setViewer
(
$viewer
);
$definition
=
$source
->
getDefinition
();
$properties
->
addProperty
(
pht
(
'Source Type'
),
$definition
->
getName
());
return
$properties
;
}
}
Event Timeline
Log In to Comment