119 lines
4.3 KiB
Plaintext
119 lines
4.3 KiB
Plaintext
<%@include file="../init.jsp"%>
|
|
<%
|
|
String portletURLString = PortalUtil.getCurrentURL(request);
|
|
RowChecker rowChecker = new RowChecker(renderResponse);
|
|
String currentUsername = Utils.getCurrentUser(request).getUsername();
|
|
Team team = (Team) request.getAttribute("theTeam");
|
|
Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request));
|
|
long currentGroupId = group.getGroupId();
|
|
String currentURL = PortalUtil.getCurrentURL(request);
|
|
//this is the list to be working on manage
|
|
List<GCubeUser> nonFarmMembers = (List<GCubeUser>) request.getAttribute("nonFarmMembers");
|
|
pageContext.setAttribute("logoURL", renderRequest.getAttribute("companyLogoURL"));
|
|
pageContext.setAttribute("farmName", team.getName());
|
|
%>
|
|
|
|
<a class="btn btn-link btn-large no-padding" href="farm-dashboard"><i
|
|
class="icon icon-angle-left"></i> Back to manage farm users</a>
|
|
|
|
<div style="text-align: center; padding-bottom: 15px;">
|
|
<table>
|
|
<tr>
|
|
<c:if test="${not empty logoURL}">
|
|
<td>
|
|
<div class="logo-circular"
|
|
style="background-image: url('${logoURL}');
|
|
background-size: cover; "></div>
|
|
</td>
|
|
</c:if>
|
|
|
|
<td><p
|
|
style="font-size: 1.5em; padding-top: 12px; padding-left: 5px;">${farmName}
|
|
</p></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<p class="lead">Available company users to associate to ${farmName}:</p>
|
|
|
|
|
|
<liferay-portlet:renderURL varImpl="iteratorURL">
|
|
</liferay-portlet:renderURL>
|
|
|
|
<%
|
|
String orderByCol = ParamUtil.getString(request, "orderByCol");
|
|
String orderByType = ParamUtil.getString(request, "orderByType");
|
|
String sortingOrder = orderByType;
|
|
|
|
//Logic for toggle asc and desc
|
|
if (orderByType.equals("desc"))
|
|
orderByType = "asc";
|
|
else
|
|
orderByType = "desc";
|
|
if (Validator.isNull(orderByType)) {
|
|
orderByType = "asc";
|
|
}
|
|
%>
|
|
|
|
<aui:form action="<%=portletURLString%>" method="post" name="fm">
|
|
|
|
<liferay-ui:search-container var="searchContainer" delta="5"
|
|
deltaConfigurable="true"
|
|
emptyResultsMessage="Sorry. There are no users to display."
|
|
iteratorURL="<%=iteratorURL%>" rowChecker="<%=rowChecker%>"
|
|
orderByType="<%=orderByType%>">
|
|
|
|
<liferay-ui:search-container-results>
|
|
<%
|
|
int totalUsers = nonFarmMembers.size();
|
|
List<GCubeUser> sortableUsers = ListUtil.subList(nonFarmMembers, searchContainer.getStart(),
|
|
searchContainer.getEnd());
|
|
|
|
if (Validator.isNotNull(orderByCol)) {
|
|
Collections.sort(sortableUsers, new UserComparator());
|
|
if (sortingOrder.equalsIgnoreCase("desc"))
|
|
Collections.reverse(sortableUsers);
|
|
}
|
|
pageContext.setAttribute("results", sortableUsers);
|
|
pageContext.setAttribute("total", totalUsers);
|
|
%>
|
|
</liferay-ui:search-container-results>
|
|
|
|
<liferay-ui:search-container-row
|
|
className="org.gcube.vomanagement.usermanagement.model.GCubeUser"
|
|
modelVar="item" keyProperty="username">
|
|
<liferay-ui:search-container-column-text orderable="true" name="Name">${item.fullname}</liferay-ui:search-container-column-text>
|
|
<liferay-ui:search-container-column-text name="Email">${item.email}</liferay-ui:search-container-column-text>
|
|
<liferay-ui:search-container-column-text name="Position">${item.jobTitle}</liferay-ui:search-container-column-text>
|
|
</liferay-ui:search-container-row>
|
|
<liferay-ui:search-iterator />
|
|
</liferay-ui:search-container>
|
|
<button name="associate" type="button" class="btn btn-primary"
|
|
onClick='<%=renderResponse.getNamespace() + "associateFarmUsers();"%>'>Associate
|
|
selected</button>
|
|
<aui:input name="addUserIds" type="hidden" />
|
|
<aui:input name="teamId" type="hidden" value="<%=team.getTeamId()%>" />
|
|
<aui:input name="currentUsername" type="hidden"
|
|
value="<%=currentUsername%>" />
|
|
<aui:input name="currentGroupId" type="hidden"
|
|
value="<%=currentGroupId%>" />
|
|
|
|
</aui:form>
|
|
|
|
<aui:script>
|
|
Liferay.provide(
|
|
window,
|
|
'<portlet:namespace />associateFarmUsers',
|
|
function() {
|
|
var addUserIds = Liferay.Util.listCheckedExcept(document.<portlet:namespace />fm, '<portlet:namespace />allRowIds');
|
|
|
|
if (addUserIds && confirm("Are you sure you want to associate the selected users to this farm?")) {
|
|
document.<portlet:namespace />fm.<portlet:namespace />addUserIds.value = addUserIds;
|
|
|
|
submitForm(document.<portlet:namespace />fm, '<portlet:actionURL name="associateFarmUsers"></portlet:actionURL>');
|
|
} else {
|
|
|
|
}
|
|
},
|
|
['liferay-util-list-fields']
|
|
);
|
|
</aui:script> |