Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93474758
PhabricatorInlineSummaryView.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, 01:36
Size
2 KB
Mime Type
text/x-php
Expires
Sun, Dec 1, 01:36 (2 d)
Engine
blob
Format
Raw Data
Handle
22648543
Attached To
rPH Phabricator
PhabricatorInlineSummaryView.php
View Options
<?php
final
class
PhabricatorInlineSummaryView
extends
AphrontView
{
private
$groups
=
array
();
public
function
addCommentGroup
(
$name
,
array
$items
)
{
if
(!
isset
(
$this
->
groups
[
$name
]))
{
$this
->
groups
[
$name
]
=
$items
;
}
else
{
$this
->
groups
[
$name
]
=
array_merge
(
$this
->
groups
[
$name
],
$items
);
}
return
$this
;
}
public
function
render
()
{
require_celerity_resource
(
'inline-comment-summary-css'
);
return
$this
->
renderHeader
().
$this
->
renderTable
();
}
private
function
renderHeader
()
{
return
phutil_tag
(
'div'
,
array
(
'class'
=>
'phabricator-inline-summary'
,
),
'Inline Comments'
);
}
private
function
renderTable
()
{
$rows
=
array
();
foreach
(
$this
->
groups
as
$group
=>
$items
)
{
$has_where
=
false
;
foreach
(
$items
as
$item
)
{
if
(!
empty
(
$item
[
'where'
]))
{
$has_where
=
true
;
break
;
}
}
$rows
[]
=
'<tr>'
.
'<th colspan="3">'
.
phutil_escape_html
(
$group
).
'</th>'
.
'</tr>'
;
foreach
(
$items
as
$item
)
{
$items
=
isort
(
$items
,
'line'
);
$line
=
$item
[
'line'
];
$length
=
$item
[
'length'
];
if
(
$length
)
{
$lines
=
$line
.
"
\x
E2
\x
80
\x
93"
.(
$line
+
$length
);
}
else
{
$lines
=
$line
;
}
if
(
isset
(
$item
[
'href'
]))
{
$href
=
$item
[
'href'
];
$target
=
'_blank'
;
$tail
=
"
\x
E2
\x
86
\x
97"
;
}
else
{
$href
=
'#inline-'
.
$item
[
'id'
];
$target
=
null
;
$tail
=
null
;
}
$lines
=
phutil_escape_html
(
$lines
);
if
(
$href
)
{
$lines
=
phutil_render_tag
(
'a'
,
array
(
'href'
=>
$href
,
'target'
=>
$target
,
'class'
=>
'num'
,
),
$lines
.
$tail
);
}
$where
=
idx
(
$item
,
'where'
);
$colspan
=
(
$has_where
?
''
:
' colspan="2"'
);
$rows
[]
=
'<tr>'
.
'<td class="inline-line-number">'
.
$lines
.
'</td>'
.
(
$has_where
?
'<td class="inline-which-diff">'
.
phutil_escape_html
(
$where
).
'</td>'
:
null
).
'<td class="inline-summary-content"'
.
$colspan
.
'>'
.
'<div class="phabricator-remarkup">'
.
$item
[
'content'
].
'</div>'
.
'</td>'
.
'</tr>'
;
}
}
return
phutil_render_tag
(
'table'
,
array
(
'class'
=>
'phabricator-inline-summary-table'
,
),
implode
(
"
\n
"
,
$rows
));
}
}
Event Timeline
Log In to Comment