Differential D14584 Diff 35308 src/applications/transactions/controller/PhabricatorEditEngineConfigurationViewController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/controller/PhabricatorEditEngineConfigurationViewController.php
| <?php | <?php | ||||
| final class PhabricatorEditEngineConfigurationViewController | final class PhabricatorEditEngineConfigurationViewController | ||||
| extends PhabricatorEditEngineController { | extends PhabricatorEditEngineController { | ||||
| public function shouldAllowPublic() { | public function shouldAllowPublic() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
| $engine_key = $request->getURIData('engineKey'); | |||||
| $this->setEngineKey($engine_key); | |||||
| $key = $request->getURIData('key'); | |||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $config = id(new PhabricatorEditEngineConfigurationQuery()) | $config = $this->loadConfigForEdit(); | ||||
| ->setViewer($viewer) | |||||
| ->withEngineKeys(array($engine_key)) | |||||
| ->withIdentifiers(array($key)) | |||||
| ->executeOne(); | |||||
| if (!$config) { | if (!$config) { | ||||
| return id(new Aphront404Response()); | return id(new Aphront404Response()); | ||||
| } | } | ||||
| $is_concrete = (bool)$config->getID(); | $is_concrete = (bool)$config->getID(); | ||||
| $actions = $this->buildActionView($config); | $actions = $this->buildActionView($config); | ||||
| ▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | private function buildActionView( | ||||
| $view->addAction( | $view->addAction( | ||||
| id(new PhabricatorActionView()) | id(new PhabricatorActionView()) | ||||
| ->setName(pht('Lock / Hide Fields')) | ->setName(pht('Lock / Hide Fields')) | ||||
| ->setIcon('fa-lock') | ->setIcon('fa-lock') | ||||
| ->setHref($lock_uri) | ->setHref($lock_uri) | ||||
| ->setWorkflow(true) | ->setWorkflow(true) | ||||
| ->setDisabled(!$can_edit)); | ->setDisabled(!$can_edit)); | ||||
| $disable_uri = "{$base_uri}/disable/{$form_key}/"; | |||||
| if ($config->getIsDisabled()) { | |||||
| $disable_name = pht('Enable Form'); | |||||
| $disable_icon = 'fa-check'; | |||||
| } else { | |||||
| $disable_name = pht('Disable Form'); | |||||
| $disable_icon = 'fa-ban'; | |||||
| } | |||||
| $view->addAction( | |||||
| id(new PhabricatorActionView()) | |||||
| ->setName($disable_name) | |||||
| ->setIcon($disable_icon) | |||||
| ->setHref($disable_uri) | |||||
| ->setWorkflow(true) | |||||
| ->setDisabled(!$can_edit)); | |||||
| $defaultcreate_uri = "{$base_uri}/defaultcreate/{$form_key}/"; | |||||
| if ($config->getIsDefault()) { | |||||
| $defaultcreate_name = pht('Remove from "Create" Menu'); | |||||
| $defaultcreate_icon = 'fa-minus'; | |||||
| } else { | |||||
| $defaultcreate_name = pht('Add to "Create" Menu'); | |||||
| $defaultcreate_icon = 'fa-plus'; | |||||
| } | |||||
| $view->addAction( | |||||
| id(new PhabricatorActionView()) | |||||
| ->setName($defaultcreate_name) | |||||
| ->setIcon($defaultcreate_icon) | |||||
| ->setHref($defaultcreate_uri) | |||||
| ->setWorkflow(true) | |||||
| ->setDisabled(!$can_edit)); | |||||
| return $view; | return $view; | ||||
| } | } | ||||
| private function buildPropertyView( | private function buildPropertyView( | ||||
| PhabricatorEditEngineConfiguration $config) { | PhabricatorEditEngineConfiguration $config) { | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $properties = id(new PHUIPropertyListView()) | $properties = id(new PHUIPropertyListView()) | ||||
| Show All 38 Lines | |||||