2013-11-02 01:39:35 +01:00
|
|
|
<?php
|
|
|
|
|
2014-07-25 00:20:39 +02:00
|
|
|
final class DiffusionRepositoryNewController extends DiffusionController {
|
2013-11-02 01:39:35 +01:00
|
|
|
|
2015-01-09 22:29:08 +01:00
|
|
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
2013-11-02 01:39:35 +01:00
|
|
|
$viewer = $request->getUser();
|
|
|
|
|
|
|
|
$this->requireApplicationCapability(
|
2014-07-25 00:20:39 +02:00
|
|
|
DiffusionCreateRepositoriesCapability::CAPABILITY);
|
2013-11-02 01:39:35 +01:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-23 00:24:27 +01:00
|
|
|
$doc_href = PhabricatorEnv::getDoclink(
|
2014-03-17 23:01:31 +01:00
|
|
|
'Diffusion User Guide: Repository Hosting');
|
2013-11-23 00:24:27 +01:00
|
|
|
|
|
|
|
$doc_link = phutil_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $doc_href,
|
|
|
|
'target' => '_blank',
|
|
|
|
),
|
|
|
|
pht('Diffusion User Guide: Repository Hosting'));
|
|
|
|
|
2013-11-02 01:39:35 +01:00
|
|
|
$form = id(new AphrontFormView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormRadioButtonControl())
|
|
|
|
->setName('type')
|
|
|
|
->addButton(
|
|
|
|
'create',
|
|
|
|
pht('Create a New Hosted Repository'),
|
|
|
|
array(
|
|
|
|
pht(
|
2013-11-23 00:24:27 +01:00
|
|
|
'Create a new, empty repository which Phabricator will host. '.
|
2014-09-18 03:25:57 +02:00
|
|
|
'For instructions on configuring repository hosting, see %s.',
|
2013-11-23 00:24:27 +01:00
|
|
|
$doc_link),
|
2013-11-02 01:39:35 +01:00
|
|
|
))
|
|
|
|
->addButton(
|
|
|
|
'import',
|
|
|
|
pht('Import an Existing External Repository'),
|
|
|
|
pht(
|
|
|
|
'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.')))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSubmitControl())
|
|
|
|
->setValue(pht('Continue'))
|
|
|
|
->addCancelButton($this->getApplicationURI()));
|
|
|
|
|
|
|
|
$crumbs = $this->buildApplicationCrumbs();
|
2013-12-19 02:47:34 +01:00
|
|
|
$crumbs->addTextCrumb(pht('New Repository'));
|
2013-11-02 01:39:35 +01:00
|
|
|
|
|
|
|
$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'),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|