<% /** * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ %> <% int assetOrder = ParamUtil.getInteger(request, "assetOrder", -1); long userId = 0; String keywords = ParamUtil.getString(request, "keywords"); PortletURL portletURL = renderResponse.createRenderURL(); portletURL.setParameter("struts_action", "/portlet_configuration/edit_configuration"); portletURL.setParameter("redirect", redirect); portletURL.setParameter("backURL", redirect); portletURL.setParameter("portletResource", portletResource); portletURL.setParameter("typeSelection", BlogsEntry.class.getName()); %>
" onclick="submitForm(document.fm, '<%= portletURL.toString() %>');" />
<% List headerNames = new ArrayList(); headerNames.add("entry"); headerNames.add("user-name"); headerNames.add("modified-date"); headerNames.add("score"); SearchContainer searchContainer = new SearchContainer(renderRequest, null, null, SearchContainer.DEFAULT_CUR_PARAM, SearchContainer.DEFAULT_DELTA, portletURL, headerNames, LanguageUtil.format(pageContext, "no-entries-were-found-that-matched-the-keywords-x", "" + HtmlUtil.escape(keywords) + "")); try { Hits results = BlogsEntryLocalServiceUtil.search(company.getCompanyId(), scopeGroupId, themeDisplay.getUserId(), userId, keywords, searchContainer.getStart(), searchContainer.getEnd()); int total = results.getLength(); searchContainer.setTotal(total); List resultRows = searchContainer.getResultRows(); for (int i = 0; i < results.getDocs().length; i++) { com.liferay.portal.kernel.search.Document doc = results.doc(i); ResultRow row = new ResultRow(doc, i, i); long entryId = GetterUtil.getLong(doc.get(Field.ENTRY_CLASS_PK)); BlogsEntry entry = BlogsEntryLocalServiceUtil.getEntry(entryId); entry = entry.toEscapedModel(); TagsAsset asset = TagsAssetLocalServiceUtil.getAsset(BlogsEntry.class.getName(), entry.getEntryId()); StringBuilder sb = new StringBuilder(); sb.append("javascript: "); sb.append(renderResponse.getNamespace()); sb.append("selectAsset('"); sb.append(asset.getAssetId()); sb.append("', '"); sb.append(asset.getAssetId()); sb.append("', '"); sb.append(UnicodeFormatter.toString(asset.getTitle())); sb.append("', '"); sb.append(assetOrder); sb.append("');"); String rowHREF = sb.toString(); // Title row.addText(entry.getTitle(), rowHREF); // User name row.addText(entry.getUserName(), rowHREF); // Modified date row.addText(dateFormatDate.format(entry.getModifiedDate()), rowHREF); // Score row.addScore(results.score(i)); // Add result row resultRows.add(row); } } catch (Exception e) { } %> <% List headerNames = new ArrayList(); headerNames.add("entry"); headerNames.add("user-name"); headerNames.add("modified-date"); SearchContainer searchContainer = new SearchContainer(renderRequest, null, null, SearchContainer.DEFAULT_CUR_PARAM, SearchContainer.DEFAULT_DELTA, portletURL, headerNames, "there-are-no-entries"); int total = BlogsEntryLocalServiceUtil.getGroupEntriesCount(scopeGroupId); searchContainer.setTotal(total); List results = BlogsEntryLocalServiceUtil.getGroupEntries(scopeGroupId, searchContainer.getStart(), searchContainer.getEnd()); searchContainer.setResults(results); List resultRows = searchContainer.getResultRows(); for (int i = 0; i < results.size(); i++) { BlogsEntry entry = (BlogsEntry)results.get(i); entry = entry.toEscapedModel(); ResultRow row = new ResultRow(entry, entry.getEntryId(), i); TagsAsset asset = TagsAssetLocalServiceUtil.getAsset(BlogsEntry.class.getName(), entry.getEntryId()); StringBuilder sb = new StringBuilder(); sb.append("javascript: "); sb.append(renderResponse.getNamespace()); sb.append("selectAsset('"); sb.append(asset.getAssetId()); sb.append("', '"); sb.append(asset.getAssetId()); sb.append("', '"); sb.append(UnicodeFormatter.toString(asset.getTitle())); sb.append("', '"); sb.append(assetOrder); sb.append("');"); String rowHREF = sb.toString(); // Title row.addText(entry.getTitle(), rowHREF); // User name row.addText(entry.getUserName(), rowHREF); // Modified date row.addText(dateFormatDate.format(entry.getModifiedDate()), rowHREF); // Add result row resultRows.add(row); } %>