diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 4d4aeda7aa..8e7b09a959 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -4322,6 +4322,7 @@ phutil_register_library_map(array( 'PhabricatorUIExample' => 'applications/uiexample/examples/PhabricatorUIExample.php', 'PhabricatorUIExampleRenderController' => 'applications/uiexample/controller/PhabricatorUIExampleRenderController.php', 'PhabricatorUIExamplesApplication' => 'applications/uiexample/application/PhabricatorUIExamplesApplication.php', + 'PhabricatorURIExportField' => 'infrastructure/export/field/PhabricatorURIExportField.php', 'PhabricatorUSEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php', 'PhabricatorUnifiedDiffsSetting' => 'applications/settings/setting/PhabricatorUnifiedDiffsSetting.php', 'PhabricatorUnitTestContentSource' => 'infrastructure/contentsource/PhabricatorUnitTestContentSource.php', @@ -10023,6 +10024,7 @@ phutil_register_library_map(array( 'PhabricatorUIExample' => 'Phobject', 'PhabricatorUIExampleRenderController' => 'PhabricatorController', 'PhabricatorUIExamplesApplication' => 'PhabricatorApplication', + 'PhabricatorURIExportField' => 'PhabricatorExportField', 'PhabricatorUSEnglishTranslation' => 'PhutilTranslation', 'PhabricatorUnifiedDiffsSetting' => 'PhabricatorSelectSetting', 'PhabricatorUnitTestContentSource' => 'PhabricatorContentSource', diff --git a/src/applications/maniphest/application/PhabricatorManiphestApplication.php b/src/applications/maniphest/application/PhabricatorManiphestApplication.php index 6e4ac0a8f6..4376eb3f32 100644 --- a/src/applications/maniphest/application/PhabricatorManiphestApplication.php +++ b/src/applications/maniphest/application/PhabricatorManiphestApplication.php @@ -50,7 +50,7 @@ final class PhabricatorManiphestApplication extends PhabricatorApplication { return array( '/T(?P[1-9]\d*)' => 'ManiphestTaskDetailController', '/maniphest/' => array( - '(?:query/(?P[^/]+)/)?' => 'ManiphestTaskListController', + $this->getQueryRoutePattern() => 'ManiphestTaskListController', 'report/(?:(?P\w+)/)?' => 'ManiphestReportController', $this->getBulkRoutePattern('bulk/') => 'ManiphestBulkEditController', 'task/' => array( diff --git a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php index ec1956bd8e..caf6eb30f5 100644 --- a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php +++ b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php @@ -432,4 +432,111 @@ final class ManiphestTaskSearchEngine return $view; } + + protected function newExportFields() { + $fields = array( + id(new PhabricatorStringExportField()) + ->setKey('monogram') + ->setLabel(pht('Monogram')), + id(new PhabricatorPHIDExportField()) + ->setKey('authorPHID') + ->setLabel(pht('Author PHID')), + id(new PhabricatorStringExportField()) + ->setKey('author') + ->setLabel(pht('Author')), + id(new PhabricatorPHIDExportField()) + ->setKey('ownerPHID') + ->setLabel(pht('Owner PHID')), + id(new PhabricatorStringExportField()) + ->setKey('owner') + ->setLabel(pht('Owner')), + id(new PhabricatorStringExportField()) + ->setKey('status') + ->setLabel(pht('Status')), + id(new PhabricatorStringExportField()) + ->setKey('statusName') + ->setLabel(pht('Status Name')), + id(new PhabricatorStringExportField()) + ->setKey('priority') + ->setLabel(pht('Priority')), + id(new PhabricatorStringExportField()) + ->setKey('priorityName') + ->setLabel(pht('Priority Name')), + id(new PhabricatorStringExportField()) + ->setKey('subtype') + ->setLabel('string'), + id(new PhabricatorURIExportField()) + ->setKey('uri') + ->setLabel(pht('URI')), + id(new PhabricatorStringExportField()) + ->setKey('title') + ->setLabel(pht('Title')), + id(new PhabricatorStringExportField()) + ->setKey('description') + ->setLabel(pht('Description')), + ); + + if (ManiphestTaskPoints::getIsEnabled()) { + $fields[] = id(new PhabricatorIntExportField()) + ->setKey('points') + ->setLabel('Points'); + } + + return $fields; + } + + protected function newExportData(array $tasks) { + $viewer = $this->requireViewer(); + + $phids = array(); + foreach ($tasks as $task) { + $phids[] = $task->getAuthorPHID(); + $phids[] = $task->getOwnerPHID(); + } + $handles = $viewer->loadHandles($phids); + + $export = array(); + foreach ($tasks as $task) { + + $author_phid = $task->getAuthorPHID(); + if ($author_phid) { + $author_name = $handles[$author_phid]->getName(); + } else { + $author_name = null; + } + + $owner_phid = $task->getOwnerPHID(); + if ($owner_phid) { + $owner_name = $handles[$owner_phid]->getName(); + } else { + $owner_name = null; + } + + $status_value = $task->getStatus(); + $status_name = ManiphestTaskStatus::getTaskStatusName($status_value); + + $priority_value = $task->getPriority(); + $priority_name = ManiphestTaskPriority::getTaskPriorityName( + $priority_value); + + $export[] = array( + 'monogram' => $task->getMonogram(), + 'authorPHID' => $author_phid, + 'author' => $author_name, + 'ownerPHID' => $owner_phid, + 'owner' => $owner_name, + 'status' => $status_value, + 'statusName' => $status_name, + 'priority' => $priority_value, + 'priorityName' => $priority_name, + 'points' => $task->getPoints(), + 'subtype' => $task->getSubtype(), + 'title' => $task->getTitle(), + 'uri' => PhabricatorEnv::getProductionURI($task->getURI()), + 'description' => $task->getDescription(), + ); + } + + return $export; + } } diff --git a/src/infrastructure/export/field/PhabricatorURIExportField.php b/src/infrastructure/export/field/PhabricatorURIExportField.php new file mode 100644 index 0000000000..9ba2cd4b75 --- /dev/null +++ b/src/infrastructure/export/field/PhabricatorURIExportField.php @@ -0,0 +1,4 @@ +