<?php include $this->admin_tpl('meta', 'admin');?>
<title>添加组别 - YzmCMS内容管理系统</title>
</head>
<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" name="name" value=""></li>
			 <li><label><span class="c-red">*</span>经验小于：</label><input type="text" class="input" name="experience" value=""></li>
			 <li class="yzm-explain-box"><label><span class="c-red">*</span>每日最大投稿量：</label><input type="text" class="input" name="max_amount" value="3">
			 	<span class="yzm-explain">VIP用户不受限</span>
			 </li>
			 <li class="yzm-explain-box"><label>会员组图标：</label><input type="text" class="input" name="icon" style="width:450px">
			 	<span class="yzm-explain">图标放置在/common/static/images/icon/</span>
			 </li>
			 <li><label>组别权限：</label>
			 <span class="span_input">
					<label  class="label_box"><input type="checkbox" name="authority[]" value="1"> 发送消息</label>
					<label  class="label_box"><input type="checkbox" name="authority[]" value="2"> 发表评论</label>
					<label  class="label_box"><input type="checkbox" name="authority[]" value="3"> 发表内容</label>
					<label  class="label_box"><input type="checkbox" name="authority[]" value="4"> 投稿免审核</label>
			 </span>
			 </li>
			 <li><label>简洁描述：</label><input type="text" class="input" name="description" style="width:450px"></li>
			 <li><input type="hidden" name="dosubmit" value="1">
			 <input class="dosubmit w_120 btn-primary radius" 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', 'admin');?>

<script type="text/javascript">
	function dosub(obj){
		 if(obj.name.value==''){
			 layer.msg('会员组名称不能为空！');
			 return false;
		 }
		 if(obj.experience.value=='' || isNaN(obj.experience.value)){
			 layer.msg('经验点数只能为数字类型！');
			 return false;
		 }
		if(obj.max_amount.value=='' || isNaN(obj.max_amount.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>