[BUGFIX] Indexed_search Make results per page work (Extbase plugin) 89/38789/5
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Sat, 18 Apr 2015 18:35:28 +0000 (20:35 +0200)
committerTymoteusz Motylewski <t.motylewski@gmail.com>
Sun, 19 Apr 2015 07:55:48 +0000 (09:55 +0200)
Replaces wrong setting "results" and uses "numberOfResults" instead.
Protects PageBrowskingViewHelper from division by zero warning.
Fix wrong path to the page_links setting in the template.

Resolves: #40280
Releases: master, 6.2
Change-Id: I6636c6796b92181dbe298562df2fb59a4f1f1ec2
Reviewed-on: http://review.typo3.org/38789
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
typo3/sysext/indexed_search/Classes/Controller/SearchController.php
typo3/sysext/indexed_search/Classes/ViewHelpers/PageBrowsingResultsViewHelper.php
typo3/sysext/indexed_search/Classes/ViewHelpers/PageBrowsingViewHelper.php
typo3/sysext/indexed_search/Configuration/TypoScript/setup.txt
typo3/sysext/indexed_search/Resources/Private/Partials/Form.html
typo3/sysext/indexed_search/Resources/Private/Templates/Search/Search.html

index caa436d..1f72a18 100644 (file)
@@ -157,7 +157,7 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
                if ($searchData['_freeIndexUid'] !== '' && $searchData['_freeIndexUid'] !== '_') {
                        $searchData['freeIndexUid'] = $searchData['_freeIndexUid'];
                }
-               $searchData['results'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($searchData['results'], 1, 100000, $this->defaultResultNumber);
+               $searchData['numberOfResults'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($searchData['numberOfResults'], 1, 100000, $this->defaultResultNumber);
                // This gets the search-words into the $searchWordArray
                $this->sword = $searchData['sword'];
                // Add previous search words to current
@@ -1147,7 +1147,7 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
                        );
                }
                // disable single entries by TypoScript
-               $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['numberOfResults.']);
+               $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['numberOfResults']);
                return $allOptions;
        }
 
index 81907df..3946bc7 100644 (file)
@@ -28,7 +28,7 @@ class PageBrowsingResultsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
         * @param int $numberOfResults
         * @param int $resultsPerPage
         * @param int $currentPage
-        * @return the content
+        * @return string the content
         */
        public function render($numberOfResults, $resultsPerPage, $currentPage = 1) {
                $firstResultOnPage = $currentPage * $resultsPerPage + 1;
index 207f06d..08670c4 100644 (file)
@@ -41,6 +41,9 @@ class PageBrowsingViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractVi
         * @return string The content
         */
        public function render($maximumNumberOfResultPages, $numberOfResults, $resultsPerPage, $currentPage = 0, $freeIndexUid = NULL) {
+               if ($resultsPerPage <= 0) {
+                       $resultsPerPage = 10;
+               }
                $pageCount = (int)ceil($numberOfResults / $resultsPerPage);
                // only show the result browser if more than one page is needed
                if ($pageCount === 1) {
index a6d97d9..78f2fb9 100644 (file)
@@ -47,7 +47,7 @@ plugin.tx_indexedsearch {
                        group = 0
                        languageUid = 0
                        desc = 0
-                       results = 0
+                       numberOfResults = 0
                        # defaultOperand.1 = 1
                        # extResume=1
                }
index ee20b70..0ff90c8 100644 (file)
@@ -90,7 +90,7 @@
                                        <label for="tx-indexedsearch-selectbox-group"><f:translate key="form.style" />:</label>
                                        <f:form.select name="search[group]" options="{allGroups}" value="{searchParams.group}" id="tx-indexedsearch-selectbox-group" class="tx-indexedsearch-selectbox-group" />
                                        <f:if condition="{settings.blind.extResume} == 0">
-                                               <f:form.checkbox name="tx_indexedsearch[extResume]" id="tx_indexedsearch_extResume" checked="{searchParams.extResume}" value="1" />
+                                               <f:form.checkbox name="search[extResume]" id="tx_indexedsearch_extResume" checked="{searchParams.extResume}" value="1" />
                                        </f:if>
                                </div>
                        </f:if>
index 9a3e3d3..f616ee2 100644 (file)
@@ -27,7 +27,7 @@
                <f:then>
                        <div class="tx-indexedsearch-browsebox">
                                <p>
-                                       <is:pageBrowsingResults numberOfResults="{result.count}" currentPage="{searchParams.pointer}" resultsPerPage="{searchParams.results}" />
+                                       <is:pageBrowsingResults numberOfResults="{result.count}" currentPage="{searchParams.pointer}" resultsPerPage="{searchParams.numberOfResults}" />
                                        {result.sectionText}
                                </p>
                                <!-- render the anchor-links to the sections inside the displayed result rows -->
@@ -50,7 +50,7 @@
                                                </table>
                                        </div>
                                </f:if>
-                               <is:pageBrowsing maximumNumberOfResultPages="{settings.search.page_links}" numberOfResults="{result.count}" currentPage="{searchParams.pointer}" resultsPerPage="{searchParams.results}" />
+                               <is:pageBrowsing maximumNumberOfResultPages="{settings.page_links}" numberOfResults="{result.count}" currentPage="{searchParams.pointer}" resultsPerPage="{searchParams.numberOfResults}" />
                        </div>
                        <f:for each="{result.rows}" as="row">
                                <f:if condition="{row.isSectionHeader}">
@@ -65,7 +65,7 @@
                                </f:if>
                        </f:for>
                        <div class="tx-indexedsearch-browsebox">
-                               <is:pageBrowsing numberOfResults="{result.count}" maximumNumberOfResultPages="{settings.search.page_links}" currentPage="{searchParams.pointer}" resultsPerPage="{searchParams.results}" />
+                               <is:pageBrowsing numberOfResults="{result.count}" maximumNumberOfResultPages="{settings.page_links}" currentPage="{searchParams.pointer}" resultsPerPage="{searchParams.numberOfResults}" />
                        </div>
                </f:then>
                <f:else>