phorge/src/applications/diffusion/controller/DiffusionRepositoryEditStorageController.php36e2d02d6ec5master
phorge/src/applications/diffusion/controller/DiffusionRepositoryEditStorageController.php
36e2d02d6ec5master
DiffusionRepositoryEditStorageController.php
DiffusionRepositoryEditStorageController.php
c4cdb5c5f035 | <?php | ||
---|---|---|---|
d8739459f6f9 | final class DiffusionRepositoryEditStorageController | ||
c4cdb5c5f035 | extends DiffusionRepositoryEditController { | ||
a823654be095 | protected function processDiffusionRequest(AphrontRequest $request) { | ||
c4cdb5c5f035 | $user = $request->getUser(); | ||
$drequest = $this->diffusionRequest; | |||
$repository = $drequest->getRepository(); | |||
$repository = id(new PhabricatorRepositoryQuery()) | |||
->setViewer($user) | |||
->requireCapabilities( | |||
array( | |||
PhabricatorPolicyCapability::CAN_VIEW, | |||
PhabricatorPolicyCapability::CAN_EDIT, | |||
)) | |||
->withIDs(array($repository->getID())) | |||
->executeOne(); | |||
if (!$repository) { | |||
return new Aphront404Response(); | |||
} | |||
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); | |||
$v_local = $repository->getHumanReadableDetail('local-path'); | |||
$errors = array(); | |||
$crumbs = $this->buildApplicationCrumbs(); | |||
d8739459f6f9 | $crumbs->addTextCrumb(pht('Edit Storage')); | ||
c4cdb5c5f035 | |||
$title = pht('Edit %s', $repository->getName()); | |||
cd6f67ef95a3 | $service_phid = $repository->getAlmanacServicePHID(); | ||
if ($service_phid) { | |||
$handles = $this->loadViewerHandles(array($service_phid)); | |||
$v_service = $handles[$service_phid]->renderLink(); | |||
} else { | |||
$v_service = phutil_tag( | |||
'em', | |||
array(), | |||
pht('Local')); | |||
} | |||
c4cdb5c5f035 | $form = id(new AphrontFormView()) | ||
->setUser($user) | |||
cd6f67ef95a3 | ->appendChild( | ||
id(new AphrontFormMarkupControl()) | |||
->setLabel(pht('Storage Service')) | |||
->setValue($v_service)) | |||
->appendChild( | |||
id(new AphrontFormMarkupControl()) | |||
->setName('local') | |||
->setLabel(pht('Storage Path')) | |||
->setValue($v_local)) | |||
c4cdb5c5f035 | ->appendRemarkupInstructions( | ||
pht( | |||
2dc8065d1143 | "You can not adjust the local path for this repository from the ". | ||
36e2d02d6ec5 | "web interface. To edit it, run this command:\n\n %s", | ||
sprintf( | |||
'phabricator/ $ ./bin/repository edit %s --as %s --local-path ...', | |||
$repository->getCallsign(), | |||
$user->getUsername()))) | |||
c4cdb5c5f035 | ->appendChild( | ||
id(new AphrontFormSubmitControl()) | |||
2dc8065d1143 | ->addCancelButton($edit_uri, pht('Done'))); | ||
c4cdb5c5f035 | |||
$object_box = id(new PHUIObjectBoxView()) | |||
->setHeaderText($title) | |||
->setForm($form) | |||
b74c7a3d371a | ->setFormErrors($errors); | ||
c4cdb5c5f035 | |||
return $this->buildApplicationPage( | |||
array( | |||
$crumbs, | |||
$object_box, | |||
), | |||
array( | |||
'title' => $title, | |||
)); | |||
} | |||
} |
Owner Packages
Owner Packages
- No Owners