3 final class AlmanacBindingDisableController
4 extends AlmanacServiceController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $viewer = $request->getViewer();
9 $id = $request->getURIData('id');
10 $binding = id(new AlmanacBindingQuery())
13 ->requireCapabilities(
15 PhabricatorPolicyCapability
::CAN_VIEW
,
16 PhabricatorPolicyCapability
::CAN_EDIT
,
20 return new Aphront404Response();
23 $id = $binding->getID();
24 $is_disable = !$binding->getIsDisabled();
25 $done_uri = $binding->getURI();
28 $disable_title = pht('Disable Binding');
29 $disable_body = pht('Disable this binding?');
30 $disable_button = pht('Disable Binding');
34 $disable_title = pht('Enable Binding');
35 $disable_body = pht('Enable this binding?');
36 $disable_button = pht('Enable Binding');
42 if ($request->isFormPost()) {
43 $type_disable = AlmanacBindingDisableTransaction
::TRANSACTIONTYPE
;
47 $xactions[] = id(new AlmanacBindingTransaction())
48 ->setTransactionType($type_disable)
49 ->setNewValue($v_disable);
51 $editor = id(new AlmanacBindingEditor())
53 ->setContentSourceFromRequest($request)
54 ->setContinueOnNoEffect(true)
55 ->setContinueOnMissingFields(true);
57 $editor->applyTransactions($binding, $xactions);
59 return id(new AphrontRedirectResponse())->setURI($done_uri);
62 return $this->newDialog()
63 ->setTitle($disable_title)
64 ->appendParagraph($disable_body)
65 ->addSubmitButton($disable_button)
66 ->addCancelButton($done_uri);