Differential D17861 Diff 43049 src/applications/differential/render/DifferentialChangesetOneUpRenderer.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/render/DifferentialChangesetOneUpRenderer.php
Show All 35 Lines | final class DifferentialChangesetOneUpRenderer | ||||
protected function renderPrimitives(array $primitives, $rows) { | protected function renderPrimitives(array $primitives, $rows) { | ||||
list($left_prefix, $right_prefix) = $this->getLineIDPrefixes(); | list($left_prefix, $right_prefix) = $this->getLineIDPrefixes(); | ||||
$no_copy = phutil_tag('td', array('class' => 'copy')); | $no_copy = phutil_tag('td', array('class' => 'copy')); | ||||
$no_coverage = null; | $no_coverage = null; | ||||
$column_width = 4; | $column_width = 4; | ||||
$hidden = new PHUIDiffRevealIconView(); | |||||
$out = array(); | $out = array(); | ||||
foreach ($primitives as $k => $p) { | foreach ($primitives as $k => $p) { | ||||
$type = $p['type']; | $type = $p['type']; | ||||
switch ($type) { | switch ($type) { | ||||
case 'old': | case 'old': | ||||
case 'new': | case 'new': | ||||
case 'old-file': | case 'old-file': | ||||
case 'new-file': | case 'new-file': | ||||
$is_old = ($type == 'old' || $type == 'old-file'); | $is_old = ($type == 'old' || $type == 'old-file'); | ||||
$o_hidden = array(); | |||||
$n_hidden = array(); | |||||
for ($look = $k + 1; isset($primitives[$look]); $look++) { | |||||
$next = $primitives[$look]; | |||||
switch ($next['type']) { | |||||
case 'inline': | |||||
$comment = $next['comment']; | |||||
if ($comment->isHidden()) { | |||||
if ($next['right']) { | |||||
$n_hidden[] = $comment; | |||||
} else { | |||||
$o_hidden[] = $comment; | |||||
} | |||||
} | |||||
break; | |||||
default: | |||||
break 2; | |||||
} | |||||
} | |||||
$cells = array(); | $cells = array(); | ||||
if ($is_old) { | if ($is_old) { | ||||
if ($p['htype']) { | if ($p['htype']) { | ||||
$class = 'left old'; | $class = 'left old'; | ||||
} else { | } else { | ||||
$class = 'left'; | $class = 'left'; | ||||
} | } | ||||
if ($type == 'old-file') { | if ($type == 'old-file') { | ||||
$class = "{$class} differential-old-image"; | $class = "{$class} differential-old-image"; | ||||
} | } | ||||
if ($left_prefix) { | if ($left_prefix) { | ||||
$left_id = $left_prefix.$p['line']; | $left_id = $left_prefix.$p['line']; | ||||
} else { | } else { | ||||
$left_id = null; | $left_id = null; | ||||
} | } | ||||
$line = $p['line']; | $line = $p['line']; | ||||
if ($o_hidden) { | |||||
$line = array($hidden, $line); | |||||
} | |||||
$cells[] = phutil_tag( | $cells[] = phutil_tag( | ||||
'th', | 'th', | ||||
array( | array( | ||||
'id' => $left_id, | 'id' => $left_id, | ||||
'class' => $class, | 'class' => $class, | ||||
), | ), | ||||
$line); | $line); | ||||
Show All 10 Lines | foreach ($primitives as $k => $p) { | ||||
$class = 'right'; | $class = 'right'; | ||||
if ($left_prefix) { | if ($left_prefix) { | ||||
$left_id = $left_prefix.$p['oline']; | $left_id = $left_prefix.$p['oline']; | ||||
} else { | } else { | ||||
$left_id = null; | $left_id = null; | ||||
} | } | ||||
$oline = $p['oline']; | $oline = $p['oline']; | ||||
if ($o_hidden) { | |||||
$oline = array($hidden, $oline); | |||||
} | |||||
$cells[] = phutil_tag('th', array('id' => $left_id), $oline); | $cells[] = phutil_tag('th', array('id' => $left_id), $oline); | ||||
} | } | ||||
if ($type == 'new-file') { | if ($type == 'new-file') { | ||||
$class = "{$class} differential-new-image"; | $class = "{$class} differential-new-image"; | ||||
} | } | ||||
if ($right_prefix) { | if ($right_prefix) { | ||||
$right_id = $right_prefix.$p['line']; | $right_id = $right_prefix.$p['line']; | ||||
} else { | } else { | ||||
$right_id = null; | $right_id = null; | ||||
} | } | ||||
$line = $p['line']; | $line = $p['line']; | ||||
if ($n_hidden) { | |||||
$line = array($hidden, $line); | |||||
} | |||||
$cells[] = phutil_tag( | $cells[] = phutil_tag( | ||||
'th', | 'th', | ||||
array( | array( | ||||
'id' => $right_id, | 'id' => $right_id, | ||||
'class' => $class, | 'class' => $class, | ||||
), | ), | ||||
$line); | $line); | ||||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |