<?php 
include_once(''.P.'/public/header.html');
?>



<script>
var fieldsarr = <?=json_encode($fieldsobj)?>;
function initbody(){
	
	
}
function save(o1){
	var da = js.getformdata(),fid,fd;
	for(fid in fieldsarr){
		fd = fieldsarr[fid];
		if(form(fid) && fd.isbt=='NO' && !da[fid]){
			js.setmsg(''+fd.name+'不能为空');
			form(fid).focus();
			return;
		}
	}
	
	js.setmsg('保存中...');
	o1.disabled=true;
	js.ajax({
		type:'post',
		url:'?m=wenti&a=savecheck',
		data:da,
		success:function(res){
			if(res=='ok'){
				js.back();
			}else{
				js.setmsg(res);
				o1.disabled=false;
			}
		}
	});
}
</script>
</head>

<body style="background:#f1f1f1">

<?php 
include_once(''.P.'/public/top.html');
?>

<div align="center">

<div style="width:<?=$maxwidth?>;margin:20px 0px" align="left">
	<div style="color:#cccccc">
		<a href="?m=index" class="zhu">平台首页</a> &gt;
		<a href="?m=wenti" class="zhu">常见问题</a> &gt;
		<a href="" class="zhu">常见问题操作</a>
	</div>
	<div style="background-color:white;margin:20px 0px;border:1px #eeeeee solid;min-height:500px;border-radius:5px">
		<div style="padding:20px" align="center">
			
			<form name="myform">
			<input type="hidden" name="id" value="<?=$data['id']?>">
			<table width="500px">
		
			<tr>
				<td height="50" align="right"><font color=red>*</font><?=$fieldsobj['title']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:250px" name="title" class="input" value="<?=$data['title']?>"></td>
			</tr>
			<tr>
				<td height="50" align="right"><?=$fieldsobj['targ']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:250px" name="targ" class="input" placeholder="<?=$fieldsobj['targ']['msg']?>" value="<?=$data['targ']?>"></td>
			</tr>
			
			<tr>
				<td height="50" align="right"><?=$fieldsobj['content']['name']?>&nbsp;&nbsp;</td>
				<td><textarea style="width:250px;height:80px" name="content" class="input"><?=$data['content']?></textarea></td>
			</tr>
			<tr>
				<td height="50" align="right"><?=$fieldsobj['url']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:250px" name="url" class="input" placeholder="<?=$fieldsobj['url']['msg']?>" value="<?=$data['url']?>"></td>
			</tr>
			<tr>
				<td height="50" align="right"><?=$fieldsobj['color']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:250px" name="color" class="input" placeholder="<?=$fieldsobj['color']['msg']?>" value="<?=$data['color']?>"></td>
			</tr>
			<tr>
				<td height="50" align="right"><?=$fieldsobj['sort']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:250px" name="sort" class="input" value="<?=$data['sort']?>"></td>
			</tr>
			<tr>
				<td height="50" align="right"><?=$fieldsobj['type']['name']?>&nbsp;&nbsp;</td>
				<td><select style="width:250px" name="type" class="input">
				<?php
				foreach($fieldsobj['type']['store'] as $k=>$v){
					$sel = '';
					if($data['type']==$v[0])$sel = ' selected';
					echo '<option value="'.$v[0].'"'.$sel.'>'.$v[1].'</option>';
				}
				?>
			</tr>
			<tr>
				<td height="50" align="right"><?=$fieldsobj['status']['name']?>&nbsp;&nbsp;</td>
				<td><select style="width:250px" name="status" class="input">
				<?php
				foreach($fieldsobj['status']['store'] as $k=>$v){
					$sel = '';
					if($data['status']==$v[0])$sel = ' selected';
					echo '<option value="'.$v[0].'"'.$sel.'>'.$v[1].'</option>';
				}
				?>
			</tr>
			<tr>
				<td height="50" align="right"><?=$fieldsobj['agentid']['name']?>&nbsp;&nbsp;</td>
				<td><select style="width:250px" name="agentid" class="input">
				<option value="0">全部</option>
				<?php
				foreach($agentrows as $k=>$v){
					$sel = '';
					if($data['agentid']==$v['id'])$sel = ' selected';
					echo '<option value="'.$v['id'].'"'.$sel.'>'.$v['name'].'</option>';
				}
				?>
			</tr>
			<tr>
				<td height="50" align="right"></td>
				<td><button type="button" onClick="save(this)" style="padding:8px 20px;border-radius:5px" class="webbtn" >保存</button>&nbsp;<span id="msgview"><a href="javascript:;" onclick="js.back()">返回</a></span></td>
			</tr>
			</table>
			</form>
			
			
		</div>
	</div>
</div>



<?php 
include_once(''.P.'/public/footer.html');
?>
</div>

</body>
</html>