[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/diffusion/controller/ -> DiffusionRepositoryEditLocalController.php (source)

   1  <?php
   2  
   3  final class DiffusionRepositoryEditLocalController
   4    extends DiffusionRepositoryEditController {
   5  
   6    public function processRequest() {
   7      $request = $this->getRequest();
   8      $user = $request->getUser();
   9      $drequest = $this->diffusionRequest;
  10      $repository = $drequest->getRepository();
  11  
  12      $repository = id(new PhabricatorRepositoryQuery())
  13        ->setViewer($user)
  14        ->requireCapabilities(
  15          array(
  16            PhabricatorPolicyCapability::CAN_VIEW,
  17            PhabricatorPolicyCapability::CAN_EDIT,
  18          ))
  19        ->withIDs(array($repository->getID()))
  20        ->executeOne();
  21  
  22      if (!$repository) {
  23        return new Aphront404Response();
  24      }
  25  
  26      $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
  27  
  28      $v_local = $repository->getHumanReadableDetail('local-path');
  29      $errors = array();
  30  
  31      $crumbs = $this->buildApplicationCrumbs();
  32      $crumbs->addTextCrumb(pht('Edit Local'));
  33  
  34      $title = pht('Edit %s', $repository->getName());
  35  
  36      $form = id(new AphrontFormView())
  37        ->setUser($user)
  38        ->appendRemarkupInstructions(
  39          pht(
  40            "You can not adjust the local path for this repository from the ".
  41            "web interface. To edit it, run this command:\n\n".
  42            "  phabricator/ $ ./bin/repository edit %s --as %s --local-path ...",
  43            $repository->getCallsign(),
  44            $user->getUsername()))
  45        ->appendChild(
  46          id(new AphrontFormMarkupControl())
  47            ->setName('local')
  48            ->setLabel(pht('Local Path'))
  49            ->setValue($v_local))
  50        ->appendChild(
  51          id(new AphrontFormSubmitControl())
  52            ->addCancelButton($edit_uri, pht('Done')));
  53  
  54      $object_box = id(new PHUIObjectBoxView())
  55        ->setHeaderText($title)
  56        ->setForm($form)
  57        ->setFormErrors($errors);
  58  
  59      return $this->buildApplicationPage(
  60        array(
  61          $crumbs,
  62          $object_box,
  63        ),
  64        array(
  65          'title' => $title,
  66        ));
  67    }
  68  
  69  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1