<%--
 * Copyright by Intland Software
 *
 * All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of Intland Software. ("Confidential Information"). You
 * shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement
 * you entered into with Intland.
 *
 * $Revision$ $Date$
--%>
<meta name="decorator" content="main">
<meta name="module" content="members">
<meta name="moduleCSSClass" content="membersModule">
<meta name="stylesheet" content="members.css">


<%@ taglib uri="jstl-c" prefix="c" %>


<%@ taglib uri="struts-html" prefix="html" %>

<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>

<%@ taglib uri="acltaglib" prefix="acl" %>
<%@ taglib uri="uitaglib" prefix="ui" %>

<c:set var="user_id" value="${param.user_id}" />
<c:set var="user" value="${applicationScope.userData[user_id]}" />
<c:set var="group_id" value="${param.group_id}" />

<acl:info var="group" value="findGroup" group_id="${group_id}" />

<acl:info var="role" value="findRole" role_id="${role_id}" />

<acl:info var="canAdminRoles" value="hasUserPermission" group_id="${group_id}"
	permission="${applicationScope.PERMISSION_MEMBER_ROLE_ADMIN}" />

<ui:actionMenuBar>
	<ui:pageTitle>Assign Roles to Member "<span class="titlenormal"><c:out value="${user.name}" /></span>"</ui:pageTitle>
</ui:actionMenuBar>

<html:errors />

<c:set var="controlButtons">
	<c:if test="${canAdminRoles}">
		&nbsp;&nbsp;<html:submit styleClass="button"
			property="SUBMIT" value="Save" />
	</c:if>

	&nbsp;&nbsp;<html:cancel styleClass="button" />
</c:set>

<html:form action="/proj/members/assignUserToRolesDialog">

<html:hidden property="user_id" value="${user_id}" />
<html:hidden property="group_id" value="${group_id}" />
<html:hidden property="remove_user_id" value="${user_id}" />
<html:hidden property="assign_user_id" value="${user_id}" />

<c:set var="checkAll">
	<INPUT TYPE="CHECKBOX" TITLE="Select/Clear All"
		NAME="SELECT_ALL" VALUE="on"
		ONCLICK="setAllStatesFrom(this, 'role_id')">
</c:set>

<acl:info var="roles" value="availableRoles" group_id="${group_id}" />

<div class="actionBar">
	<c:out value="${controlButtons}" escapeXml="false" />
</div>

<display:table requestURI="" name="${roles}" id="role" cellpadding="0" defaultsort="1">
	<c:url var="editRoleLink" value="/proj/editRole.spr">
		<c:param name="group_id" value="${group_id}" />
		<c:param name="role_id" value="${role.id}" />
	</c:url>

	<display:column title="${checkAll}" headerClass="textData" class="textData">
		<html:multibox property="assign_role_id" value="${role.id}" />
		<html:hidden property="remove_role_id" value="${role.id}" />
	</display:column>

	<display:column title="Role" headerClass="textData" class="textData"
		decorator="com.intland.codebeamer.ui.view.table.TrimmedColumnDecorator" media="html"
		sortable="true" sortProperty="name">
		<html:link
			href="${editRoleLink}"><c:out
			value="${role.description}" /></html:link>
	</display:column>

	<display:column class="${COLUMN_SEPARATOR}" media="html" decorator="com.intland.codebeamer.ui.view.table.TrimmedColumnDecorator" />

	<display:column title="Description" property="details" headerClass="textData" class="textData" sortable="true" />
</display:table>

</html:form>
