<?php include $this->admin_tpl('meta');?>
<title>编辑配置 - YzmCMS内容管理系统</title>
<style>
.select{width:230px}
</style>
</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 disabled" placeholder="必须为英文拼音或数字,如：qq" name="name" disabled="disabled" value="<?php echo $data['name'];?>">
			 </li>
			 <li><label><span class="c-red">*</span>配置类型</label>
			 <span class="span_input" >
				<select name="fieldtype" class="select" style="width:244px" disabled>		
					<option value="textarea" <?php if($fieldtype=='textarea') echo 'selected';?>>文本类型</option>					
					<option value="image" <?php if($fieldtype=='image') echo 'selected';?>>图片上传</option>
					<option value="attachment" <?php if($fieldtype=='attachment') echo 'selected';?>>附件上传</option>
					<option value="radio" <?php if($fieldtype=='radio') echo 'selected';?>>radio选项卡</option>
					<option value="select" <?php if($fieldtype=='select') echo 'selected';?>>option下拉框</option>
				</select>
			 </span>
			 </li>	
			<li><label><span class="c-red">*</span>配置值：</label>
				<span class="span_input"><?php echo $this->public_gethtml($fieldtype, $data['value'], $data['setting']);?></span>
			</li>
			<li><label>简洁说明：</label>
			 	<textarea name="title" class="textarea w_420" placeholder="例如：这个是站点QQ"><?php echo $data['title'];?></textarea>
			 </li>
			 <li><label>状态</label>
			 <span class="span_input">
			 	<label class="label_radio"><input name="status" type="radio" value="1" <?php if($data['status']=='1') echo 'checked';?>> 启用</label>
			 	<label class="label_radio"><input name="status" type="radio" value="0" <?php if($data['status']=='0') echo 'checked';?>> 禁用</label>
			 </span>
			 </li>
		</ul>
		<div class="footer_btn">
			<input type="hidden" name="dosubmit" value="1">
			<input type="hidden" name="id" value="<?php echo $data['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.value.value==''){
		 	layer.msg('配置值不能为空！', {icon:2});
		 	return false;
		 }
        $.ajax({
            type: 'POST',
            url: '<?php echo U('user_config_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>