Changeset View
Changeset View
Standalone View
Standalone View
src/applications/pholio/view/PholioMockImagesView.php
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | private function calculateBehaviorConfig() { | ||||
// TODO: We could maybe do a better job with tailoring this, which is the | // TODO: We could maybe do a better job with tailoring this, which is the | ||||
// image shown on the review stage. | // image shown on the review stage. | ||||
$viewer = $this->getUser(); | $viewer = $this->getUser(); | ||||
$default = PhabricatorFile::loadBuiltin($viewer, 'image-100x100.png'); | $default = PhabricatorFile::loadBuiltin($viewer, 'image-100x100.png'); | ||||
$images = array(); | $images = array(); | ||||
$current_set = 0; | $current_set = 0; | ||||
foreach ($mock->getAllImages() as $image) { | foreach ($mock->getImages() as $image) { | ||||
$file = $image->getFile(); | $file = $image->getFile(); | ||||
$metadata = $file->getMetadata(); | $metadata = $file->getMetadata(); | ||||
$x = idx($metadata, PhabricatorFile::METADATA_IMAGE_WIDTH); | $x = idx($metadata, PhabricatorFile::METADATA_IMAGE_WIDTH); | ||||
$y = idx($metadata, PhabricatorFile::METADATA_IMAGE_HEIGHT); | $y = idx($metadata, PhabricatorFile::METADATA_IMAGE_HEIGHT); | ||||
$is_obs = (bool)$image->getIsObsolete(); | $is_obs = (bool)$image->getIsObsolete(); | ||||
if (!$is_obs) { | if (!$is_obs) { | ||||
$current_set++; | $current_set++; | ||||
Show All 19 Lines | foreach ($mock->getImages() as $image) { | ||||
'title' => $image->getName(), | 'title' => $image->getName(), | ||||
'descriptionMarkup' => $description, | 'descriptionMarkup' => $description, | ||||
'isObsolete' => (bool)$image->getIsObsolete(), | 'isObsolete' => (bool)$image->getIsObsolete(), | ||||
'isImage' => $file->isViewableImage(), | 'isImage' => $file->isViewableImage(), | ||||
'isViewable' => $file->isViewableInBrowser(), | 'isViewable' => $file->isViewableInBrowser(), | ||||
); | ); | ||||
} | } | ||||
$ids = mpull($mock->getImages(), 'getID'); | $ids = mpull($mock->getActiveImages(), 'getID'); | ||||
if ($this->imageID && isset($ids[$this->imageID])) { | if ($this->imageID && isset($ids[$this->imageID])) { | ||||
$selected_id = $this->imageID; | $selected_id = $this->imageID; | ||||
} else { | } else { | ||||
$selected_id = head_key($ids); | $selected_id = head_key($ids); | ||||
} | } | ||||
$navsequence = array(); | $navsequence = array(); | ||||
foreach ($mock->getImages() as $image) { | foreach ($mock->getActiveImages() as $image) { | ||||
$navsequence[] = $image->getID(); | $navsequence[] = $image->getID(); | ||||
} | } | ||||
$full_icon = array( | $full_icon = array( | ||||
javelin_tag('span', array('aural' => true), pht('View Raw File')), | javelin_tag('span', array('aural' => true), pht('View Raw File')), | ||||
id(new PHUIIconView())->setIcon('fa-file-image-o'), | id(new PHUIIconView())->setIcon('fa-file-image-o'), | ||||
); | ); | ||||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |