<% /** * 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. */ %> <% String keywords = ParamUtil.getString(request, "keywords"); String tag = ParamUtil.getString(request, "tag"); String searchRepositoryURL = ParamUtil.getString(request, "searchRepositoryURL"); String license = ParamUtil.getString(request, "license"); String installStatus = ParamUtil.getString(request, "installStatus", PluginPackageImpl.STATUS_NOT_INSTALLED_OR_OLDER_VERSION_INSTALLED); %> <% try { %>

" />

<% String orderByCol = ParamUtil.getString(request, "orderByCol"); String orderByType = ParamUtil.getString(request, "orderByType"); if (Validator.isNotNull(orderByCol) && Validator.isNotNull(orderByType)) { portalPrefs.setValue(PortletKeys.PLUGIN_INSTALLER, "plugin-packages-order-by-col", orderByCol); portalPrefs.setValue(PortletKeys.PLUGIN_INSTALLER, "plugin-packages-order-by-type", orderByType); } else { orderByCol = portalPrefs.getValue(PortletKeys.PLUGIN_INSTALLER, "plugin-packages-order-by-col", "modified-date"); orderByType = portalPrefs.getValue(PortletKeys.PLUGIN_INSTALLER, "plugin-packages-order-by-type", "desc"); } List headerNames = new ArrayList(); headerNames.add(pluginType + "-plugin"); headerNames.add("trusted"); headerNames.add("tags"); headerNames.add("installed-version"); headerNames.add("available-version"); headerNames.add("modified-date"); Map orderableHeaders = new HashMap(); orderableHeaders.put(pluginType + "-plugin", Field.TITLE); orderableHeaders.put("modified-date", "modified-date"); SearchContainer searchContainer = new SearchContainer(renderRequest, null, null, SearchContainer.DEFAULT_CUR_PARAM, SearchContainer.DEFAULT_DELTA, portletURL, headerNames, LanguageUtil.get(pageContext, "no-" + pluginType + "-plugins-were-found")); searchContainer.setOrderableHeaders(orderableHeaders); searchContainer.setOrderByCol(orderByCol); searchContainer.setOrderByType(orderByType); List results = PluginPackageUtil.search(keywords, pluginType, tag, license, searchRepositoryURL, installStatus, QueryUtil.ALL_POS, QueryUtil.ALL_POS).toList(); DocumentComparator docComparator = null; if (orderByType.equals("desc")) { docComparator = new DocumentComparator(false, false); } else { docComparator = new DocumentComparator(); } if (orderByCol.equals("modified-date")) { docComparator.addOrderBy("modified-date"); } else { docComparator.addOrderBy(Field.TITLE); docComparator.addOrderBy("version"); } results = ListUtil.sort(results, docComparator); int total = results.size(); searchContainer.setTotal(total); results = ListUtil.subList(results, searchContainer.getStart(), searchContainer.getEnd()); searchContainer.setResults(results); List resultRows = searchContainer.getResultRows(); for (int i = 0; i < results.size(); i++) { Document doc = (Document)results.get(i); String pluginPackageName = doc.get(Field.TITLE); String pluginPackageModuleId = doc.get("moduleId"); String pluginPackageGroupId = doc.get("groupId"); String pluginPackageArtifactId = doc.get("artifactId"); String pluginPackageAvailableVersion = doc.get("version"); Date pluginPackageModifiedDate = doc.getDate(Field.MODIFIED); String pluginPackageTags = StringUtil.merge(doc.getValues("tag"), StringPool.COMMA + StringPool.SPACE); String pluginPackageShortDescription = doc.get("shortDescription"); String pluginPackageChangeLog = doc.get("changeLog"); String pluginPackageRepositoryURL = doc.get("repositoryURL"); // The value for pluginPackage should never be null except when Lucene // is out of sync as in LEP-4783 or when the plugin was not installed // from a repository. PluginPackage pluginPackage = null; if (!pluginPackageRepositoryURL.startsWith(RemotePluginPackageRepository.LOCAL_URL)) { pluginPackage = PluginPackageUtil.getPluginPackageByModuleId(pluginPackageModuleId, pluginPackageRepositoryURL); } PluginPackage installedPluginPackage = PluginPackageUtil.getLatestInstalledPluginPackage(pluginPackageGroupId, pluginPackageArtifactId); ResultRow row = new ResultRow(doc, pluginPackageModuleId, i); PortletURL rowURL = renderResponse.createRenderURL(); rowURL.setWindowState(WindowState.MAXIMIZED); rowURL.setParameter("struts_action", "/plugin_installer/view"); rowURL.setParameter("tabs1", tabs1); rowURL.setParameter("tabs2", tabs2); rowURL.setParameter("redirect", currentURL); rowURL.setParameter("moduleId", pluginPackageModuleId); rowURL.setParameter("repositoryURL", pluginPackageRepositoryURL); // Name, screenshots, and short description StringBuilder sb = new StringBuilder(); if (pluginPackage != null) { sb.append(""); if (tabs2.equals("layout-templates") || tabs2.equals("themes")) { List screenshots = pluginPackage.getScreenshots(); if (screenshots.size() > 0) { Screenshot screenshot = (Screenshot)screenshots.get(0); sb.append(""); } } } sb.append(""); sb.append(pluginPackageName); sb.append(" "); sb.append(pluginPackageAvailableVersion); if (pluginPackage != null) { sb.append(""); } if (Validator.isNotNull(pluginPackageShortDescription)) { sb.append("
"); sb.append(LanguageUtil.get(pageContext, "id")); sb.append(": "); sb.append(pluginPackageModuleId); sb.append("
"); sb.append(pluginPackageShortDescription); } row.addText(sb.toString()); // Trusted TextSearchEntry rowTextEntry = new TextSearchEntry(SearchEntry.DEFAULT_ALIGN, SearchEntry.DEFAULT_VALIGN, pluginPackageTags, null, null, null); if (PluginPackageUtil.isTrusted(pluginPackageRepositoryURL)) { row.addText(LanguageUtil.get(pageContext, "yes")); } else { row.addText(LanguageUtil.get(pageContext, "no")); } // Tags row.addText(rowTextEntry); // Installed version if (installedPluginPackage != null) { row.addText(installedPluginPackage.getVersion()); } else { row.addText(StringPool.DASH); } // Available version sb = new StringBuilder(); sb.append(pluginPackageAvailableVersion); sb.append(" "); row.addText(sb.toString()); // Modified date row.addText(dateFormatDateTime.format(pluginPackageModifiedDate)); // Add result row resultRows.add(row); } %>
<%= LanguageUtil.format(pageContext, "list-of-plugins-was-last-refreshed-on-x", dateFormatDateTime.format(PluginPackageUtil.getLastUpdateDate())) %> " onClick="reloadRepositories();" />
<% } catch (PluginPackageException ppe) { if (_log.isWarnEnabled()) { _log.warn(ppe.getMessage()); } %> <% } %> <%! private static Log _log = LogFactoryUtil.getLog("portal-web.docroot.html.portlet.plugin_installer.browse_repository.jsp"); %>