<%@ page import="com.liferay.portal.util.PortalUtil" %>
<%
/**
 * Copyright (c) 2000-2011 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.
 */
%>

<div class="portlet-msg-info">
	<liferay-ui:message key="update-rankings-help" />
</div>

<liferay-ui:search-container>
	<liferay-ui:search-container-results
		results="<%= SocialEquityUserLocalServiceUtil.getRankedEquityUsers(scopeGroupId, searchContainer.getStart(), searchContainer.getEnd(), new SocialEquityUserRankComparator(true)) %>"
		total="<%= SocialEquityUserLocalServiceUtil.getRankedEquityUsersCount(scopeGroupId) %>"
	/>

	<liferay-ui:search-container-row
		className="com.liferay.portlet.social.model.SocialEquityUser"
		keyProperty="equityUserId"
		modelVar="equityUser"
	>
		<liferay-ui:search-container-column-text
			name="rank"
			value="<%= String.valueOf(equityUser.getRank()) %>"
		/>

		<liferay-ui:search-container-column-text
			name="user"
			value="<%= HtmlUtil.escape(PortalUtil.getUserName(equityUser.getUserId(), StringPool.BLANK)) %>"
		/>

		<liferay-ui:search-container-column-text
			name="contribution-score"
			value="<%= String.valueOf(Math.round(equityUser.getContributionEquity())) %>"
		/>

		<liferay-ui:search-container-column-text
			name="participation-score"
			value="<%= String.valueOf(Math.round(equityUser.getParticipationEquity())) %>"
		/>
	</liferay-ui:search-container-row>

	<liferay-ui:search-iterator />
</liferay-ui:search-container>

<aui:button-row>

	<%
	String taglibOnClick = renderResponse.getNamespace() + "saveEquitySettings('updateRanks');";
	%>

	<aui:button onClick="<%= taglibOnClick %>" value="update-rankings" />
</aui:button-row>