<?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><span class="c-red">*</span>模型名称：</label><input type="text" class="input" name="name" value="<?php echo $data['name'];?>"></li>
			 <li><label><span class="c-red">*</span>模型表名：</label><input type="text" class="input" value="<?php echo $data['tablename'];?>" name="tablename" disabled="disabled"></li>	
			 <li><label>模型简介：</label><span class="span_input"><textarea name="description" class="textarea" style="width:70%"><?php echo $data['description'];?></textarea></span></li>	
			 <li><label>禁用：</label>
			 <span class="span_input">
			 	<label class="label_radio"><input name="disabled" type="radio" value="1" <?php echo $data['disabled']==1 ? ' checked="checked" ' : '';?>> 是</label>
			 	<label class="label_radio"><input name="disabled" type="radio" value="0" <?php echo $data['disabled']==0 ? ' checked="checked" ' : '';?>> 否</label>
			 </span>
			 </li>				 
			<li>
				<input type="hidden" name="dosubmit" value="1"><input type="hidden" name="modelid" value="<?php echo $data['modelid'];?>">
				<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');?>

<script type="text/javascript">
	function dosub(obj){
		 var reg = /^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){0,19}$/;	
		 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){
					parent.location.reload();       
			    }else{
					layer.msg(msg.message);
				}
            }
        })		 
		return false;			 
	}
</script> 

</body>
</html>