Changeset View
Changeset View
Standalone View
Standalone View
src/applications/almanac/controller/AlmanacServiceEditController.php
Show First 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | if ($request->isFormPost() && $request->getStr('edit')) { | ||||
} | } | ||||
} | } | ||||
$policies = id(new PhabricatorPolicyQuery()) | $policies = id(new PhabricatorPolicyQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->setObject($service) | ->setObject($service) | ||||
->execute(); | ->execute(); | ||||
if ($v_projects) { | |||||
$project_handles = $this->loadViewerHandles($v_projects); | |||||
} else { | |||||
$project_handles = array(); | |||||
} | |||||
$form = id(new AphrontFormView()) | $form = id(new AphrontFormView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->addHiddenInput('edit', true) | ->addHiddenInput('edit', true) | ||||
->addHiddenInput('serviceClass', $service->getServiceClass()) | ->addHiddenInput('serviceClass', $service->getServiceClass()) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormTextControl()) | id(new AphrontFormTextControl()) | ||||
->setLabel(pht('Name')) | ->setLabel(pht('Name')) | ||||
->setName('name') | ->setName('name') | ||||
->setValue($v_name) | ->setValue($v_name) | ||||
->setError($e_name)) | ->setError($e_name)) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormPolicyControl()) | id(new AphrontFormPolicyControl()) | ||||
->setName('viewPolicy') | ->setName('viewPolicy') | ||||
->setPolicyObject($service) | ->setPolicyObject($service) | ||||
->setCapability(PhabricatorPolicyCapability::CAN_VIEW) | ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) | ||||
->setPolicies($policies)) | ->setPolicies($policies)) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormPolicyControl()) | id(new AphrontFormPolicyControl()) | ||||
->setName('editPolicy') | ->setName('editPolicy') | ||||
->setPolicyObject($service) | ->setPolicyObject($service) | ||||
->setCapability(PhabricatorPolicyCapability::CAN_EDIT) | ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) | ||||
->setPolicies($policies)) | ->setPolicies($policies)) | ||||
->appendChild( | ->appendControl( | ||||
id(new AphrontFormTokenizerControl()) | id(new AphrontFormTokenizerControl()) | ||||
->setLabel(pht('Projects')) | ->setLabel(pht('Projects')) | ||||
->setName('projects') | ->setName('projects') | ||||
->setValue($project_handles) | ->setValue($v_projects) | ||||
->setDatasource(new PhabricatorProjectDatasource())) | ->setDatasource(new PhabricatorProjectDatasource())) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormSubmitControl()) | id(new AphrontFormSubmitControl()) | ||||
->addCancelButton($cancel_uri) | ->addCancelButton($cancel_uri) | ||||
->setValue($save_button)); | ->setValue($save_button)); | ||||
$box = id(new PHUIObjectBoxView()) | $box = id(new PHUIObjectBoxView()) | ||||
->setValidationException($validation_exception) | ->setValidationException($validation_exception) | ||||
▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines |