<?php include $this->admin_tpl('meta');?>
<title>添加菜单 - YzmCMS内容管理系统</title>
</head>
<body>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" onsubmit="return dosub(this)">
		<ul>
			 <li>
			 <label>上级菜单：</label>
			 <select  name="parentid" size="1">
				<option value="0">一级菜单</option>
			    <?php echo $select_menus;?>			
			 </select>
			 </li>		
			 <li>
			 	<label><span class="c-red">*</span>菜单名称：</label>
			 	<input type="text" class="input" placeholder="菜单名称" name="name" value="<?php echo $name?>">
			 </li>	
			 <li>
			 	<label><span class="c-red">*</span>模块名：</label>
			 	<input type="text" class="input" placeholder="模块名" name="m" value="<?php echo $m?>">
			 </li>	
			 <li>
			 	<label><span class="c-red">*</span>类名：</label>
			 	<input type="text" class="input" placeholder="类名" name="c" value="<?php echo $c?>">
			 </li>	
			 <li>
			 	<label><span class="c-red">*</span>方法名：</label>
			 	<input type="text" class="input" placeholder="方法名" name="a" value="<?php echo $a?>">
			 </li>	
			 <li class="yzm-explain-box">
			 	<label>附加参数：</label>
			 	<input type="text" class="input" placeholder="如：id=1&mid=2" name="data" value="<?php echo $data?>">
			 	<span class="yzm-explain">为一级菜单时，<br>需填写icon图标的class名称</span>
			 </li>
			 <li><label>显示菜单：</label>
			 <span class="span_input">
			 	<label class="label_radio"><input name="display" type="radio" value="1" <?php if($display) echo 'checked';?>> 是</label>
			 	<label class="label_radio"><input name="display" type="radio" value="0" <?php if(!$display) echo 'checked';?>> 否</label>
			 </span>
			 </li>
		</ul>
		<div class="footer_btn">
			<input type="hidden" name="dosubmit" value="1">
			<input name="id" type="hidden" value="<?php echo $id?>">
			<input class="btn btn-primary radius" type="submit" value="提 交">
			<input class="btn btn-default radius" type="button" value="取 消" onclick="yzmcms_close()">	
		</div>
	</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.name.value==''){
			 layer.msg('模块名不能为空！');
			 return false;
		 }
		 if(obj.name.value==''){
			 layer.msg('文件名不能为空！');
			 return false;
		 }
		 if(obj.name.value==''){
			 layer.msg('方法名不能为空！');
			 return false;
		 }
        $.ajax({
            type: 'POST',
            url: '<?php echo U('edit');?>', 
            data: $(obj).serialize(),
		    dataType: "json", 
            success: function (msg) {
				if(msg.status == 1){
					layer.msg(msg.message, {icon:1,time:1500}, function(){
						parent.location.reload();     
					});
			    }else{
					layer.msg(msg.message, {icon:2});
				}
            }
        })		 
		return false;			 
	}
</script> 

</body>
</html>