{if !OFFLINE || $__wcf->session->getPermission('admin.general.canViewPageDuringOfflineMode')}
<script data-relocate="true">
require(['WoltLabSuite/Core/Ui/Search/Page'], function(UiSearchPage) {
- UiSearchPage.init('{if !$__searchObjectTypeName|empty}{@$__searchObjectTypeName}{else}everywhere{/if}');
+ UiSearchPage.init('{if !$__searchObjectTypeName|empty}{@$__searchObjectTypeName}{elseif !$searchPreselectObjectType|empty}{$searchPreselectObjectType}{else}everywhere{/if}');
});
</script>
{/if}
\ No newline at end of file
// init form
foreach (SearchEngine::getInstance()->getAvailableObjectTypes() as $objectType) $objectType->show($this);
+ $searchPreselectObjectType = 'everywhere';
+ if (count($this->selectedObjectTypes) === 1) $searchPreselectObjectType = reset($this->selectedObjectTypes);
+
WCF::getTPL()->assign([
'query' => $this->query,
'subjectOnly' => $this->subjectOnly,
'sortField' => $this->sortField,
'sortOrder' => $this->sortOrder,
'selectedObjectTypes' => $this->selectedObjectTypes,
- 'objectTypes' => SearchEngine::getInstance()->getAvailableObjectTypes()
+ 'objectTypes' => SearchEngine::getInstance()->getAvailableObjectTypes(),
+ 'searchPreselectObjectType' => $searchPreselectObjectType
]);
}
public function assignVariables() {
parent::assignVariables();
+ $searchPreselectObjectType = 'everywhere';
+ if (count($this->searchData['selectedObjectTypes']) === 1) $searchPreselectObjectType = reset($this->searchData['selectedObjectTypes']);
+
WCF::getTPL()->assign([
'query' => $this->searchData['query'],
'objects' => $this->messages,
'objectTypes' => SearchEngine::getInstance()->getAvailableObjectTypes(),
'resultListTemplateName' => $this->resultListTemplateName,
'resultListApplication' => $this->resultListApplication,
- 'application' => ApplicationHandler::getInstance()->getAbbreviation(ApplicationHandler::getInstance()->getActiveApplication()->packageID)
+ 'application' => ApplicationHandler::getInstance()->getAbbreviation(ApplicationHandler::getInstance()->getActiveApplication()->packageID),
+ 'searchPreselectObjectType' => $searchPreselectObjectType
]);
}