%
/**
* 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.
*/
%>
" />
<%
List headerNames = new ArrayList();
headerNames.add("portlet");
headerNames.add("active");
headerNames.add("roles");
if (showReindexButton) {
headerNames.add("search-index");
}
SearchContainer searchContainer = new SearchContainer(renderRequest, null, null, SearchContainer.DEFAULT_CUR_PARAM, SearchContainer.DEFAULT_DELTA, portletURL, headerNames, null);
List portlets = PortletLocalServiceUtil.getPortlets(company.getCompanyId(), false, false);
portlets = ListUtil.sort(portlets, new PortletTitleComparator(application, locale));
int total = portlets.size();
searchContainer.setTotal(total);
List results = ListUtil.subList(portlets, searchContainer.getStart(), searchContainer.getEnd());
searchContainer.setResults(results);
List resultRows = searchContainer.getResultRows();
for (int i = 0; i < results.size(); i++) {
Portlet portlet = results.get(i);
PluginPackage pluginPackage = portlet.getPluginPackage();
PluginSetting pluginSetting = PluginSettingLocalServiceUtil.getPluginSetting(company.getCompanyId(), portlet.getPortletId(), Plugin.TYPE_PORTLET);
ResultRow row = new ResultRow(portlet, portlet.getId(), i);
PortletURL rowURL = renderResponse.createRenderURL();
rowURL.setWindowState(WindowState.MAXIMIZED);
rowURL.setParameter("struts_action", "/enterprise_admin/edit_plugin");
rowURL.setParameter("redirect", currentURL);
if (pluginPackage != null) {
rowURL.setParameter("moduleId", pluginPackage.getModuleId());
}
rowURL.setParameter("pluginId", portlet.getPortletId());
rowURL.setParameter("pluginType", Plugin.TYPE_PORTLET);
// Name and description
StringBuilder sb = new StringBuilder();
String displayName = portlet.getDisplayName();
String title = PortalUtil.getPortletTitle(portlet, application, locale);
if (showEditPluginHREF) {
sb.append("");
}
sb.append("");
sb.append(title);
sb.append("");
if (showEditPluginHREF) {
sb.append("");
}
sb.append(" ");
sb.append(LanguageUtil.get(pageContext, "package"));
sb.append(": ");
if (pluginPackage == null) {
sb.append(LanguageUtil.get(pageContext, "unknown"));
}
else {
sb.append(pluginPackage.getName());
if (pluginPackage.getContext() != null) {
sb.append(" (");
sb.append(pluginPackage.getContext());
sb.append(")");
}
}
if (Validator.isNotNull(displayName) && !title.equals(displayName)) {
sb.append(" ");
sb.append(portlet.getDisplayName());
}
row.addText(sb.toString());
// Active
row.addText(LanguageUtil.get(pageContext, (portlet.isActive() ? "yes" : "no")));
// Roles
row.addText(StringUtil.merge(portlet.getRolesArray(), ", "));
// Search index
sb = new StringBuilder();
if (showReindexButton && Validator.isNotNull(portlet.getIndexerClass())) {
sb.append("");
}
row.addText(sb.toString());
// Add result row
resultRows.add(row);
}
%>