Differential D20424 Diff 48778 src/applications/diffusion/management/DiffusionRepositoryPublishingManagementPanel.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/management/DiffusionRepositoryPublishingManagementPanel.php
- This file was moved from src/applications/diffusion/management/DiffusionRepositoryActionsManagementPanel.php.
| <?php | <?php | ||||
| final class DiffusionRepositoryActionsManagementPanel | final class DiffusionRepositoryPublishingManagementPanel | ||||
| extends DiffusionRepositoryManagementPanel { | extends DiffusionRepositoryManagementPanel { | ||||
| const PANELKEY = 'actions'; | const PANELKEY = 'publishing'; | ||||
| public function getManagementPanelLabel() { | public function getManagementPanelLabel() { | ||||
| return pht('Actions'); | return pht('Publishing'); | ||||
| } | } | ||||
| public function getManagementPanelOrder() { | public function getManagementPanelOrder() { | ||||
| return 1100; | return 1100; | ||||
| } | } | ||||
| public function getManagementPanelIcon() { | public function getManagementPanelIcon() { | ||||
| $repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
| $has_any = | $has_any = $repository->isPublishingDisabled(); | ||||
| $repository->getDetail('herald-disabled') || | |||||
| $repository->getDetail('disable-autoclose'); | |||||
| // NOTE: Any value here really means something is disabled, so try to | |||||
| // hint that a little bit with the icon. | |||||
| if ($has_any) { | if ($has_any) { | ||||
| return 'fa-flash'; | return 'fa-flash'; | ||||
| } else { | } else { | ||||
| return 'fa-flash grey'; | return 'fa-flash grey'; | ||||
| } | } | ||||
| } | } | ||||
| protected function getEditEngineFieldKeys() { | protected function getEditEngineFieldKeys() { | ||||
| return array( | return array( | ||||
| 'publish', | 'publish', | ||||
| 'autoclose', | |||||
| ); | ); | ||||
| } | } | ||||
| public function buildManagementPanelCurtain() { | public function buildManagementPanelCurtain() { | ||||
| $repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $action_list = $this->newActionList(); | $action_list = $this->newActionList(); | ||||
| $can_edit = PhabricatorPolicyFilter::hasCapability( | $can_edit = PhabricatorPolicyFilter::hasCapability( | ||||
| $viewer, | $viewer, | ||||
| $repository, | $repository, | ||||
| PhabricatorPolicyCapability::CAN_EDIT); | PhabricatorPolicyCapability::CAN_EDIT); | ||||
| $actions_uri = $this->getEditPageURI(); | $publishing_uri = $this->getEditPageURI(); | ||||
| $action_list->addAction( | $action_list->addAction( | ||||
| id(new PhabricatorActionView()) | id(new PhabricatorActionView()) | ||||
| ->setIcon('fa-pencil') | ->setIcon('fa-pencil') | ||||
| ->setName(pht('Edit Actions')) | ->setName(pht('Edit Publishing')) | ||||
| ->setHref($actions_uri) | ->setHref($publishing_uri) | ||||
| ->setDisabled(!$can_edit) | ->setDisabled(!$can_edit) | ||||
| ->setWorkflow(!$can_edit)); | ->setWorkflow(!$can_edit)); | ||||
| return $this->newCurtainView() | return $this->newCurtainView() | ||||
| ->setActionList($action_list); | ->setActionList($action_list); | ||||
| } | } | ||||
| public function buildManagementPanelContent() { | public function buildManagementPanelContent() { | ||||
| $repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $view = id(new PHUIPropertyListView()) | $view = id(new PHUIPropertyListView()) | ||||
| ->setViewer($viewer); | ->setViewer($viewer); | ||||
| $notify = $repository->getDetail('herald-disabled') | $notify = $repository->isPublishingDisabled() | ||||
| ? pht('Off') | ? pht('Off') | ||||
| : pht('On'); | : pht('On'); | ||||
| $notify = phutil_tag('em', array(), $notify); | $notify = phutil_tag('em', array(), $notify); | ||||
| $view->addProperty(pht('Publish/Notify'), $notify); | $view->addProperty(pht('Publishing'), $notify); | ||||
| $autoclose = $repository->getDetail('disable-autoclose') | |||||
| ? pht('Off') | |||||
| : pht('On'); | |||||
| $autoclose = phutil_tag('em', array(), $autoclose); | |||||
| $view->addProperty(pht('Autoclose'), $autoclose); | |||||
| return $this->newBox(pht('Actions'), $view); | return $this->newBox(pht('Publishing'), $view); | ||||
| } | } | ||||
| } | } | ||||