<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/commons/meta.jsp"%>
<base href="<%=basePath%>">
<title>编辑应用</title>
<script type="text/javascript">
	function createActUser(values, names) {
		$("#appManagerIds").val(values.replace(/USER#/g, ""));
		$("#appManagerNames").val(names);
	}

	$(function(){
		$("#submitButton").click(function(){
			var url = "";
			if("${role.roleId}"==""){
				url = "${ctx}/role/save.do";
			}else{
				url = '${ctx}/role/update.do';
			}
			$.post(url,
					$('#myform').serialize(),
					function(data){
						if(data == "操作成功"){
							alert(data);
							art.dialog.opener.location.reload();
						}else{
							alert(data);
						}
					});
		});

		$('#roleId').keyup(trimkeyup);
	});

</script>
</head>
<body class="white-page">
<form action="${ctx}/role/update.do" id="myform" name="myform" method="post">
	<div class="main-container" id="main-container">
		<div class="panel panel-primary">
			<div class="panel-body">
				<table class="table table-bordered form-table" border="0" cellspacing="0"
					   cellpadding="0" id="myTable">
					<!-- 存放表单的区域 -->

					<tr>
						<th>角色编码<font color="red">*</font>：
						</th>
						<td>
							<input type="text" name="roleId"
								   value="${role.roleId}" id="roleId"
								   datatype="roleId" errormsg="角色编码只能输入字母，数字，下划线！"  nullmsg="请您填写角色编码"
								   onKeypress="javascript:if(event.keyCode == 32)event.returnValue = false;"
								   <c:if test="${not empty role.roleId}">readonly="readonly"</c:if>/>
						</td>
					</tr>
					<tr>
						<th style="width: 120px;">角色名称<font color="red">*</font>：</th>
						<td><input type="text" name="roleName" name="roleName"
								   datatype="*1-12" nullmsg="请输入角色名称！" errormsg="角色名称不能超过12个汉字！"
								   value="${role.roleName}" class="validate[required,length[0,30]]"/></td>
					</tr>
					<tr>
						<th>角色排序号：</th>
						<td>
							<!-- <input type="text" name="roleSort"
								datatype="n1-4" 
								errormsg="角色排序号只能输入数字！"  nullmsg="请您填写角色排序号"
								value="${role.roleSort}" id="roleSort" 
								class="validate[custom[onlyNumber] ,length[0,10]]"/> -->
							<input type="text" name="roleSort"
								   value="${role.roleSort}" id="roleSort"
								   class="validate[custom[onlyNumber] ,length[0,10]]"
								   onkeyup="this.value=this.value.replace(/\D/g,'')"
								   onafterpaste="this.value=this.value.replace(/\D/g,'')"/>
						</td>
					</tr>
					<tr>
						<th>角色类型<font color="red">*</font>：</th>
						<td>
							<select name="roleType">
								<option value="FLOW" ${role.roleType=="FLOW"?"selected":""}>流程角色</option>
								<option value="BIZ" ${role.roleType=="BIZ"?"selected":""}>业务角色</option>
								<c:if test="${ebpmAdmin}">
									<!-- <option value="SYS" ${role.roleType=="SYS"?"selected":""}>系统管理角色</option> -->
									<option value="GLOBAL" ${role.roleType=="GLOBAL"?"selected":""}>全局角色</option>
								</c:if>
							</select>
						</td>
					</tr>
					<tr>
						<th>所属应用系统：
						</th>
						<td>
							<input type="hidden" name="roleAppId"
								   value="${applicaton.appId}" id="roleAppId" />
							<input type="text" name="appName" readonly="readonly"
								   value="${applicaton.appName}" id="appName" />
							<!--
								<select name="roleAppId">
					    			<option value="">请选择</option>
						    		<option value="PORTAL" ${role.roleAppId=="PORTAL"?"selected":""}>门户</option>
						    		<option value="WORKFLOW" ${role.roleAppId=="WORKFLOW"?"selected":""}>工作流</option>
						    		<option value="TCM" ${role.roleAppId=="TCM"?"selected":""}>内容发布</option>
					    		</select>
					    		-->
						</td>
					</tr>
					<tr>
						<th>角色状态<font color="red">*</font>：
						</th>
						<td>
							<select name="roleStatus">
								<option value="QY" ${role.roleStatus=="QY"?"selected":""}>启用</option>
								<option value="JY" ${role.roleStatus=="JY"?"selected":""}>禁用</option>
							</select>
						</td>
					</tr>
					<tr>
						<th>业务描述：</th>
						<td><input type="text" name="remark"
								   value="${role.remark}" id="remark" class="input"
								   class="validate[length[0,500]]"/>
						</td>
					</tr>
				</table>
				<div class="col-md-offset-1 col-md-9" style="text-align: center;">
					<button type="button" class="btn btn-sm btn-primary"
							id="submitButton">
						保存
						<i class="ace-icon fa fa-save bigger-110"></i>
					</button>
					<!-- <input type="button" class="btn btn-sm btn-primary"
                        id="submitButton" onclick="saveRole();" value="保 存" />
                    -->
				</div>
			</div>
		</div>
	</div>
	</div>
</form>
</body>
</html>