forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiffusionRepositorySubversionManagementPanel.php
78 lines (59 loc) · 1.88 KB
/
DiffusionRepositorySubversionManagementPanel.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
final class DiffusionRepositorySubversionManagementPanel
extends DiffusionRepositoryManagementPanel {
const PANELKEY = 'subversion';
public function getManagementPanelLabel() {
return pht('Subversion');
}
public function getManagementPanelOrder() {
return 1000;
}
public function shouldEnableForRepository(
PhabricatorRepository $repository) {
return $repository->isSVN();
}
public function getManagementPanelIcon() {
$repository = $this->getRepository();
$has_any = (bool)$repository->getDetail('svn-subpath');
if ($has_any) {
return 'fa-folder';
} else {
return 'fa-folder grey';
}
}
protected function getEditEngineFieldKeys() {
return array(
'importOnly',
);
}
public function buildManagementPanelCurtain() {
$repository = $this->getRepository();
$viewer = $this->getViewer();
$action_list = $this->newActionList();
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
$repository,
PhabricatorPolicyCapability::CAN_EDIT);
$subversion_uri = $this->getEditPageURI();
$action_list->addAction(
id(new PhabricatorActionView())
->setIcon('fa-pencil')
->setName(pht('Edit Properties'))
->setHref($subversion_uri)
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
return $this->newCurtainView($action_list)
->setActionList($action_list);
}
public function buildManagementPanelContent() {
$repository = $this->getRepository();
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())
->setViewer($viewer);
$default_branch = nonempty(
$repository->getDetail('svn-subpath'),
phutil_tag('em', array(), pht('Import Entire Repository')));
$view->addProperty(pht('Import Only'), $default_branch);
return $this->newBox(pht('Subversion'), $view);
}
}