2014-10-17 05:01:57 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class AlmanacServiceListController
|
|
|
|
extends AlmanacServiceController {
|
|
|
|
|
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
|
|
$controller = id(new PhabricatorApplicationSearchController())
|
|
|
|
->setQueryKey($request->getURIData('queryKey'))
|
|
|
|
->setSearchEngine(new AlmanacServiceSearchEngine())
|
|
|
|
->setNavigation($this->buildSideNavView());
|
|
|
|
|
|
|
|
return $this->delegateToController($controller);
|
|
|
|
}
|
|
|
|
|
2015-01-07 07:34:58 +11:00
|
|
|
protected function buildApplicationCrumbs() {
|
2014-10-17 05:01:57 -07:00
|
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
|
|
|
|
$can_create = $this->hasApplicationCapability(
|
|
|
|
AlmanacCreateServicesCapability::CAPABILITY);
|
|
|
|
|
|
|
|
$crumbs->addAction(
|
|
|
|
id(new PHUIListItemView())
|
|
|
|
->setName(pht('Create Service'))
|
|
|
|
->setHref($this->getApplicationURI('service/edit/'))
|
|
|
|
->setIcon('fa-plus-square')
|
|
|
|
->setDisabled(!$can_create)
|
|
|
|
->setWorkflow(!$can_create));
|
|
|
|
|
|
|
|
return $crumbs;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function buildSideNavView() {
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
|
|
|
|
$nav = new AphrontSideNavFilterView();
|
|
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
|
|
|
|
|
|
|
id(new AlmanacServiceSearchEngine())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->addNavigationItems($nav->getMenu());
|
|
|
|
|
|
|
|
$nav->selectFilter(null);
|
|
|
|
|
|
|
|
return $nav;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|