[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

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

   1  <?php
   2  
   3  final class DiffusionRepositoryNewController extends DiffusionController {
   4  
   5    public function processRequest() {
   6      $request = $this->getRequest();
   7      $viewer = $request->getUser();
   8  
   9      $this->requireApplicationCapability(
  10        DiffusionCreateRepositoriesCapability::CAPABILITY);
  11  
  12      if ($request->isFormPost()) {
  13        if ($request->getStr('type')) {
  14          switch ($request->getStr('type')) {
  15            case 'create':
  16              $uri = $this->getApplicationURI('create/');
  17              break;
  18            case 'import':
  19            default:
  20              $uri = $this->getApplicationURI('import/');
  21              break;
  22          }
  23  
  24          return id(new AphrontRedirectResponse())->setURI($uri);
  25        }
  26      }
  27  
  28      $doc_href = PhabricatorEnv::getDoclink(
  29        'Diffusion User Guide: Repository Hosting');
  30  
  31      $doc_link = phutil_tag(
  32        'a',
  33        array(
  34          'href' => $doc_href,
  35          'target' => '_blank',
  36        ),
  37        pht('Diffusion User Guide: Repository Hosting'));
  38  
  39      $form = id(new AphrontFormView())
  40        ->setUser($viewer)
  41        ->appendChild(
  42          id(new AphrontFormRadioButtonControl())
  43            ->setName('type')
  44            ->addButton(
  45              'create',
  46              pht('Create a New Hosted Repository'),
  47              array(
  48                pht(
  49                  'Create a new, empty repository which Phabricator will host. '.
  50                  'For instructions on configuring repository hosting, see %s.',
  51                  $doc_link),
  52              ))
  53            ->addButton(
  54              'import',
  55              pht('Import an Existing External Repository'),
  56              pht(
  57                'Import a repository hosted somewhere else, like GitHub, '.
  58                'Bitbucket, or your organization\'s existing servers. '.
  59                'Phabricator will read changes from the repository but will '.
  60                'not host or manage it. The authoritative master version of '.
  61                'the repository will stay where it is now.')))
  62        ->appendChild(
  63          id(new AphrontFormSubmitControl())
  64            ->setValue(pht('Continue'))
  65            ->addCancelButton($this->getApplicationURI()));
  66  
  67      $crumbs = $this->buildApplicationCrumbs();
  68      $crumbs->addTextCrumb(pht('New Repository'));
  69  
  70      $form_box = id(new PHUIObjectBoxView())
  71        ->setHeaderText(pht('Create or Import Repository'))
  72        ->setForm($form);
  73  
  74      return $this->buildApplicationPage(
  75        array(
  76          $crumbs,
  77          $form_box,
  78        ),
  79        array(
  80          'title' => pht('New Repository'),
  81        ));
  82    }
  83  
  84  }


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