@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class DiffusionRepositorySubversionManagementPanel
4 extends DiffusionRepositoryManagementPanel {
5
6 const PANELKEY = 'subversion';
7
8 public function getManagementPanelLabel() {
9 return pht('Subversion');
10 }
11
12 public function getManagementPanelOrder() {
13 return 1000;
14 }
15
16 public function shouldEnableForRepository(
17 PhabricatorRepository $repository) {
18 return $repository->isSVN();
19 }
20
21 public function getManagementPanelIcon() {
22 $repository = $this->getRepository();
23
24 $has_any = (bool)$repository->getDetail('svn-subpath');
25
26 if ($has_any) {
27 return 'fa-folder';
28 } else {
29 return 'fa-folder grey';
30 }
31 }
32
33 protected function getEditEngineFieldKeys() {
34 return array(
35 'importOnly',
36 );
37 }
38
39 public function buildManagementPanelCurtain() {
40 $repository = $this->getRepository();
41 $viewer = $this->getViewer();
42 $action_list = $this->newActionList();
43
44 $can_edit = PhabricatorPolicyFilter::hasCapability(
45 $viewer,
46 $repository,
47 PhabricatorPolicyCapability::CAN_EDIT);
48
49 $subversion_uri = $this->getEditPageURI();
50
51 $action_list->addAction(
52 id(new PhabricatorActionView())
53 ->setIcon('fa-pencil')
54 ->setName(pht('Edit Properties'))
55 ->setHref($subversion_uri)
56 ->setDisabled(!$can_edit)
57 ->setWorkflow(!$can_edit));
58
59 return $this->newCurtainView()
60 ->setActionList($action_list);
61 }
62
63 public function buildManagementPanelContent() {
64 $repository = $this->getRepository();
65 $viewer = $this->getViewer();
66
67 $view = id(new PHUIPropertyListView())
68 ->setViewer($viewer);
69
70 $default_branch = nonempty(
71 $repository->getDetail('svn-subpath'),
72 phutil_tag('em', array(), pht('Import Entire Repository')));
73 $view->addProperty(pht('Import Only'), $default_branch);
74
75 return $this->newBox(pht('Subversion'), $view);
76 }
77
78}