Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99417638
PholioInlineCommentView.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, Jan 24, 09:21
Size
3 KB
Mime Type
text/x-php
Expires
Sun, Jan 26, 09:21 (2 d)
Engine
blob
Format
Raw Data
Handle
23793164
Attached To
rPH Phabricator
PholioInlineCommentView.php
View Options
<?php
/**
* @group pholio
*/
final
class
PholioInlineCommentView
extends
AphrontView
{
private
$engine
;
private
$handle
;
private
$inlineComment
;
public
function
setEngine
(
PhabricatorMarkupEngine
$engine
)
{
$this
->
engine
=
$engine
;
return
$this
;
}
public
function
setHandle
(
PhabricatorObjectHandle
$handle
)
{
$this
->
handle
=
$handle
;
return
$this
;
}
public
function
setInlineComment
(
PholioTransactionComment
$inline_comment
)
{
if
(
$inline_comment
->
getImageID
()
===
null
)
{
throw
new
Exception
(
"Comment provided is not inline comment"
);
}
$this
->
inlineComment
=
$inline_comment
;
return
$this
;
}
public
function
render
()
{
if
(!
$this
->
inlineComment
)
{
throw
new
Exception
(
"Call setInlineComment() before render()!"
);
}
if
(
$this
->
user
===
null
)
{
throw
new
Exception
(
"Call setUser() before render()!"
);
}
if
(
$this
->
engine
===
null
)
{
throw
new
Exception
(
"Call setEngine() before render()!"
);
}
if
(
$this
->
handle
===
null
)
{
throw
new
Exception
(
"Call setHandle() before render()!"
);
}
$actions
=
null
;
$inline
=
$this
->
inlineComment
;
$phid
=
$inline
->
getPHID
();
$id
=
$inline
->
getID
();
$user
=
$this
->
user
;
$is_draft
=
(
$inline
->
getTransactionPHID
()
===
null
);
$can_edit
=
PhabricatorPolicyFilter
::
hasCapability
(
$user
,
$inline
,
PhabricatorPolicyCapability
::
CAN_EDIT
);
if
(
$is_draft
&&
$can_edit
)
{
$draft
=
phutil_tag
(
'span'
,
array
(
'class'
=>
'pholio-inline-status'
,
),
pht
(
'Not Submitted Yet'
));
$edit_action
=
javelin_tag
(
'a'
,
array
(
'href'
=>
'/pholio/inline/edit/'
.
$id
.
'/'
,
'sigil'
=>
'inline-edit'
,
'meta'
=>
array
(
'phid'
=>
$phid
,
'id'
=>
$id
,
)
),
pht
(
'Edit'
));
$delete_action
=
javelin_tag
(
'a'
,
array
(
'href'
=>
'/pholio/inline/delete/'
.
$id
.
'/'
,
'sigil'
=>
'inline-delete'
,
'meta'
=>
array
(
'phid'
=>
$phid
,
'id'
=>
$id
,
)
),
pht
(
'Delete'
));
$actions
=
phutil_tag
(
'span'
,
array
(
'class'
=>
'pholio-inline-head-links'
),
phutil_implode_html
(
"
\x
C2
\x
B7 "
,
array
(
$draft
,
$edit_action
,
$delete_action
)));
}
$comment_header
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'pholio-inline-comment-header'
),
array
(
$this
->
handle
->
getName
(),
$actions
));
$comment
=
$this
->
engine
->
renderOneObject
(
$inline
,
PholioTransactionComment
::
MARKUP_FIELD_COMMENT
,
$this
->
user
);
$comment_body
=
phutil_tag
(
'div'
,
array
(),
$comment
);
$classes
=
array
();
$classes
[]
=
'pholio-inline-comment'
;
if
(
$is_draft
)
{
$classes
[]
=
'pholio-inline-comment-draft'
;
}
return
javelin_tag
(
'div'
,
array
(
'id'
=>
"{$phid}_comment"
,
'class'
=>
implode
(
' '
,
$classes
),
'sigil'
=>
'inline_comment'
,
'meta'
=>
array
(
'phid'
=>
$phid
,
)
),
array
(
$comment_header
,
$comment_body
));
}
}
Event Timeline
Log In to Comment