Changeset View
Changeset View
Standalone View
Standalone View
src/applications/legalpad/query/LegalpadDocumentSearchEngine.php
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | final class LegalpadDocumentSearchEngine | ||||
public function buildSearchForm( | public function buildSearchForm( | ||||
AphrontFormView $form, | AphrontFormView $form, | ||||
PhabricatorSavedQuery $saved_query) { | PhabricatorSavedQuery $saved_query) { | ||||
$creator_phids = $saved_query->getParameter('creatorPHIDs', array()); | $creator_phids = $saved_query->getParameter('creatorPHIDs', array()); | ||||
$contributor_phids = $saved_query->getParameter( | $contributor_phids = $saved_query->getParameter( | ||||
'contributorPHIDs', array()); | 'contributorPHIDs', array()); | ||||
$phids = array_merge($creator_phids, $contributor_phids); | |||||
$handles = id(new PhabricatorHandleQuery()) | |||||
->setViewer($this->requireViewer()) | |||||
->withPHIDs($phids) | |||||
->execute(); | |||||
$viewer_signature = $saved_query->getParameter('withViewerSignature'); | $viewer_signature = $saved_query->getParameter('withViewerSignature'); | ||||
if (!$this->requireViewer()->getPHID()) { | if (!$this->requireViewer()->getPHID()) { | ||||
$viewer_signature = false; | $viewer_signature = false; | ||||
} | } | ||||
$form | $form | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormCheckboxControl()) | id(new AphrontFormCheckboxControl()) | ||||
->addCheckbox( | ->addCheckbox( | ||||
'withViewerSignature', | 'withViewerSignature', | ||||
1, | 1, | ||||
pht('Show only documents I have signed.'), | pht('Show only documents I have signed.'), | ||||
$viewer_signature) | $viewer_signature) | ||||
->setDisabled(!$this->requireViewer()->getPHID())) | ->setDisabled(!$this->requireViewer()->getPHID())) | ||||
->appendChild( | ->appendControl( | ||||
id(new AphrontFormTokenizerControl()) | id(new AphrontFormTokenizerControl()) | ||||
->setDatasource(new PhabricatorPeopleDatasource()) | ->setDatasource(new PhabricatorPeopleDatasource()) | ||||
->setName('creators') | ->setName('creators') | ||||
->setLabel(pht('Creators')) | ->setLabel(pht('Creators')) | ||||
->setValue(array_select_keys($handles, $creator_phids))) | ->setValue($creator_phids)) | ||||
->appendChild( | ->appendControl( | ||||
id(new AphrontFormTokenizerControl()) | id(new AphrontFormTokenizerControl()) | ||||
->setDatasource(new PhabricatorPeopleDatasource()) | ->setDatasource(new PhabricatorPeopleDatasource()) | ||||
->setName('contributors') | ->setName('contributors') | ||||
->setLabel(pht('Contributors')) | ->setLabel(pht('Contributors')) | ||||
->setValue(array_select_keys($handles, $contributor_phids))); | ->setValue($contributor_phids)); | ||||
$this->buildDateRange( | $this->buildDateRange( | ||||
$form, | $form, | ||||
$saved_query, | $saved_query, | ||||
'createdStart', | 'createdStart', | ||||
pht('Created After'), | pht('Created After'), | ||||
'createdEnd', | 'createdEnd', | ||||
pht('Created Before')); | pht('Created Before')); | ||||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |