Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/view/DifferentialInlineCommentView.php
<?php | <?php | ||||
final class DifferentialInlineCommentView extends AphrontView { | final class DifferentialInlineCommentView extends AphrontView { | ||||
private $inlineComment; | private $inlineComment; | ||||
private $onRight; | private $onRight; | ||||
private $buildScaffolding; | private $buildScaffolding; | ||||
private $handles; | private $handles; | ||||
private $markupEngine; | private $markupEngine; | ||||
private $editable; | private $editable; | ||||
private $preview; | private $preview; | ||||
private $allowReply; | private $allowReply; | ||||
private $renderer; | |||||
public function setInlineComment(PhabricatorInlineCommentInterface $comment) { | public function setInlineComment(PhabricatorInlineCommentInterface $comment) { | ||||
$this->inlineComment = $comment; | $this->inlineComment = $comment; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setOnRight($on_right) { | public function setOnRight($on_right) { | ||||
$this->onRight = $on_right; | $this->onRight = $on_right; | ||||
Show All 26 Lines | public function setPreview($preview) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setAllowReply($allow_reply) { | public function setAllowReply($allow_reply) { | ||||
$this->allowReply = $allow_reply; | $this->allowReply = $allow_reply; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setRenderer($renderer) { | |||||
$this->renderer = $renderer; | |||||
return $this; | |||||
} | |||||
public function getRenderer() { | |||||
return $this->renderer; | |||||
} | |||||
public function render() { | public function render() { | ||||
$inline = $this->inlineComment; | $inline = $this->inlineComment; | ||||
$start = $inline->getLineNumber(); | $start = $inline->getLineNumber(); | ||||
$length = $inline->getLineLength(); | $length = $inline->getLineLength(); | ||||
if ($length) { | if ($length) { | ||||
$end = $start + $length; | $end = $start + $length; | ||||
▲ Show 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | public function render() { | ||||
return $this->scaffoldMarkup($markup); | return $this->scaffoldMarkup($markup); | ||||
} | } | ||||
private function scaffoldMarkup($markup) { | private function scaffoldMarkup($markup) { | ||||
if (!$this->buildScaffolding) { | if (!$this->buildScaffolding) { | ||||
return $markup; | return $markup; | ||||
} | } | ||||
if ($this->renderer == '1up') { | |||||
$cells = array( | |||||
phutil_tag('th', array()), | |||||
phutil_tag('th', array()), | |||||
phutil_tag( | |||||
'td', | |||||
array('colspan' => 3, 'class' => 'right3'), | |||||
$markup), | |||||
); | |||||
} else { | |||||
$left_markup = !$this->onRight ? $markup : ''; | $left_markup = !$this->onRight ? $markup : ''; | ||||
$right_markup = $this->onRight ? $markup : ''; | $right_markup = $this->onRight ? $markup : ''; | ||||
return phutil_tag('table', array(), | $cells = array( | ||||
phutil_tag('tr', array(), array( | |||||
phutil_tag('th', array()), | phutil_tag('th', array()), | ||||
phutil_tag('td', array('class' => 'left'), $left_markup), | phutil_tag('td', array('class' => 'left'), $left_markup), | ||||
phutil_tag('th', array()), | phutil_tag('th', array()), | ||||
phutil_tag( | phutil_tag( | ||||
'td', | 'td', | ||||
array('colspan' => 3, 'class' => 'right3'), | array('colspan' => 3, 'class' => 'right3'), | ||||
$right_markup), | $right_markup), | ||||
))); | ); | ||||
} | |||||
$row = phutil_tag('tr', array(), $cells); | |||||
return phutil_tag('table', array(), $row); | |||||
} | } | ||||
} | } |