Differential D18570 Diff 44603 src/applications/passphrase/controller/PassphraseCredentialEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/passphrase/controller/PassphraseCredentialEditController.php
Show First 20 Lines • Show All 244 Lines • ▼ Show 20 Lines | $form = id(new AphrontFormView()) | ||||
->setError($e_name)) | ->setError($e_name)) | ||||
->appendChild( | ->appendChild( | ||||
id(new PhabricatorRemarkupControl()) | id(new PhabricatorRemarkupControl()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->setName('description') | ->setName('description') | ||||
->setLabel(pht('Description')) | ->setLabel(pht('Description')) | ||||
->setValue($v_desc)) | ->setValue($v_desc)) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormMarkupControl()) | |||||
->setLabel(pht('Credential Type')) | |||||
->setValue($type->getCredentialTypeName())) | |||||
->appendChild( | |||||
id(new AphrontFormDividerControl())) | id(new AphrontFormDividerControl())) | ||||
->appendControl( | ->appendControl( | ||||
id(new AphrontFormPolicyControl()) | id(new AphrontFormPolicyControl()) | ||||
->setName('viewPolicy') | ->setName('viewPolicy') | ||||
->setPolicyObject($credential) | ->setPolicyObject($credential) | ||||
->setSpacePHID($v_space) | ->setSpacePHID($v_space) | ||||
->setCapability(PhabricatorPolicyCapability::CAN_VIEW) | ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) | ||||
->setPolicies($policies)) | ->setPolicies($policies)) | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | if ($is_new) { | ||||
$v_is_locked) | $v_is_locked) | ||||
->setDisabled($credential_is_locked)); | ->setDisabled($credential_is_locked)); | ||||
} | } | ||||
$crumbs = $this->buildApplicationCrumbs(); | $crumbs = $this->buildApplicationCrumbs(); | ||||
$crumbs->setBorder(true); | $crumbs->setBorder(true); | ||||
if ($is_new) { | if ($is_new) { | ||||
$title = pht('Create New Credential'); | $title = pht('New Credential: %s', $type->getCredentialTypeName()); | ||||
$crumbs->addTextCrumb(pht('Create')); | $crumbs->addTextCrumb(pht('Create')); | ||||
$cancel_uri = $this->getApplicationURI(); | $cancel_uri = $this->getApplicationURI(); | ||||
$header_icon = 'fa-plus-square'; | |||||
} else { | } else { | ||||
$title = pht('Edit Credential: %s', $credential->getName()); | $title = pht('Edit Credential: %s', $credential->getName()); | ||||
$crumbs->addTextCrumb( | $crumbs->addTextCrumb( | ||||
'K'.$credential->getID(), | 'K'.$credential->getID(), | ||||
'/K'.$credential->getID()); | '/K'.$credential->getID()); | ||||
$crumbs->addTextCrumb(pht('Edit')); | $crumbs->addTextCrumb(pht('Edit')); | ||||
$cancel_uri = '/K'.$credential->getID(); | $cancel_uri = '/K'.$credential->getID(); | ||||
$header_icon = 'fa-pencil'; | |||||
} | } | ||||
if ($request->isAjax()) { | if ($request->isAjax()) { | ||||
if ($errors) { | if ($errors) { | ||||
$errors = id(new PHUIInfoView())->setErrors($errors); | $errors = id(new PHUIInfoView())->setErrors($errors); | ||||
} | } | ||||
return $this->newDialog() | return $this->newDialog() | ||||
->setWidth(AphrontDialogView::WIDTH_FORM) | ->setWidth(AphrontDialogView::WIDTH_FORM) | ||||
->setTitle($title) | ->setTitle($title) | ||||
->appendChild($errors) | ->appendChild($errors) | ||||
->appendChild($form->buildLayoutView()) | ->appendChild($form->buildLayoutView()) | ||||
->addSubmitButton(pht('Create Credential')) | ->addSubmitButton(pht('Create Credential')) | ||||
->addCancelButton($cancel_uri); | ->addCancelButton($cancel_uri); | ||||
} | } | ||||
$form->appendChild( | $form->appendChild( | ||||
id(new AphrontFormSubmitControl()) | id(new AphrontFormSubmitControl()) | ||||
->setValue(pht('Save')) | ->setValue(pht('Save')) | ||||
->addCancelButton($cancel_uri)); | ->addCancelButton($cancel_uri)); | ||||
$box = id(new PHUIObjectBoxView()) | $box = id(new PHUIObjectBoxView()) | ||||
->setHeaderText(pht('Credential')) | ->setHeaderText($title) | ||||
->setFormErrors($errors) | ->setFormErrors($errors) | ||||
->setValidationException($validation_exception) | ->setValidationException($validation_exception) | ||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) | ->setBackground(PHUIObjectBoxView::WHITE_CONFIG) | ||||
->setForm($form); | ->setForm($form); | ||||
$header = id(new PHUIHeaderView()) | |||||
->setHeader($title) | |||||
->setHeaderIcon($header_icon); | |||||
$view = id(new PHUITwoColumnView()) | $view = id(new PHUITwoColumnView()) | ||||
->setHeader($header) | |||||
->setFooter(array( | ->setFooter(array( | ||||
$box, | $box, | ||||
)); | )); | ||||
return $this->newPage() | return $this->newPage() | ||||
->setTitle($title) | ->setTitle($title) | ||||
->setCrumbs($crumbs) | ->setCrumbs($crumbs) | ||||
->appendChild($view); | ->appendChild($view); | ||||
Show All 14 Lines |