After many hours searching/trying and failing I found how that is to be done.
You are not supposed to use the search-portlet in the theme. All you need to do is to set up a regular form with the right action attribute. This way you just send your search-criteria to the Search-portlet and have it display the result. This is how it is done by Liferay when using the $theme.journalContentSearch(). The trick is however how to generate the right action-url. This is what I did :
Within navigation.vm added this line where I wanted the search to appear.
1$theme.include($themeServletContext, "/jsps/my_search.jsp")
Created the file "my_search.jsp" and filled it with the following (I left out all the imports part)
1
2<%
3PortletRequest portletRequest = (PortletRequest)request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST);
4PortletResponse portletResponse = (PortletResponse)request.getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE);
5String namespace = StringPool.BLANK;
6boolean useNamespace = GetterUtil.getBoolean((String)request.getAttribute("aui:form:useNamespace"), true);
7if ((portletResponse != null) && useNamespace) {
8 namespace = portletResponse.getNamespace();
9}
10
11String currentURL = PortalUtil.getCurrentURL(request);
12String defaultKeywords = LanguageUtil.get(pageContext, "search") + "....";
13String unicodeDefaultKeywords = UnicodeFormatter.toString(defaultKeywords);
14
15String keywords = ParamUtil.getString(request, namespace + "keywords", defaultKeywords);
16PortletURL portletURL = PortletURLFactoryUtil.create(request, PortletKeys.SEARCH, plid, PortletRequest.RENDER_PHASE);
17
18portletURL.setWindowState(WindowState.MAXIMIZED);
19portletURL.setPortletMode(PortletMode.VIEW);
20
21portletURL.setParameter("struts_action", "/search/search");
22
23long groupId = ParamUtil.getLong(request, "groupId");
24Group group = themeDisplay.getScopeGroup();
25String format = ParamUtil.getString(request, "format");
26%>
27
28<form action="<%= portletURL.toString() %>" class="aui-form" method="post" name="<%= namespace %>fm" onSubmit="submitForm(this); return false;">
29<aui:input name="format" type="hidden" value="<%= format %>" />
30
31<%
32String taglibOnBlur = "if (this.value == '') { this.value = '" + unicodeDefaultKeywords + "'; }";
33String taglibOnFocus = "if (this.value == '" + unicodeDefaultKeywords + "') { this.value = ''; }";
34%>
35 <aui:fieldset>
36 <aui:input inlineField="<%= true %>" label="" name="keywords" size="30" onBlur="<%= taglibOnBlur %>" onFocus="<%= taglibOnFocus %>" title="search-web-content" type="text" value="<%= HtmlUtil.escape(keywords) %>" />
37
38 <aui:select inlineField="<%= true %>" label="" name="groupId">
39 <aui:option label="everything" selected="<%= groupId == 0 %>" value="0" />
40 <aui:option label='<%= "this-" + (group.isOrganization() ? "organization" : "community") %>' selected="<%= groupId != 0 %>" value="<%= group.getGroupId() %>" />
41 </aui:select>
42
43 <aui:input align="absmiddle" border="0" inlineField="<%= true %>" label="" name="search" src='<%= themeDisplay.getPathThemeImages() + "/common/search.png" %>' title="search" type="image" />
44 </aui:fieldset>
45
46</form>
But, this will result in an error message like this "You do not have the roles required to access this portlet. ". After some hours frustration I found that this is a new security in Liferay 6 to prevent Cross-site scripting. The solution is to white-list the portlet or the Struts-action in your portal-ext.properties
1portlet.add.default.resource.check.whitelist = 3
Hope this will prevent some others to go through all the trouble I had to go through.
Be kell jelentkezni ahhoz, hogy ez helytelenként legyen megjelölve.