Differential D20733 Diff 49429 src/applications/phortune/controller/merchant/PhortuneMerchantPictureController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phortune/controller/merchant/PhortuneMerchantPictureController.php
<?php | <?php | ||||
final class PhortuneMerchantPictureController | final class PhortuneMerchantPictureController | ||||
extends PhortuneMerchantProfileController { | extends PhortuneMerchantController { | ||||
public function handleRequest(AphrontRequest $request) { | protected function shouldRequireMerchantEditCapability() { | ||||
$viewer = $request->getViewer(); | return true; | ||||
$id = $request->getURIData('id'); | |||||
$merchant = id(new PhortuneMerchantQuery()) | |||||
->setViewer($viewer) | |||||
->withIDs(array($id)) | |||||
->needProfileImage(true) | |||||
->requireCapabilities( | |||||
array( | |||||
PhabricatorPolicyCapability::CAN_VIEW, | |||||
PhabricatorPolicyCapability::CAN_EDIT, | |||||
)) | |||||
->executeOne(); | |||||
if (!$merchant) { | |||||
return new Aphront404Response(); | |||||
} | } | ||||
$this->setMerchant($merchant); | protected function handleMerchantRequest(AphrontRequest $request) { | ||||
$uri = $merchant->getURI(); | $viewer = $request->getViewer(); | ||||
$merchant = $this->getMerchant(); | |||||
$uri = $merchant->getDetailsURI(); | |||||
$supported_formats = PhabricatorFile::getTransformableImageFormats(); | $supported_formats = PhabricatorFile::getTransformableImageFormats(); | ||||
$e_file = true; | $e_file = true; | ||||
$errors = array(); | $errors = array(); | ||||
if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
$phid = $request->getStr('phid'); | $phid = $request->getStr('phid'); | ||||
$is_default = false; | $is_default = false; | ||||
▲ Show 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | protected function handleMerchantRequest(AphrontRequest $request) { | ||||
$view = id(new PHUITwoColumnView()) | $view = id(new PHUITwoColumnView()) | ||||
->setHeader($header) | ->setHeader($header) | ||||
->setFooter(array( | ->setFooter(array( | ||||
$form_box, | $form_box, | ||||
$upload_box, | $upload_box, | ||||
)); | )); | ||||
$navigation = $this->buildSideNavView(); | |||||
return $this->newPage() | return $this->newPage() | ||||
->setTitle($title) | ->setTitle($title) | ||||
->setCrumbs($crumbs) | ->setCrumbs($crumbs) | ||||
->setNavigation($navigation) | |||||
->appendChild( | ->appendChild( | ||||
array( | array( | ||||
$view, | $view, | ||||
)); | )); | ||||
} | } | ||||
} | } |