Differential D19855 Diff 47436 src/applications/maniphest/controller/ManiphestTaskSubtaskController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/maniphest/controller/ManiphestTaskSubtaskController.php
Show All 31 Lines | if (!$subtype_options) { | ||||
->setTitle(pht('No Forms')) | ->setTitle(pht('No Forms')) | ||||
->appendParagraph( | ->appendParagraph( | ||||
pht( | pht( | ||||
'You do not have access to any forms which can be used to '. | 'You do not have access to any forms which can be used to '. | ||||
'create a subtask.')) | 'create a subtask.')) | ||||
->addCancelButton($cancel_uri, pht('Close')); | ->addCancelButton($cancel_uri, pht('Close')); | ||||
} | } | ||||
if ($request->isFormPost()) { | $menu = id(new PHUIObjectItemListView()) | ||||
$form_key = $request->getStr('formKey'); | ->setUser($viewer) | ||||
if (isset($subtype_options[$form_key])) { | ->setBig(true) | ||||
->setFlush(true); | |||||
foreach ($subtype_options as $form_key => $subtype_form) { | |||||
$subtype_key = $subtype_form->getSubtype(); | |||||
$subtype = $subtype_map->getSubtype($subtype_key); | |||||
$subtask_uri = id(new PhutilURI("/task/edit/form/{$form_key}/")) | $subtask_uri = id(new PhutilURI("/task/edit/form/{$form_key}/")) | ||||
->setQueryParam('parent', $id) | ->setQueryParam('parent', $id) | ||||
->setQueryParam('template', $id) | ->setQueryParam('template', $id) | ||||
->setQueryParam('status', ManiphestTaskStatus::getDefaultStatus()); | ->setQueryParam('status', ManiphestTaskStatus::getDefaultStatus()); | ||||
$subtask_uri = $this->getApplicationURI($subtask_uri); | $subtask_uri = $this->getApplicationURI($subtask_uri); | ||||
return id(new AphrontRedirectResponse()) | $item = id(new PHUIObjectItemView()) | ||||
->setURI($subtask_uri); | ->setHeader($subtype_form->getDisplayName()) | ||||
} | ->setHref($subtask_uri) | ||||
} | ->setClickable(true) | ||||
->setImageIcon($subtype->newIconView()) | |||||
->addAttribute($subtype->getName()); | |||||
$control = id(new AphrontFormRadioButtonControl()) | $menu->addItem($item); | ||||
->setName('formKey') | |||||
->setLabel(pht('Subtype')); | |||||
foreach ($subtype_options as $key => $subtype_form) { | |||||
$control->addButton( | |||||
$key, | |||||
$subtype_form->getDisplayName(), | |||||
null); | |||||
} | } | ||||
$form = id(new AphrontFormView()) | |||||
->setViewer($viewer) | |||||
->appendControl($control); | |||||
return $this->newDialog() | return $this->newDialog() | ||||
->setTitle(pht('Choose Subtype')) | ->setTitle(pht('Choose Subtype')) | ||||
->appendForm($form) | ->appendChild($menu) | ||||
->addSubmitButton(pht('Continue')) | |||||
->addCancelButton($cancel_uri); | ->addCancelButton($cancel_uri); | ||||
} | } | ||||
} | } |