<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ page isELIgnored="false" %> 
<html>
	<head>
		<link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css">
		<title>修改用户的角色信息</title>
		<script src="${pageContext.request.contextPath}/js/option.js"></script> 
		<script language="JavaScript">
    	<!--
    	function onSubmit()
    	{
    		// 该值可能最后带有","
    		var idsValue = document.getElementById("ids").value;
    		if (idsValue != '')
    		{
    			var idsLen = idsValue.length;
        		document.myform.roleIds.value = idsValue.substring(0, idsLen-1);
        		return true;
        	}
        	else
       		{
       			document.myform.roleIds.value = "";
       			return false;
       		}
    	}
    	//-->
   	 	</script>
	</head>
	<body>
		<form action="${pageContext.request.contextPath}/servlet/UserServlet" name="myform" method="post" onsubmit="return onSubmit()">
			<input type="hidden" name="methodName" value="updateUserRole" />
			<input type="hidden" name="loginName" value="${loginName}" />
			<input type="hidden" name="ids" id="ids" value="" />
			<input type="hidden" name="roleIds" value="" />
			
	        <table width="98%" align="center" border="0" cellpadding="4" cellspacing="1" class="list">
	        	<tr align="center"> 
          			<td colspan="3" width="100%" class="title_td" align="center"> 
          				<div class="title_font">修改用户的角色信息</div>
         			</td>
        		</tr>
	            <tr>
	                <td width="40%">
	                    <select style="width:100%" multiple name="notSelectList" size="10" 
	                        ondblclick="moveOption(document.myform.notSelectList, document.myform.selectList, 'ids', document.myform.selectList)">
	                        <c:forEach items="${notSelectList}" var="notSelectObj">
	                        	<option value='<c:out value="${notSelectObj.trId}" />'><c:out value="${notSelectObj.roleName}" /></option>
							</c:forEach>
	                    </select>
	                </td>
	                <td width="20%" align="center">
	                    <input type="button" value="---->" class="btn_style" 
	                                onclick="moveOption(document.myform.notSelectList, document.myform.selectList, 'ids', document.myform.selectList)"><br><br>
	                    <input type="button" value="<----" class="btn_style" 
	                                onclick="moveOption(document.myform.selectList, document.myform.notSelectList, 'ids', document.myform.selectList)"><br><br>
	                    <input type="button" value="全选" class="btn_style" 
	                                onclick="moveAllOption(document.myform.notSelectList, document.myform.selectList, 'ids', document.myform.selectList)"><br><br>
	                    <input type="button" value="全删" class="btn_style" 
	                                onclick="moveAllOption(document.myform.selectList, document.myform.notSelectList, 'ids', document.myform.selectList)">
	                </td>
	                <td width="40%">
	                    <select style="width:100%;" multiple name="selectList" size="12" 
	                                ondblclick="moveOption(document.myform.selectList, document.myform.notSelectList, 'ids', document.myform.selectList)">
	                    	<c:forEach items="${selectList}" var="selectObj">
	                        	<option value='<c:out value="${selectObj.trId}" />'><c:out value="${selectObj.roleName}" /></option>
							</c:forEach>
	                    </select>
	                </td>
	            </tr>
	            <tr>
	            	<td align="center" colspan="3">
		            	<input type="submit" value="确定" class="btn_style"/>&nbsp;&nbsp;
		            	<input type="button" value="返回" class="btn_style" onclick="history.go(-1)">
		            </td>
	            </tr>
	        </table>
	    </form>
	</body>
</html>