Changeset View
Changeset View
Standalone View
Standalone View
src/applications/pholio/controller/PholioMockEditController.php
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | public function processRequest() { | ||||
$e_name = true; | $e_name = true; | ||||
$e_images = true; | $e_images = true; | ||||
$errors = array(); | $errors = array(); | ||||
$posted_mock_images = array(); | $posted_mock_images = array(); | ||||
$v_name = $mock->getName(); | $v_name = $mock->getName(); | ||||
$v_desc = $mock->getDescription(); | $v_desc = $mock->getDescription(); | ||||
$v_status = $mock->getStatus(); | |||||
$v_view = $mock->getViewPolicy(); | $v_view = $mock->getViewPolicy(); | ||||
$v_cc = PhabricatorSubscribersQuery::loadSubscribersForPHID( | $v_cc = PhabricatorSubscribersQuery::loadSubscribersForPHID( | ||||
$mock->getPHID()); | $mock->getPHID()); | ||||
if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
$xactions = array(); | $xactions = array(); | ||||
$type_name = PholioTransactionType::TYPE_NAME; | $type_name = PholioTransactionType::TYPE_NAME; | ||||
$type_desc = PholioTransactionType::TYPE_DESCRIPTION; | $type_desc = PholioTransactionType::TYPE_DESCRIPTION; | ||||
$type_status = PholioTransactionType::TYPE_STATUS; | |||||
$type_view = PhabricatorTransactions::TYPE_VIEW_POLICY; | $type_view = PhabricatorTransactions::TYPE_VIEW_POLICY; | ||||
$type_cc = PhabricatorTransactions::TYPE_SUBSCRIBERS; | $type_cc = PhabricatorTransactions::TYPE_SUBSCRIBERS; | ||||
$v_name = $request->getStr('name'); | $v_name = $request->getStr('name'); | ||||
$v_desc = $request->getStr('description'); | $v_desc = $request->getStr('description'); | ||||
$v_status = $request->getStr('status'); | |||||
$v_view = $request->getStr('can_view'); | $v_view = $request->getStr('can_view'); | ||||
$v_cc = $request->getArr('cc'); | $v_cc = $request->getArr('cc'); | ||||
$mock_xactions = array(); | $mock_xactions = array(); | ||||
$mock_xactions[$type_name] = $v_name; | $mock_xactions[$type_name] = $v_name; | ||||
$mock_xactions[$type_desc] = $v_desc; | $mock_xactions[$type_desc] = $v_desc; | ||||
$mock_xactions[$type_status] = $v_status; | |||||
$mock_xactions[$type_view] = $v_view; | $mock_xactions[$type_view] = $v_view; | ||||
$mock_xactions[$type_cc] = array('=' => $v_cc); | $mock_xactions[$type_cc] = array('=' => $v_cc); | ||||
if (!strlen($request->getStr('name'))) { | if (!strlen($request->getStr('name'))) { | ||||
$e_name = 'Required'; | $e_name = 'Required'; | ||||
$errors[] = pht('You must give the mock a name.'); | $errors[] = pht('You must give the mock a name.'); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 209 Lines • ▼ Show 20 Lines | $form = id(new AphrontFormView()) | ||||
->setError($e_name)) | ->setError($e_name)) | ||||
->appendChild( | ->appendChild( | ||||
id(new PhabricatorRemarkupControl()) | id(new PhabricatorRemarkupControl()) | ||||
->setName('description') | ->setName('description') | ||||
->setValue($v_desc) | ->setValue($v_desc) | ||||
->setLabel(pht('Description')) | ->setLabel(pht('Description')) | ||||
->setUser($user)) | ->setUser($user)) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormSelectControl()) | |||||
->setLabel(pht('Status')) | |||||
->setName('status') | |||||
->setValue($mock->getStatus()) | |||||
->setOptions($mock->getStatuses())) | |||||
->appendChild( | |||||
id(new AphrontFormTokenizerControl()) | id(new AphrontFormTokenizerControl()) | ||||
->setLabel(pht('CC')) | ->setLabel(pht('CC')) | ||||
->setName('cc') | ->setName('cc') | ||||
->setValue($handles) | ->setValue($handles) | ||||
->setUser($user) | ->setUser($user) | ||||
->setDatasource('/typeahead/common/mailable/')) | ->setDatasource('/typeahead/common/mailable/')) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormPolicyControl()) | id(new AphrontFormPolicyControl()) | ||||
Show All 36 Lines |