
META-INF.resources.document_library.select_group.jsp Maven / Gradle / Ivy
<%--
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/document_library/init.jsp" %>
<%
String eventName = ParamUtil.getString(request, "eventName", liferayPortletResponse.getNamespace() + "selectGroup");
%>
<%
PortletURL portletURL = renderResponse.createRenderURL();
portletURL.setParameter("mvcPath", "/document_library/select_group.jsp");
%>
<%
GroupSearchTerms searchTerms = (GroupSearchTerms)searchContainer.getSearchTerms();
LinkedHashMap groupParams = new LinkedHashMap();
groupParams.put("active", true);
groupParams.put("usersGroups", user.getUserId());
%>
<%
int additionalSites = 0;
if (!searchTerms.hasSearchTerms() && PortletPermissionUtil.hasControlPanelAccessPermission(permissionChecker, themeDisplay.getCompanyGroupId(), DLPortletKeys.DOCUMENT_LIBRARY_ADMIN)) {
if (searchContainer.getStart() == 0) {
results.add(company.getGroup());
}
additionalSites++;
if (searchContainer.getStart() == 0) {
Group userPersonalSite = GroupLocalServiceUtil.getGroup(company.getCompanyId(), GroupConstants.USER_PERSONAL_SITE);
results.add(userPersonalSite);
}
additionalSites++;
}
total = GroupLocalServiceUtil.searchCount(company.getCompanyId(), null, searchTerms.getKeywords(), groupParams);
total += additionalSites;
searchContainer.setTotal(total);
int start = searchContainer.getStart();
if (searchContainer.getStart() > additionalSites) {
start = searchContainer.getStart() - additionalSites;
}
int end = searchContainer.getEnd() - additionalSites;
List sites = GroupServiceUtil.search(company.getCompanyId(), null, searchTerms.getKeywords(), groupParams, start, end, searchContainer.getOrderByComparator());
results.addAll(sites);
searchContainer.setResults(results);
%>
<%
String groupDescriptiveName = HtmlUtil.escape(group.getDescriptiveName(locale));
if (group.isUser()) {
groupDescriptiveName = LanguageUtil.get(request, "my-site");
}
%>
<%
Map data = new HashMap();
data.put("groupdescriptivename", groupDescriptiveName);
data.put("groupid", group.getGroupId());
%>
Liferay.Util.selectEntityHandler('# selectGroupFm', '<%= HtmlUtil.escapeJS(eventName) %>');
© 2015 - 2025 Weber Informatics LLC | Privacy Policy