Differential D12132 Diff 29188 src/applications/differential/render/DifferentialChangesetRenderer.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/render/DifferentialChangesetRenderer.php
<?php | <?php | ||||
abstract class DifferentialChangesetRenderer { | abstract class DifferentialChangesetRenderer { | ||||
private $user; | private $user; | ||||
private $changeset; | private $changeset; | ||||
private $renderingReference; | private $renderingReference; | ||||
private $renderPropertyChangeHeader; | private $renderPropertyChangeHeader; | ||||
private $isTopLevel; | private $isTopLevel; | ||||
private $isUndershield; | |||||
private $hunkStartLines; | private $hunkStartLines; | ||||
private $oldLines; | private $oldLines; | ||||
private $newLines; | private $newLines; | ||||
private $oldComments; | private $oldComments; | ||||
private $newComments; | private $newComments; | ||||
private $oldChangesetID; | private $oldChangesetID; | ||||
private $newChangesetID; | private $newChangesetID; | ||||
private $oldAttachesToNewFile; | private $oldAttachesToNewFile; | ||||
private $newAttachesToNewFile; | private $newAttachesToNewFile; | ||||
private $highlightOld = array(); | private $highlightOld = array(); | ||||
private $highlightNew = array(); | private $highlightNew = array(); | ||||
private $codeCoverage; | private $codeCoverage; | ||||
private $handles; | private $handles; | ||||
private $markupEngine; | private $markupEngine; | ||||
private $oldRender; | private $oldRender; | ||||
private $newRender; | private $newRender; | ||||
private $originalOld; | private $originalOld; | ||||
private $originalNew; | private $originalNew; | ||||
private $gaps; | private $gaps; | ||||
private $mask; | private $mask; | ||||
private $depths; | private $depths; | ||||
private $originalCharacterEncoding; | private $originalCharacterEncoding; | ||||
private $showEditAndReplyLinks; | private $showEditAndReplyLinks; | ||||
private $canMarkDone; | private $canMarkDone; | ||||
private $highlightingDisabled; | |||||
private $oldFile = false; | private $oldFile = false; | ||||
private $newFile = false; | private $newFile = false; | ||||
abstract public function getRendererKey(); | abstract public function getRendererKey(); | ||||
public function setShowEditAndReplyLinks($bool) { | public function setShowEditAndReplyLinks($bool) { | ||||
$this->showEditAndReplyLinks = $bool; | $this->showEditAndReplyLinks = $bool; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getShowEditAndReplyLinks() { | public function getShowEditAndReplyLinks() { | ||||
return $this->showEditAndReplyLinks; | return $this->showEditAndReplyLinks; | ||||
} | } | ||||
public function setHighlightingDisabled($highlighting_disabled) { | |||||
$this->highlightingDisabled = $highlighting_disabled; | |||||
return $this; | |||||
} | |||||
public function getHighlightingDisabled() { | |||||
return $this->highlightingDisabled; | |||||
} | |||||
public function setOriginalCharacterEncoding($original_character_encoding) { | public function setOriginalCharacterEncoding($original_character_encoding) { | ||||
$this->originalCharacterEncoding = $original_character_encoding; | $this->originalCharacterEncoding = $original_character_encoding; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getOriginalCharacterEncoding() { | public function getOriginalCharacterEncoding() { | ||||
return $this->originalCharacterEncoding; | return $this->originalCharacterEncoding; | ||||
} | } | ||||
public function setIsUndershield($is_undershield) { | |||||
$this->isUndershield = $is_undershield; | |||||
return $this; | |||||
} | |||||
public function getIsUndershield() { | |||||
return $this->isUndershield; | |||||
} | |||||
public function setDepths($depths) { | public function setDepths($depths) { | ||||
$this->depths = $depths; | $this->depths = $depths; | ||||
return $this; | return $this; | ||||
} | } | ||||
protected function getDepths() { | protected function getDepths() { | ||||
return $this->depths; | return $this->depths; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 255 Lines • ▼ Show 20 Lines | final public function renderChangesetTable($content) { | ||||
} | } | ||||
$notice = null; | $notice = null; | ||||
if ($this->getIsTopLevel()) { | if ($this->getIsTopLevel()) { | ||||
$force = (!$content && !$props); | $force = (!$content && !$props); | ||||
$notice = $this->renderChangeTypeHeader($force); | $notice = $this->renderChangeTypeHeader($force); | ||||
} | } | ||||
$result = $notice.$props.$content; | $undershield = null; | ||||
if ($this->getIsUndershield()) { | |||||
$undershield = $this->renderUndershieldHeader(); | |||||
} | |||||
$result = $notice.$props.$undershield.$content; | |||||
// TODO: Let the user customize their tab width / display style. | // TODO: Let the user customize their tab width / display style. | ||||
// TODO: We should possibly post-process "\r" as well. | // TODO: We should possibly post-process "\r" as well. | ||||
// TODO: Both these steps should happen earlier. | // TODO: Both these steps should happen earlier. | ||||
$result = str_replace("\t", ' ', $result); | $result = str_replace("\t", ' ', $result); | ||||
return phutil_safe_html($result); | return phutil_safe_html($result); | ||||
} | } | ||||
abstract public function isOneUpRenderer(); | abstract public function isOneUpRenderer(); | ||||
abstract public function renderTextChange( | abstract public function renderTextChange( | ||||
$range_start, | $range_start, | ||||
$range_len, | $range_len, | ||||
$rows); | $rows); | ||||
abstract public function renderFileChange( | abstract public function renderFileChange( | ||||
$old = null, | $old = null, | ||||
$new = null, | $new = null, | ||||
$id = 0, | $id = 0, | ||||
$vs = 0); | $vs = 0); | ||||
abstract protected function renderChangeTypeHeader($force); | abstract protected function renderChangeTypeHeader($force); | ||||
abstract protected function renderUndershieldHeader(); | |||||
protected function didRenderChangesetTableContents($contents) { | protected function didRenderChangesetTableContents($contents) { | ||||
return $contents; | return $contents; | ||||
} | } | ||||
/** | /** | ||||
* Render a "shield" over the diff, with a message like "This file is | * Render a "shield" over the diff, with a message like "This file is | ||||
* generated and does not need to be reviewed." or "This file was completely | * generated and does not need to be reviewed." or "This file was completely | ||||
▲ Show 20 Lines • Show All 273 Lines • Show Last 20 Lines |