diff --git a/src/applications/countdown/query/PhabricatorCountdownQuery.php b/src/applications/countdown/query/PhabricatorCountdownQuery.php index 17fde126f8..e6c410ee49 100644 --- a/src/applications/countdown/query/PhabricatorCountdownQuery.php +++ b/src/applications/countdown/query/PhabricatorCountdownQuery.php @@ -74,4 +74,35 @@ final class PhabricatorCountdownQuery return 'PhabricatorCountdownApplication'; } + public function getBuiltinOrders() { + return array( + 'ending' => array( + 'vector' => array('-epoch', '-id'), + 'name' => pht('End Date (Past to Future)'), + ), + 'unending' => array( + 'vector' => array('epoch', 'id'), + 'name' => pht('End Date (Future to Past)'), + ), + ) + parent::getBuiltinOrders(); + } + + public function getOrderableColumns() { + return array( + 'epoch' => array( + 'table' => $this->getPrimaryTableAlias(), + 'column' => 'epoch', + 'type' => 'int', + ), + ) + parent::getOrderableColumns(); + } + + protected function getPagingValueMap($cursor, array $keys) { + $countdown = $this->loadCursorObject($cursor); + return array( + 'epoch' => $countdown->getEpoch(), + 'id' => $countdown->getID(), + ); + } + } diff --git a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php index 79b329385a..93aec9a037 100644 --- a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php +++ b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php @@ -30,20 +30,18 @@ final class PhabricatorCountdownSearchEngine } protected function buildCustomSearchFields() { - return array( - id(new PhabricatorUsersSearchField()) - ->setLabel(pht('Authors')) - ->setKey('authorPHIDs') - ->setAliases(array('author', 'authors')), - - id(new PhabricatorSearchCheckboxesField()) - ->setKey('upcoming') - ->setOptions(array( + id(new PhabricatorUsersSearchField()) + ->setLabel(pht('Authors')) + ->setKey('authorPHIDs') + ->setAliases(array('author', 'authors')), + id(new PhabricatorSearchCheckboxesField()) + ->setKey('upcoming') + ->setOptions( + array( 'upcoming' => pht('Show only upcoming countdowns.'), )), - ); - + ); } protected function getURI($path) { diff --git a/src/applications/countdown/storage/PhabricatorCountdown.php b/src/applications/countdown/storage/PhabricatorCountdown.php index 1a985b0b83..ad9b1b33aa 100644 --- a/src/applications/countdown/storage/PhabricatorCountdown.php +++ b/src/applications/countdown/storage/PhabricatorCountdown.php @@ -46,6 +46,14 @@ final class PhabricatorCountdown extends PhabricatorCountdownDAO 'description' => 'text', 'mailKey' => 'bytes20', ), + self::CONFIG_KEY_SCHEMA => array( + 'key_epoch' => array( + 'columns' => array('epoch'), + ), + 'key_author' => array( + 'columns' => array('authorPHID', 'epoch'), + ), + ), ) + parent::getConfiguration(); }