Fixed bug #1044: Indexed Search results always on same page as search
authorDmitry Dulepov <dmitry.dulepov@gmail.com>
Mon, 29 Mar 2010 08:35:10 +0000 (08:35 +0000)
committerDmitry Dulepov <dmitry.dulepov@gmail.com>
Mon, 29 Mar 2010 08:35:10 +0000 (08:35 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7217 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/indexed_search/ext_typoscript_setup.txt
typo3/sysext/indexed_search/pi/class.tx_indexedsearch.php

index 622584c..f1526b1 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
        * Fixed bug #12375: typo3temp got filled with thousands of EXTERNAL_URL* files
        * !!! Fixed bug #12254: Double wrap of rules subpart with template_css.tmpl (indexed_search)
        * Fixed bug #1436: Meta tag output in indexed search result breaks layout
+       * Fixed bug #1044: Indexed Search results always on same page as search
 
 2010-03-28  Ernesto Baschny  <ernst@cron-it.de>
 
index 3b340c2..8230a7b 100755 (executable)
@@ -48,6 +48,7 @@ plugin.tx_indexedsearch {
                defaultFreeIndexUidList =
                skipExtendToSubpagesChecking = 0
                exactCount = 0
+               targetPid.data = TSFE:id
        }
 
        result_link_target =
index f93ce24..9ae8301 100755 (executable)
@@ -1341,7 +1341,7 @@ class tx_indexedsearch extends tslib_pibase {
                        $html = $this->cObj->substituteSubpart($html, '###ADDITONAL_KEYWORD###', '');
                }
 
-               $markerArray['###ACTION_URL###'] = htmlspecialchars($this->pi_getPageLink($GLOBALS['TSFE']->id, $GLOBALS['TSFE']->sPre));
+               $markerArray['###ACTION_URL###'] = htmlspecialchars($this->getSearchFormActionURL());
 
                $hiddenFieldCode = $this->cObj->getSubpart($this->templateCode, '###HIDDEN_FIELDS###');
                $hiddenFieldCode = preg_replace('/^\n\t(.+)/ms', '$1', $hiddenFieldCode);               // Remove first newline and tab (cosmetical issue)
@@ -2395,6 +2395,38 @@ class tx_indexedsearch extends tslib_pibase {
                        }
                }
        }
+
+       /**
+        * Obtains the URL of the search target page
+        *
+        * @return string
+        */
+       protected function getSearchFormActionURL() {
+               $targetUrlPid = $this->getSearchFormActionPidFromTS();
+               if ($targetUrlPid == 0) {
+                       $targetUrlPid = $GLOBALS['TSFE']->id;
+               }
+               return $this->pi_getPageLink($targetUrlPid, $GLOBALS['TSFE']->sPre);
+       }
+
+       /**
+        * Obtains search form target pid from the TypoScript configuration
+        *
+        * @return int
+        */
+       protected function getSearchFormActionPidFromTS() {
+               $result = 0;
+               if (isset($this->conf['search.']['targetPid']) || isset($this->conf['search.']['targetPid.'])) {
+                       if (is_array($this->conf['search.']['targetPid.'])) {
+                               $result = $this->cObj->stdWrap($this->conf['search.']['targetPid'], $this->conf['search.']['targetPid.']);
+                       }
+                       else {
+                               $result = $this->conf['search.']['targetPid'];
+                       }
+                       $result = intval($result);
+               }
+               return $result;
+       }
 }