<%@ page contentType="text/html;charset=UTF-8"%>
<%@page import="com.blueland.bpm.engine.config.model.*"%>
<%@ 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>
	/* function update() {
        var url="${ctx}/sysGlType/update.do";
	$.post(url, $('#myform').serialize(),
			function (data){
			art.dialog.opener.parent.document.getElementById("leftFrame").src=   art.dialog.opener.parent.document.getElementById("leftFrame").src
			art.dialog.opener.parent.document.getElementById("rightFrame").src = 
			"${ctx}/sysGlType/show.do?typeId="+$("#typeId").val()+"&processTypeName="+$("#typeName").val();
		   });
	  } */
	$(function(){
		var demo=$("#myform").Validform({
			datatype:{"typeId": /^[^\s]{1,12}$/},
			tiptype:function(msg,o,cssctl){
				var b = true;
				//msg：提示信息;
				//o:{obj:*,type:*,curform:*}, obj指向的是当前验证的表单元素（或表单对象），type指示提示的状态，值为1、2、3、4， 1：正在检测/提交数据，2：通过验证，3：验证失败，4：提示ignore状态, curform为当前form对象;
				//cssctl:内置的提示信息样式控制函数，该函数需传入两个参数：显示提示信息的对象 和 当前提示的状态（既形参o中的type）;
				if(o.type==3){
					if(msg.indexOf("statusText")<0){
						//排除掉提交完成后返回的状态字符串
						alert(msg);
						b = false;
						return b;
					}
				}
				return b;
			},
			callback:function(data){
				if('OK' == data.statusText){
					alert("保存成功");
					art.dialog.opener.parent.document.getElementById("leftFrame").src=   art.dialog.opener.parent.document.getElementById("leftFrame").src
					art.dialog.opener.parent.document.getElementById("rightFrame").src = "${ctx}/sysGlType/show.do?typeId="+$("#typeId").val()+"&processTypeName="+$("#typeName").val();
				}else{
					alert("保存失败");
				}
			},
			ajaxPost:true
		});
		$("#submitButton").click(function(){
			demo.ajaxPost();
			return false;
		});
	})
</script>
</head>
<body class="white-page">
<form action="${ctx}/sysGlType/update.do" method="post" id="myform">
	<input type="hidden" name="typeParentId" value="${sysGlType.typeParentId}"  id="typeParentId" />
	<input type="hidden" name="appKey" value="${sysGlType.appKey}" id="appKey" />
	<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">
					<!-- 存放隐藏域的区域 -->
					<input type="hidden" id="typeId" name="typeId"
						   value="${sysGlType.typeId}" />
					<!-- 存放表单的区域 -->
					<tr>
						<td style="width: 36%">分类ID<font color="red">*</font>：
						</td>
						<td>${sysGlType.typeId}</td>
					</tr>
					<tr>
						<td>分类名称<font color="red">*</font>：
						</td>
						<td><input type="text" name="typeName"
								   value="${sysGlType.typeName}" id="typeName" datatype="typeId" nullmsg="分类名称不能为空!" errormsg="分类名称不能超过12个字符!"/></td>
					</tr>

					<tr>
						<td>分类排序号：</td>
						<td><input type="text" name="typeSort"
								   value="${sysGlType.typeSort}" id="typeSort" /></td>
					</tr>

					<tr>
						<td>备注：</td>
						<td><input type="text" name="typeRemark"
								   value="${sysGlType.typeRemark}" id="typeRemark" /></td>
					</tr>

				</table>

				<div class="col-md-offset-1 col-md-9" style="text-align: center;margin-top: 15px">
					<button type="button" class="btn btn-sm btn-primary" id="submitButton">
						保存
						<i class="ace-icon fa fa-save bigger-110"></i>
					</button>
					<button
							type="button" class="btn btn-sm btn-primary"
							onclick="art.dialog.close();" >
						关闭
						<i class="ace-icon fa fa-times bigger-110"></i>
					</button>
				</div>
			</div>
		</div>
	</div>
</form>

</body>
</html>
