3 final class PhabricatorDashboardPanelArchiveController
4 extends PhabricatorDashboardController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $viewer = $request->getViewer();
8 $id = $request->getURIData('id');
10 $panel = id(new PhabricatorDashboardPanelQuery())
13 ->requireCapabilities(
15 PhabricatorPolicyCapability
::CAN_VIEW
,
16 PhabricatorPolicyCapability
::CAN_EDIT
,
20 return new Aphront404Response();
23 $next_uri = '/'.$panel->getMonogram();
25 if ($request->isFormPost()) {
27 $xactions[] = id(new PhabricatorDashboardPanelTransaction())
29 PhabricatorDashboardPanelStatusTransaction
::TRANSACTIONTYPE
)
30 ->setNewValue((int)!$panel->getIsArchived());
32 id(new PhabricatorDashboardPanelTransactionEditor())
34 ->setContentSourceFromRequest($request)
35 ->applyTransactions($panel, $xactions);
37 return id(new AphrontRedirectResponse())->setURI($next_uri);
40 if ($panel->getIsArchived()) {
41 $title = pht('Activate Panel?');
43 'This panel will be reactivated and appear in other interfaces as '.
45 $submit_text = pht('Activate Panel');
47 $title = pht('Archive Panel?');
49 'This panel will be archived and no longer appear in lists of active '.
51 $submit_text = pht('Archive Panel');
54 return $this->newDialog()
56 ->appendParagraph($body)
57 ->addSubmitButton($submit_text)
58 ->addCancelButton($next_uri);