[BUGFIX] indexed_search fix advanced search select boxes in extbase plugin 30/37930/3
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Tue, 17 Mar 2015 17:47:31 +0000 (18:47 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Mon, 23 Mar 2015 22:39:20 +0000 (23:39 +0100)
Fix missing labels for advanced search in extbase plugin.
- "Search in:"
- "From section:"
- "Order by:"
- "Category:"

Some language labels were renamed (the former names were never used).
It also fixes one uninitialized variable and wrong/missing doc comments

Resolves: #65817
Releases: master, 6.2
Change-Id: I519fa989ae5281be61105ceb05eb1438a5820469
Reviewed-on: http://review.typo3.org/37930
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/indexed_search/Classes/Controller/SearchController.php
typo3/sysext/indexed_search/Resources/Private/Language/locallang.xlf
typo3/sysext/indexed_search/Resources/Private/Partials/Form.html

index ea22ec2..75fd3d4 100644 (file)
@@ -44,7 +44,7 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
        protected $defaultResultNumber = 10;
 
        /**
-        * Lexer object
+        * Search repository
         *
         * @var \TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository
         */
@@ -57,31 +57,69 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
         */
        protected $lexerObj;
 
-       // External parser objects
+       /**
+        * External parser objects
+        * @var array
+        */
        protected $externalParsers = array();
 
-       // Will hold the first row in result - used to calculate relative hit-ratings.
+       /**
+        * Will hold the first row in result - used to calculate relative hit-ratings.
+        *
+        * @var array
+        */
        protected $firstRow = array();
 
-       // Domain records (needed ?)
+       /**
+        * sys_domain records
+        *
+        * @var array
+        */
        protected $domainRecords = array();
 
-       // Required fe_groups memberships for display of a result.
+       /**
+        * Required fe_groups memberships for display of a result.
+        *
+        * @var array
+        */
        protected $requiredFrontendUsergroups = array();
 
-       // Page tree sections for search result.
+       /**
+        * Page tree sections for search result.
+        *
+        * @var array
+        */
        protected $resultSections = array();
 
-       // Caching of page path
+       /**
+        * Caching of page path
+        *
+        * @var array
+        */
        protected $pathCache = array();
 
-       // Storage of icons
+       /**
+        * Storage of icons
+        *
+        * @var array
+        */
        protected $iconFileNameCache = array();
 
-       // Indexer configuration, coming from $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['indexed_search']
+       /**
+        * Indexer configuration, coming from $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['indexed_search']
+        *
+        * @var array
+        */
        protected $indexerConfig = array();
 
        /**
+        * Flag whether metaphone search should be enabled
+        *
+        * @var bool
+        */
+       protected $enableMetaphoneSearch = FALSE;
+
+       /**
         * sets up all necessary object for searching
         *
         * @param array $searchData The incoming search parameters
@@ -391,8 +429,8 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
                                'sys_language_uid' => $row['sys_language_uid']
                        ));
                        // check if the access is restricted
-                       if (is_array($this->requiredFrontendUsergroups[$id]) && count($this->requiredFrontendUsergroups[$id])) {
-                               $resultData['access'] = '<img src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('indexed_search') . 'pi/res/locked.gif" width="12" height="15" vspace="5" title="' . sprintf(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.memberGroups', 'indexed_search'), implode(',', array_unique($this->requiredFrontendUsergroups[$id]))) . '" alt="" />';
+                       if (is_array($this->requiredFrontendUsergroups[$pathId]) && count($this->requiredFrontendUsergroups[$pathId])) {
+                               $resultData['access'] = '<img src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('indexed_search') . 'pi/res/locked.gif" width="12" height="15" vspace="5" title="' . sprintf(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.memberGroups', 'indexed_search'), implode(',', array_unique($this->requiredFrontendUsergroups[$pathId]))) . '" alt="" />';
                        }
                }
                // If there are subrows (eg. subpages in a PDF-file or if a duplicate page
@@ -898,7 +936,8 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
                                        continue;
                                }
                                if ($name = $obj->searchTypeMediaTitle($extension)) {
-                                       $allOptions[$extension] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('mediaTypes.' . $extension, $name);
+                                       $translatedName = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('mediaTypes.' . $extension, 'indexed_search');
+                                       $allOptions[$extension] = $translatedName ?: $name;
                                }
                        }
                }
@@ -956,8 +995,8 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
                // This selects the first and secondary menus for the "sections" selector - so we can search in sections and sub sections.
                if ($this->settings['displayLevel1Sections']) {
                        $firstLevelMenu = $this->getMenuOfPages($this->searchRootPageIdList);
-                       $labelLevel1 = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sections.Rl1', 'indexed_search');
-                       $labelLevel2 = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sections.Rl2', 'indexed_search');
+                       $labelLevel1 = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sections.rootLevel1', 'indexed_search');
+                       $labelLevel2 = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sections.rootLevel2', 'indexed_search');
                        foreach ($firstLevelMenu as $firstLevelKey => $menuItem) {
                                if (!$menuItem['nav_hide']) {
                                        $allOptions['rl1_' . $menuItem['uid']] = trim($labelLevel1 . ' ' . $menuItem['title']);
@@ -970,13 +1009,13 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
                                                                unset($secondLevelMenu[$secondLevelKey]);
                                                        }
                                                }
-                                               $allOptions['rl2_' . implode(',', array_keys($secondLevelMenu))] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sections.Rl2All', 'indexed_search');
+                                               $allOptions['rl2_' . implode(',', array_keys($secondLevelMenu))] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sections.rootLevel2All', 'indexed_search');
                                        }
                                } else {
                                        unset($firstLevelMenu[$firstLevelKey]);
                                }
                        }
-                       $allOptions['rl1_' . implode(',', array_keys($firstLevelMenu))] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sections.Rl1All', 'indexed_search');
+                       $allOptions['rl1_' . implode(',', array_keys($firstLevelMenu))] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sections.rootLevel1All', 'indexed_search');
                }
                // disable single entries by TypoScript
                $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['sections.']);
@@ -1141,6 +1180,7 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
                if (!is_array($this->domainRecords[$pageUid])) {
                        $this->getPathFromPageId($pageUid);
                }
+               $target = '';
                // If external domain, then link to that:
                if (count($this->domainRecords[$pageUid])) {
                        $scheme = GeneralUtility::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
@@ -1186,7 +1226,7 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
         * Returns the path to the page $id
         *
         * @param int $id Page ID
-        * @param string MP variable content
+        * @param string $pathMP MP variable content
         * @return string Path
         */
        protected function getPathFromPageId($id, $pathMP = '') {
index 92fabc6..56420ef 100644 (file)
@@ -71,22 +71,22 @@ All search words are converted to lowercase.
                        </trans-unit>
 
 
-                       <trans-unit id="types.0" xml:space="preserve">
+                       <trans-unit id="searchTypes.0" xml:space="preserve">
                                <source>Distinct word</source>
                        </trans-unit>
-                       <trans-unit id="types.1" xml:space="preserve">
+                       <trans-unit id="searchTypes.1" xml:space="preserve">
                                <source>Part of word</source>
                        </trans-unit>
-                       <trans-unit id="types.2" xml:space="preserve">
+                       <trans-unit id="searchTypes.2" xml:space="preserve">
                                <source>First part of word</source>
                        </trans-unit>
-                       <trans-unit id="types.3" xml:space="preserve">
+                       <trans-unit id="searchTypes.3" xml:space="preserve">
                                <source>Last part of word</source>
                        </trans-unit>
-                       <trans-unit id="types.10" xml:space="preserve">
+                       <trans-unit id="searchTypes.10" xml:space="preserve">
                                <source>Sounds like</source>
                        </trans-unit>
-                       <trans-unit id="types.20" xml:space="preserve">
+                       <trans-unit id="searchTypes.20" xml:space="preserve">
                                <source>Sentence</source>
                        </trans-unit>
 
@@ -116,16 +116,16 @@ All search words are converted to lowercase.
                        <trans-unit id="sections.-3" xml:space="preserve">
                                <source>Level 2 and out</source>
                        </trans-unit>
-                       <trans-unit id="sections.RL1" xml:space="preserve">
+                       <trans-unit id="sections.rootLevel1" xml:space="preserve">
                                <source>Level 1:</source>
                        </trans-unit>
-                       <trans-unit id="sections.RL1All" xml:space="preserve">
+                       <trans-unit id="sections.rootLevel1All" xml:space="preserve">
                                <source>All pages on level 1</source>
                        </trans-unit>
-                       <trans-unit id="sections.RL2" xml:space="preserve">
+                       <trans-unit id="sections.rootLevel2" xml:space="preserve">
                                <source>- Level 2:</source>
                        </trans-unit>
-                       <trans-unit id="sections.RL2All" xml:space="preserve">
+                       <trans-unit id="sections.rootLevel2All" xml:space="preserve">
                                <source>- All pages on level 2</source>
                        </trans-unit>
 
@@ -145,7 +145,7 @@ All search words are converted to lowercase.
                        <trans-unit id="indexingConfigurations.-2" xml:space="preserve">
                                <source>All, categorized</source>
                        </trans-unit>
-                       <trans-unit id="indexingConfigurations._0" xml:space="preserve">
+                       <trans-unit id="indexingConfigurations.0" xml:space="preserve">
                                <source>Pages</source>
                        </trans-unit>
 
index 479050a..ee20b70 100644 (file)
@@ -74,7 +74,7 @@
                                <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" />
+                                       <f:form.select name="search[sortDesc]"  options="{allSortDescendings}" value="{searchParams.sortDesc}" id="tx-indexedsearch-selectbox-desc" class="tx-indexedsearch-selectbox-desc" />
                                </div>
                        </f:if>