Changeset View
Changeset View
Standalone View
Standalone View
src/applications/maniphest/editor/ManiphestEditEngine.php
Show First 20 Lines • Show All 209 Lines • ▼ Show 20 Lines | $fields = array( | ||||
id(new PhabricatorSelectEditField()) | id(new PhabricatorSelectEditField()) | ||||
->setKey('priority') | ->setKey('priority') | ||||
->setLabel(pht('Priority')) | ->setLabel(pht('Priority')) | ||||
->setDescription(pht('Priority of the task.')) | ->setDescription(pht('Priority of the task.')) | ||||
->setConduitDescription(pht('Change the priority of the task.')) | ->setConduitDescription(pht('Change the priority of the task.')) | ||||
->setConduitTypeDescription(pht('New task priority constant.')) | ->setConduitTypeDescription(pht('New task priority constant.')) | ||||
->setTransactionType(ManiphestTaskPriorityTransaction::TRANSACTIONTYPE) | ->setTransactionType(ManiphestTaskPriorityTransaction::TRANSACTIONTYPE) | ||||
->setIsCopyable(true) | ->setIsCopyable(true) | ||||
->setValue($object->getPriority()) | ->setValue($object->getPriorityKeyword()) | ||||
->setOptions($priority_map) | ->setOptions($priority_map) | ||||
->setCommentActionLabel(pht('Change Priority')), | ->setCommentActionLabel(pht('Change Priority')), | ||||
); | ); | ||||
if (ManiphestTaskPoints::getIsEnabled()) { | if (ManiphestTaskPoints::getIsEnabled()) { | ||||
$points_label = ManiphestTaskPoints::getPointsLabel(); | $points_label = ManiphestTaskPoints::getPointsLabel(); | ||||
$action_label = ManiphestTaskPoints::getPointsActionLabel(); | $action_label = ManiphestTaskPoints::getPointsActionLabel(); | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | foreach ($status_map as $status => $status_name) { | ||||
} | } | ||||
} | } | ||||
return $status_map; | return $status_map; | ||||
} | } | ||||
private function getTaskPriorityMap(ManiphestTask $task) { | private function getTaskPriorityMap(ManiphestTask $task) { | ||||
$priority_map = ManiphestTaskPriority::getTaskPriorityMap(); | $priority_map = ManiphestTaskPriority::getTaskPriorityMap(); | ||||
$priority_keywords = ManiphestTaskPriority::getTaskPriorityKeywordsMap(); | |||||
$current_priority = $task->getPriority(); | $current_priority = $task->getPriority(); | ||||
$results = array(); | |||||
// If the current value isn't a legitimate one, put it in the dropdown | |||||
// anyway so saving the form doesn't cause a side effects. | |||||
if (idx($priority_map, $current_priority) === null) { | |||||
$priority_map[$current_priority] = pht( | |||||
'<Unknown: %s>', | |||||
$current_priority); | |||||
} | |||||
foreach ($priority_map as $priority => $priority_name) { | foreach ($priority_map as $priority => $priority_name) { | ||||
// Always keep the current priority. | $disabled = ManiphestTaskPriority::isDisabledPriority($priority); | ||||
if ($priority == $current_priority) { | if ($disabled && !($priority == $current_priority)) { | ||||
continue; | continue; | ||||
} | } | ||||
if (ManiphestTaskPriority::isDisabledPriority($priority)) { | $keyword = head(idx($priority_keywords, $priority)); | ||||
unset($priority_map[$priority]); | $results[$keyword] = $priority_name; | ||||
continue; | |||||
} | } | ||||
// If the current value isn't a legitimate one, put it in the dropdown | |||||
// anyway so saving the form doesn't cause any side effects. | |||||
if (idx($priority_map, $current_priority) === null) { | |||||
$results[ManiphestTaskPriority::UNKNOWN_PRIORITY_KEYWORD] = pht( | |||||
'<Unknown: %s>', | |||||
$current_priority); | |||||
} | } | ||||
return $priority_map; | return $results; | ||||
} | } | ||||
protected function newEditResponse( | protected function newEditResponse( | ||||
AphrontRequest $request, | AphrontRequest $request, | ||||
$object, | $object, | ||||
array $xactions) { | array $xactions) { | ||||
if ($request->isAjax()) { | if ($request->isAjax()) { | ||||
▲ Show 20 Lines • Show All 147 Lines • Show Last 20 Lines |