mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 09:05:56 +00:00
BUGFIX: fixed link to search query from opensearch description
This commit is contained in:
parent
13fdb8dd80
commit
94121f0a66
@ -194,7 +194,6 @@ class DocumentationSearch {
|
||||
$start = ($request->requestVar('start')) ? (int)$request->requestVar('start') : 0;
|
||||
$query = ($request->requestVar('Search')) ? $request->requestVar('Search') : '';
|
||||
|
||||
|
||||
$currentPage = floor( $start / $pageLength ) + 1;
|
||||
|
||||
$totalPages = ceil(count($this->results) / $pageLength );
|
||||
@ -346,11 +345,12 @@ class DocumentationSearch {
|
||||
$request = $this->outputController->getRequest();
|
||||
|
||||
$data = $this->getSearchResults($request);
|
||||
|
||||
$templates = array('DocumentationViewer_results', 'DocumentationViewer');
|
||||
|
||||
if($request->requestVar('format') && $request->requestVar('format') == "rss") {
|
||||
// alter the fields for the opensearch xml.
|
||||
$title = ($title = $this->getTitle()) ? ' | '. $title : "";
|
||||
$title = ($title = $this->getTitle()) ? ' - '. $title : "";
|
||||
|
||||
$link = Controller::join_links($this->outputController->Link(), 'DocumentationOpenSearch_Controller/description/');
|
||||
|
||||
@ -386,7 +386,7 @@ class DocumentationOpenSearch_Controller extends Controller {
|
||||
$link = Director::absoluteBaseUrl() .
|
||||
$data['SearchPageLink'] = Controller::join_links(
|
||||
$viewer->Link(),
|
||||
'results/?query={searchTerms}&start={startIndex}&length={count}'
|
||||
'results/?Search={searchTerms}&start={startIndex}&length={count}&action_results=1'
|
||||
);
|
||||
|
||||
$data['SearchPageRss'] = $data['SearchPageLink'] . '&format=rss';
|
||||
|
@ -716,9 +716,14 @@ class DocumentationViewer extends Controller {
|
||||
/**
|
||||
* Past straight to results, display and encode the query
|
||||
*/
|
||||
function results($data, $form, $request) {
|
||||
function results($data, $form = false) {
|
||||
|
||||
$query = (isset($_REQUEST['Search'])) ? $_REQUEST['Search'] : false;
|
||||
|
||||
if(!$query) return $this->httpError('404');
|
||||
|
||||
$search = new DocumentationSearch();
|
||||
$search->setQuery($form->dataFieldByName('Search')->dataValue());
|
||||
$search->setQuery($query);
|
||||
$search->setOutputController($this);
|
||||
|
||||
return $search->renderResults();
|
||||
|
Loading…
x
Reference in New Issue
Block a user