1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 11:22:40 +01:00
phorge-phorge/src/applications/owners/controller/PhabricatorOwnersDeleteController.php

42 lines
1.1 KiB
PHP
Raw Normal View History

2011-04-04 07:03:27 +02:00
<?php
final class PhabricatorOwnersDeleteController
extends PhabricatorOwnersController {
2011-04-04 07:03:27 +02:00
private $id;
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$package = id(new PhabricatorOwnersPackage())->load($this->id);
if (!$package) {
return new Aphront404Response();
}
if ($request->isDialogFormPost()) {
$package->attachActorPHID($user->getPHID());
2011-04-04 07:03:27 +02:00
$package->delete();
return id(new AphrontRedirectResponse())->setURI('/owners/');
}
$dialog = id(new AphrontDialogView())
->setUser($user)
->setTitle('Really delete this package?')
->appendChild(
'<p>Are you sure you want to delete the "'.
phutil_escape_html($package->getName()).'" package? This operation '.
'can not be undone.</p>')
->addSubmitButton('Delete')
->addCancelButton('/owners/package/'.$package->getID().'/')
->setSubmitURI($request->getRequestURI());
return id(new AphrontDialogResponse())->setDialog($dialog);
}
}