3 final class PhabricatorFileUICurtainListController
4 extends PhabricatorFileController
{
6 public function shouldAllowPublic() {
10 public function handleRequest(AphrontRequest
$request) {
11 $viewer = $request->getViewer();
13 $object_phid = $request->getURIData('phid');
15 $object = id(new PhabricatorObjectQuery())
17 ->withPHIDs(array($object_phid))
20 return new Aphront404Response();
23 $attachments = id(new PhabricatorFileAttachmentQuery())
25 ->withObjectPHIDs(array($object->getPHID()))
29 $handles = $viewer->loadHandles(array($object_phid));
30 $object_handle = $handles[$object_phid];
32 $file_phids = mpull($attachments, 'getFilePHID');
33 $file_handles = $viewer->loadHandles($file_phids);
35 $list = id(new PHUIObjectItemListView())
37 foreach ($attachments as $attachment) {
38 $file_phid = $attachment->getFilePHID();
39 $handle = $file_handles[$file_phid];
41 $item = id(new PHUIObjectItemView())
42 ->setHeader($handle->getFullName())
43 ->setHref($handle->getURI())
44 ->setDisabled($handle->isDisabled());
46 if ($handle->getImageURI()) {
47 $item->setImageURI($handle->getImageURI());
50 $list->addItem($item);
53 return $this->newDialog()
55 ->setWidth(AphrontDialogView
::WIDTH_FORM
)
56 ->setTitle(pht('Attached Files'))
57 ->setObjectList($list)
58 ->addCancelButton($object_handle->getURI(), pht('Close'));