2011-02-20 18:41:23 -08:00
|
|
|
<?php
|
|
|
|
|
|
2012-03-09 15:46:25 -08:00
|
|
|
final class PhabricatorProjectListController
|
2014-05-09 12:25:52 -07:00
|
|
|
extends PhabricatorProjectController {
|
2011-02-20 18:41:23 -08:00
|
|
|
|
2013-07-22 08:34:35 -07:00
|
|
|
private $queryKey;
|
|
|
|
|
|
|
|
|
|
public function shouldAllowPublic() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2011-12-16 17:08:18 -08:00
|
|
|
|
|
|
|
|
public function willProcessRequest(array $data) {
|
2013-07-22 08:34:35 -07:00
|
|
|
$this->queryKey = idx($data, 'queryKey');
|
2011-12-16 17:08:18 -08:00
|
|
|
}
|
|
|
|
|
|
2011-02-20 18:41:23 -08:00
|
|
|
public function processRequest() {
|
2011-12-16 17:08:18 -08:00
|
|
|
$request = $this->getRequest();
|
2013-07-22 08:34:35 -07:00
|
|
|
$controller = id(new PhabricatorApplicationSearchController($request))
|
|
|
|
|
->setQueryKey($this->queryKey)
|
|
|
|
|
->setSearchEngine(new PhabricatorProjectSearchEngine())
|
|
|
|
|
->setNavigation($this->buildSideNavView());
|
2011-12-16 17:08:18 -08:00
|
|
|
|
2013-07-22 08:34:35 -07:00
|
|
|
return $this->delegateToController($controller);
|
|
|
|
|
}
|
2011-12-16 18:56:26 -08:00
|
|
|
|
2014-01-12 21:39:50 -08:00
|
|
|
public function buildApplicationCrumbs() {
|
|
|
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
|
|
|
|
|
|
$can_create = $this->hasApplicationCapability(
|
|
|
|
|
ProjectCapabilityCreateProjects::CAPABILITY);
|
|
|
|
|
|
|
|
|
|
$crumbs->addAction(
|
|
|
|
|
id(new PHUIListItemView())
|
|
|
|
|
->setName(pht('Create Project'))
|
|
|
|
|
->setHref($this->getApplicationURI('create/'))
|
|
|
|
|
->setIcon('create')
|
|
|
|
|
->setWorkflow(!$can_create)
|
|
|
|
|
->setDisabled(!$can_create));
|
|
|
|
|
|
|
|
|
|
return $crumbs;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-20 18:41:23 -08:00
|
|
|
}
|