phorge/src/applications/diffusion/controller/DiffusionRepositoryNewController.php36e2d02d6ec5master
phorge/src/applications/diffusion/controller/DiffusionRepositoryNewController.php
36e2d02d6ec5master
DiffusionRepositoryNewController.php
DiffusionRepositoryNewController.php
cd674931fc6b | <?php | ||
---|---|---|---|
c34de8361984 | final class DiffusionRepositoryNewController extends DiffusionController { | ||
cd674931fc6b | |||
a823654be095 | protected function processDiffusionRequest(AphrontRequest $request) { | ||
cd674931fc6b | $viewer = $request->getUser(); | ||
$this->requireApplicationCapability( | |||
c34de8361984 | DiffusionCreateRepositoriesCapability::CAPABILITY); | ||
cd674931fc6b | |||
if ($request->isFormPost()) { | |||
if ($request->getStr('type')) { | |||
switch ($request->getStr('type')) { | |||
case 'create': | |||
$uri = $this->getApplicationURI('create/'); | |||
break; | |||
case 'import': | |||
default: | |||
$uri = $this->getApplicationURI('import/'); | |||
break; | |||
} | |||
return id(new AphrontRedirectResponse())->setURI($uri); | |||
} | |||
} | |||
6e4101607776 | $doc_href = PhabricatorEnv::getDoclink( | ||
38cc38eaf67b | 'Diffusion User Guide: Repository Hosting'); | ||
6e4101607776 | |||
$doc_link = phutil_tag( | |||
'a', | |||
array( | |||
'href' => $doc_href, | |||
'target' => '_blank', | |||
), | |||
pht('Diffusion User Guide: Repository Hosting')); | |||
cd674931fc6b | $form = id(new AphrontFormView()) | ||
->setUser($viewer) | |||
->appendChild( | |||
id(new AphrontFormRadioButtonControl()) | |||
->setName('type') | |||
->addButton( | |||
'create', | |||
pht('Create a New Hosted Repository'), | |||
array( | |||
pht( | |||
6e4101607776 | 'Create a new, empty repository which Phabricator will host. '. | ||
298604c9d35d | 'For instructions on configuring repository hosting, see %s.', | ||
6e4101607776 | $doc_link), | ||
cd674931fc6b | )) | ||
->addButton( | |||
'import', | |||
pht('Import an Existing External Repository'), | |||
pht( | |||
36e2d02d6ec5 | "Import a repository hosted somewhere else, like GitHub, ". | ||
"Bitbucket, or your organization's existing servers. ". | |||
"Phabricator will read changes from the repository but will ". | |||
"not host or manage it. The authoritative master version of ". | |||
"the repository will stay where it is now."))) | |||
cd674931fc6b | ->appendChild( | ||
id(new AphrontFormSubmitControl()) | |||
->setValue(pht('Continue')) | |||
->addCancelButton($this->getApplicationURI())); | |||
$crumbs = $this->buildApplicationCrumbs(); | |||
a5dc9067af0c | $crumbs->addTextCrumb(pht('New Repository')); | ||
cd674931fc6b | |||
$form_box = id(new PHUIObjectBoxView()) | |||
->setHeaderText(pht('Create or Import Repository')) | |||
->setForm($form); | |||
return $this->buildApplicationPage( | |||
array( | |||
$crumbs, | |||
$form_box, | |||
), | |||
array( | |||
'title' => pht('New Repository'), | |||
)); | |||
} | |||
} |
Owner Packages
Owner Packages
- No Owners