Differential D14702 Diff 35572 src/applications/transactions/query/PhabricatorEditEngineConfigurationSearchEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/query/PhabricatorEditEngineConfigurationSearchEngine.php
| Show All 27 Lines | final class PhabricatorEditEngineConfigurationSearchEngine | ||||
| public function newQuery() { | public function newQuery() { | ||||
| return id(new PhabricatorEditEngineConfigurationQuery()) | return id(new PhabricatorEditEngineConfigurationQuery()) | ||||
| ->withEngineKeys(array($this->getEngineKey())); | ->withEngineKeys(array($this->getEngineKey())); | ||||
| } | } | ||||
| protected function buildQueryFromParameters(array $map) { | protected function buildQueryFromParameters(array $map) { | ||||
| $query = $this->newQuery(); | $query = $this->newQuery(); | ||||
| $is_create = $map['isCreate']; | |||||
| if ($is_create !== null) { | |||||
| $query->withIsDefault($is_create); | |||||
| } | |||||
| $is_edit = $map['isEdit']; | |||||
| if ($is_edit !== null) { | |||||
| $query->withIsEdit($is_edit); | |||||
| } | |||||
| return $query; | return $query; | ||||
| } | } | ||||
| protected function buildCustomSearchFields() { | protected function buildCustomSearchFields() { | ||||
| return array(); | return array( | ||||
| id(new PhabricatorSearchThreeStateField()) | |||||
| ->setLabel(pht('Create')) | |||||
| ->setKey('isCreate') | |||||
| ->setOptions( | |||||
| pht('Show All'), | |||||
| pht('Hide Create Forms'), | |||||
| pht('Show Only Create Forms')), | |||||
| id(new PhabricatorSearchThreeStateField()) | |||||
| ->setLabel(pht('Edit')) | |||||
| ->setKey('isEdit') | |||||
| ->setOptions( | |||||
| pht('Show All'), | |||||
| pht('Hide Edit Forms'), | |||||
| pht('Show Only Edit Forms')), | |||||
| ); | |||||
| } | } | ||||
| protected function getDefaultFieldOrder() { | protected function getDefaultFieldOrder() { | ||||
| return array(); | return array(); | ||||
| } | } | ||||
| protected function getURI($path) { | protected function getURI($path) { | ||||
| return '/transactions/editengine/'.$this->getEngineKey().'/'.$path; | return '/transactions/editengine/'.$this->getEngineKey().'/'.$path; | ||||
| } | } | ||||
| protected function getBuiltinQueryNames() { | protected function getBuiltinQueryNames() { | ||||
| $names = array( | $names = array( | ||||
| 'all' => pht('All Forms'), | 'all' => pht('All Forms'), | ||||
| 'create' => pht('Create Forms'), | |||||
| 'modify' => pht('Edit Forms'), | |||||
| ); | ); | ||||
| return $names; | return $names; | ||||
| } | } | ||||
| public function buildSavedQueryFromBuiltin($query_key) { | public function buildSavedQueryFromBuiltin($query_key) { | ||||
| $query = $this->newSavedQuery(); | $query = $this->newSavedQuery(); | ||||
| $query->setQueryKey($query_key); | $query->setQueryKey($query_key); | ||||
| switch ($query_key) { | switch ($query_key) { | ||||
| case 'all': | case 'all': | ||||
| return $query; | return $query; | ||||
| case 'create': | |||||
| return $query->setParameter('isCreate', true); | |||||
| case 'modify': | |||||
| return $query->setParameter('isEdit', true); | |||||
| } | } | ||||
| return parent::buildSavedQueryFromBuiltin($query_key); | return parent::buildSavedQueryFromBuiltin($query_key); | ||||
| } | } | ||||
| protected function renderResultList( | protected function renderResultList( | ||||
| array $configs, | array $configs, | ||||
| PhabricatorSavedQuery $query, | PhabricatorSavedQuery $query, | ||||
| Show All 17 Lines | foreach ($configs as $config) { | ||||
| $key = $config->getBuiltinKey(); | $key = $config->getBuiltinKey(); | ||||
| } | } | ||||
| $item->setHref("/transactions/editengine/{$engine_key}/view/{$key}/"); | $item->setHref("/transactions/editengine/{$engine_key}/view/{$key}/"); | ||||
| if ($config->getIsDefault()) { | if ($config->getIsDefault()) { | ||||
| $item->addIcon('fa-plus', pht('Default')); | $item->addIcon('fa-plus', pht('Default')); | ||||
| } | } | ||||
| if ($config->getIsEdit()) { | |||||
| $item->addIcon('fa-pencil', pht('Edit Form')); | |||||
| } | |||||
| if ($config->getIsDisabled()) { | if ($config->getIsDisabled()) { | ||||
| $item->addIcon('fa-ban', pht('Disabled')); | $item->addIcon('fa-ban', pht('Disabled')); | ||||
| } | } | ||||
| $list->addItem($item); | $list->addItem($item); | ||||
| } | } | ||||
| return id(new PhabricatorApplicationSearchResultView()) | return id(new PhabricatorApplicationSearchResultView()) | ||||
| ->setObjectList($list); | ->setObjectList($list); | ||||
| } | } | ||||
| } | } | ||||