2014-01-17 20:40:26 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class LegalpadDocumentSignatureListController extends LegalpadController {
|
|
|
|
|
2014-06-29 01:36:37 +02:00
|
|
|
private $documentID;
|
|
|
|
private $queryKey;
|
|
|
|
private $document;
|
2014-01-17 20:40:26 +01:00
|
|
|
|
|
|
|
public function willProcessRequest(array $data) {
|
2014-06-29 01:36:37 +02:00
|
|
|
$this->documentID = $data['id'];
|
|
|
|
$this->queryKey = idx($data, 'queryKey');
|
2014-01-17 20:40:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
|
|
|
$document = id(new LegalpadDocumentQuery())
|
|
|
|
->setViewer($user)
|
2014-06-29 01:36:37 +02:00
|
|
|
->withIDs(array($this->documentID))
|
|
|
|
->requireCapabilities(
|
|
|
|
array(
|
|
|
|
PhabricatorPolicyCapability::CAN_VIEW,
|
|
|
|
PhabricatorPolicyCapability::CAN_EDIT,
|
|
|
|
))
|
2014-01-17 20:40:26 +01:00
|
|
|
->executeOne();
|
|
|
|
if (!$document) {
|
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
|
|
|
|
2014-06-29 01:36:37 +02:00
|
|
|
$this->document = $document;
|
2014-01-17 20:40:26 +01:00
|
|
|
|
2014-06-29 01:36:37 +02:00
|
|
|
$engine = id(new LegalpadDocumentSignatureSearchEngine())
|
|
|
|
->setDocument($document);
|
2014-01-17 20:40:26 +01:00
|
|
|
|
2014-06-29 01:36:37 +02:00
|
|
|
$controller = id(new PhabricatorApplicationSearchController($request))
|
|
|
|
->setQueryKey($this->queryKey)
|
|
|
|
->setSearchEngine($engine)
|
|
|
|
->setNavigation($this->buildSideNav());
|
2014-01-17 20:40:26 +01:00
|
|
|
|
2014-06-29 01:36:37 +02:00
|
|
|
return $this->delegateToController($controller);
|
2014-01-17 20:40:26 +01:00
|
|
|
}
|
|
|
|
|
2014-06-29 01:36:37 +02:00
|
|
|
public function buildSideNav($for_app = false) {
|
2014-01-17 20:40:26 +01:00
|
|
|
$user = $this->getRequest()->getUser();
|
|
|
|
|
2014-06-29 01:36:37 +02:00
|
|
|
$nav = new AphrontSideNavFilterView();
|
|
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
2014-01-17 20:40:26 +01:00
|
|
|
|
2014-06-29 01:36:37 +02:00
|
|
|
id(new LegalpadDocumentSignatureSearchEngine())
|
|
|
|
->setViewer($user)
|
|
|
|
->setDocument($this->document)
|
|
|
|
->addNavigationItems($nav->getMenu());
|
2014-01-17 20:40:26 +01:00
|
|
|
|
2014-06-29 01:36:37 +02:00
|
|
|
return $nav;
|
|
|
|
}
|
2014-01-17 20:40:26 +01:00
|
|
|
|
2014-06-29 01:36:37 +02:00
|
|
|
public function buildApplicationCrumbs() {
|
|
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
|
|
|
|
$crumbs->addTextCrumb(
|
|
|
|
$this->document->getMonogram(),
|
|
|
|
'/'.$this->document->getMonogram());
|
2014-01-17 20:40:26 +01:00
|
|
|
|
2014-06-29 01:36:37 +02:00
|
|
|
return $crumbs;
|
2014-01-17 20:40:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|