This repository has been archived by the owner on Nov 20, 2021. It is now read-only.
forked from liferay/liferay-portal
/
select_user_group.jsp
126 lines (98 loc) · 4.05 KB
/
select_user_group.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<%--
/**
* Copyright (c) 2000-2013 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="/html/portlet/user_groups_admin/init.jsp" %>
<%
String eventName = ParamUtil.getString(request, "eventName", liferayPortletResponse.getNamespace() + "selectUserGroup");
User selUser = PortalUtil.getSelectedUser(request);
PortletURL portletURL = renderResponse.createRenderURL();
portletURL.setParameter("struts_action", "/user_groups_admin/select_user_group");
if (selUser != null) {
portletURL.setParameter("p_u_i_d", String.valueOf(selUser.getUserId()));
}
portletURL.setParameter("eventName", eventName);
%>
<aui:form action="<%= portletURL.toString() %>" method="post" name="selectUserGroupFm">
<liferay-ui:header
title="user-groups"
/>
<liferay-ui:search-container
searchContainer="<%= new UserGroupSearch(renderRequest, portletURL) %>"
>
<liferay-ui:search-form
page="/html/portlet/user_groups_admin/user_group_search.jsp"
/>
<%
UserGroupSearchTerms searchTerms = (UserGroupSearchTerms)searchContainer.getSearchTerms();
%>
<liferay-ui:search-container-results>
<%
if (filterManageableUserGroups) {
List<UserGroup> userGroups = UserGroupLocalServiceUtil.search(company.getCompanyId(), searchTerms.getKeywords(), null, QueryUtil.ALL_POS, QueryUtil.ALL_POS, searchContainer.getOrderByComparator());
userGroups = UsersAdminUtil.filterUserGroups(permissionChecker, userGroups);
total = userGroups.size();
results = ListUtil.subList(userGroups, searchContainer.getStart(), searchContainer.getEnd());
}
else {
results = UserGroupLocalServiceUtil.search(company.getCompanyId(), searchTerms.getKeywords(), null, searchContainer.getStart(), searchContainer.getEnd(), searchContainer.getOrderByComparator());
total = UserGroupLocalServiceUtil.searchCount(company.getCompanyId(), searchTerms.getKeywords(), null);
}
pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total);
%>
</liferay-ui:search-container-results>
<liferay-ui:search-container-row
className="com.liferay.portal.model.UserGroup"
escapedModel="<%= false %>"
keyProperty="userGroupId"
modelVar="userGroup"
>
<liferay-ui:search-container-column-text
name="name"
value="<%= HtmlUtil.escape(userGroup.getName()) %>"
/>
<liferay-ui:search-container-column-text
name="description"
value="<%= HtmlUtil.escape(userGroup.getDescription()) %>"
/>
<liferay-ui:search-container-column-text>
<c:if test="<%= (UserGroupMembershipPolicyUtil.isMembershipAllowed((selUser != null) ? selUser.getUserId() : 0, userGroup.getUserGroupId())) %>">
<%
Map<String, Object> data = new HashMap<String, Object>();
data.put("usergroupid", userGroup.getUserGroupId());
data.put("usergroupname", HtmlUtil.escape(userGroup.getName()));
%>
<aui:button cssClass="selector-button" data="<%= data %>" value="choose" />
</c:if>
</liferay-ui:search-container-column-text>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
</aui:form>
<aui:script>
Liferay.Util.focusFormField(document.<portlet:namespace />selectUserGroupFm.<portlet:namespace />name);
</aui:script>
<aui:script use="aui-base">
var Util = Liferay.Util;
A.one('#<portlet:namespace />selectUserGroupFm').delegate(
'click',
function(event) {
var result = Util.getAttributes(event.currentTarget, 'data-');
Util.getOpener().Liferay.fire('<%= HtmlUtil.escapeJS(eventName) %>', result);
Util.getWindow().hide();
},
'.selector-button input'
);
</aui:script>