Changeset View
Changeset View
Standalone View
Standalone View
src/view/layout/PhabricatorFileLinkView.php
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | public function setFileSize($file_size) { | ||||
$this->fileSize = $file_size; | $this->fileSize = $file_size; | ||||
return $this; | return $this; | ||||
} | } | ||||
private function getFileSize() { | private function getFileSize() { | ||||
return $this->fileSize; | return $this->fileSize; | ||||
} | } | ||||
private function getFileIcon() { | |||||
return FileTypeIcon::getFileIcon($this->getFileName()); | |||||
} | |||||
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(), | 'monogram' => $this->getFileMonogram(), | ||||
'icon' => $this->getFileIcon(), | |||||
'size' => $this->getFileSize(), | |||||
); | ); | ||||
} | } | ||||
public function render() { | public function render() { | ||||
require_celerity_resource('phabricator-remarkup-css'); | require_celerity_resource('phabricator-remarkup-css'); | ||||
require_celerity_resource('phui-lightbox-css'); | require_celerity_resource('phui-lightbox-css'); | ||||
$mustcapture = true; | $mustcapture = true; | ||||
$sigil = 'lightboxable'; | $sigil = 'lightboxable'; | ||||
$meta = $this->getMetadata(); | $meta = $this->getMetadata(); | ||||
$class = 'phabricator-remarkup-embed-layout-link'; | $class = 'phabricator-remarkup-embed-layout-link'; | ||||
if ($this->getCustomClass()) { | if ($this->getCustomClass()) { | ||||
$class = $this->getCustomClass(); | $class = $this->getCustomClass(); | ||||
} | } | ||||
$filename = $this->getFileName(); | |||||
$type_icon = FileTypeIcon::getFileIcon($filename); | |||||
$icon = id(new PHUIIconView()) | $icon = id(new PHUIIconView()) | ||||
->setIcon($type_icon); | ->setIcon($this->getFileIcon()); | ||||
$info = phutil_tag( | $info = phutil_tag( | ||||
'span', | 'span', | ||||
array( | array( | ||||
'class' => 'phabricator-remarkup-embed-layout-info', | 'class' => 'phabricator-remarkup-embed-layout-info', | ||||
), | ), | ||||
$this->getFileSize()); | $this->getFileSize()); | ||||
$name = phutil_tag( | $name = phutil_tag( | ||||
'span', | 'span', | ||||
array( | array( | ||||
'class' => 'phabricator-remarkup-embed-layout-name', | 'class' => 'phabricator-remarkup-embed-layout-name', | ||||
), | ), | ||||
$filename); | $this->getFileName()); | ||||
$inner = phutil_tag( | $inner = phutil_tag( | ||||
'span', | 'span', | ||||
array( | array( | ||||
'class' => 'phabricator-remarkup-embed-layout-info-block', | 'class' => 'phabricator-remarkup-embed-layout-info-block', | ||||
), | ), | ||||
array( | array( | ||||
$name, | $name, | ||||
Show All 18 Lines |