Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diviner/controller/DivinerFindController.php
| <?php | <?php | ||||
| final class DivinerFindController extends DivinerController { | final class DivinerFindController extends DivinerController { | ||||
| public function shouldAllowPublic() { | public function shouldAllowPublic() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| public function processRequest() { | public function handleRequest(AphrontRequest $request) { | ||||
| $request = $this->getRequest(); | $viewer = $request->getViewer(); | ||||
| $viewer = $request->getUser(); | |||||
| $book_name = $request->getStr('book'); | $book_name = $request->getStr('book'); | ||||
| $query_text = $request->getStr('name'); | $query_text = $request->getStr('name'); | ||||
| $book = null; | $book = null; | ||||
| if ($book_name) { | if ($book_name) { | ||||
| $book = id(new DivinerBookQuery()) | $book = id(new DivinerBookQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withNames(array($book_name)) | ->withNames(array($book_name)) | ||||
| ->executeOne(); | ->executeOne(); | ||||
| if (!$book) { | if (!$book) { | ||||
| return new Aphront404Response(); | return new Aphront404Response(); | ||||
| } | } | ||||
| } | } | ||||
| $query = id(new DivinerAtomQuery()) | $query = id(new DivinerAtomQuery()) | ||||
| ->setViewer($viewer); | ->setViewer($viewer); | ||||
| Show All 35 Lines | public function handleRequest(AphrontRequest $request) { | ||||
| $not_found_uri = $this->getApplicationURI(); | $not_found_uri = $this->getApplicationURI(); | ||||
| if (!$atoms) { | if (!$atoms) { | ||||
| $dialog = id(new AphrontDialogView()) | $dialog = id(new AphrontDialogView()) | ||||
| ->setUser($viewer) | ->setUser($viewer) | ||||
| ->setTitle(pht('Documentation Not Found')) | ->setTitle(pht('Documentation Not Found')) | ||||
| ->appendChild( | ->appendChild( | ||||
| pht( | pht( | ||||
| 'Unable to find the specified documentation. You may have '. | 'Unable to find the specified documentation. '. | ||||
| 'followed a bad or outdated link.')) | 'You may have followed a bad or outdated link.')) | ||||
| ->addCancelButton($not_found_uri, pht('Read More Documentation')); | ->addCancelButton($not_found_uri, pht('Read More Documentation')); | ||||
| return id(new AphrontDialogResponse())->setDialog($dialog); | return id(new AphrontDialogResponse())->setDialog($dialog); | ||||
| } | } | ||||
| if (count($atoms) == 1 && $request->getBool('jump')) { | if (count($atoms) == 1 && $request->getBool('jump')) { | ||||
| $atom_uri = head($atoms)->getURI(); | $atom_uri = head($atoms)->getURI(); | ||||
| return id(new AphrontRedirectResponse())->setURI($atom_uri); | return id(new AphrontRedirectResponse())->setURI($atom_uri); | ||||
| Show All 12 Lines | |||||