Differential D14945 Diff 36121 src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php
<?php | <?php | ||||
final class DiffusionRepositoryEditEncodingController | final class DiffusionRepositoryEditEncodingController | ||||
extends DiffusionRepositoryEditController { | extends DiffusionRepositoryEditController { | ||||
protected function processDiffusionRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
$user = $request->getUser(); | $response = $this->loadDiffusionContextForEdit(); | ||||
$drequest = $this->diffusionRequest; | if ($response) { | ||||
$repository = $drequest->getRepository(); | return $response; | ||||
$repository = id(new PhabricatorRepositoryQuery()) | |||||
->setViewer($user) | |||||
->requireCapabilities( | |||||
array( | |||||
PhabricatorPolicyCapability::CAN_VIEW, | |||||
PhabricatorPolicyCapability::CAN_EDIT, | |||||
)) | |||||
->withIDs(array($repository->getID())) | |||||
->executeOne(); | |||||
if (!$repository) { | |||||
return new Aphront404Response(); | |||||
} | } | ||||
$user = $this->getViewer(); | |||||
$drequest = $this->getDiffusionRequest(); | |||||
$repository = $drequest->getRepository(); | |||||
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); | $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); | ||||
$v_encoding = $repository->getDetail('encoding'); | $v_encoding = $repository->getDetail('encoding'); | ||||
$e_encoding = null; | $e_encoding = null; | ||||
$errors = array(); | $errors = array(); | ||||
if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
$v_encoding = $request->getStr('encoding'); | $v_encoding = $request->getStr('encoding'); | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | $form = id(new AphrontFormView()) | ||||
->setValue(pht('Save Encoding')) | ->setValue(pht('Save Encoding')) | ||||
->addCancelButton($edit_uri)); | ->addCancelButton($edit_uri)); | ||||
$object_box = id(new PHUIObjectBoxView()) | $object_box = id(new PHUIObjectBoxView()) | ||||
->setHeaderText($title) | ->setHeaderText($title) | ||||
->setForm($form) | ->setForm($form) | ||||
->setFormErrors($errors); | ->setFormErrors($errors); | ||||
return $this->buildApplicationPage( | return $this->newPage() | ||||
array( | ->setTitle($title) | ||||
$crumbs, | ->setCrumbs($crumbs) | ||||
$object_box, | ->appendChild($object_box); | ||||
), | |||||
array( | |||||
'title' => $title, | |||||
)); | |||||
} | } | ||||
private function getEncodingInstructions() { | private function getEncodingInstructions() { | ||||
return pht(<<<EOT | return pht(<<<EOT | ||||
If source code in this repository uses a character encoding other than UTF-8 | If source code in this repository uses a character encoding other than UTF-8 | ||||
(for example, `ISO-8859-1`), specify it here. | (for example, `ISO-8859-1`), specify it here. | ||||
**Normally, you can leave this field blank.** If your source code is written in | **Normally, you can leave this field blank.** If your source code is written in | ||||
Show All 13 Lines |