Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diviner/query/DivinerAtomSearchEngine.php
| <?php | <?php | ||||
| final class DivinerAtomSearchEngine extends PhabricatorApplicationSearchEngine { | final class DivinerAtomSearchEngine extends PhabricatorApplicationSearchEngine { | ||||
| public function getResultTypeDescription() { | public function getResultTypeDescription() { | ||||
| return pht('Documentation Atoms'); | return pht('Documentation Atoms'); | ||||
| } | } | ||||
| public function getApplicationClassName() { | public function getApplicationClassName() { | ||||
| return 'PhabricatorDivinerApplication'; | return 'PhabricatorDivinerApplication'; | ||||
| } | } | ||||
| public function buildSavedQueryFromRequest(AphrontRequest $request) { | public function buildSavedQueryFromRequest(AphrontRequest $request) { | ||||
| $saved = new PhabricatorSavedQuery(); | $saved = new PhabricatorSavedQuery(); | ||||
| $saved->setParameter( | $saved->setParameter( | ||||
| 'bookPHIDs', | |||||
| $this->readPHIDsFromRequest($request, 'bookPHIDs')); | |||||
| $saved->setParameter( | |||||
| 'repositoryPHIDs', | 'repositoryPHIDs', | ||||
| $this->readPHIDsFromRequest($request, 'repositoryPHIDs')); | $this->readPHIDsFromRequest($request, 'repositoryPHIDs')); | ||||
| $saved->setParameter('name', $request->getStr('name')); | $saved->setParameter('name', $request->getStr('name')); | ||||
| $saved->setParameter( | $saved->setParameter( | ||||
| 'types', | 'types', | ||||
| $this->readListFromRequest($request, 'types')); | $this->readListFromRequest($request, 'types')); | ||||
| return $saved; | return $saved; | ||||
| } | } | ||||
| public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { | public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { | ||||
| $query = id(new DivinerAtomQuery()); | $query = id(new DivinerAtomQuery()); | ||||
| $books = $saved->getParameter('bookPHIDs'); | |||||
| if ($books) { | |||||
| $query->withBookPHIDs($books); | |||||
| } | |||||
| $repository_phids = $saved->getParameter('repositoryPHIDs'); | $repository_phids = $saved->getParameter('repositoryPHIDs'); | ||||
| if ($repository_phids) { | if ($repository_phids) { | ||||
| $query->withRepositoryPHIDs($repository_phids); | $query->withRepositoryPHIDs($repository_phids); | ||||
| } | } | ||||
| $name = $saved->getParameter('name'); | $name = $saved->getParameter('name'); | ||||
| if ($name) { | if ($name) { | ||||
| $query->withNameContains($name); | $query->withNameContains($name); | ||||
| Show All 32 Lines | foreach ($all_types as $type => $name) { | ||||
| 'types[]', | 'types[]', | ||||
| $type, | $type, | ||||
| $name, | $name, | ||||
| isset($types[$type])); | isset($types[$type])); | ||||
| } | } | ||||
| $form->appendChild($type_control); | $form->appendChild($type_control); | ||||
| $form->appendControl( | $form->appendControl( | ||||
| id(new AphrontFormTokenizerControl()) | id(new AphrontFormTokenizerControl()) | ||||
| ->setDatasource(new DivinerBookDatasource()) | |||||
| ->setName('bookPHIDs') | |||||
| ->setLabel(pht('Books')) | |||||
| ->setValue($saved->getParameter('bookPHIDs'))); | |||||
| $form->appendControl( | |||||
| id(new AphrontFormTokenizerControl()) | |||||
| ->setLabel(pht('Repositories')) | ->setLabel(pht('Repositories')) | ||||
| ->setName('repositoryPHIDs') | ->setName('repositoryPHIDs') | ||||
| ->setDatasource(new DiffusionRepositoryDatasource()) | ->setDatasource(new DiffusionRepositoryDatasource()) | ||||
| ->setValue($saved->getParameter('repositoryPHIDs'))); | ->setValue($saved->getParameter('repositoryPHIDs'))); | ||||
| } | } | ||||
| protected function getURI($path) { | protected function getURI($path) { | ||||
| return '/diviner/'.$path; | return '/diviner/'.$path; | ||||
| ▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines | |||||