Changeset View
Changeset View
Standalone View
Standalone View
src/view/layout/PhabricatorFileLinkView.php
<?php | <?php | ||||
final class PhabricatorFileLinkView extends AphrontView { | final class PhabricatorFileLinkView extends AphrontView { | ||||
private $fileName; | private $fileName; | ||||
private $fileDownloadURI; | private $fileDownloadURI; | ||||
private $fileViewURI; | private $fileViewURI; | ||||
private $fileViewable; | private $fileViewable; | ||||
private $filePHID; | private $filePHID; | ||||
private $fileMonogram; | |||||
private $customClass; | private $customClass; | ||||
public function setCustomClass($custom_class) { | public function setCustomClass($custom_class) { | ||||
$this->customClass = $custom_class; | $this->customClass = $custom_class; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getCustomClass() { | public function getCustomClass() { | ||||
return $this->customClass; | return $this->customClass; | ||||
} | } | ||||
public function setFilePHID($file_phid) { | public function setFilePHID($file_phid) { | ||||
$this->filePHID = $file_phid; | $this->filePHID = $file_phid; | ||||
return $this; | return $this; | ||||
} | } | ||||
private function getFilePHID() { | private function getFilePHID() { | ||||
return $this->filePHID; | return $this->filePHID; | ||||
} | } | ||||
public function setFileMonogram($monogram) { | |||||
$this->fileMonogram = $monogram; | |||||
return $this; | |||||
} | |||||
private function getFileMonogram() { | |||||
return $this->fileMonogram; | |||||
} | |||||
public function setFileViewable($file_viewable) { | public function setFileViewable($file_viewable) { | ||||
$this->fileViewable = $file_viewable; | $this->fileViewable = $file_viewable; | ||||
return $this; | return $this; | ||||
} | } | ||||
private function getFileViewable() { | private function getFileViewable() { | ||||
return $this->fileViewable; | return $this->fileViewable; | ||||
} | } | ||||
public function setFileViewURI($file_view_uri) { | public function setFileViewURI($file_view_uri) { | ||||
$this->fileViewURI = $file_view_uri; | $this->fileViewURI = $file_view_uri; | ||||
return $this; | return $this; | ||||
} | } | ||||
private function getFileViewURI() { | private function getFileViewURI() { | ||||
return $this->fileViewURI; | return $this->fileViewURI; | ||||
} | } | ||||
public function setFileDownloadURI($file_download_uri) { | public function setFileDownloadURI($file_download_uri) { | ||||
$this->fileDownloadURI = $file_download_uri; | $this->fileDownloadURI = $file_download_uri; | ||||
return $this; | return $this; | ||||
} | } | ||||
private function getFileDownloadURI() { | private function getFileDownloadURI() { | ||||
return $this->fileDownloadURI; | return $this->fileDownloadURI; | ||||
} | } | ||||
public function setFileName($file_name) { | public function setFileName($file_name) { | ||||
$this->fileName = $file_name; | $this->fileName = $file_name; | ||||
return $this; | return $this; | ||||
} | } | ||||
private function getFileName() { | private function getFileName() { | ||||
return $this->fileName; | return $this->fileName; | ||||
} | } | ||||
public function getMetadata() { | public function getMetadata() { | ||||
return array( | return array( | ||||
'phid' => $this->getFilePHID(), | 'phid' => $this->getFilePHID(), | ||||
'viewable' => $this->getFileViewable(), | 'viewable' => $this->getFileViewable(), | ||||
'uri' => $this->getFileViewURI(), | 'uri' => $this->getFileViewURI(), | ||||
'dUri' => $this->getFileDownloadURI(), | 'dUri' => $this->getFileDownloadURI(), | ||||
'name' => $this->getFileName(), | 'name' => $this->getFileName(), | ||||
'monogram' => $this->getFileMonogram(), | |||||
); | ); | ||||
} | } | ||||
public function render() { | public function render() { | ||||
require_celerity_resource('phabricator-remarkup-css'); | require_celerity_resource('phabricator-remarkup-css'); | ||||
require_celerity_resource('lightbox-attachment-css'); | require_celerity_resource('phui-lightbox-css'); | ||||
$sigil = null; | $sigil = null; | ||||
$meta = null; | $meta = null; | ||||
$mustcapture = false; | $mustcapture = false; | ||||
if ($this->getFileViewable()) { | if ($this->getFileViewable()) { | ||||
$mustcapture = true; | $mustcapture = true; | ||||
$sigil = 'lightboxable'; | $sigil = 'lightboxable'; | ||||
$meta = $this->getMetadata(); | $meta = $this->getMetadata(); | ||||
Show All 19 Lines |