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_encoding = $repository->getDetail('encoding'); $e_encoding = null; $errors = array(); if ($request->isFormPost()) { $v_encoding = $request->getStr('encoding'); if (!$errors) { $xactions = array(); $template = id(new PhabricatorRepositoryTransaction()); $type_encoding = PhabricatorRepositoryTransaction::TYPE_ENCODING; $xactions[] = id(clone $template) ->setTransactionType($type_encoding) ->setNewValue($v_encoding); try { id(new PhabricatorRepositoryEditor()) ->setContinueOnNoEffect(true) ->setContentSourceFromRequest($request) ->setActor($user) ->applyTransactions($repository, $xactions); return id(new AphrontRedirectResponse())->setURI($edit_uri); } catch (Exception $ex) { $errors[] = $ex->getMessage(); } } } $crumbs = $this->buildApplicationCrumbs(); $crumbs->addCrumb( id(new PhabricatorCrumbView()) ->setName(pht('Edit Encoding'))); $title = pht('Edit %s', $repository->getName()); $error_view = null; if ($errors) { $error_view = id(new AphrontErrorView()) ->setTitle(pht('Form Errors')) ->setErrors($errors); } $form = id(new AphrontFormView()) ->setUser($user) ->appendRemarkupInstructions($this->getEncodingInstructions()) ->appendChild( id(new AphrontFormTextControl()) ->setName('encoding') ->setLabel(pht('Text Encoding')) ->setValue($v_encoding) ->setError($e_encoding)) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue(pht('Save Encoding')) ->addCancelButton($edit_uri)); $object_box = id(new PHUIObjectBoxView()) ->setHeaderText($title) ->setForm($form) ->setFormError($error_view); return $this->buildApplicationPage( array( $crumbs, $object_box, ), array( 'title' => $title, 'device' => true, )); } private function getEncodingInstructions() { return pht(<<