2013-07-03 20:15:45 +02:00
|
|
|
<?php
|
|
|
|
|
2014-05-09 21:25:52 +02:00
|
|
|
final class LegalpadDocumentListController extends LegalpadController {
|
2013-07-03 20:15:45 +02:00
|
|
|
|
|
|
|
private $queryKey;
|
|
|
|
|
2014-06-26 16:16:42 +02:00
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-07-03 20:15:45 +02:00
|
|
|
public function willProcessRequest(array $data) {
|
|
|
|
$this->queryKey = idx($data, 'queryKey');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$controller = id(new PhabricatorApplicationSearchController($request))
|
|
|
|
->setQueryKey($this->queryKey)
|
|
|
|
->setSearchEngine(new LegalpadDocumentSearchEngine())
|
|
|
|
->setNavigation($this->buildSideNav());
|
|
|
|
|
|
|
|
return $this->delegateToController($controller);
|
|
|
|
}
|
|
|
|
|
2014-06-26 03:38:07 +02:00
|
|
|
public function buildApplicationCrumbs() {
|
|
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
|
2014-06-29 21:43:13 +02:00
|
|
|
$can_create = $this->hasApplicationCapability(
|
|
|
|
LegalpadCapabilityCreateDocuments::CAPABILITY);
|
|
|
|
|
2014-06-26 03:38:07 +02:00
|
|
|
$crumbs->addAction(
|
|
|
|
id(new PHUIListItemView())
|
|
|
|
->setName(pht('Create Document'))
|
|
|
|
->setHref($this->getApplicationURI('create/'))
|
2014-06-29 21:43:13 +02:00
|
|
|
->setIcon('fa-plus-square')
|
|
|
|
->setDisabled(!$can_create)
|
|
|
|
->setWorkflow(!$can_create));
|
|
|
|
|
2014-06-26 03:38:07 +02:00
|
|
|
|
|
|
|
return $crumbs;
|
|
|
|
}
|
|
|
|
|
2013-07-03 20:15:45 +02:00
|
|
|
}
|