Differential D21135 Diff 50331 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 $loaded; | ||||
| private $renderer; | private $renderer; | ||||
| private $repository; | |||||
| private $diff; | |||||
| 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; | ||||
| ▲ Show 20 Lines • Show All 167 Lines • ▼ Show 20 Lines | return javelin_tag( | ||||
| 'ref' => $this->getRenderingRef(), | 'ref' => $this->getRenderingRef(), | ||||
| 'autoload' => $this->getAutoload(), | 'autoload' => $this->getAutoload(), | ||||
| 'loaded' => $this->getLoaded(), | 'loaded' => $this->getLoaded(), | ||||
| 'undoTemplates' => hsprintf('%s', $renderer->renderUndoTemplates()), | '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(), | |||||
| 'editorConfigureURI' => $this->getEditorConfigureURI(), | |||||
| ), | ), | ||||
| '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) | ||||
| Show All 12 Lines | return javelin_tag( | ||||
| array( | array( | ||||
| 'class' => 'changeset-view-content', | 'class' => 'changeset-view-content', | ||||
| 'sigil' => 'changeset-view-content', | 'sigil' => 'changeset-view-content', | ||||
| ), | ), | ||||
| $this->renderChildren()), | $this->renderChildren()), | ||||
| )); | )); | ||||
| } | } | ||||
| public function setRepository(PhabricatorRepository $repository) { | |||||
| $this->repository = $repository; | |||||
| return $this; | |||||
| } | |||||
| public function getRepository() { | |||||
| return $this->repository; | |||||
| } | |||||
| public function getChangeset() { | |||||
| return $this->changeset; | |||||
| } | |||||
| public function setDiff(DifferentialDiff $diff) { | |||||
| $this->diff = $diff; | |||||
| return $this; | |||||
| } | |||||
| public function getDiff() { | |||||
| return $this->diff; | |||||
| } | |||||
| private function getEditorURI() { | |||||
| $viewer = $this->getViewer(); | |||||
| if (!$viewer->isLoggedIn()) { | |||||
| return null; | |||||
| } | |||||
| $repository = $this->getRepository(); | |||||
| if (!$repository) { | |||||
| return null; | |||||
| } | |||||
| $changeset = $this->getChangeset(); | |||||
| $diff = $this->getDiff(); | |||||
| $path = $changeset->getAbsoluteRepositoryPath($repository, $diff); | |||||
| $path = ltrim($path, '/'); | |||||
| $line = idx($changeset->getMetadata(), 'line:first', 1); | |||||
| return $viewer->loadEditorLink($path, $line, $repository); | |||||
| } | |||||
| private function getEditorConfigureURI() { | |||||
| $viewer = $this->getViewer(); | |||||
| if (!$viewer->isLoggedIn()) { | |||||
| return null; | |||||
| } | |||||
| return '/settings/panel/display/'; | |||||
| } | |||||
| } | } | ||||