1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-21 17:58:47 +02:00
phorge-phorge/src/applications/diffusion/management/DiffusionRepositorySubversionManagementPanel.php
epriestley 97c103fa00 Restore edit UI for "Import Only" in Subversion
Summary: Ref T10923. Although I'd ideally like to get rid of this eventually, keep it around for now.

Test Plan:
  - Edited value for an SVN repository.
  - Observed no panel present for a Git repository.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10923

Differential Revision: https://secure.phabricator.com/D15883
2016-05-11 06:47:32 -07:00

77 lines
1.8 KiB
PHP

<?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-database';
} else {
return 'fa-database grey';
}
}
protected function getEditEngineFieldKeys() {
return array(
'importOnly',
);
}
protected function buildManagementPanelActions() {
$repository = $this->getRepository();
$viewer = $this->getViewer();
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
$repository,
PhabricatorPolicyCapability::CAN_EDIT);
$subversion_uri = $this->getEditPageURI();
return array(
id(new PhabricatorActionView())
->setIcon('fa-pencil')
->setName(pht('Edit Properties'))
->setHref($subversion_uri)
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit),
);
}
public function buildManagementPanelContent() {
$repository = $this->getRepository();
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())
->setViewer($viewer)
->setActionList($this->newActions());
$default_branch = nonempty(
$repository->getHumanReadableDetail('svn-subpath'),
phutil_tag('em', array(), pht('Import Entire Repository')));
$view->addProperty(pht('Import Only'), $default_branch);
return $this->newBox(pht('Subversion'), $view);
}
}