[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhragmentSnapshotDeleteController extends PhragmentController { 4 5 private $id; 6 7 public function willProcessRequest(array $data) { 8 $this->id = $data['id']; 9 } 10 11 public function processRequest() { 12 $request = $this->getRequest(); 13 $viewer = $request->getUser(); 14 15 $snapshot = id(new PhragmentSnapshotQuery()) 16 ->setViewer($viewer) 17 ->requireCapabilities(array( 18 PhabricatorPolicyCapability::CAN_VIEW, 19 PhabricatorPolicyCapability::CAN_EDIT, 20 )) 21 ->withIDs(array($this->id)) 22 ->executeOne(); 23 if ($snapshot === null) { 24 return new Aphront404Response(); 25 } 26 27 if ($request->isDialogFormPost()) { 28 $fragment_uri = $snapshot->getPrimaryFragment()->getURI(); 29 30 $snapshot->delete(); 31 32 return id(new AphrontRedirectResponse()) 33 ->setURI($fragment_uri); 34 } 35 36 return $this->createDialog(); 37 } 38 39 function createDialog() { 40 $request = $this->getRequest(); 41 $viewer = $request->getUser(); 42 43 $dialog = id(new AphrontDialogView()) 44 ->setTitle(pht('Really delete this snapshot?')) 45 ->setUser($request->getUser()) 46 ->addSubmitButton(pht('Delete')) 47 ->addCancelButton(pht('Cancel')) 48 ->appendParagraph(pht( 49 'Deleting this snapshot is a permanent operation. You can not '. 50 'recover the state of the snapshot.')); 51 return id(new AphrontDialogResponse())->setDialog($dialog); 52 } 53 54 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |