<?php include $this->admin_tpl('meta');?>
<title>添加URL规则 - YzmCMS内容管理系统</title>
</head>
<style>
.exp{margin:5px 0px 5px 120px;color:#888}
</style>
<body>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" onsubmit="return dosub(this)">
		<ul>
			<li><label><span class="c-red">*</span>名称：</label><input type="text" class="input" style="width:400px" name="name" value=""><p class="exp">给它起一个描述名称</p></li>
			<li><label><span class="c-red">*</span>URL规则：</label><input type="text" class="input" style="width:400px" name="urlrule" value=""><p class="exp">如：mylist/(\d+)，“(\d+)”表示匹配数字，支持的特殊符号有：<span class="c-red">~!@</span></p></li>
			<li><label><span class="c-red">*</span>指向的路由：</label><input type="text" class="input" style="width:400px" name="route" value="">
			<p class="exp">如：对应上面的例子：模块/控制器/方法/参数1/$1</p>
			<p class="exp">URL规则：模块/控制器/方法/参数1/$1/参数2/$2...<span class="c-red">（$1,$2为规则中匹配到的动态值）</span></p></li>
			<li></li>
			<li><?php echo creat_token();?>
				<input type="hidden" name="dosubmit" value="1">
				<input class="dosubmit w_120 btn-primary radius" name="dosubmit" type="submit" value="提交">
				<input class="btn w_120 btn-default radius" type="button" value="取消" onclick="yzmcms_close()">
			</li>
		</ul>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer');?>

<script type="text/javascript">
	function dosub(obj){
		 if(obj.name.value==''){
			 layer.msg('名称不能为空！');
			 return false;
		 }
		 if(obj.urlrule.value==''){
			 layer.msg('URL规则不能为空！');
			 return false;
		 }
		 if(obj.route.value==''){
			 layer.msg('指向的路由不能为空！');
			 return false;
		 }
        $.ajax({
            type: 'POST',
            url: '<?php echo U('add');?>', 
            data: $(obj).serialize(),
		    dataType: "json", 
            success: function (msg) {
				if(msg.status == 1){
					parent.location.reload();       
			    }else{
					layer.msg(msg.message);
				}
            }
        })		 
		return false;			 
	}
</script> 

</body>
</html>