1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 23:01:04 +01:00

render_tag -> tag: DifferentialResultsTableView

Summary: Fix lint and unit results escaping.

Test Plan:
Looked at lint/unit results. Clicked show/hide:

{F30680}

Reviewers: vrana

Reviewed By: vrana

CC: aran

Maniphest Tasks: T2432

Differential Revision: https://secure.phabricator.com/D4693
This commit is contained in:
epriestley 2013-01-28 18:46:04 -08:00
parent 114ed6c7fe
commit da27b448fa
3 changed files with 23 additions and 20 deletions

View file

@ -43,7 +43,7 @@ final class DifferentialLintFieldSpecification
$rows[] = array( $rows[] = array(
'style' => 'star', 'style' => 'star',
'name' => $lstar, 'name' => phutil_safe_html($lstar),
'value' => $lmsg, 'value' => $lmsg,
'show' => true, 'show' => true,
); );
@ -53,7 +53,7 @@ final class DifferentialLintFieldSpecification
$rows[] = array( $rows[] = array(
'style' => 'excuse', 'style' => 'excuse',
'name' => 'Excuse', 'name' => 'Excuse',
'value' => nl2br(phutil_escape_html($excuse)), 'value' => phutil_safe_html(nl2br(phutil_escape_html($excuse))),
'show' => true, 'show' => true,
); );
} }
@ -67,7 +67,7 @@ final class DifferentialLintFieldSpecification
$rows[] = array( $rows[] = array(
'style' => 'section', 'style' => 'section',
'name' => phutil_escape_html($path), 'name' => $path,
'show' => $show_limit, 'show' => $show_limit,
); );
@ -108,7 +108,7 @@ final class DifferentialLintFieldSpecification
$rows[] = array( $rows[] = array(
'style' => $this->getSeverityStyle($severity), 'style' => $this->getSeverityStyle($severity),
'name' => phutil_escape_html(ucwords($severity)), 'name' => ucwords($severity),
'value' => hsprintf( 'value' => hsprintf(
"(%s) %s at {$line_link}", "(%s) %s at {$line_link}",
$code, $code,
@ -130,7 +130,10 @@ final class DifferentialLintFieldSpecification
if (strlen($description)) { if (strlen($description)) {
$rows[] = array( $rows[] = array(
'style' => 'details', 'style' => 'details',
'value' => nl2br(phutil_escape_html($description)), 'value' =>
phutil_safe_html(
nl2br(
phutil_escape_html($description))),
'show' => false, 'show' => false,
); );
if (empty($hidden['details'])) { if (empty($hidden['details'])) {
@ -148,7 +151,7 @@ final class DifferentialLintFieldSpecification
$rows[] = array( $rows[] = array(
'style' => $this->getPostponedStyle(), 'style' => $this->getPostponedStyle(),
'name' => 'Postponed', 'name' => 'Postponed',
'value' => phutil_escape_html($linter), 'value' => $linter,
'show' => false, 'show' => false,
); );
if (empty($hidden['postponed'])) { if (empty($hidden['postponed'])) {

View file

@ -37,7 +37,7 @@ final class DifferentialUnitFieldSpecification
$rows[] = array( $rows[] = array(
'style' => 'star', 'style' => 'star',
'name' => $ustar, 'name' => phutil_safe_html($ustar),
'value' => $umsg, 'value' => $umsg,
'show' => true, 'show' => true,
); );
@ -47,7 +47,7 @@ final class DifferentialUnitFieldSpecification
$rows[] = array( $rows[] = array(
'style' => 'excuse', 'style' => 'excuse',
'name' => 'Excuse', 'name' => 'Excuse',
'value' => nl2br(phutil_escape_html($excuse)), 'value' => phutil_safe_html(nl2br(phutil_escape_html($excuse))),
'show' => true, 'show' => true,
); );
} }
@ -105,7 +105,7 @@ final class DifferentialUnitFieldSpecification
} }
$rows[] = array( $rows[] = array(
'style' => $this->getResultStyle($result), 'style' => $this->getResultStyle($result),
'name' => phutil_escape_html(ucwords($result)), 'name' => ucwords($result),
'value' => $value, 'value' => $value,
'show' => $show, 'show' => $show,
); );

View file

@ -25,7 +25,7 @@ final class DifferentialResultsTableView extends AphrontView {
$style = idx($row, 'style'); $style = idx($row, 'style');
switch ($style) { switch ($style) {
case 'section': case 'section':
$cells = phutil_render_tag( $cells = phutil_tag(
'th', 'th',
array( array(
'colspan' => 2, 'colspan' => 2,
@ -33,23 +33,23 @@ final class DifferentialResultsTableView extends AphrontView {
idx($row, 'name')); idx($row, 'name'));
break; break;
default: default:
$name = phutil_render_tag( $name = phutil_tag(
'th', 'th',
array( array(
), ),
idx($row, 'name')); idx($row, 'name'));
$value = phutil_render_tag( $value = phutil_tag(
'td', 'td',
array( array(
), ),
idx($row, 'value')); idx($row, 'value'));
$cells = $name.$value; $cells = array($name, $value);
break; break;
} }
$show = idx($row, 'show'); $show = idx($row, 'show');
$rows[] = javelin_render_tag( $rows[] = javelin_tag(
'tr', 'tr',
array( array(
'style' => $show ? null : 'display: none', 'style' => $show ? null : 'display: none',
@ -64,7 +64,7 @@ final class DifferentialResultsTableView extends AphrontView {
} }
if ($any_hidden) { if ($any_hidden) {
$show_more = javelin_render_tag( $show_more = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
@ -72,7 +72,7 @@ final class DifferentialResultsTableView extends AphrontView {
), ),
$this->showMoreString); $this->showMoreString);
$hide_more = javelin_render_tag( $hide_more = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
@ -80,22 +80,22 @@ final class DifferentialResultsTableView extends AphrontView {
), ),
'Hide'); 'Hide');
$rows[] = javelin_render_tag( $rows[] = javelin_tag(
'tr', 'tr',
array( array(
'class' => 'differential-results-row-show', 'class' => 'differential-results-row-show',
'sigil' => 'differential-results-row-show', 'sigil' => 'differential-results-row-show',
), ),
'<th colspan="2">'.$show_more.'</td>'); phutil_tag('th', array('colspan' => 2), $show_more));
$rows[] = javelin_render_tag( $rows[] = javelin_tag(
'tr', 'tr',
array( array(
'class' => 'differential-results-row-show', 'class' => 'differential-results-row-show',
'sigil' => 'differential-results-row-hide', 'sigil' => 'differential-results-row-hide',
'style' => 'display: none', 'style' => 'display: none',
), ),
'<th colspan="2">'.$hide_more.'</th>'); phutil_tag('th', array('colspan' => 2), $hide_more));
Javelin::initBehavior('differential-show-field-details'); Javelin::initBehavior('differential-show-field-details');
} }