<?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>
			 <select  name="groupid" size="1">
			  <?php 
				foreach($member_group as $val){
					echo '<option value="'.$val['groupid'].'">'.$val['name'].'</option>';
				}
			   ?>			
			 </select></li>
			 <li><label><span class="c-red">*</span>主题：</label><input type="text" class="input" name="subject" value=""></li>
			 <li><label><span class="c-red">*</span>内容：</label><span class="span_input"><textarea class="textarea" name="content" style="width:75%"></textarea></span></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.subject.value==''){
			 layer.msg('主题不能为空！', {icon:2});
			 return false;
		 }
		 if(obj.content.value==''){
			 layer.msg('内容不能为空！', {icon:2});
			 return false;
		 }
        $.ajax({
            type: 'POST',
            url: '<?php echo U('add_messages');?>', 
            data: $(obj).serialize(),
		    dataType: "json", 
            success: function (msg) {
				if(msg.status == 1){
					layer.msg(msg.message, {icon:1, time:800}, function(){
						parent.location.reload();
					});
			    }else{
					layer.msg(msg.message, {icon:2});
				}
            }
        })		 
		return false;			 
	}
</script> 

</body>
</html>