Differential D21840 Diff 52055 src/applications/files/controller/PhabricatorFileUICurtainAttachController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/controller/PhabricatorFileUICurtainAttachController.php
- This file was copied to src/applications/files/controller/PhabricatorFileDetachController.php.
Show All 22 Lines | $attachment = id(new PhabricatorFileAttachmentQuery()) | ||||
->withFilePHIDs(array($file_phid)) | ->withFilePHIDs(array($file_phid)) | ||||
->needFiles(true) | ->needFiles(true) | ||||
->withVisibleFiles(true) | ->withVisibleFiles(true) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$attachment) { | if (!$attachment) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
$file = $attachment->getFile(); | |||||
$file_phid = $file->getPHID(); | |||||
$handles = $viewer->loadHandles( | $handles = $viewer->loadHandles( | ||||
array( | array( | ||||
$object_phid, | $object_phid, | ||||
$file_phid, | $file_phid, | ||||
)); | )); | ||||
$object_handle = $handles[$object_phid]; | $object_handle = $handles[$object_phid]; | ||||
$file_handle = $handles[$file_phid]; | $file_handle = $handles[$file_phid]; | ||||
$cancel_uri = $object_handle->getURI(); | $cancel_uri = $object_handle->getURI(); | ||||
$dialog = $this->newDialog() | $dialog = $this->newDialog() | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->setTitle(pht('Attach File')) | ->setTitle(pht('Attach File')) | ||||
->addCancelButton($object_handle->getURI(), pht('Close')); | ->addCancelButton($cancel_uri, pht('Close')); | ||||
$file_link = phutil_tag('strong', array(), $file_handle->renderLink()); | $file_link = phutil_tag('strong', array(), $file_handle->renderLink()); | ||||
$object_link = phutil_tag('strong', array(), $object_handle->renderLink()); | $object_link = phutil_tag('strong', array(), $object_handle->renderLink()); | ||||
if ($attachment->isPolicyAttachment()) { | if ($attachment->isPolicyAttachment()) { | ||||
$body = pht( | $body = pht( | ||||
'The file %s is already attached to the object %s.', | 'The file %s is already attached to the object %s.', | ||||
$file_link, | $file_link, | ||||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |