Differential D13773 Diff 33266 src/applications/maniphest/controller/ManiphestTaskEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/maniphest/controller/ManiphestTaskEditController.php
<?php | <?php | ||||
final class ManiphestTaskEditController extends ManiphestController { | final class ManiphestTaskEditController extends ManiphestController { | ||||
private $id; | public function handleRequest(AphrontRequest $request) { | ||||
$viewer = $this->getViewer(); | |||||
public function willProcessRequest(array $data) { | $id = $request->getURIData('id'); | ||||
$this->id = idx($data, 'id'); | |||||
} | |||||
public function processRequest() { | |||||
$request = $this->getRequest(); | |||||
$user = $request->getUser(); | |||||
$response_type = $request->getStr('responseType', 'task'); | $response_type = $request->getStr('responseType', 'task'); | ||||
$order = $request->getStr('order', PhabricatorProjectColumn::DEFAULT_ORDER); | $order = $request->getStr('order', PhabricatorProjectColumn::DEFAULT_ORDER); | ||||
$can_edit_assign = $this->hasApplicationCapability( | $can_edit_assign = $this->hasApplicationCapability( | ||||
ManiphestEditAssignCapability::CAPABILITY); | ManiphestEditAssignCapability::CAPABILITY); | ||||
$can_edit_policies = $this->hasApplicationCapability( | $can_edit_policies = $this->hasApplicationCapability( | ||||
ManiphestEditPoliciesCapability::CAPABILITY); | ManiphestEditPoliciesCapability::CAPABILITY); | ||||
$can_edit_priority = $this->hasApplicationCapability( | $can_edit_priority = $this->hasApplicationCapability( | ||||
ManiphestEditPriorityCapability::CAPABILITY); | ManiphestEditPriorityCapability::CAPABILITY); | ||||
$can_edit_projects = $this->hasApplicationCapability( | $can_edit_projects = $this->hasApplicationCapability( | ||||
ManiphestEditProjectsCapability::CAPABILITY); | ManiphestEditProjectsCapability::CAPABILITY); | ||||
$can_edit_status = $this->hasApplicationCapability( | $can_edit_status = $this->hasApplicationCapability( | ||||
ManiphestEditStatusCapability::CAPABILITY); | ManiphestEditStatusCapability::CAPABILITY); | ||||
$can_create_projects = PhabricatorPolicyFilter::hasCapability( | $can_create_projects = PhabricatorPolicyFilter::hasCapability( | ||||
$user, | $viewer, | ||||
PhabricatorApplication::getByClass('PhabricatorProjectApplication'), | PhabricatorApplication::getByClass('PhabricatorProjectApplication'), | ||||
ProjectCreateProjectsCapability::CAPABILITY); | ProjectCreateProjectsCapability::CAPABILITY); | ||||
$parent_task = null; | $parent_task = null; | ||||
$template_id = null; | $template_id = null; | ||||
if ($this->id) { | if ($id) { | ||||
$task = id(new ManiphestTaskQuery()) | $task = id(new ManiphestTaskQuery()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->requireCapabilities( | ->requireCapabilities( | ||||
array( | array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
)) | )) | ||||
->withIDs(array($this->id)) | ->withIDs(array($id)) | ||||
->needSubscriberPHIDs(true) | ->needSubscriberPHIDs(true) | ||||
->needProjectPHIDs(true) | ->needProjectPHIDs(true) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$task) { | if (!$task) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
} else { | } else { | ||||
$task = ManiphestTask::initializeNewTask($user); | $task = ManiphestTask::initializeNewTask($viewer); | ||||
// We currently do not allow you to set the task status when creating | // We currently do not allow you to set the task status when creating | ||||
// a new task, although now that statuses are custom it might make | // a new task, although now that statuses are custom it might make | ||||
// sense. | // sense. | ||||
$can_edit_status = false; | $can_edit_status = false; | ||||
// These allow task creation with defaults. | // These allow task creation with defaults. | ||||
if (!$request->isFormPost()) { | if (!$request->isFormPost()) { | ||||
Show All 16 Lines | if ($id) { | ||||
continue; | continue; | ||||
} | } | ||||
// Add a "#" prefix. | // Add a "#" prefix. | ||||
$tokens[$key] = '#'.$token; | $tokens[$key] = '#'.$token; | ||||
} | } | ||||
$default_projects = id(new PhabricatorObjectQuery()) | $default_projects = id(new PhabricatorObjectQuery()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->withNames($tokens) | ->withNames($tokens) | ||||
->execute(); | ->execute(); | ||||
$default_projects = mpull($default_projects, 'getPHID'); | $default_projects = mpull($default_projects, 'getPHID'); | ||||
if ($default_projects) { | if ($default_projects) { | ||||
$task->attachProjectPHIDs($default_projects); | $task->attachProjectPHIDs($default_projects); | ||||
} | } | ||||
} | } | ||||
Show All 10 Lines | if ($id) { | ||||
} | } | ||||
$task->setDescription($request->getStr('description')); | $task->setDescription($request->getStr('description')); | ||||
if ($can_edit_assign) { | if ($can_edit_assign) { | ||||
$assign = $request->getStr('assign'); | $assign = $request->getStr('assign'); | ||||
if (strlen($assign)) { | if (strlen($assign)) { | ||||
$assign_user = id(new PhabricatorPeopleQuery()) | $assign_user = id(new PhabricatorPeopleQuery()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->withUsernames(array($assign)) | ->withUsernames(array($assign)) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$assign_user) { | if (!$assign_user) { | ||||
$assign_user = id(new PhabricatorPeopleQuery()) | $assign_user = id(new PhabricatorPeopleQuery()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->withPHIDs(array($assign)) | ->withPHIDs(array($assign)) | ||||
->executeOne(); | ->executeOne(); | ||||
} | } | ||||
if ($assign_user) { | if ($assign_user) { | ||||
$task->setOwnerPHID($assign_user->getPHID()); | $task->setOwnerPHID($assign_user->getPHID()); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
$template_id = $request->getInt('template'); | $template_id = $request->getInt('template'); | ||||
// You can only have a parent task if you're creating a new task. | // You can only have a parent task if you're creating a new task. | ||||
$parent_id = $request->getInt('parent'); | $parent_id = $request->getInt('parent'); | ||||
if (strlen($parent_id)) { | if (strlen($parent_id)) { | ||||
$parent_task = id(new ManiphestTaskQuery()) | $parent_task = id(new ManiphestTaskQuery()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->withIDs(array($parent_id)) | ->withIDs(array($parent_id)) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$parent_task) { | if (!$parent_task) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
if (!$template_id) { | if (!$template_id) { | ||||
$template_id = $parent_id; | $template_id = $parent_id; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
$errors = array(); | $errors = array(); | ||||
$e_title = true; | $e_title = true; | ||||
$field_list = PhabricatorCustomField::getObjectFields( | $field_list = PhabricatorCustomField::getObjectFields( | ||||
$task, | $task, | ||||
PhabricatorCustomField::ROLE_EDIT); | PhabricatorCustomField::ROLE_EDIT); | ||||
$field_list->setViewer($user); | $field_list->setViewer($viewer); | ||||
$field_list->readFieldsFromStorage($task); | $field_list->readFieldsFromStorage($task); | ||||
$aux_fields = $field_list->getFields(); | $aux_fields = $field_list->getFields(); | ||||
$v_space = $task->getSpacePHID(); | $v_space = $task->getSpacePHID(); | ||||
if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
$changes = array(); | $changes = array(); | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | if ($request->isFormPost()) { | ||||
if ($can_edit_projects) { | if ($can_edit_projects) { | ||||
$projects = $request->getArr('projects'); | $projects = $request->getArr('projects'); | ||||
$changes[PhabricatorTransactions::TYPE_EDGE] = | $changes[PhabricatorTransactions::TYPE_EDGE] = | ||||
$projects; | $projects; | ||||
$column_phid = $request->getStr('columnPHID'); | $column_phid = $request->getStr('columnPHID'); | ||||
// allow for putting a task in a project column at creation -only- | // allow for putting a task in a project column at creation -only- | ||||
if (!$task->getID() && $column_phid && $projects) { | if (!$task->getID() && $column_phid && $projects) { | ||||
$column = id(new PhabricatorProjectColumnQuery()) | $column = id(new PhabricatorProjectColumnQuery()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->withProjectPHIDs($projects) | ->withProjectPHIDs($projects) | ||||
->withPHIDs(array($column_phid)) | ->withPHIDs(array($column_phid)) | ||||
->executeOne(); | ->executeOne(); | ||||
if ($column) { | if ($column) { | ||||
$changes[ManiphestTransaction::TYPE_PROJECT_COLUMN] = | $changes[ManiphestTransaction::TYPE_PROJECT_COLUMN] = | ||||
array( | array( | ||||
'new' => array( | 'new' => array( | ||||
'projectPHID' => $column->getProjectPHID(), | 'projectPHID' => $column->getProjectPHID(), | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | if ($request->isFormPost()) { | ||||
$event = new PhabricatorEvent( | $event = new PhabricatorEvent( | ||||
PhabricatorEventType::TYPE_MANIPHEST_WILLEDITTASK, | PhabricatorEventType::TYPE_MANIPHEST_WILLEDITTASK, | ||||
array( | array( | ||||
'task' => $task, | 'task' => $task, | ||||
'new' => $is_new, | 'new' => $is_new, | ||||
'transactions' => $transactions, | 'transactions' => $transactions, | ||||
)); | )); | ||||
$event->setUser($user); | $event->setUser($viewer); | ||||
$event->setAphrontRequest($request); | $event->setAphrontRequest($request); | ||||
PhutilEventEngine::dispatchEvent($event); | PhutilEventEngine::dispatchEvent($event); | ||||
$task = $event->getValue('task'); | $task = $event->getValue('task'); | ||||
$transactions = $event->getValue('transactions'); | $transactions = $event->getValue('transactions'); | ||||
$editor = id(new ManiphestTransactionEditor()) | $editor = id(new ManiphestTransactionEditor()) | ||||
->setActor($user) | ->setActor($viewer) | ||||
->setContentSourceFromRequest($request) | ->setContentSourceFromRequest($request) | ||||
->setContinueOnNoEffect(true) | ->setContinueOnNoEffect(true) | ||||
->applyTransactions($task, $transactions); | ->applyTransactions($task, $transactions); | ||||
$event = new PhabricatorEvent( | $event = new PhabricatorEvent( | ||||
PhabricatorEventType::TYPE_MANIPHEST_DIDEDITTASK, | PhabricatorEventType::TYPE_MANIPHEST_DIDEDITTASK, | ||||
array( | array( | ||||
'task' => $task, | 'task' => $task, | ||||
'new' => $is_new, | 'new' => $is_new, | ||||
'transactions' => $transactions, | 'transactions' => $transactions, | ||||
)); | )); | ||||
$event->setUser($user); | $event->setUser($viewer); | ||||
$event->setAphrontRequest($request); | $event->setAphrontRequest($request); | ||||
PhutilEventEngine::dispatchEvent($event); | PhutilEventEngine::dispatchEvent($event); | ||||
} | } | ||||
if ($parent_task) { | if ($parent_task) { | ||||
// TODO: This should be transactional now. | // TODO: This should be transactional now. | ||||
id(new PhabricatorEdgeEditor()) | id(new PhabricatorEdgeEditor()) | ||||
->addEdge( | ->addEdge( | ||||
$parent_task->getPHID(), | $parent_task->getPHID(), | ||||
ManiphestTaskDependsOnTaskEdgeType::EDGECONST, | ManiphestTaskDependsOnTaskEdgeType::EDGECONST, | ||||
$task->getPHID()) | $task->getPHID()) | ||||
->save(); | ->save(); | ||||
$workflow = $parent_task->getID(); | $workflow = $parent_task->getID(); | ||||
} | } | ||||
if ($request->isAjax()) { | if ($request->isAjax()) { | ||||
switch ($response_type) { | switch ($response_type) { | ||||
case 'card': | case 'card': | ||||
$owner = null; | $owner = null; | ||||
if ($task->getOwnerPHID()) { | if ($task->getOwnerPHID()) { | ||||
$owner = id(new PhabricatorHandleQuery()) | $owner = id(new PhabricatorHandleQuery()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->withPHIDs(array($task->getOwnerPHID())) | ->withPHIDs(array($task->getOwnerPHID())) | ||||
->executeOne(); | ->executeOne(); | ||||
} | } | ||||
$tasks = id(new ProjectBoardTaskCard()) | $tasks = id(new ProjectBoardTaskCard()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->setTask($task) | ->setTask($task) | ||||
->setOwner($owner) | ->setOwner($owner) | ||||
->setCanEdit(true) | ->setCanEdit(true) | ||||
->getItem(); | ->getItem(); | ||||
$column = id(new PhabricatorProjectColumnQuery()) | $column = id(new PhabricatorProjectColumnQuery()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->withPHIDs(array($request->getStr('columnPHID'))) | ->withPHIDs(array($request->getStr('columnPHID'))) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$column) { | if (!$column) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
// re-load projects for accuracy as they are not re-loaded via | // re-load projects for accuracy as they are not re-loaded via | ||||
// the editor | // the editor | ||||
$project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( | $project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( | ||||
$task->getPHID(), | $task->getPHID(), | ||||
PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); | PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); | ||||
$task->attachProjectPHIDs($project_phids); | $task->attachProjectPHIDs($project_phids); | ||||
$remove_from_board = false; | $remove_from_board = false; | ||||
if (!in_array($column->getProjectPHID(), $project_phids)) { | if (!in_array($column->getProjectPHID(), $project_phids)) { | ||||
$remove_from_board = true; | $remove_from_board = true; | ||||
} | } | ||||
$positions = id(new PhabricatorProjectColumnPositionQuery()) | $positions = id(new PhabricatorProjectColumnPositionQuery()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->withColumns(array($column)) | ->withColumns(array($column)) | ||||
->execute(); | ->execute(); | ||||
$task_phids = mpull($positions, 'getObjectPHID'); | $task_phids = mpull($positions, 'getObjectPHID'); | ||||
$column_tasks = id(new ManiphestTaskQuery()) | $column_tasks = id(new ManiphestTaskQuery()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->withPHIDs($task_phids) | ->withPHIDs($task_phids) | ||||
->execute(); | ->execute(); | ||||
if ($order == PhabricatorProjectColumn::ORDER_NATURAL) { | if ($order == PhabricatorProjectColumn::ORDER_NATURAL) { | ||||
// TODO: This is a little bit awkward, because PHP and JS use | // TODO: This is a little bit awkward, because PHP and JS use | ||||
// slightly different sort order parameters to achieve the same | // slightly different sort order parameters to achieve the same | ||||
// effect. It would be good to unify this a bit at some point. | // effect. It would be good to unify this a bit at some point. | ||||
$sort_map = array(); | $sort_map = array(); | ||||
Show All 35 Lines | if ($request->isFormPost()) { | ||||
} | } | ||||
return id(new AphrontRedirectResponse()) | return id(new AphrontRedirectResponse()) | ||||
->setURI($redirect_uri); | ->setURI($redirect_uri); | ||||
} | } | ||||
} else { | } else { | ||||
if (!$task->getID()) { | if (!$task->getID()) { | ||||
$task->attachSubscriberPHIDs(array( | $task->attachSubscriberPHIDs(array( | ||||
$user->getPHID(), | $viewer->getPHID(), | ||||
)); | )); | ||||
if ($template_id) { | if ($template_id) { | ||||
$template_task = id(new ManiphestTaskQuery()) | $template_task = id(new ManiphestTaskQuery()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->withIDs(array($template_id)) | ->withIDs(array($template_id)) | ||||
->needSubscriberPHIDs(true) | ->needSubscriberPHIDs(true) | ||||
->needProjectPHIDs(true) | ->needProjectPHIDs(true) | ||||
->executeOne(); | ->executeOne(); | ||||
if ($template_task) { | if ($template_task) { | ||||
$cc_phids = array_unique(array_merge( | $cc_phids = array_unique(array_merge( | ||||
$template_task->getSubscriberPHIDs(), | $template_task->getSubscriberPHIDs(), | ||||
array($user->getPHID()))); | array($viewer->getPHID()))); | ||||
$task->attachSubscriberPHIDs($cc_phids); | $task->attachSubscriberPHIDs($cc_phids); | ||||
$task->attachProjectPHIDs($template_task->getProjectPHIDs()); | $task->attachProjectPHIDs($template_task->getProjectPHIDs()); | ||||
$task->setOwnerPHID($template_task->getOwnerPHID()); | $task->setOwnerPHID($template_task->getOwnerPHID()); | ||||
$task->setPriority($template_task->getPriority()); | $task->setPriority($template_task->getPriority()); | ||||
$task->setViewPolicy($template_task->getViewPolicy()); | $task->setViewPolicy($template_task->getViewPolicy()); | ||||
$task->setEditPolicy($template_task->getEditPolicy()); | $task->setEditPolicy($template_task->getEditPolicy()); | ||||
$v_space = $template_task->getSpacePHID(); | $v_space = $template_task->getSpacePHID(); | ||||
Show All 9 Lines | if ($request->isFormPost()) { | ||||
} | } | ||||
if (empty($aux_fields[$key])) { | if (empty($aux_fields[$key])) { | ||||
unset($fields[$key]); | unset($fields[$key]); | ||||
} | } | ||||
} | } | ||||
if ($fields) { | if ($fields) { | ||||
id(new PhabricatorCustomFieldList($fields)) | id(new PhabricatorCustomFieldList($fields)) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->readFieldsFromStorage($template_task); | ->readFieldsFromStorage($template_task); | ||||
foreach ($fields as $key => $field) { | foreach ($fields as $key => $field) { | ||||
$aux_fields[$key]->setValueFromStorage( | $aux_fields[$key]->setValueFromStorage( | ||||
$field->getValueForStorage()); | $field->getValueForStorage()); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | public function handleRequest(AphrontRequest $request) { | ||||
} | } | ||||
require_celerity_resource('maniphest-task-edit-css'); | require_celerity_resource('maniphest-task-edit-css'); | ||||
$project_tokenizer_id = celerity_generate_unique_node_id(); | $project_tokenizer_id = celerity_generate_unique_node_id(); | ||||
$form = new AphrontFormView(); | $form = new AphrontFormView(); | ||||
$form | $form | ||||
->setUser($user) | ->setUser($viewer) | ||||
->addHiddenInput('template', $template_id) | ->addHiddenInput('template', $template_id) | ||||
->addHiddenInput('responseType', $response_type) | ->addHiddenInput('responseType', $response_type) | ||||
->addHiddenInput('order', $order) | ->addHiddenInput('order', $order) | ||||
->addHiddenInput('ungrippable', $request->getStr('ungrippable')) | ->addHiddenInput('ungrippable', $request->getStr('ungrippable')) | ||||
->addHiddenInput('columnPHID', $request->getStr('columnPHID')); | ->addHiddenInput('columnPHID', $request->getStr('columnPHID')); | ||||
if ($parent_task) { | if ($parent_task) { | ||||
$form | $form | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormStaticControl()) | id(new AphrontFormStaticControl()) | ||||
->setLabel(pht('Parent Task')) | ->setLabel(pht('Parent Task')) | ||||
->setValue($user->renderHandle($parent_task->getPHID()))) | ->setValue($viewer->renderHandle($parent_task->getPHID()))) | ||||
->addHiddenInput('parent', $parent_task->getID()); | ->addHiddenInput('parent', $parent_task->getID()); | ||||
} | } | ||||
$form | $form | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormTextAreaControl()) | id(new AphrontFormTextAreaControl()) | ||||
->setLabel(pht('Title')) | ->setLabel(pht('Title')) | ||||
->setName('title') | ->setName('title') | ||||
Show All 15 Lines | if ($can_edit_status) { | ||||
id(new AphrontFormSelectControl()) | id(new AphrontFormSelectControl()) | ||||
->setLabel(pht('Status')) | ->setLabel(pht('Status')) | ||||
->setName('status') | ->setName('status') | ||||
->setValue($task->getStatus()) | ->setValue($task->getStatus()) | ||||
->setOptions($status_map)); | ->setOptions($status_map)); | ||||
} | } | ||||
$policies = id(new PhabricatorPolicyQuery()) | $policies = id(new PhabricatorPolicyQuery()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->setObject($task) | ->setObject($task) | ||||
->execute(); | ->execute(); | ||||
if ($can_edit_assign) { | if ($can_edit_assign) { | ||||
$form->appendControl( | $form->appendControl( | ||||
id(new AphrontFormTokenizerControl()) | id(new AphrontFormTokenizerControl()) | ||||
->setLabel(pht('Assigned To')) | ->setLabel(pht('Assigned To')) | ||||
->setName('assigned_to') | ->setName('assigned_to') | ||||
->setValue($assigned_value) | ->setValue($assigned_value) | ||||
->setUser($user) | ->setUser($viewer) | ||||
->setDatasource(new PhabricatorPeopleDatasource()) | ->setDatasource(new PhabricatorPeopleDatasource()) | ||||
->setLimit(1)); | ->setLimit(1)); | ||||
} | } | ||||
$form | $form | ||||
->appendControl( | ->appendControl( | ||||
id(new AphrontFormTokenizerControl()) | id(new AphrontFormTokenizerControl()) | ||||
->setLabel(pht('CC')) | ->setLabel(pht('CC')) | ||||
->setName('cc') | ->setName('cc') | ||||
->setValue($cc_value) | ->setValue($cc_value) | ||||
->setUser($user) | ->setUser($viewer) | ||||
->setDatasource(new PhabricatorMetaMTAMailableDatasource())); | ->setDatasource(new PhabricatorMetaMTAMailableDatasource())); | ||||
if ($can_edit_priority) { | if ($can_edit_priority) { | ||||
$form | $form | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormSelectControl()) | id(new AphrontFormSelectControl()) | ||||
->setLabel(pht('Priority')) | ->setLabel(pht('Priority')) | ||||
->setName('priority') | ->setName('priority') | ||||
->setOptions($priority_map) | ->setOptions($priority_map) | ||||
->setValue($task->getPriority())); | ->setValue($task->getPriority())); | ||||
} | } | ||||
if ($can_edit_policies) { | if ($can_edit_policies) { | ||||
$form | $form | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormPolicyControl()) | id(new AphrontFormPolicyControl()) | ||||
->setUser($user) | ->setUser($viewer) | ||||
->setCapability(PhabricatorPolicyCapability::CAN_VIEW) | ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) | ||||
->setPolicyObject($task) | ->setPolicyObject($task) | ||||
->setPolicies($policies) | ->setPolicies($policies) | ||||
->setSpacePHID($v_space) | ->setSpacePHID($v_space) | ||||
->setName('viewPolicy')) | ->setName('viewPolicy')) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormPolicyControl()) | id(new AphrontFormPolicyControl()) | ||||
->setUser($user) | ->setUser($viewer) | ||||
->setCapability(PhabricatorPolicyCapability::CAN_EDIT) | ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) | ||||
->setPolicyObject($task) | ->setPolicyObject($task) | ||||
->setPolicies($policies) | ->setPolicies($policies) | ||||
->setName('editPolicy')); | ->setName('editPolicy')); | ||||
} | } | ||||
if ($can_edit_projects) { | if ($can_edit_projects) { | ||||
$caption = null; | $caption = null; | ||||
Show All 26 Lines | Javelin::initBehavior('project-create', array( | ||||
'tokenizerID' => $project_tokenizer_id, | 'tokenizerID' => $project_tokenizer_id, | ||||
)); | )); | ||||
$description_control = id(new PhabricatorRemarkupControl()) | $description_control = id(new PhabricatorRemarkupControl()) | ||||
->setLabel(pht('Description')) | ->setLabel(pht('Description')) | ||||
->setName('description') | ->setName('description') | ||||
->setID('description-textarea') | ->setID('description-textarea') | ||||
->setValue($task->getDescription()) | ->setValue($task->getDescription()) | ||||
->setUser($user); | ->setUser($viewer); | ||||
$form | $form | ||||
->appendChild($description_control); | ->appendChild($description_control); | ||||
if ($request->isAjax()) { | if ($request->isAjax()) { | ||||
$dialog = id(new AphrontDialogView()) | $dialog = id(new AphrontDialogView()) | ||||
->setUser($user) | ->setUser($viewer) | ||||
->setWidth(AphrontDialogView::WIDTH_FULL) | ->setWidth(AphrontDialogView::WIDTH_FULL) | ||||
->setTitle($header_name) | ->setTitle($header_name) | ||||
->appendChild( | ->appendChild( | ||||
array( | array( | ||||
$error_view, | $error_view, | ||||
$form->buildLayoutView(), | $form->buildLayoutView(), | ||||
)) | )) | ||||
->addCancelButton($cancel_uri) | ->addCancelButton($cancel_uri) | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |