2013-10-29 20:20:26 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DiffusionRepositoryEditLocalController
|
|
|
|
extends DiffusionRepositoryEditController {
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$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();
|
2013-12-19 02:47:34 +01:00
|
|
|
$crumbs->addTextCrumb(pht('Edit Local'));
|
2013-10-29 20:20:26 +01:00
|
|
|
|
|
|
|
$title = pht('Edit %s', $repository->getName());
|
|
|
|
|
|
|
|
$form = id(new AphrontFormView())
|
|
|
|
->setUser($user)
|
|
|
|
->appendRemarkupInstructions(
|
|
|
|
pht(
|
2013-11-13 20:26:22 +01:00
|
|
|
"You can not adjust the local path for this repository from the ".
|
|
|
|
"web interface. To edit it, run this command:\n\n".
|
|
|
|
" phabricator/ $ ./bin/repository edit %s --as %s --local-path ...",
|
|
|
|
$repository->getCallsign(),
|
|
|
|
$user->getUsername()))
|
2013-10-29 20:20:26 +01:00
|
|
|
->appendChild(
|
2013-11-13 20:26:22 +01:00
|
|
|
id(new AphrontFormMarkupControl())
|
2013-10-29 20:20:26 +01:00
|
|
|
->setName('local')
|
|
|
|
->setLabel(pht('Local Path'))
|
2013-11-13 20:26:22 +01:00
|
|
|
->setValue($v_local))
|
2013-10-29 20:20:26 +01:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSubmitControl())
|
2013-11-13 20:26:22 +01:00
|
|
|
->addCancelButton($edit_uri, pht('Done')));
|
2013-10-29 20:20:26 +01:00
|
|
|
|
|
|
|
$object_box = id(new PHUIObjectBoxView())
|
|
|
|
->setHeaderText($title)
|
|
|
|
->setForm($form)
|
2014-01-10 18:17:37 +01:00
|
|
|
->setFormErrors($errors);
|
2013-10-29 20:20:26 +01:00
|
|
|
|
|
|
|
return $this->buildApplicationPage(
|
|
|
|
array(
|
|
|
|
$crumbs,
|
|
|
|
$object_box,
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'title' => $title,
|
|
|
|
'device' => true,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|