Differential D21138 Diff 50349 src/applications/differential/view/DifferentialChangesetDetailView.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/view/DifferentialChangesetDetailView.php
| <?php | <?php | ||||
| final class DifferentialChangesetDetailView extends AphrontView { | final class DifferentialChangesetDetailView extends AphrontView { | ||||
| private $changeset; | private $changeset; | ||||
| private $buttons = array(); | private $buttons = array(); | ||||
| private $editable; | private $editable; | ||||
| private $symbolIndex; | private $symbolIndex; | ||||
| private $id; | private $id; | ||||
| private $vsChangesetID; | private $vsChangesetID; | ||||
| private $renderURI; | private $renderURI; | ||||
| private $renderingRef; | private $renderingRef; | ||||
| private $autoload; | private $autoload; | ||||
| private $loaded; | |||||
| private $renderer; | |||||
| private $repository; | private $repository; | ||||
| private $diff; | private $diff; | ||||
| private $changesetResponse; | |||||
| public function setAutoload($autoload) { | public function setAutoload($autoload) { | ||||
| $this->autoload = $autoload; | $this->autoload = $autoload; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getAutoload() { | public function getAutoload() { | ||||
| return $this->autoload; | return $this->autoload; | ||||
| } | } | ||||
| public function setLoaded($loaded) { | public function setRenderingRef($rendering_ref) { | ||||
| $this->loaded = $loaded; | $this->renderingRef = $rendering_ref; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getLoaded() { | public function getRenderingRef() { | ||||
| return $this->loaded; | return $this->renderingRef; | ||||
| } | } | ||||
| public function setRenderingRef($rendering_ref) { | public function setChangesetResponse(PhabricatorChangesetResponse $response) { | ||||
| $this->renderingRef = $rendering_ref; | $this->changesetResponse = $response; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getRenderingRef() { | public function getChangesetResponse() { | ||||
| return $this->renderingRef; | return $this->changesetResponse; | ||||
| } | } | ||||
| public function setRenderURI($render_uri) { | public function setRenderURI($render_uri) { | ||||
| $this->renderURI = $render_uri; | $this->renderURI = $render_uri; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getRenderURI() { | public function getRenderURI() { | ||||
| Show All 15 Lines | public function setEditable($editable) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setSymbolIndex($symbol_index) { | public function setSymbolIndex($symbol_index) { | ||||
| $this->symbolIndex = $symbol_index; | $this->symbolIndex = $symbol_index; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setRenderer($renderer) { | |||||
| $this->renderer = $renderer; | |||||
| return $this; | |||||
| } | |||||
| public function getRenderer() { | |||||
| return $this->renderer; | |||||
| } | |||||
| public function getID() { | public function getID() { | ||||
| if (!$this->id) { | if (!$this->id) { | ||||
| $this->id = celerity_generate_unique_node_id(); | $this->id = celerity_generate_unique_node_id(); | ||||
| } | } | ||||
| return $this->id; | return $this->id; | ||||
| } | } | ||||
| public function setID($id) { | public function setID($id) { | ||||
| ▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | if ($this->symbolIndex) { | ||||
| ) + $this->symbolIndex); | ) + $this->symbolIndex); | ||||
| } | } | ||||
| $display_filename = $changeset->getDisplayFilename(); | $display_filename = $changeset->getDisplayFilename(); | ||||
| $display_icon = FileTypeIcon::getFileIcon($display_filename); | $display_icon = FileTypeIcon::getFileIcon($display_filename); | ||||
| $icon = id(new PHUIIconView()) | $icon = id(new PHUIIconView()) | ||||
| ->setIcon($display_icon); | ->setIcon($display_icon); | ||||
| $renderer = DifferentialChangesetHTMLRenderer::getHTMLRendererByKey( | |||||
| $this->getRenderer()); | |||||
| $changeset_id = $this->changeset->getID(); | $changeset_id = $this->changeset->getID(); | ||||
| $vs_id = $this->getVsChangesetID(); | $vs_id = $this->getVsChangesetID(); | ||||
| if (!$vs_id) { | if (!$vs_id) { | ||||
| // Showing a changeset normally. | // Showing a changeset normally. | ||||
| $left_id = $changeset_id; | $left_id = $changeset_id; | ||||
| $right_id = $changeset_id; | $right_id = $changeset_id; | ||||
| } else if ($vs_id == -1) { | } else if ($vs_id == -1) { | ||||
| Show All 22 Lines | public function render() { | ||||
| } | } | ||||
| $display_parts[] = phutil_tag( | $display_parts[] = phutil_tag( | ||||
| 'span', | 'span', | ||||
| array( | array( | ||||
| 'class' => 'diff-banner-file', | 'class' => 'diff-banner-file', | ||||
| ), | ), | ||||
| $file_part); | $file_part); | ||||
| $response = $this->getChangesetResponse(); | |||||
| if ($response) { | |||||
| $is_loaded = true; | |||||
| $changeset_markup = $response->getRenderedChangeset(); | |||||
| $changeset_state = $response->getChangesetState(); | |||||
| } else { | |||||
| $is_loaded = false; | |||||
| $changeset_markup = null; | |||||
| $changeset_state = null; | |||||
| } | |||||
| return javelin_tag( | return javelin_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'sigil' => 'differential-changeset', | 'sigil' => 'differential-changeset', | ||||
| 'meta' => array( | 'meta' => array( | ||||
| 'left' => $left_id, | 'left' => $left_id, | ||||
| 'right' => $right_id, | 'right' => $right_id, | ||||
| 'renderURI' => $this->getRenderURI(), | 'renderURI' => $this->getRenderURI(), | ||||
| 'highlight' => null, | |||||
| 'renderer' => $this->getRenderer(), | |||||
| 'ref' => $this->getRenderingRef(), | 'ref' => $this->getRenderingRef(), | ||||
| 'autoload' => $this->getAutoload(), | 'autoload' => $this->getAutoload(), | ||||
| 'loaded' => $this->getLoaded(), | |||||
| 'undoTemplates' => hsprintf('%s', $renderer->renderUndoTemplates()), | |||||
| 'displayPath' => hsprintf('%s', $display_parts), | 'displayPath' => hsprintf('%s', $display_parts), | ||||
| 'path' => $display_filename, | 'path' => $display_filename, | ||||
| 'icon' => $display_icon, | 'icon' => $display_icon, | ||||
| 'treeNodeID' => 'tree-node-'.$changeset->getAnchorName(), | 'treeNodeID' => 'tree-node-'.$changeset->getAnchorName(), | ||||
| 'editorURI' => $this->getEditorURI(), | 'editorURI' => $this->getEditorURI(), | ||||
| 'editorConfigureURI' => $this->getEditorConfigureURI(), | 'editorConfigureURI' => $this->getEditorConfigureURI(), | ||||
| 'loaded' => $is_loaded, | |||||
| 'changesetState' => $changeset_state, | |||||
| ), | ), | ||||
| 'class' => $class, | 'class' => $class, | ||||
| 'id' => $id, | 'id' => $id, | ||||
| ), | ), | ||||
| array( | array( | ||||
| id(new PhabricatorAnchorView()) | id(new PhabricatorAnchorView()) | ||||
| ->setAnchorName($changeset->getAnchorName()) | ->setAnchorName($changeset->getAnchorName()) | ||||
| ->setNavigationMarker(true) | ->setNavigationMarker(true) | ||||
| ->render(), | ->render(), | ||||
| $buttons, | $buttons, | ||||
| phutil_tag('h1', | phutil_tag('h1', | ||||
| array( | array( | ||||
| 'class' => 'differential-file-icon-header', | 'class' => 'differential-file-icon-header', | ||||
| ), | ), | ||||
| array( | array( | ||||
| $icon, | $icon, | ||||
| $display_filename, | $display_filename, | ||||
| )), | )), | ||||
| javelin_tag( | javelin_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'changeset-view-content', | 'class' => 'changeset-view-content', | ||||
| 'sigil' => 'changeset-view-content', | 'sigil' => 'changeset-view-content', | ||||
| ), | ), | ||||
| $this->renderChildren()), | array( | ||||
| $changeset_markup, | |||||
| $this->renderChildren(), | |||||
| )), | |||||
| )); | )); | ||||
| } | } | ||||
| public function setRepository(PhabricatorRepository $repository) { | public function setRepository(PhabricatorRepository $repository) { | ||||
| $this->repository = $repository; | $this->repository = $repository; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines | |||||