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

<script>
var fieldsarr = <?=json_encode($fieldsobj)?>;

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=agent&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=agent" 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="<?=$da['id']?>">
			<table width="500px">
			
			<tr>
				<td height="50" align="right"><?=$fieldsobj['picurl']['name']?>&nbsp;&nbsp;</td>
				<td>
				<img src="<?=$data['picurlpic']?>" style="border-radius:50%" id="imgpcid" width="80px" height="80px"><br>
				<input style="width:250px" name="picurl" onblur="if(this.value)get('imgpcid').src=this.value" placeholder="<?=$fieldsobj['picurl']['msg']?>" class="input" value="<?=$data['picurl']?>">
				</td>
			</tr>
			
			<tr>
				<td height="50" align="right"><font color=red>*</font><?=$fieldsobj['name']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:250px" name="name" class="input" value="<?=$data['name']?>"></td>
			</tr>
			<tr>
				<td height="50" align="right"><?=$fieldsobj['callurl']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:250px" name="callurl" placeholder="<?=$fieldsobj['callurl']['msg']?>" class="input" value="<?=$data['callurl']?>"></td>
			</tr>
			
			<tr>
				<td height="50" align="right"><?=$fieldsobj['kefuid']['name']?>&nbsp;&nbsp;</td>
				<td>
				<?php
				$str = '';
				foreach($userlist as $k1=>$rs1){
					$chex = '';
					if(contain(','.$data['kefuid'].',',','.$rs1['id'].','))$chex='checked';
					$str .='<label><input name="kefuid[]" '.$chex.' value="'.$rs1['id'].'" type="checkbox">'.$rs1['name'].'';
					if(!isempt($rs1['ranking']))$str.='<span style="color:gray">('.$rs1['ranking'].')</font>';
					$str .='</label>&nbsp;&nbsp;';
				}
				echo $str;
				?>
				</td>
			</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>