3 final class PhabricatorSpacesArchiveController
4 extends PhabricatorSpacesController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $viewer = $request->getUser();
9 $space = id(new PhabricatorSpacesNamespaceQuery())
11 ->withIDs(array($request->getURIData('id')))
12 ->requireCapabilities(
14 PhabricatorPolicyCapability
::CAN_VIEW
,
15 PhabricatorPolicyCapability
::CAN_EDIT
,
19 return new Aphront404Response();
22 $is_archive = ($request->getURIData('action') == 'archive');
23 $cancel_uri = '/'.$space->getMonogram();
25 if ($request->isFormPost()) {
27 PhabricatorSpacesNamespaceArchiveTransaction
::TRANSACTIONTYPE
;
30 $xactions[] = id(new PhabricatorSpacesNamespaceTransaction())
31 ->setTransactionType($type_archive)
32 ->setNewValue($is_archive ?
1 : 0);
34 $editor = id(new PhabricatorSpacesNamespaceEditor())
36 ->setContinueOnNoEffect(true)
37 ->setContinueOnMissingFields(true)
38 ->setContentSourceFromRequest($request);
40 $editor->applyTransactions($space, $xactions);
42 return id(new AphrontRedirectResponse())->setURI($cancel_uri);
47 $title = pht('Archive Space: %s', $space->getNamespaceName());
49 'If you archive this Space, you will no longer be able to create '.
50 'new objects inside it.');
52 'Existing objects in this Space will be hidden from query results '.
54 $button = pht('Archive Space');
56 $title = pht('Activate Space: %s', $space->getNamespaceName());
58 'If you activate this space, you will be able to create objects '.
61 'Existing objects will no longer be hidden from query results.');
62 $button = pht('Activate Space');
66 $dialog = $this->newDialog()
68 ->addCancelButton($cancel_uri)
69 ->addSubmitButton($button);
71 foreach ($body as $paragraph) {
72 $dialog->appendParagraph($paragraph);