~ubuntu-branches/ubuntu/wily/phabricator/wily

« back to all changes in this revision

Viewing changes to phabricator/src/applications/owners/controller/PhabricatorOwnersDeleteController.php

  • Committer: Package Import Robot
  • Author(s): Richard Sellam
  • Date: 2015-06-13 10:52:10 UTC
  • mfrom: (0.30.1) (0.29.1) (0.17.4) (2.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20150613105210-5uirr7tvnk0n6e6y
Tags: 0~git20150613-1
* New snapshot release (closes: #787805)
* fixed typo in logrotate script (closes: #787645)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
 
3
 
final class PhabricatorOwnersDeleteController
4
 
  extends PhabricatorOwnersController {
5
 
 
6
 
  private $id;
7
 
 
8
 
  public function willProcessRequest(array $data) {
9
 
    $this->id = $data['id'];
10
 
  }
11
 
 
12
 
  public function processRequest() {
13
 
    $request = $this->getRequest();
14
 
    $user = $request->getUser();
15
 
 
16
 
    $package = id(new PhabricatorOwnersPackage())->load($this->id);
17
 
    if (!$package) {
18
 
      return new Aphront404Response();
19
 
    }
20
 
 
21
 
    if ($request->isDialogFormPost()) {
22
 
      id(new PhabricatorOwnersPackageEditor())
23
 
        ->setActor($user)
24
 
        ->setPackage($package)
25
 
        ->delete();
26
 
      return id(new AphrontRedirectResponse())->setURI('/owners/');
27
 
    }
28
 
 
29
 
    $text = pht(
30
 
      'Are you sure you want to delete the "%s" package? This '.
31
 
      'operation can not be undone.',
32
 
      $package->getName());
33
 
    $dialog = id(new AphrontDialogView())
34
 
      ->setUser($user)
35
 
      ->setTitle(pht('Really delete this package?'))
36
 
      ->appendChild(phutil_tag('p', array(), $text))
37
 
      ->addSubmitButton(pht('Delete'))
38
 
      ->addCancelButton('/owners/package/'.$package->getID().'/')
39
 
      ->setSubmitURI($request->getRequestURI());
40
 
 
41
 
    return id(new AphrontDialogResponse())->setDialog($dialog);
42
 
  }
43
 
 
44
 
}