1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Expose "withAnyProjects()" in the UI

Summary:
Add an "Any Projects" field to the custom search UI.

This is starting to get ugly but we'll do a design pass on it before toooo long.

Test Plan: {F20423}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1610

Differential Revision: https://secure.phabricator.com/D3632
This commit is contained in:
epriestley 2012-10-04 15:31:14 -07:00
parent 5cbc4fe7e1
commit 5578ccdff2

View file

@ -58,6 +58,7 @@ final class ManiphestTaskListController extends ManiphestController {
$uri = $request->getRequestURI() $uri = $request->getRequestURI()
->alter('users', $this->getArrToStrList('set_users')) ->alter('users', $this->getArrToStrList('set_users'))
->alter('projects', $this->getArrToStrList('set_projects')) ->alter('projects', $this->getArrToStrList('set_projects'))
->alter('aprojects', $this->getArrToStrList('set_aprojects'))
->alter('xprojects', $this->getArrToStrList('set_xprojects')) ->alter('xprojects', $this->getArrToStrList('set_xprojects'))
->alter('owners', $this->getArrToStrList('set_owners')) ->alter('owners', $this->getArrToStrList('set_owners'))
->alter('authors', $this->getArrToStrList('set_authors')) ->alter('authors', $this->getArrToStrList('set_authors'))
@ -118,6 +119,9 @@ final class ManiphestTaskListController extends ManiphestController {
$owner_phids = $query->getParameter('ownerPHIDs', array()); $owner_phids = $query->getParameter('ownerPHIDs', array());
$author_phids = $query->getParameter('authorPHIDs', array()); $author_phids = $query->getParameter('authorPHIDs', array());
$project_phids = $query->getParameter('projectPHIDs', array()); $project_phids = $query->getParameter('projectPHIDs', array());
$any_project_phids = $query->getParameter(
'anyProjectPHIDs',
array());
$exclude_project_phids = $query->getParameter( $exclude_project_phids = $query->getParameter(
'excludeProjectPHIDs', 'excludeProjectPHIDs',
array()); array());
@ -201,15 +205,34 @@ final class ManiphestTaskListController extends ManiphestController {
$tokens[$phid] = $handles[$phid]->getFullName(); $tokens[$phid] = $handles[$phid]->getFullName();
} }
if ($this->view != 'projectall' && $this->view != 'projecttriage') { if ($this->view != 'projectall' && $this->view != 'projecttriage') {
$caption = null;
if ($this->view == 'custom') {
$caption = 'Find tasks in ALL of these projects ("AND" query).';
}
$form->appendChild( $form->appendChild(
id(new AphrontFormTokenizerControl()) id(new AphrontFormTokenizerControl())
->setDatasource('/typeahead/common/searchproject/') ->setDatasource('/typeahead/common/searchproject/')
->setName('set_projects') ->setName('set_projects')
->setLabel('Projects') ->setLabel('Projects')
->setCaption($caption)
->setValue($tokens)); ->setValue($tokens));
} }
if ($this->view == 'custom') { if ($this->view == 'custom') {
$atokens = array();
foreach ($any_project_phids as $phid) {
$atokens[$phid] = $handles[$phid]->getFullName();
}
$form->appendChild(
id(new AphrontFormTokenizerControl())
->setDatasource('/typeahead/common/projects/')
->setName('set_aprojects')
->setLabel('Any Projects')
->setCaption('Find tasks in ANY of these projects ("OR" query).')
->setValue($atokens));
$tokens = array(); $tokens = array();
foreach ($exclude_project_phids as $phid) { foreach ($exclude_project_phids as $phid) {
$tokens[$phid] = $handles[$phid]->getFullName(); $tokens[$phid] = $handles[$phid]->getFullName();
@ -219,6 +242,7 @@ final class ManiphestTaskListController extends ManiphestController {
->setDatasource('/typeahead/common/projects/') ->setDatasource('/typeahead/common/projects/')
->setName('set_xprojects') ->setName('set_xprojects')
->setLabel('Exclude Projects') ->setLabel('Exclude Projects')
->setCaption('Find tasks NOT in any of these projects.')
->setValue($tokens)); ->setValue($tokens));
$priority = ManiphestTaskPriority::getLowestPriority(); $priority = ManiphestTaskPriority::getLowestPriority();
@ -435,6 +459,10 @@ final class ManiphestTaskListController extends ManiphestController {
$query->withoutProjects($xproject_phids); $query->withoutProjects($xproject_phids);
} }
if ($any_project_phids) {
$query->withAnyProjects($any_project_phids);
}
if ($owner_phids) { if ($owner_phids) {
$query->withOwners($owner_phids); $query->withOwners($owner_phids);
} }
@ -473,10 +501,8 @@ final class ManiphestTaskListController extends ManiphestController {
break; break;
case 'projecttriage': case 'projecttriage':
$query->withPriority(ManiphestTaskPriority::PRIORITY_TRIAGE); $query->withPriority(ManiphestTaskPriority::PRIORITY_TRIAGE);
$query->withAnyProjects($any_project_phids);
break; break;
case 'projectall': case 'projectall':
$query->withAnyProjects($any_project_phids);
break; break;
case 'custom': case 'custom':
$query->withPrioritiesBetween($low_priority, $high_priority); $query->withPrioritiesBetween($low_priority, $high_priority);