<% /** * 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. */ %> <% long[] entryIds = TagsEntryLocalServiceUtil.getEntryIds(scopeGroupId, entries); long[] notEntryIds = TagsEntryLocalServiceUtil.getEntryIds(scopeGroupId, notEntries); if (allowEmptyResults && (entryIds.length == 0) && (notEntryIds.length == 0)) { entryIds = new long[] {-1}; } Date now = new Date(); int total = TagsAssetLocalServiceUtil.getAssetsCount(scopeGroupId, classNameIds, entryIds, notEntryIds, andOperator, excludeZeroViewCount, now, now); searchContainer.setTotal(total); Map> assetsByCategory = new TreeMap>(); List assets = TagsAssetLocalServiceUtil.getAssets(scopeGroupId, classNameIds, entryIds, notEntryIds, andOperator, orderByColumn1, orderByColumn2, orderByType1, orderByType2, excludeZeroViewCount, now, now, searchContainer.getStart(), total); for (TagsAsset asset : assets) { List assetEntries = TagsEntryLocalServiceUtil.getAssetEntries(asset.getAssetId(), TagsEntryConstants.FOLKSONOMY_TAG); for (TagsEntry assetEntry : assetEntries) { TagsVocabulary vocabulary = assetEntry.getVocabulary(); if (vocabulary.getName().equals(category)) { String tagLabel = null; try { TagsProperty descriptionProperty = TagsPropertyLocalServiceUtil.getProperty(assetEntry.getEntryId(), themeDisplay.getLanguageId()); tagLabel = descriptionProperty.getValue(); } catch (NoSuchPropertyException nspee1) { try { TagsProperty descriptionProperty = TagsPropertyLocalServiceUtil.getProperty(assetEntry.getEntryId(), "en_US"); tagLabel = descriptionProperty.getValue(); } catch (NoSuchPropertyException nspee2) { tagLabel = StringUtil.upperCaseFirstLetter(assetEntry.getName()); } } List assetsList = assetsByCategory.get(tagLabel); if (assetsList == null) { assetsList = new ArrayList(); assetsByCategory.put(tagLabel, assetsList); } assetsList.add(asset); break; } } } Iterator>> itr = assetsByCategory.entrySet().iterator(); if (!itr.hasNext()) { if (!showPortletWithNoResults) { renderRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.TRUE); } %> <% } while (itr.hasNext()) { Map.Entry> entry = itr.next(); String tagLabel = entry.getKey(); List results = entry.getValue(); request.setAttribute("view.jsp-results", results); %>

<%= tagLabel %>

<% for (int assetIndex = 0; (assetIndex < results.size()) && (assetIndex < delta); assetIndex++) { TagsAsset asset = results.get(assetIndex); String className = PortalUtil.getClassName(asset.getClassNameId()); long classPK = asset.getClassPK(); String title = asset.getTitle(); String summary = StringPool.BLANK; String viewURL = StringPool.BLANK; String viewURLMessage = StringPool.BLANK; String editURL = StringPool.BLANK; boolean show = true; request.setAttribute("view.jsp-assetIndex", new Integer(assetIndex)); request.setAttribute("view.jsp-asset", asset); request.setAttribute("view.jsp-title", title); request.setAttribute("view.jsp-summary", summary); request.setAttribute("view.jsp-viewURL", viewURL); request.setAttribute("view.jsp-viewURLMessage", viewURLMessage); request.setAttribute("view.jsp-className", className); request.setAttribute("view.jsp-classPK", new Long(classPK)); request.setAttribute("view.jsp-show", new Boolean(show)); try { %> <%@ include file="/html/portlet/asset_publisher/view_display.jspf" %> <% } catch (Exception e) { _log.error(e.getMessage()); } } %>
<% } %>