2015-12-03 23:32:40 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class ManiphestEditEngine
|
|
|
|
extends PhabricatorEditEngine {
|
|
|
|
|
|
|
|
const ENGINECONST = 'maniphest.task';
|
|
|
|
|
|
|
|
public function getEngineName() {
|
|
|
|
return pht('Maniphest Tasks');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getEngineApplicationClass() {
|
|
|
|
return 'PhabricatorManiphestApplication';
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function newEditableObject() {
|
|
|
|
return ManiphestTask::initializeNewTask($this->getViewer());
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function newObjectQuery() {
|
|
|
|
return id(new ManiphestTaskQuery());
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getObjectCreateTitleText($object) {
|
|
|
|
return pht('Create New Task');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getObjectEditTitleText($object) {
|
|
|
|
return pht('Edit %s %s', $object->getMonogram(), $object->getTitle());
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getObjectEditShortText($object) {
|
|
|
|
return $object->getMonogram();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getObjectCreateShortText() {
|
|
|
|
return pht('Create Task');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getCommentViewHeaderText($object) {
|
|
|
|
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
|
|
|
|
if (!$is_serious) {
|
|
|
|
return pht('Weigh In');
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getCommentViewHeaderText($object);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getObjectViewURI($object) {
|
|
|
|
return '/'.$object->getMonogram();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function buildCustomEditFields($object) {
|
|
|
|
// See T4819.
|
|
|
|
$status_map = ManiphestTaskStatus::getTaskStatusMap();
|
|
|
|
$dup_status = ManiphestTaskStatus::getDuplicateStatus();
|
|
|
|
if ($object->getStatus() != $dup_status) {
|
|
|
|
unset($status_map[$dup_status]);
|
|
|
|
}
|
|
|
|
|
|
|
|
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
|
|
|
|
|
2015-12-04 15:37:36 +01:00
|
|
|
// TODO: Restore these or toss them:
|
|
|
|
// - Default owner to viewer.
|
|
|
|
// - Don't show "change owner" for closed tasks.
|
|
|
|
// - When closing an unassigned task, assign the closing user.
|
|
|
|
// - Make sure implicit CCs on actions are working reasonably.
|
|
|
|
|
2015-12-04 16:56:03 +01:00
|
|
|
if ($object->isClosed()) {
|
|
|
|
$priority_label = null;
|
|
|
|
$default_status = ManiphestTaskStatus::getDefaultStatus();
|
|
|
|
} else {
|
|
|
|
$priority_label = pht('Change Priority');
|
|
|
|
$default_status = ManiphestTaskStatus::getDefaultClosedStatus();
|
|
|
|
}
|
|
|
|
|
2015-12-03 23:32:40 +01:00
|
|
|
return array(
|
|
|
|
id(new PhabricatorTextEditField())
|
|
|
|
->setKey('title')
|
|
|
|
->setLabel(pht('Title'))
|
2015-12-04 15:37:36 +01:00
|
|
|
->setDescription(pht('Name of the task.'))
|
2015-12-03 23:32:40 +01:00
|
|
|
->setTransactionType(ManiphestTransaction::TYPE_TITLE)
|
|
|
|
->setIsRequired(true)
|
|
|
|
->setValue($object->getTitle()),
|
|
|
|
id(new PhabricatorSelectEditField())
|
|
|
|
->setKey('status')
|
|
|
|
->setLabel(pht('Status'))
|
|
|
|
->setDescription(pht('Status of the task.'))
|
|
|
|
->setTransactionType(ManiphestTransaction::TYPE_STATUS)
|
|
|
|
->setValue($object->getStatus())
|
2015-12-04 16:56:03 +01:00
|
|
|
->setOptions($status_map)
|
|
|
|
->setCommentActionLabel(pht('Change Status'))
|
|
|
|
->setCommentActionDefaultValue($default_status),
|
2015-12-03 23:32:40 +01:00
|
|
|
id(new PhabricatorUsersEditField())
|
2015-12-04 16:21:50 +01:00
|
|
|
->setKey('owner')
|
|
|
|
->setAliases(array('ownerPHID', 'assign', 'assigned'))
|
2015-12-03 23:32:40 +01:00
|
|
|
->setLabel(pht('Assigned To'))
|
|
|
|
->setDescription(pht('User who is responsible for the task.'))
|
|
|
|
->setTransactionType(ManiphestTransaction::TYPE_OWNER)
|
2015-12-04 16:21:50 +01:00
|
|
|
->setSingleValue($object->getOwnerPHID()),
|
2015-12-03 23:32:40 +01:00
|
|
|
id(new PhabricatorSelectEditField())
|
|
|
|
->setKey('priority')
|
|
|
|
->setLabel(pht('Priority'))
|
|
|
|
->setDescription(pht('Priority of the task.'))
|
|
|
|
->setTransactionType(ManiphestTransaction::TYPE_PRIORITY)
|
|
|
|
->setValue($object->getPriority())
|
2015-12-04 16:56:03 +01:00
|
|
|
->setOptions($priority_map)
|
|
|
|
->setCommentActionLabel($priority_label),
|
2015-12-03 23:32:40 +01:00
|
|
|
id(new PhabricatorRemarkupEditField())
|
|
|
|
->setKey('description')
|
|
|
|
->setLabel(pht('Description'))
|
|
|
|
->setDescription(pht('Task description.'))
|
|
|
|
->setTransactionType(ManiphestTransaction::TYPE_DESCRIPTION)
|
|
|
|
->setValue($object->getDescription()),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getEditorURI() {
|
|
|
|
// TODO: Remove when cutting over.
|
|
|
|
return $this->getApplication()->getApplicationURI('editpro/');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|