Differential D21243 Diff 50591 src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
| Show First 20 Lines • Show All 375 Lines • ▼ Show 20 Lines | public function renderDocumentEngineBlocks( | ||||
| $refs = $block_list->getDocumentRefs(); | $refs = $block_list->getDocumentRefs(); | ||||
| if ($refs) { | if ($refs) { | ||||
| list($old_ref, $new_ref) = $refs; | list($old_ref, $new_ref) = $refs; | ||||
| } | } | ||||
| $old_comments = $this->getOldComments(); | $old_comments = $this->getOldComments(); | ||||
| $new_comments = $this->getNewComments(); | $new_comments = $this->getNewComments(); | ||||
| $gap_view = javelin_tag( | |||||
| 'tr', | |||||
| array( | |||||
| 'sigil' => 'context-target', | |||||
| ), | |||||
| phutil_tag( | |||||
| 'td', | |||||
| array( | |||||
| 'colspan' => 6, | |||||
| 'class' => 'show-more', | |||||
| ), | |||||
| pht("\xE2\x80\xA2 \xE2\x80\xA2 \xE2\x80\xA2"))); | |||||
| $rows = array(); | $rows = array(); | ||||
| $gap = array(); | |||||
| $in_gap = false; | $in_gap = false; | ||||
| foreach ($block_list->newTwoUpLayout() as $row) { | |||||
| // NOTE: The generated layout is affected by range constraints, and may | |||||
| // represent only a slice of the document. | |||||
| $layout = $block_list->newTwoUpLayout(); | |||||
| $available_count = $block_list->getLayoutAvailableRowCount(); | |||||
| foreach ($layout as $idx => $row) { | |||||
| list($old, $new) = $row; | list($old, $new) = $row; | ||||
| if ($old) { | if ($old) { | ||||
| $old_key = $old->getBlockKey(); | $old_key = $old->getBlockKey(); | ||||
| $is_visible = $old->getIsVisible(); | $is_visible = $old->getIsVisible(); | ||||
| } else { | } else { | ||||
| $old_key = null; | $old_key = null; | ||||
| } | } | ||||
| if ($new) { | if ($new) { | ||||
| $new_key = $new->getBlockKey(); | $new_key = $new->getBlockKey(); | ||||
| $is_visible = $new->getIsVisible(); | $is_visible = $new->getIsVisible(); | ||||
| } else { | } else { | ||||
| $new_key = null; | $new_key = null; | ||||
| } | } | ||||
| if (!$is_visible) { | if (!$is_visible) { | ||||
| if (!$in_gap) { | if (!$in_gap) { | ||||
| $in_gap = true; | $in_gap = true; | ||||
| $rows[] = $gap_view; | |||||
| } | } | ||||
| $gap[$idx] = $row; | |||||
| continue; | continue; | ||||
| } | } | ||||
| if ($in_gap) { | if ($in_gap) { | ||||
| $in_gap = false; | $in_gap = false; | ||||
| $rows[] = $this->renderDocumentEngineGap( | |||||
| $gap, | |||||
| $available_count); | |||||
| $gap = array(); | |||||
| } | } | ||||
| if ($old) { | if ($old) { | ||||
| $is_rem = ($old->getDifferenceType() === '-'); | $is_rem = ($old->getDifferenceType() === '-'); | ||||
| } else { | } else { | ||||
| $is_rem = false; | $is_rem = false; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | foreach ($layout as $idx => $row) { | ||||
| $rows[] = array( | $rows[] = array( | ||||
| $row_view, | $row_view, | ||||
| $old_inline_rows, | $old_inline_rows, | ||||
| $new_inline_rows, | $new_inline_rows, | ||||
| ); | ); | ||||
| } | } | ||||
| if ($in_gap) { | |||||
| $rows[] = $this->renderDocumentEngineGap( | |||||
| $gap, | |||||
| $available_count); | |||||
| } | |||||
| $output = $this->wrapChangeInTable($rows); | $output = $this->wrapChangeInTable($rows); | ||||
| return $this->renderChangesetTable($output); | return $this->renderChangesetTable($output); | ||||
| } | } | ||||
| public function getRowScaffoldForInline(PHUIDiffInlineCommentView $view) { | public function getRowScaffoldForInline(PHUIDiffInlineCommentView $view) { | ||||
| return id(new PHUIDiffTwoUpInlineCommentRowScaffold()) | return id(new PHUIDiffTwoUpInlineCommentRowScaffold()) | ||||
| ->addInlineView($view); | ->addInlineView($view); | ||||
| Show All 23 Lines | final class DifferentialChangesetTwoUpRenderer | ||||
| } | } | ||||
| protected function getTableSigils() { | protected function getTableSigils() { | ||||
| return array( | return array( | ||||
| 'intercept-copy', | 'intercept-copy', | ||||
| ); | ); | ||||
| } | } | ||||
| private function renderDocumentEngineGap(array $gap, $available_count) { | |||||
| $content = $this->renderShowContextLinks( | |||||
| head_key($gap), | |||||
| count($gap), | |||||
| $available_count, | |||||
| $is_blocks = true); | |||||
| return javelin_tag( | |||||
| 'tr', | |||||
| array( | |||||
| 'sigil' => 'context-target', | |||||
| ), | |||||
| phutil_tag( | |||||
| 'td', | |||||
| array( | |||||
| 'colspan' => 6, | |||||
| 'class' => 'show-more', | |||||
| ), | |||||
| $content)); | |||||
| } | |||||
| } | } | ||||