[BUGFIX] IndexedSearch: Fix various issues in extbase plugin 23/30023/5
authorRobert Vock <robert.vock@4wdmedia.de>
Mon, 12 May 2014 11:52:37 +0000 (13:52 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Sat, 13 Dec 2014 13:20:11 +0000 (14:20 +0100)
Fix these bug in the experimental extbase plugin of IndexedSearch:
 * TypoScript does not appear in include_static_file
 * Fatal error because views use variable named differently in
   Controller
 * Pagination does not work because the form is not present on
   resultpage which breaks JavaScript

Change-Id: I55962d07c543a10358298d7e9c8096c18bc0a615
Resolves: #58003
Releases: master
Reviewed-on: http://review.typo3.org/30023
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Cedric Ziel <cedric@cedric-ziel.com>
Reviewed-by: Andreas Fernandez <andreas.fernandez@aspedia.de>
Reviewed-by: Sebastian Schawohl <s.schawohl@magnetic.coop>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/indexed_search/Configuration/TypoScript/constants.txt
typo3/sysext/indexed_search/Resources/Private/Partials/Form.html [new file with mode: 0644]
typo3/sysext/indexed_search/Resources/Private/Templates/Search/Form.html
typo3/sysext/indexed_search/Resources/Private/Templates/Search/Search.html
typo3/sysext/indexed_search/ext_tables.php

index 75ed86d..9844ea0 100644 (file)
@@ -1,10 +1,10 @@
 plugin.tx_indexedsearch {
        view {
                 # cat=plugin.tx_indexedsearch/file; type=string; label=Path to template root (FE)
-               templateRootPath = EXT:indexedsearch/Resources/Private/Templates/
+               templateRootPath = EXT:indexed_search/Resources/Private/Templates/
                 # cat=plugin.tx_indexedsearch/file; type=string; label=Path to template partials (FE)
-               partialRootPath = EXT:indexedsearch/Resources/Private/Partials/
+               partialRootPath = EXT:indexed_search/Resources/Private/Partials/
                 # cat=plugin.tx_indexedsearch/file; type=string; label=Path to template layouts (FE)
-               layoutRootPath = EXT:indexedsearch/Resources/Private/Layouts/
+               layoutRootPath = EXT:indexed_search/Resources/Private/Layouts/
        }
 }
\ No newline at end of file
diff --git a/typo3/sysext/indexed_search/Resources/Private/Partials/Form.html b/typo3/sysext/indexed_search/Resources/Private/Partials/Form.html
new file mode 100644 (file)
index 0000000..30627c2
--- /dev/null
@@ -0,0 +1,121 @@
+<div class="tx-indexedsearch-searchbox">
+<f:form action="search" method="post" id="tx_indexedsearch" noCacheHash="true">
+       <div class="tx-indexedsearch-hidden-fields">
+               <f:form.hidden name="search[_sections]" value="0" />
+               <f:form.hidden name="search[_freeIndexUid]" id="tx_indexedsearch_freeIndexUid" value="_" />
+               <f:form.hidden name="search[pointer]" id="tx_indexedsearch_pointer" value="0" />
+               <f:form.hidden name="search[ext]" value="{searchParams.ext}" />
+               <f:form.hidden name="search[searchType]" value="{searchParams.searchType}" />
+               <f:form.hidden name="search[defaultOperand]" value="{searchParams.defaultOperand}" />
+               <f:form.hidden name="search[mediaType]" value="{searchParams.mediaType}" />
+               <f:form.hidden name="search[sortOrder]" value="{searchParams.sortOrder}" />
+               <f:form.hidden name="search[group]" value="{searchParams.group}" />
+               <f:form.hidden name="search[languageUid]" value="{searchParams.languageUid}" />
+               <f:form.hidden name="search[desc]" value="{searchParams.desc}" />
+               <f:form.hidden name="search[numberOfResults]" value="{searchParams.numberOfResults}" />
+       </div>
+
+       <fieldset>
+               <legend><f:translate key="form.legend" /></legend>
+
+               <div class="tx-indexedsearch-form">
+                       <label for="tx-indexedsearch-searchbox-sword"><f:translate key="form.searchFor" />:</label>
+                       <f:form.textfield name="search[sword]" value="{sword}" id="tx-indexedsearch-searchbox-sword" class="tx-indexedsearch-searchbox-sword" />
+               </div>
+
+               <f:if condition="{showAdditionalKeywordSearch}">
+                       <f:form.hidden name="search[sword_prev]" value="{previousSearchWord}" />
+                       <f:form.checkbox name="search[sword_prev_include]" id="tx_indexedsearch_sword_prev_include" value="1" checked="{searchParams.sword_prev}" /> <label for="tx_indexedsearch_sword_prev_include"><f:translate key="form.addToSearch" />.</label>
+               </f:if>
+
+               <f:if condition="{searchParams.extendedSearch}">
+                       <f:if condition="{showTypeSearch}">
+                               <div class="tx-indexedsearch-search-for">
+                                       <label for="tx-indexedsearch-selectbox-type"><f:translate key="form.match" />:</label>
+
+                                       <f:if condition="{allSearchTypes}">
+                                               <f:form.select name="search[searchType]" options="{allSearchTypes}" value="{searchParams.searchType}" id="tx-indexedsearch-selectbox-searchtype" class="tx-indexedsearch-selectbox-searchtype" />
+                                       </f:if>
+
+                                       <f:if condition="{allDefaultOperands}">
+                                               <f:form.select name="search[defaultOperand]" options="{allDefaultOperands}" value="{searchParams.defaultOperand}" id="tx-indexedsearch-selectbox-defaultoperand" class="tx-indexedsearch-selectbox-defaultoperand" />
+                                       </f:if>
+                               </div>
+                       </f:if>
+
+                       <f:if condition="{showMediaAndLanguageSearch}">
+                               <div class="tx-indexedsearch-search-in">
+                                       <label for="tx-indexedsearch-selectbox-media"><f:translate key="form.searchIn" />:</label>
+
+                                       <f:if condition="{allMediaTypes}">
+                                               <f:form.select name="search[mediaType]" options="{allMediaTypes}" value="{searchParams.mediaType}" id="tx-indexedsearch-selectbox-media" class="tx-indexedsearch-selectbox-media media" />
+                                       </f:if>
+
+                                       <f:if condition="{allLanguageUids}">
+                                               <f:form.select name="search[languageUid]" options="{allLanguageUids}" value="{searchParams.languageUid}" id="tx-indexedsearch-selectbox-lang" class="tx-indexedsearch-selectbox-lang lang" />
+                                       </f:if>
+                               </div>
+                       </f:if>
+
+                       <f:if condition="{allSections}">
+                               <div class="tx-indexedsearch-search-select-section">
+                                       <label for="tx-indexedsearch-selectbox-sections"><f:translate key="form.fromSection" />:</label>
+                                       <f:form.select name="search[sections]" options="{allSections}" value="{searchParams.sections}" id="tx-indexedsearch-selectbox-sections" class="tx-indexedsearch-selectbox-sections" />
+                               </div>
+                       </f:if>
+
+                       <f:if condition="{allIndexConfigurations}">
+                               <div class="tx-indexedsearch-search-freeindexuid">
+                                       <label for="tx-indexedsearch-selectbox-freeIndexUid"><f:translate key="form.freeIndexUid" />:</label>
+                                       <f:form.select name="search[freeIndexUid]" options="{allIndexConfigurations}" value="{searchParams.freeIndexUid}" id="tx-indexedsearch-selectbox-freeIndexUid" class="tx-indexedsearch-selectbox-freeIndexUid" />
+                               </div>
+                       </f:if>
+
+                       <f:if condition="{showSortOrders}">
+                               <div class="tx-indexedsearch-search-select-order">
+                                       <label for="tx-indexedsearch-selectbox-order"><f:translate key="form.orderBy" />:</label>
+                                       <f:form.select name="search[sortOrder]" options="{allSortOrders}" value="{searchParams.sortOrder}" id="tx-indexedsearch-selectbox-order" class="tx-indexedsearch-selectbox-order" />&nbsp;
+                                       <f:form.select name="search[sortDesc]"  options="{allSortDescending}" value="{searchParams.sortDesc}" id="tx-indexedsearch-selectbox-desc" class="tx-indexedsearch-selectbox-desc" />
+                               </div>
+                       </f:if>
+
+                       <f:if condition="{allNumberOfResults}">
+                               <div class="tx-indexedsearch-search-select-results">
+                                       <label for="tx-indexedsearch-selectbox-results"><f:translate key="form.atATime" /></label>
+                                       <f:form.select name="search[numberOfResults]" options="{allNumberOfResults}" value="{searchParams.numberOfResults}" id="tx-indexedsearch-selectbox-results" class="tx-indexedsearch-selectbox-results" />
+                               </div>
+                       </f:if>
+
+                       <f:if condition="{allGroups}">
+                               <div class="tx-indexedsearch-search-select-group">
+                                       <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:if>
+                               </div>
+                       </f:if>
+               </f:if>
+
+               <div class="tx-indexedsearch-search-submit">
+                       <f:form.submit name="search[submitButton]" value="{f:translate(key: 'form.submit')}" id="tx-indexedsearch-searchbox-button-submit" class="tx-indexedsearch-searchbox-button" />
+               </div>
+       </fieldset>
+
+
+       <f:if condition="{settings.displayAdvancedSearchLink}">
+               <p>
+               <f:if condition="{searchParams.extendedSearch}">
+                       <f:then>
+                               <f:link.action action="form" arguments="{extendedSearch: 0}"><f:translate key="form.linkToRegularSearch" /></f:link.action>
+                       </f:then>
+                       <f:else>
+                               <f:link.action action="form" arguments="{extendedSearch: 1}"><f:translate key="form.linkToExtendedSearch" /></f:link.action>
+                       </f:else>
+               </f:if>
+               </p>
+       </f:if>
+</f:form>
+</div>
+
+<f:render partial="Rules" />
\ No newline at end of file
index 30627c2..4fa7c18 100644 (file)
@@ -1,121 +1 @@
-<div class="tx-indexedsearch-searchbox">
-<f:form action="search" method="post" id="tx_indexedsearch" noCacheHash="true">
-       <div class="tx-indexedsearch-hidden-fields">
-               <f:form.hidden name="search[_sections]" value="0" />
-               <f:form.hidden name="search[_freeIndexUid]" id="tx_indexedsearch_freeIndexUid" value="_" />
-               <f:form.hidden name="search[pointer]" id="tx_indexedsearch_pointer" value="0" />
-               <f:form.hidden name="search[ext]" value="{searchParams.ext}" />
-               <f:form.hidden name="search[searchType]" value="{searchParams.searchType}" />
-               <f:form.hidden name="search[defaultOperand]" value="{searchParams.defaultOperand}" />
-               <f:form.hidden name="search[mediaType]" value="{searchParams.mediaType}" />
-               <f:form.hidden name="search[sortOrder]" value="{searchParams.sortOrder}" />
-               <f:form.hidden name="search[group]" value="{searchParams.group}" />
-               <f:form.hidden name="search[languageUid]" value="{searchParams.languageUid}" />
-               <f:form.hidden name="search[desc]" value="{searchParams.desc}" />
-               <f:form.hidden name="search[numberOfResults]" value="{searchParams.numberOfResults}" />
-       </div>
-
-       <fieldset>
-               <legend><f:translate key="form.legend" /></legend>
-
-               <div class="tx-indexedsearch-form">
-                       <label for="tx-indexedsearch-searchbox-sword"><f:translate key="form.searchFor" />:</label>
-                       <f:form.textfield name="search[sword]" value="{sword}" id="tx-indexedsearch-searchbox-sword" class="tx-indexedsearch-searchbox-sword" />
-               </div>
-
-               <f:if condition="{showAdditionalKeywordSearch}">
-                       <f:form.hidden name="search[sword_prev]" value="{previousSearchWord}" />
-                       <f:form.checkbox name="search[sword_prev_include]" id="tx_indexedsearch_sword_prev_include" value="1" checked="{searchParams.sword_prev}" /> <label for="tx_indexedsearch_sword_prev_include"><f:translate key="form.addToSearch" />.</label>
-               </f:if>
-
-               <f:if condition="{searchParams.extendedSearch}">
-                       <f:if condition="{showTypeSearch}">
-                               <div class="tx-indexedsearch-search-for">
-                                       <label for="tx-indexedsearch-selectbox-type"><f:translate key="form.match" />:</label>
-
-                                       <f:if condition="{allSearchTypes}">
-                                               <f:form.select name="search[searchType]" options="{allSearchTypes}" value="{searchParams.searchType}" id="tx-indexedsearch-selectbox-searchtype" class="tx-indexedsearch-selectbox-searchtype" />
-                                       </f:if>
-
-                                       <f:if condition="{allDefaultOperands}">
-                                               <f:form.select name="search[defaultOperand]" options="{allDefaultOperands}" value="{searchParams.defaultOperand}" id="tx-indexedsearch-selectbox-defaultoperand" class="tx-indexedsearch-selectbox-defaultoperand" />
-                                       </f:if>
-                               </div>
-                       </f:if>
-
-                       <f:if condition="{showMediaAndLanguageSearch}">
-                               <div class="tx-indexedsearch-search-in">
-                                       <label for="tx-indexedsearch-selectbox-media"><f:translate key="form.searchIn" />:</label>
-
-                                       <f:if condition="{allMediaTypes}">
-                                               <f:form.select name="search[mediaType]" options="{allMediaTypes}" value="{searchParams.mediaType}" id="tx-indexedsearch-selectbox-media" class="tx-indexedsearch-selectbox-media media" />
-                                       </f:if>
-
-                                       <f:if condition="{allLanguageUids}">
-                                               <f:form.select name="search[languageUid]" options="{allLanguageUids}" value="{searchParams.languageUid}" id="tx-indexedsearch-selectbox-lang" class="tx-indexedsearch-selectbox-lang lang" />
-                                       </f:if>
-                               </div>
-                       </f:if>
-
-                       <f:if condition="{allSections}">
-                               <div class="tx-indexedsearch-search-select-section">
-                                       <label for="tx-indexedsearch-selectbox-sections"><f:translate key="form.fromSection" />:</label>
-                                       <f:form.select name="search[sections]" options="{allSections}" value="{searchParams.sections}" id="tx-indexedsearch-selectbox-sections" class="tx-indexedsearch-selectbox-sections" />
-                               </div>
-                       </f:if>
-
-                       <f:if condition="{allIndexConfigurations}">
-                               <div class="tx-indexedsearch-search-freeindexuid">
-                                       <label for="tx-indexedsearch-selectbox-freeIndexUid"><f:translate key="form.freeIndexUid" />:</label>
-                                       <f:form.select name="search[freeIndexUid]" options="{allIndexConfigurations}" value="{searchParams.freeIndexUid}" id="tx-indexedsearch-selectbox-freeIndexUid" class="tx-indexedsearch-selectbox-freeIndexUid" />
-                               </div>
-                       </f:if>
-
-                       <f:if condition="{showSortOrders}">
-                               <div class="tx-indexedsearch-search-select-order">
-                                       <label for="tx-indexedsearch-selectbox-order"><f:translate key="form.orderBy" />:</label>
-                                       <f:form.select name="search[sortOrder]" options="{allSortOrders}" value="{searchParams.sortOrder}" id="tx-indexedsearch-selectbox-order" class="tx-indexedsearch-selectbox-order" />&nbsp;
-                                       <f:form.select name="search[sortDesc]"  options="{allSortDescending}" value="{searchParams.sortDesc}" id="tx-indexedsearch-selectbox-desc" class="tx-indexedsearch-selectbox-desc" />
-                               </div>
-                       </f:if>
-
-                       <f:if condition="{allNumberOfResults}">
-                               <div class="tx-indexedsearch-search-select-results">
-                                       <label for="tx-indexedsearch-selectbox-results"><f:translate key="form.atATime" /></label>
-                                       <f:form.select name="search[numberOfResults]" options="{allNumberOfResults}" value="{searchParams.numberOfResults}" id="tx-indexedsearch-selectbox-results" class="tx-indexedsearch-selectbox-results" />
-                               </div>
-                       </f:if>
-
-                       <f:if condition="{allGroups}">
-                               <div class="tx-indexedsearch-search-select-group">
-                                       <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:if>
-                               </div>
-                       </f:if>
-               </f:if>
-
-               <div class="tx-indexedsearch-search-submit">
-                       <f:form.submit name="search[submitButton]" value="{f:translate(key: 'form.submit')}" id="tx-indexedsearch-searchbox-button-submit" class="tx-indexedsearch-searchbox-button" />
-               </div>
-       </fieldset>
-
-
-       <f:if condition="{settings.displayAdvancedSearchLink}">
-               <p>
-               <f:if condition="{searchParams.extendedSearch}">
-                       <f:then>
-                               <f:link.action action="form" arguments="{extendedSearch: 0}"><f:translate key="form.linkToRegularSearch" /></f:link.action>
-                       </f:then>
-                       <f:else>
-                               <f:link.action action="form" arguments="{extendedSearch: 1}"><f:translate key="form.linkToExtendedSearch" /></f:link.action>
-                       </f:else>
-               </f:if>
-               </p>
-       </f:if>
-</f:form>
-</div>
-
-<f:render partial="Rules" />
\ No newline at end of file
+<f:render partial="Form" arguments="{_all}" />
index 37dc2d5..c23e73e 100644 (file)
@@ -1,5 +1,9 @@
 {namespace is=TYPO3\CMS\IndexedSearch\ViewHelpers}
 
+<f:alias map="{sword: searchParams.sword}">
+       <f:render partial="Form" arguments="{_all}"/>
+</f:alias>
+
 <f:for each="{resultsets}" as="result">
        <f:if condition="{result.categoryTitle}">
                <h1 class="tx-indexedsearch-category">{result.categoryTitle}</h1>
                                        </div>
                                </f:if>
                                <p>
-                                       <is:pageBrowsingResults numberOfResults="{result.count}" currentPage="{searchData.pointer}" resultsPerPage="{searchData.results}" />
+                                       <is:pageBrowsingResults numberOfResults="{result.count}" currentPage="{searchParams.pointer}" resultsPerPage="{searchParams.results}" />
                                        {result.sectionText}
                                </p>
-                               <is:pageBrowsing maximumNumberOfResultPages="{settings.search.page_links}" numberOfResults="{result.count}" currentPage="{searchData.pointer}" resultsPerPage="{result.pageBrowser.resultsPerPage}" />
+                               <is:pageBrowsing maximumNumberOfResultPages="{settings.search.page_links}" numberOfResults="{result.count}" currentPage="{searchParams.pointer}" resultsPerPage="{searchParams.results}" />
                        </div>
                        <f:for each="{result.rows}" as="row">
                                <f:if condition="{row.isSectionHeader}">
@@ -61,7 +65,7 @@
                                </f:if>
                        </f:for>
                        <div class="tx-indexedsearch-browsebox">
-                               <is:pageBrowsing numberOfResults="{result.count}" maximumNumberOfResultPages="{settings.search.page_links}" currentPage="{searchData.pointer}" resultsPerPage="{searchData.results}" />
+                               <is:pageBrowsing numberOfResults="{result.count}" maximumNumberOfResultPages="{settings.search.page_links}" currentPage="{searchParams.pointer}" resultsPerPage="{searchParams.results}" />
                        </div>
                </f:then>
                <f:else>
index c10e77f..82f192f 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 defined('TYPO3_MODE') or die();
 
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'Indexed Search (experimental)');
+
 if (TYPO3_MODE === 'BE') {
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule(
                'tools',
@@ -41,4 +43,4 @@ if (TYPO3_MODE === 'BE') {
 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'IndexedSearch');
 
 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('index_config');
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('index_config', 'EXT:indexed_search/locallang_csh_indexcfg.xlf');
\ No newline at end of file
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('index_config', 'EXT:indexed_search/locallang_csh_indexcfg.xlf');