1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-02 19:52:44 +01:00
phorge-phorge/src/applications/project/controller/PhabricatorProjectArchiveController.php
Chad Little b381265d92 First cut of new Project Home
Summary:
First pass at a new Project Home page. This is starting to sprawl, so punting this up now before it gets too large.

 - Project homes now have "large header"
 - Custom Fields / Descriptions are in the main column
 - Feed is simpler visually
 - new "Background" option for PHUIObjectBoxView
 - move header buttons globally to "Grey" instead of "Simple"
 - New color and hover states for "Grey"
 - Transitions on Buttons haha
 - Edit Icon on Nav is now under "Manage" panel
 - New "Manage" Panel

TODO:
 - More testing of bad cases of Custom Fields
 - Members Page in flux, needs design
 - Um still not sure how to make Custom Field not show UI

Test Plan:
Lots of random Project page visits. Save project, watch project, edit project, etc.

{F1068191}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D15097
2016-01-23 16:11:45 -08:00

68 lines
2 KiB
PHP

<?php
final class PhabricatorProjectArchiveController
extends PhabricatorProjectController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$project = id(new PhabricatorProjectQuery())
->setViewer($viewer)
->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->executeOne();
if (!$project) {
return new Aphront404Response();
}
$edit_uri = $this->getApplicationURI('manage/'.$project->getID().'/');
if ($request->isFormPost()) {
if ($project->isArchived()) {
$new_status = PhabricatorProjectStatus::STATUS_ACTIVE;
} else {
$new_status = PhabricatorProjectStatus::STATUS_ARCHIVED;
}
$xactions = array();
$xactions[] = id(new PhabricatorProjectTransaction())
->setTransactionType(PhabricatorProjectTransaction::TYPE_STATUS)
->setNewValue($new_status);
id(new PhabricatorProjectTransactionEditor())
->setActor($viewer)
->setContentSourceFromRequest($request)
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true)
->applyTransactions($project, $xactions);
return id(new AphrontRedirectResponse())->setURI($edit_uri);
}
if ($project->isArchived()) {
$title = pht('Really activate project?');
$body = pht('This project will become active again.');
$button = pht('Activate Project');
} else {
$title = pht('Really archive project?');
$body = pht('This project will be moved to the archive.');
$button = pht('Archive Project');
}
$dialog = id(new AphrontDialogView())
->setUser($viewer)
->setTitle($title)
->appendChild($body)
->addCancelButton($edit_uri)
->addSubmitButton($button);
return id(new AphrontDialogResponse())->setDialog($dialog);
}
}