Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phragment/controller/PhragmentController.php
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | abstract class PhragmentController extends PhabricatorController { | ||||
protected function createCurrentFragmentView($fragment, $is_history_view) { | protected function createCurrentFragmentView($fragment, $is_history_view) { | ||||
if ($fragment === null) { | if ($fragment === null) { | ||||
return null; | return null; | ||||
} | } | ||||
$viewer = $this->getRequest()->getUser(); | $viewer = $this->getRequest()->getUser(); | ||||
$phids = array(); | |||||
$phids[] = $fragment->getLatestVersionPHID(); | |||||
$snapshot_phids = array(); | $snapshot_phids = array(); | ||||
$snapshots = id(new PhragmentSnapshotQuery()) | $snapshots = id(new PhragmentSnapshotQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withPrimaryFragmentPHIDs(array($fragment->getPHID())) | ->withPrimaryFragmentPHIDs(array($fragment->getPHID())) | ||||
->execute(); | ->execute(); | ||||
foreach ($snapshots as $snapshot) { | foreach ($snapshots as $snapshot) { | ||||
$phids[] = $snapshot->getPHID(); | |||||
$snapshot_phids[] = $snapshot->getPHID(); | $snapshot_phids[] = $snapshot->getPHID(); | ||||
} | } | ||||
$this->loadHandles($phids); | |||||
$file = null; | $file = null; | ||||
$file_uri = null; | $file_uri = null; | ||||
if (!$fragment->isDirectory()) { | if (!$fragment->isDirectory()) { | ||||
$file = id(new PhabricatorFileQuery()) | $file = id(new PhabricatorFileQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withPHIDs(array($fragment->getLatestVersion()->getFilePHID())) | ->withPHIDs(array($fragment->getLatestVersion()->getFilePHID())) | ||||
->executeOne(); | ->executeOne(); | ||||
if ($file !== null) { | if ($file !== null) { | ||||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | if (!$fragment->isDirectory()) { | ||||
pht('File (Deleted)')); | pht('File (Deleted)')); | ||||
} else { | } else { | ||||
$properties->addProperty( | $properties->addProperty( | ||||
pht('Type'), | pht('Type'), | ||||
pht('File')); | pht('File')); | ||||
} | } | ||||
$properties->addProperty( | $properties->addProperty( | ||||
pht('Latest Version'), | pht('Latest Version'), | ||||
$this->renderHandlesForPHIDs(array($fragment->getLatestVersionPHID()))); | $viewer->renderHandle($fragment->getLatestVersionPHID())); | ||||
} else { | } else { | ||||
$properties->addProperty( | $properties->addProperty( | ||||
pht('Type'), | pht('Type'), | ||||
pht('Directory')); | pht('Directory')); | ||||
} | } | ||||
if (count($snapshot_phids) > 0) { | if (count($snapshot_phids) > 0) { | ||||
$properties->addProperty( | $properties->addProperty( | ||||
pht('Snapshots'), | pht('Snapshots'), | ||||
$this->renderHandlesForPHIDs($snapshot_phids)); | $viewer->renderHandleList($snapshot_phids)); | ||||
} | } | ||||
return id(new PHUIObjectBoxView()) | return id(new PHUIObjectBoxView()) | ||||
->setHeader($header) | ->setHeader($header) | ||||
->addPropertyList($properties); | ->addPropertyList($properties); | ||||
} | } | ||||
public function renderConfigurationWarningIfRequired() { | public function renderConfigurationWarningIfRequired() { | ||||
Show All 29 Lines |