Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/view/DifferentialChangesetListView.php
| Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | public function getInlineListURI() { | ||||
| return $this->inlineListURI; | return $this->inlineListURI; | ||||
| } | } | ||||
| public function setRepository(PhabricatorRepository $repository) { | public function setRepository(PhabricatorRepository $repository) { | ||||
| $this->repository = $repository; | $this->repository = $repository; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getRepository() { | |||||
| return $this->repository; | |||||
| } | |||||
| public function setDiff(DifferentialDiff $diff) { | public function setDiff(DifferentialDiff $diff) { | ||||
| $this->diff = $diff; | $this->diff = $diff; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getDiff() { | |||||
| return $this->diff; | |||||
| } | |||||
| public function setRenderingReferences(array $references) { | public function setRenderingReferences(array $references) { | ||||
| $this->references = $references; | $this->references = $references; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setSymbolIndexes(array $indexes) { | public function setSymbolIndexes(array $indexes) { | ||||
| $this->symbolIndexes = $indexes; | $this->symbolIndexes = $indexes; | ||||
| return $this; | return $this; | ||||
| ▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | public function render() { | ||||
| $this->requireResource('differential-changeset-view-css'); | $this->requireResource('differential-changeset-view-css'); | ||||
| $changesets = $this->changesets; | $changesets = $this->changesets; | ||||
| $renderer = DifferentialChangesetParser::getDefaultRendererForViewer( | $renderer = DifferentialChangesetParser::getDefaultRendererForViewer( | ||||
| $viewer); | $viewer); | ||||
| $repository = $this->getRepository(); | |||||
| $diff = $this->getDiff(); | |||||
| $output = array(); | $output = array(); | ||||
| $ids = array(); | $ids = array(); | ||||
| foreach ($changesets as $key => $changeset) { | foreach ($changesets as $key => $changeset) { | ||||
| $file = $changeset->getFilename(); | $file = $changeset->getFilename(); | ||||
| $ref = $this->references[$key]; | $ref = $this->references[$key]; | ||||
| $detail = id(new DifferentialChangesetDetailView()) | $detail = id(new DifferentialChangesetDetailView()) | ||||
| ->setUser($viewer); | ->setUser($viewer); | ||||
| if ($repository) { | |||||
| $detail->setRepository($repository); | |||||
| } | |||||
| if ($diff) { | |||||
| $detail->setDiff($diff); | |||||
| } | |||||
| $uniq_id = 'diff-'.$changeset->getAnchorName(); | $uniq_id = 'diff-'.$changeset->getAnchorName(); | ||||
| $detail->setID($uniq_id); | $detail->setID($uniq_id); | ||||
| $view_options = $this->renderViewOptionsDropdown( | $view_options = $this->renderViewOptionsDropdown( | ||||
| $detail, | $detail, | ||||
| $ref, | $ref, | ||||
| $changeset); | $changeset); | ||||
| ▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | $this->initBehavior( | ||||
| 'List Inline Comments' => pht('List Inline Comments'), | 'List Inline Comments' => pht('List Inline Comments'), | ||||
| 'Display Options' => pht('Display Options'), | 'Display Options' => pht('Display Options'), | ||||
| 'Hide or show all inline comments.' => | 'Hide or show all inline comments.' => | ||||
| pht('Hide or show all inline comments.'), | pht('Hide or show all inline comments.'), | ||||
| 'Finish editing inline comments before changing display modes.' => | 'Finish editing inline comments before changing display modes.' => | ||||
| pht('Finish editing inline comments before changing display modes.'), | pht('Finish editing inline comments before changing display modes.'), | ||||
| 'Open file in external editor.' => | |||||
| pht('Open file in external editor.'), | |||||
| 'You must select a file to edit.' => | |||||
| pht('You must select a file to edit.'), | |||||
| 'No external editor is configured.' => | |||||
| pht('No external editor is configured.'), | |||||
| ), | ), | ||||
| )); | )); | ||||
| if ($this->header) { | if ($this->header) { | ||||
| $header = $this->header; | $header = $this->header; | ||||
| } else { | } else { | ||||
| $header = id(new PHUIHeaderView()) | $header = id(new PHUIHeaderView()) | ||||
| ->setHeader($this->getTitle()); | ->setHeader($this->getTitle()); | ||||
| ▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | if ($this->rightRawFileURI) { | ||||
| if ($change != DifferentialChangeType::TYPE_DELETE && | if ($change != DifferentialChangeType::TYPE_DELETE && | ||||
| $change != DifferentialChangeType::TYPE_MULTICOPY) { | $change != DifferentialChangeType::TYPE_MULTICOPY) { | ||||
| $uri = new PhutilURI($this->rightRawFileURI); | $uri = new PhutilURI($this->rightRawFileURI); | ||||
| $uri = $this->appendDefaultQueryParams($uri, $qparams); | $uri = $this->appendDefaultQueryParams($uri, $qparams); | ||||
| $meta['rightURI'] = (string)$uri; | $meta['rightURI'] = (string)$uri; | ||||
| } | } | ||||
| } | } | ||||
| if ($viewer && $repository) { | |||||
| $path = ltrim( | |||||
| $changeset->getAbsoluteRepositoryPath($repository, $this->diff), | |||||
| '/'); | |||||
| $line = idx($changeset->getMetadata(), 'line:first', 1); | |||||
| $editor_link = $viewer->loadEditorLink($path, $line, $repository); | |||||
| if ($editor_link) { | |||||
| $meta['editor'] = $editor_link; | |||||
| } else { | |||||
| $meta['editorConfigure'] = '/settings/panel/display/'; | |||||
| } | |||||
| } | |||||
| $meta['containerID'] = $detail->getID(); | $meta['containerID'] = $detail->getID(); | ||||
| return id(new PHUIButtonView()) | return id(new PHUIButtonView()) | ||||
| ->setTag('a') | ->setTag('a') | ||||
| ->setText(pht('View Options')) | ->setText(pht('View Options')) | ||||
| ->setIcon('fa-bars') | ->setIcon('fa-bars') | ||||
| ->setColor(PHUIButtonView::GREY) | ->setColor(PHUIButtonView::GREY) | ||||
| ->setHref(idx($meta, 'detailURI', '#')) | ->setHref(idx($meta, 'detailURI', '#')) | ||||
| Show All 25 Lines | |||||