11
11
return 'PhabricatorFilesApplication';
14
public function buildSavedQueryFromRequest(AphrontRequest $request) {
15
$saved = new PhabricatorSavedQuery();
18
$this->readUsersFromRequest($request, 'authors'));
20
$saved->setParameter('explicit', $request->getBool('explicit'));
21
$saved->setParameter('createdStart', $request->getStr('createdStart'));
22
$saved->setParameter('createdEnd', $request->getStr('createdEnd'));
27
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
28
$query = id(new PhabricatorFileQuery());
30
$author_phids = $saved->getParameter('authorPHIDs', array());
32
$query->withAuthorPHIDs($author_phids);
35
if ($saved->getParameter('explicit')) {
36
$query->showOnlyExplicitUploads(true);
39
$start = $this->parseDateTime($saved->getParameter('createdStart'));
40
$end = $this->parseDateTime($saved->getParameter('createdEnd'));
43
$query->withDateCreatedAfter($start);
47
$query->withDateCreatedBefore($end);
53
public function buildSearchForm(
54
AphrontFormView $form,
55
PhabricatorSavedQuery $saved_query) {
57
$author_phids = $saved_query->getParameter('authorPHIDs', array());
58
$explicit = $saved_query->getParameter('explicit');
62
id(new AphrontFormTokenizerControl())
63
->setDatasource(new PhabricatorPeopleDatasource())
65
->setLabel(pht('Authors'))
66
->setValue($author_phids))
68
id(new AphrontFormCheckboxControl())
72
pht('Show only manually uploaded files.'),
75
$this->buildDateRange(
14
public function newQuery() {
15
return new PhabricatorFileQuery();
18
protected function buildCustomSearchFields() {
20
id(new PhabricatorSearchUsersField())
21
->setKey('authorPHIDs')
22
->setAliases(array('author', 'authors'))
23
->setLabel(pht('Authors')),
24
id(new PhabricatorSearchThreeStateField())
26
->setLabel(pht('Upload Source'))
29
pht('Show Only Manually Uploaded Files'),
30
pht('Hide Manually Uploaded Files')),
31
id(new PhabricatorSearchDateField())
32
->setKey('createdStart')
33
->setLabel(pht('Created After')),
34
id(new PhabricatorSearchDateField())
35
->setKey('createdEnd')
36
->setLabel(pht('Created Before')),
40
protected function getDefaultFieldOrder() {
81
pht('Created Before'));
48
protected function buildQueryFromParameters(array $map) {
49
$query = $this->newQuery();
51
if ($map['authorPHIDs']) {
52
$query->withAuthorPHIDs($map['authorPHIDs']);
55
if ($map['explicit'] !== null) {
56
$query->showOnlyExplicitUploads($map['explicit']);
59
if ($map['createdStart']) {
60
$query->withDateCreatedAfter($map['createdStart']);
63
if ($map['createdEnd']) {
64
$query->withDateCreatedBefore($map['createdEnd']);
84
70
protected function getURI($path) {