3 final class DiffusionRepositoryEditController
4 extends DiffusionRepositoryManageController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $engine = id(new DiffusionRepositoryEditEngine())
8 ->setController($this);
10 $id = $request->getURIData('id');
12 $this->requireApplicationCapability(
13 DiffusionCreateRepositoriesCapability
::CAPABILITY
);
15 $vcs = $request->getStr('vcs');
16 $vcs_types = PhabricatorRepositoryType
::getRepositoryTypeMap();
17 if (empty($vcs_types[$vcs])) {
18 return $this->buildVCSTypeResponse();
22 ->addContextParameter('vcs', $vcs)
23 ->setVersionControlSystem($vcs);
26 return $engine->buildResponse();
29 private function buildVCSTypeResponse() {
30 $vcs_types = PhabricatorRepositoryType
::getRepositoryTypeMap();
32 $request = $this->getRequest();
33 $viewer = $this->getViewer();
35 $crumbs = $this->buildApplicationCrumbs();
36 $crumbs->addTextCrumb(pht('Create Repository'));
37 $crumbs->setBorder(true);
39 $title = pht('Choose Repository Type');
41 $layout = id(new AphrontMultiColumnView())
42 ->setFluidLayout(true);
44 $create_uri = $request->getRequestURI();
46 foreach ($vcs_types as $vcs_key => $vcs_type) {
47 $image = idx($vcs_type, 'image');
48 $image = PhabricatorFile
::loadBuiltin($viewer, $image);
49 $action = id(new PHUIActionPanelView())
50 ->setImage($image->getBestURI())
51 ->setHeader(idx($vcs_type, 'create.header'))
52 ->setHref($create_uri->alter('vcs', $vcs_key))
53 ->setSubheader(idx($vcs_type, 'create.subheader'));
55 $layout->addColumn($action);
58 $hints = id(new AphrontMultiColumnView())
59 ->setFluidLayout(true);
61 $observe_href = PhabricatorEnv
::getDoclink(
62 'Diffusion User Guide: Existing Repositories');
64 require_celerity_resource('diffusion-css');
66 $image = PhabricatorFile
::loadBuiltin($viewer, 'repo/repo.png');
68 id(new PHUIActionPanelView())
69 ->setImage($image->getBestURI())
70 ->setHeader(pht('Import or Observe an Existing Repository'))
71 ->setHref($observe_href)
74 'Review the documentation describing how to import or observe an '.
75 'existing repository.')));
77 $layout = id(new PHUIBoxView())
78 ->addClass('diffusion-create-repo')
79 ->appendChild($layout);
81 $launcher_view = id(new PHUILauncherView())
88 $view = id(new PHUITwoColumnView())
89 ->setFooter($launcher_view);
91 return $this->newPage()