Differential D15183 Diff 36655 src/applications/project/controller/PhabricatorProjectColumnEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/controller/PhabricatorProjectColumnEditController.php
| Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | if ($request->isFormPost()) { | ||||
| $values = mpull($columns, 'getSequence'); | $values = mpull($columns, 'getSequence'); | ||||
| $new_sequence = max($values) + 1; | $new_sequence = max($values) + 1; | ||||
| } | } | ||||
| $column->setSequence($new_sequence); | $column->setSequence($new_sequence); | ||||
| } | } | ||||
| $xactions = array(); | $xactions = array(); | ||||
| if (!$column->getProxy()) { | |||||
| $type_name = PhabricatorProjectColumnTransaction::TYPE_NAME; | $type_name = PhabricatorProjectColumnTransaction::TYPE_NAME; | ||||
| $xactions[] = id(new PhabricatorProjectColumnTransaction()) | $xactions[] = id(new PhabricatorProjectColumnTransaction()) | ||||
| ->setTransactionType($type_name) | ->setTransactionType($type_name) | ||||
| ->setNewValue($v_name); | ->setNewValue($v_name); | ||||
| } | |||||
| $type_limit = PhabricatorProjectColumnTransaction::TYPE_LIMIT; | $type_limit = PhabricatorProjectColumnTransaction::TYPE_LIMIT; | ||||
| $xactions[] = id(new PhabricatorProjectColumnTransaction()) | $xactions[] = id(new PhabricatorProjectColumnTransaction()) | ||||
| ->setTransactionType($type_limit) | ->setTransactionType($type_limit) | ||||
| ->setNewValue($v_limit); | ->setNewValue($v_limit); | ||||
| try { | try { | ||||
| $editor = id(new PhabricatorProjectColumnTransactionEditor()) | $editor = id(new PhabricatorProjectColumnTransactionEditor()) | ||||
| ->setActor($viewer) | ->setActor($viewer) | ||||
| ->setContinueOnNoEffect(true) | ->setContinueOnNoEffect(true) | ||||
| ->setContentSourceFromRequest($request) | ->setContentSourceFromRequest($request) | ||||
| ->applyTransactions($column, $xactions); | ->applyTransactions($column, $xactions); | ||||
| return id(new AphrontRedirectResponse())->setURI($view_uri); | return id(new AphrontRedirectResponse())->setURI($view_uri); | ||||
| } catch (PhabricatorApplicationTransactionValidationException $ex) { | } catch (PhabricatorApplicationTransactionValidationException $ex) { | ||||
| $e_name = $ex->getShortMessage($type_name); | $e_name = $ex->getShortMessage($type_name); | ||||
| $e_limit = $ex->getShortMessage($type_limit); | $e_limit = $ex->getShortMessage($type_limit); | ||||
| $validation_exception = $ex; | $validation_exception = $ex; | ||||
| } | } | ||||
| } | } | ||||
| $form = new AphrontFormView(); | $form = id(new AphrontFormView()) | ||||
| $form | ->setUser($request->getUser()); | ||||
| ->setUser($request->getUser()) | |||||
| ->appendChild( | if (!$column->getProxy()) { | ||||
| $form->appendChild( | |||||
| id(new AphrontFormTextControl()) | id(new AphrontFormTextControl()) | ||||
| ->setValue($v_name) | ->setValue($v_name) | ||||
| ->setLabel(pht('Name')) | ->setLabel(pht('Name')) | ||||
| ->setName('name') | ->setName('name') | ||||
| ->setError($e_name) | ->setError($e_name)); | ||||
| ->setCaption( | } | ||||
| pht('This will be displayed as the header of the column.'))) | |||||
| ->appendChild( | $form->appendChild( | ||||
| id(new AphrontFormTextControl()) | id(new AphrontFormTextControl()) | ||||
| ->setValue($v_limit) | ->setValue($v_limit) | ||||
| ->setLabel(pht('Point Limit')) | ->setLabel(pht('Point Limit')) | ||||
| ->setName('limit') | ->setName('limit') | ||||
| ->setError($e_limit) | ->setError($e_limit) | ||||
| ->setCaption( | ->setCaption( | ||||
| pht('Maximum number of points of tasks allowed in the column.'))); | pht('Maximum number of points of tasks allowed in the column.'))); | ||||
| if ($is_new) { | if ($is_new) { | ||||
| $title = pht('Create Column'); | $title = pht('Create Column'); | ||||
| $submit = pht('Create Column'); | $submit = pht('Create Column'); | ||||
| } else { | } else { | ||||
| $title = pht('Edit %s', $column->getDisplayName()); | $title = pht('Edit %s', $column->getDisplayName()); | ||||
| $submit = pht('Save Column'); | $submit = pht('Save Column'); | ||||
| } | } | ||||
| Show All 18 Lines | |||||