Differential D8598 Diff 20425 src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | private function newDateControl() { | ||||
// If we don't have anything valid, make sure we pass `null`, since the | // If we don't have anything valid, make sure we pass `null`, since the | ||||
// control special-cases that. | // control special-cases that. | ||||
$control->setValue(nonempty($value, null)); | $control->setValue(nonempty($value, null)); | ||||
return $control; | return $control; | ||||
} | } | ||||
// TODO: Support ApplicationSearch for these fields. We build indexes above, | public function readApplicationSearchValueFromRequest( | ||||
// but don't provide a UI for searching. To do so, we need a reasonable date | PhabricatorApplicationSearchEngine $engine, | ||||
// range control and the ability to add a range constraint. | AphrontRequest $request) { | ||||
$key = $this->getFieldKey(); | |||||
return array( | |||||
'min' => $request->getStr($key.'.min'), | |||||
'max' => $request->getStr($key.'.max'), | |||||
); | |||||
} | |||||
public function applyApplicationSearchConstraintToQuery( | |||||
PhabricatorApplicationSearchEngine $engine, | |||||
PhabricatorCursorPagedPolicyAwareQuery $query, | |||||
$value) { | |||||
$viewer = $this->getViewer(); | |||||
if (!is_array($value)) { | |||||
$value = array(); | |||||
} | |||||
$min_str = idx($value, 'min', ''); | |||||
if (strlen($min_str)) { | |||||
$min = PhabricatorTime::parseLocalTime($min_str, $viewer); | |||||
} else { | |||||
$min = null; | |||||
} | |||||
$max_str = idx($value, 'max', ''); | |||||
if (strlen($max_str)) { | |||||
$max = PhabricatorTime::parseLocalTime($max_str, $viewer); | |||||
} else { | |||||
$max = null; | |||||
} | |||||
if (($min !== null) || ($max !== null)) { | |||||
$query->withApplicationSearchRangeConstraint( | |||||
$this->newNumericIndex(null), | |||||
$min, | |||||
$max); | |||||
} | |||||
} | |||||
public function appendToApplicationSearchForm( | |||||
PhabricatorApplicationSearchEngine $engine, | |||||
AphrontFormView $form, | |||||
$value, | |||||
array $handles) { | |||||
if (!is_array($value)) { | |||||
$value = array(); | |||||
} | |||||
$form | |||||
->appendChild( | |||||
id(new AphrontFormTextControl()) | |||||
->setLabel(pht('%s After', $this->getFieldName())) | |||||
->setName($this->getFieldKey().'.min') | |||||
->setValue(idx($value, 'min', ''))) | |||||
->appendChild( | |||||
id(new AphrontFormTextControl()) | |||||
->setLabel(pht('%s Before', $this->getFieldName())) | |||||
->setName($this->getFieldKey().'.max') | |||||
->setValue(idx($value, 'max', ''))); | |||||
} | |||||
public function getApplicationTransactionTitle( | public function getApplicationTransactionTitle( | ||||
PhabricatorApplicationTransaction $xaction) { | PhabricatorApplicationTransaction $xaction) { | ||||
$author_phid = $xaction->getAuthorPHID(); | $author_phid = $xaction->getAuthorPHID(); | ||||
$old = $xaction->getOldValue(); | $old = $xaction->getOldValue(); | ||||
$new = $xaction->getNewValue(); | $new = $xaction->getNewValue(); | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
Show All 33 Lines |