<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>微信公众号信息管理</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
	name='viewport'>
<!-- bootstrap 3.0.2 -->
<link href="<c:url value='/styles/lib/bootstrap.min.css'/>" rel="stylesheet" type="text/css" />
<!-- font Awesome -->
<link href="<c:url value='/styles/lib/font-awesome.min.css'/>" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href='<c:url value='/styles/lib/ionicons.min.css' />' rel="stylesheet" type="text/css" />
<!-- DATA TABLES -->
<link href="<c:url value='/styles/lib/datatables/dataTables.bootstrap.css' />" rel="stylesheet" type="text/css" />
<!-- Theme style -->
<link href="<c:url value='/styles/AdminLTE.css'/>" rel="stylesheet" type="text/css" />
<link href="<c:url value='/scripts/zTree/css/zTreeStyle/zTreeStyle.css'/>" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<c:url value='/scripts/lib/jquery-1.8.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/zTree/js/jquery.ztree.core-3.5.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/zTree/js/jquery.ztree.excheck-3.5.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/My97DatePicker/WdatePicker.js'/>" ></script>
<script type="text/javascript" src="<c:url value='/scripts/loading/jquery.blockUI.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/loading/loading.js'/>"></script>
<script type="text/javascript" src="${ctx }/scripts/swfupload-jquery-plugin-master/src/jquery.swfupload.js"></script>
<script type="text/javascript" src="${ctx }/scripts/swfupload-jquery-plugin-master/vendor/swfupload/swfupload.js"></script>
<script type="text/javascript" src="<c:url value='/scripts/publicno/publicform.js?v=1.0'/>"></script>
<script type="text/javascript">
	$(document).ready(function(){
		var uploadSetting={
			upload_url: "<c:url value='/uploadTemplate/upload' />",
			file_size_limit : "10240",
			file_types : "*.jpg;*.png",
			file_post_name: "Filedata",  
			file_types_description : "图片文件",
			file_upload_limit : "0",
			button_text:'上传二维码',
			flash_url : "${ctx}/scripts/swfupload-jquery-plugin-master/vendor/swfupload/swfupload.swf",
			button_image_url : '${ctx}/scripts/swfupload-jquery-plugin-master/vendor/swfupload/XPButtonUploadText2_61x22.png',
			button_width : 80,
			button_height : 22,
			button_placeholder_id : "metadataAddBtnId",
			debug: false
		};
		$("#images").swfupload(uploadSetting).bind('uploadSuccess', function(event, file, serverData){
			$(this).find("input").remove();
			$(this).find("img").remove();
			$("#images").append('<img src="'+($.parseJSON(serverData).preview)+'" style="height: 200px;">');
			$("#publinoUrl").val($.parseJSON(serverData).url);
		})
		.bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){
			$(this).swfupload('startUpload');
		})
		.bind('uploadError', function(event, file, errorCode, message){
			alert('上传失败，'+message);
		});
	});
	
	function deleteImage(){
		$("#images").html("");
		$("#publinoUrl").val("");
	}
</script>
</head>
<style>.row{height:auto;overflow: hidden;}.box .box-header{padding-bottom: 0px;}</style>
<body>
	<input type="hidden" value="${ctx}" id="contextPath">
	<section class="content">
		<div class="row">
			<div class="col-md-6" style="float:left;width:50%;">
				<div class="box box-warning" >
					<div class="box-header" style="width:98%">
						<h3 class="box-title">微信公众号信息编辑&nbsp; <strong font-color="red">${errormsg}</strong></h3>
					</div>
					<div class="box-body">
						<form:form action="${ctx}//pblic/no/form" style="padding:0;margin:0;" modelAttribute="publicno" 
							method="post" id="conditionform" >
							<form:hidden path="id"  id="publicnoId"/>
							<input type="hidden" name="actType" value="save">
							<input type="hidden" name="funcid" value="${funcid}">
							<input type="hidden" name="organizationIds" id="organizationIds">
							
							<form:hidden path="url" style="padding:0;margin:0;" cssClass="form-control" id="publinoUrl" />
							<div class="form-group">
								<label>
									<input type="file" name="metaFiles" id="metadataAddBtnId" /> 
									<input type="button" value="删除" onclick="deleteImage()" class="btn btn-default" style="line-height:0px;" />
								</label>
								<div id="images" style="margin-top: 10px">
									<c:if test="${publicno.url!=null && publicno.url!=''}">
										<img src="${imageServer }${publicno.url}" style="height: 200px;">
									</c:if>
								</div>
							</div>
							<div class="form-group">
								<label><span style="color: red">*</span>名称</label>
								<form:input path="name" style="padding:0;margin:0;" cssClass="form-control" id="name" />
							</div>
							<div class="form-group">
								<label><span style="color: red">*</span>公众号类型</label>
								<form:select path="developType" items="${publicnoTypeGroup}" itemLabel="itemname" itemValue="itemcode" 
									cssClass="form-control">
								</form:select>
							</div>
							<div class="form-group">
								<label>服务用户群体</label> 
								<form:select path="serviceType" items="${publicnoServiceGroup}" itemLabel="itemname" itemValue="itemcode" 
									cssClass="form-control">
								</form:select>
							</div>
							<div class="form-group">
								<label><span style="color: red">*</span>公众号原始ID</label> 
								<form:input path="developId" style="padding:0;margin:0;" cssClass="form-control" id="developId" />
							</div>
							<div class="form-group">
								<label><span style="color: red">*</span>AppID应用ID</label> 
								<form:input path="appId" style="padding:0;margin:0;" cssClass="form-control" id="appId" />
							</div>
							<div class="form-group">
								<label><span style="color: red">*</span>Appsecret应用秘钥</label> 
								<form:input path="appSecret" style="padding:0;margin:0;" cssClass="form-control" id="appSecret" />
							</div>
							<div class="form-group">
								<label><span style="color: red"></span>获取授权token地址</label> 
								<form:input path="getAccessTokenUrl" style="padding:0;margin:0;" cssClass="form-control" id="getAccessTokenUrl" />
							</div>
							<div>
							以下为支付商户配置:
							</div>
							<div class="form-group">
								<label><span style="color: red"></span>微信商户号</label> 
								<form:input path="mchId" style="padding:0;margin:0;" cssClass="form-control" id="mchId" />
							</div>
							<div class="form-group">
								<label><span style="color: red"></span>微信支付密钥</label> 
								<form:input path="wxApiKey" style="padding:0;margin:0;" cssClass="form-control" id="wxApiKey" />
							</div>
							<div class="form-group">
								<label><span style="color: red"></span>支付证书路径(部署目录相对路径)</label> 
								<form:input path="sslcertPath" style="padding:0;margin:0;" cssClass="form-control" id="sslcertPath" />
							</div>
							<div class="form-group">
								<label><span style="color: red"></span>支付证书密码</label> 
								<form:input path="sslcertPassword" style="padding:0;margin:0;" cssClass="form-control" id="sslcertPassword" />
							</div>
						</form:form>
					</div>
					<div align="absmiddle" style="margin-left:10px;margin-top:10px;">
						<a class="btn btn-primary" href="#" id='btn-save'>保存</a> 
						<a class="btn btn-back" href="${ctx}/pblic/no/list?funcid=${funcid}">返回</a>
					</div>
				</div>
			</div>
			<div class="col-md-6"  style="float:left;width:45%;">
				<div class="box box-info">
					<div class="box-header">
						<h3 class="box-title"><span style="color: red">*</span>选择关联的项目</h3>
					</div>
					<div class="box-body" style="height:500px;overflow:auto;">
						<ul id="tree" class="ztree"></ul>
					</div>
				</div>
			</div>
		</div>
	</section>
</body>
</html>