Search result improvements
authorMarcel Werk <burntime@woltlab.com>
Fri, 23 May 2014 23:45:13 +0000 (01:45 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 23 May 2014 23:45:13 +0000 (01:45 +0200)
com.woltlab.wcf/templates/searchResult.tpl
wcfsetup/install/files/lib/form/SearchForm.class.php
wcfsetup/install/files/lib/page/SearchResultPage.class.php

index aca7cf64c16a4eec7fb2b7177e22a5f138c15470..30308b020278e192816de95f36b315403f851e1f 100644 (file)
@@ -19,7 +19,7 @@
 
 <div class="contentNavigation">
        {assign var=encodedHighlight value=$highlight|urlencode}
-       {pages print=true assign=pagesLinks controller='SearchResult' id=$searchID link="pageNo=%d&highlight=$encodedHighlight"}
+       {pages print=true application=$application assign=pagesLinks controller='SearchResult' id=$searchID link="pageNo=%d&highlight=$encodedHighlight"}
        
        {hascontent}
                <nav>
index ca911571c5b8dfa335eb214252bf4fa1cbb3ca42..03104a0b264fde7391cc399703ef7463380d9b5e 100644 (file)
@@ -2,6 +2,7 @@
 namespace wcf\form;
 use wcf\data\search\Search;
 use wcf\data\search\SearchAction;
+use wcf\system\application\ApplicationHandler;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\exception\NamedUserException;
@@ -351,8 +352,20 @@ class SearchForm extends RecaptchaForm {
                }
                $this->saved();
                
+               // get application
+               $application = 'wcf';
+               if (count($this->selectedObjectTypes) == 1) {
+                       $objectType = SearchEngine::getInstance()->getObjectType(reset($this->selectedObjectTypes));
+                       if ($tmp = ApplicationHandler::getInstance()->getAbbreviation($objectType->packageID)) {
+                               $application = $tmp;
+                       }
+               }
+               
                // forward to result page
-               HeaderUtil::redirect(LinkHandler::getInstance()->getLink('SearchResult', array('id' => $this->searchID), 'highlight='.urlencode($this->query)));
+               HeaderUtil::redirect(LinkHandler::getInstance()->getLink('SearchResult', array(
+                       'id' => $this->searchID,
+                       'application' => $application
+               ), 'highlight='.urlencode($this->query)));
                exit;
        }
        
index 0542de93d8c11b0cb4956cb238bb148596f70b50..01fa65cbc5bffbf6fe8ee1a736005045bfec1143 100644 (file)
@@ -2,6 +2,7 @@
 namespace wcf\page;
 use wcf\data\search\ISearchResultObject;
 use wcf\data\search\Search;
+use wcf\system\application\ApplicationHandler;
 use wcf\system\breadcrumb\Breadcrumb;
 use wcf\system\event\EventHandler;
 use wcf\system\exception\IllegalLinkException;
@@ -170,7 +171,8 @@ class SearchResultPage extends MultipleLinkPage {
                        'alterable' => (!empty($this->searchData['alterable']) ? 1 : 0),
                        'objectTypes' => SearchEngine::getInstance()->getAvailableObjectTypes(),
                        'resultListTemplateName' => $this->resultListTemplateName,
-                       'resultListApplication' => $this->resultListApplication
+                       'resultListApplication' => $this->resultListApplication,
+                       'application' => ApplicationHandler::getInstance()->getAbbreviation(ApplicationHandler::getInstance()->getActiveApplication()->packageID)
                ));
        }