3 final class PhabricatorFileTransformListController
4 extends PhabricatorFileController
{
6 public function shouldAllowPublic() {
10 public function handleRequest(AphrontRequest
$request) {
11 $viewer = $this->getViewer();
13 $file = id(new PhabricatorFileQuery())
15 ->withIDs(array($request->getURIData('id')))
18 return new Aphront404Response();
21 $monogram = $file->getMonogram();
23 $xdst = id(new PhabricatorTransformedFile())->loadAllWhere(
24 'transformedPHID = %s',
28 foreach ($xdst as $source) {
30 $source->getTransform(),
31 $viewer->renderHandle($source->getOriginalPHID()),
34 $dst_table = id(new AphrontTableView($dst_rows))
47 'This file was not created by transforming another file.'));
49 $xsrc = id(new PhabricatorTransformedFile())->loadAllWhere(
52 $xsrc = mpull($xsrc, 'getTransformedPHID', 'getTransform');
55 $xforms = PhabricatorFileTransform
::getAllTransforms();
56 foreach ($xforms as $xform) {
57 $dst_phid = idx($xsrc, $xform->getTransformKey());
59 if ($xform->canApplyTransform($file)) {
60 $can_apply = pht('Yes');
62 $view_href = $file->getURIForTransform($xform);
63 $view_href = new PhutilURI($view_href);
64 $view_href->replaceQueryParam('regenerate', 'true');
66 $view_text = pht('Regenerate');
68 $view_link = phutil_tag(
71 'class' => 'small button button-grey',
76 $can_apply = phutil_tag('em', array(), pht('No'));
77 $view_link = phutil_tag('em', array(), pht('None'));
81 $dst_link = $viewer->renderHandle($dst_phid);
83 $dst_link = phutil_tag('em', array(), pht('None'));
87 $xform->getTransformName(),
88 $xform->getTransformKey(),
95 $src_table = id(new AphrontTableView($src_rows))
113 $crumbs = $this->buildApplicationCrumbs();
114 $crumbs->addTextCrumb($monogram, '/'.$monogram);
115 $crumbs->addTextCrumb(pht('Transforms'));
116 $crumbs->setBorder(true);
118 $dst_box = id(new PHUIObjectBoxView())
119 ->setHeaderText(pht('File Sources'))
120 ->setBackground(PHUIObjectBoxView
::BLUE_PROPERTY
)
121 ->setTable($dst_table);
123 $src_box = id(new PHUIObjectBoxView())
124 ->setHeaderText(pht('Available Transforms'))
125 ->setBackground(PHUIObjectBoxView
::BLUE_PROPERTY
)
126 ->setTable($src_table);
128 $title = pht('%s Transforms', $file->getName());
130 $header = id(new PHUIHeaderView())
132 ->setHeaderIcon('fa-arrows-alt');
134 $view = id(new PHUITwoColumnView())
141 return $this->newPage()
144 ->appendChild($view);