Differential D18523 Diff 44527 src/applications/diffusion/management/DiffusionRepositorySubversionManagementPanel.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/management/DiffusionRepositorySubversionManagementPanel.php
Show All 13 Lines | final class DiffusionRepositorySubversionManagementPanel | ||||
} | } | ||||
public function shouldEnableForRepository( | public function shouldEnableForRepository( | ||||
PhabricatorRepository $repository) { | PhabricatorRepository $repository) { | ||||
return $repository->isSVN(); | return $repository->isSVN(); | ||||
} | } | ||||
public function getManagementPanelIcon() { | public function getManagementPanelIcon() { | ||||
$repository = $this->getRepository(); | return 'fa-folder'; | ||||
$has_any = (bool)$repository->getDetail('svn-subpath'); | |||||
if ($has_any) { | |||||
return 'fa-database'; | |||||
} else { | |||||
return 'fa-database grey'; | |||||
} | |||||
} | } | ||||
protected function getEditEngineFieldKeys() { | protected function getEditEngineFieldKeys() { | ||||
return array( | return array( | ||||
'importOnly', | 'importOnly', | ||||
); | ); | ||||
} | } | ||||
public function buildManagementPanelCurtain() { | public function buildManagementPanelContent() { | ||||
$repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$action_list = $this->getNewActionList(); | |||||
$view = id(new PHUIPropertyListView()) | |||||
->setViewer($viewer); | |||||
$default_branch = nonempty( | |||||
$repository->getHumanReadableDetail('svn-subpath'), | |||||
phutil_tag('em', array(), pht('Import Entire Repository'))); | |||||
$view->addProperty(pht('Import Only'), $default_branch); | |||||
$can_edit = PhabricatorPolicyFilter::hasCapability( | $can_edit = PhabricatorPolicyFilter::hasCapability( | ||||
$viewer, | $viewer, | ||||
$repository, | $repository, | ||||
PhabricatorPolicyCapability::CAN_EDIT); | PhabricatorPolicyCapability::CAN_EDIT); | ||||
$subversion_uri = $this->getEditPageURI(); | $subversion_uri = $this->getEditPageURI(); | ||||
$action_list->addAction( | $button = id(new PHUIButtonView()) | ||||
id(new PhabricatorActionView()) | ->setTag('a') | ||||
->setIcon('fa-pencil') | ->setIcon('fa-pencil') | ||||
->setName(pht('Edit Properties')) | ->setText(pht('Edit')) | ||||
->setHref($subversion_uri) | ->setHref($subversion_uri) | ||||
->setDisabled(!$can_edit) | ->setDisabled(!$can_edit) | ||||
->setWorkflow(!$can_edit)); | ->setWorkflow(!$can_edit); | ||||
return $this->getNewCurtainView($action_list); | |||||
} | |||||
public function buildManagementPanelContent() { | |||||
$repository = $this->getRepository(); | |||||
$viewer = $this->getViewer(); | |||||
$view = id(new PHUIPropertyListView()) | |||||
->setViewer($viewer); | |||||
$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); | return $this->newBox(pht('Subversion'), $view, array($button)); | ||||
} | } | ||||
} | } |