<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<title>[%$ESPCMS_SOFT_TITLE%]</title>
		<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/espcms_style_font_icon.css" rel="stylesheet" type="text/css" />
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/espcms_style_public.css" rel="stylesheet" type="text/css" />
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/espcms_all.css" rel="stylesheet" type="text/css" />
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/espcms_framework.css" rel="stylesheet" type="text/css" />
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/espcms_select.css" rel="stylesheet" type="text/css" />
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/pageload.css" rel="stylesheet" type="text/css" />
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/file.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/jquery.min.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/jquery-ui.min.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/jquery.cookie.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_dialog.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/md5.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/json.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/bootstrap.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/lngpack_cn.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_form.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_formvalidation.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_dialog.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_function.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_tool.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_page.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_select.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_checkbox.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_select_checkbox.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_batch.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_tab.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/nprogress.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/iframeResizer.contentWindow.min.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_multiple.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]espcms_admin_includes/ueditor/ueditor_config.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]espcms_admin_includes/ueditor/ueditor.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]espcms_admin_includes/ueditor/seapoa/seapoaaddpic.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]espcms_admin_includes/ueditor/seapoa/seapoaaddvideo.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]espcms_admin_includes/ueditor/seapoa/seapoaaddfilelink.js"></script>
		<script type="text/javascript">
			$(document).ready(function () {
				banpageKey();
				$("[placeholder]").tooltip();
				$('input[type=checkbox],input[type=radio]').espcms_checkbox();
				$("#espcms_saveInfo").espcms_formvalidation({
					focusName: "#templatename",
					verifyURL: "[%$link.verify%]",
					verifyField: "templatecode",
					[%if $type=='edit'%]
					verifyQueryString: "tmid=[%$read.tmid%]",
					[%/if%]
					dynamiQueryString: "typeclass",
					dynamitype: "select"
				});
				$('#espcms_saveInfo').ajaxForm({
					type: 'POST',
					url: '[%$link.save%]',
					dataType: 'json',
					beforeSubmit: function () {
						parent.espcms_are_loading();
					},
					success: function (data) {
						parent.$("#espcms_are_loading").dialog("close");

						parent.$("body").append(data.data);
						if (data.code === 'true') {
							parent.$.espcms_sticky(data.message, {'autoclose': 3000});
							parent.frames['[%$par_iframes_name%]'].refresh('ajax_list');
							parent.$(this).espcms_window_tab('close', {'iframeName': '[%$iframes_name%]'});
						} else {
							var botton = [
								{
									text: "[%pack:botton_pack-espcms_botton_colse%]",
									class: "btn btn-lightgray",
									click: function () {
										parent.$(this).dialog("close");
										parent.$(this).espcms_window_tab('close', {'iframeName': '[%$iframes_name%]'});
									}
								}
							];
							parent.espcms_public_dialog(data.domid_name, botton, 600);
						}
						$(window).unbind('beforeunload');
					}
				});
				$('.espcms_save_cancel').espcms_window_tab('closeTab');
				load_tabclick('.tab_click');
				$(".lable_key_click").unbind('click').bind('click', function () {
					var data_key = $(this).attr('data-key');
					UE.getEditor('templatecontent').setContent(data_key, true);
				});
				$('#label').on('change', function () {
					var label = $(this).val();
					$.ajax({
						type: "get", url: "[%$link.key%]", data: {'label': label}, global: false,
						beforeSend: function () {
							parent.espcms_are_loading();
						},
						success: function (data) {
							parent.$("#espcms_are_loading").dialog("close");
							$('.label_key').empty().append(data);

							$(".lable_key_click").unbind('click').bind('click', function () {
								var data_key = $(this).attr('data-key');
								UE.getEditor('templatecontent').setContent(data_key, true);
							});
						}
					});
				});
			});
		</script>
	</head>

	<body class="espcms_style_all">
		<div class="main">
			<div class="espcms_center_content_list">

				<div class="panel">
					<div class="panel-body form_bottom_page">
						<form class="form-horizontal admin-form" id="espcms_saveInfo" action="[%$link.save%]">
							<input type="hidden" name="token_key" id="token_key" value="[%$token.token_key%]"/>
							<input type="hidden" name="token_name" id="token_name" value="[%$token.token_name%]"/>
							[%if $type=='copy'%]
							<input type="hidden" name="savetype" value="copy"/>
							<div class="section-divider mb40"><span>[%pack:templates_pack-espcms_templates_mail_button_copy%]</span></div>
							[%/if%]
							[%if $type=='edit'%]
							<input type="hidden" name="savetype" value="edit"/>
							<input type="hidden" name="tmid" id="tmid" value="[%$read.tmid%]"/>
							<div class="section-divider mb40"><span>[%pack:templates_pack-espcms_templates_mail_button_edit%]</span></div>
							[%/if%]
							<div class="form-group">
								<label class="col-sm-2 control-label">[%pack:templates_pack-espcms_templates_mail_templatename%]</label>
								<div class="col-sm-9">
									<input type="text" name="templatename" class="form-control" id="templatename" value="[%$read.templatename%]" maxlength="80" data-validation-minlength="2" data-validation-maxlength="50" placeholder="[%pack:templates_pack-espcms_templates_mail_templatename_title%]" title="[%pack:templates_pack-espcms_templates_mail_templatename_title%]" data-validation-msg="[%pack:templates_pack-espcms_templates_mail_templatename_validation_msg%]"/>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">[%pack:templates_pack-espcms_templates_mail_typeclass%]</label>
								<div class="col-sm-9">
									<select class="selectpicker form-control" name="typeclass" id="typeclass" data-size="8" title="[%pack:templates_pack-espcms_templates_mail_typeclass_title%]" data-validation="^[\w]+$" data-validation-msg="[%pack:templates_pack-espcms_templates_mail_typeclass_validation_msg%]">
										[%forlist from=$typeclass key=i%]
										<option value="[%$typeclass[i].key%]" [%$typeclass[i].selected%]>[%$typeclass[i].name%]</option>
										[%/forlist%]
									</select>
								</div>
							</div>
							[%if $type=='copy'%]
							<div class="form-group">
								<label class="col-sm-2 control-label">[%pack:templates_pack-espcms_templates_mail_templatecode%]</label>
								<div class="col-sm-9">
									<input type="text" name="templatecode" class="form-control" id="templatecode" data-validation="^[\w]+$" placeholder="[%pack:templates_pack-espcms_templates_mail_templatecode_title%]" title="[%pack:templates_pack-espcms_templates_mail_templatecode_title%]" data-validation-msg="[%pack:templates_pack-espcms_templates_mail_templatecode_validation_msg%]" validation-warning="[%pack:templates_pack-espcms_templates_mail_templatecode_warning_msg%]"/>
								</div>
							</div>
							[%/if%]
							[%if $type=='edit'%]
							<div class="form-group">
								<label class="col-sm-2 control-label">[%pack:templates_pack-espcms_templates_mail_templatecode%]</label>
								<div class="col-sm-9">
									<input type="text" name="templatecode" class="form-control" id="templatecode" value="[%$read.templatecode%]" data-validation="^[\w]+$" placeholder="[%pack:templates_pack-espcms_templates_mail_templatecode_title%]" title="[%pack:templates_pack-espcms_templates_mail_templatecode_title%]" data-validation-msg="[%pack:templates_pack-espcms_templates_mail_templatecode_validation_msg%]" validation-warning="[%pack:templates_pack-espcms_templates_mail_templatecode_warning_msg%]"/>
								</div>
							</div>
							[%/if%]
							<div class="form-group">
								<label class="col-sm-2 control-label">[%pack:templates_pack-espcms_templates_mail_title%]</label>
								<div class="col-sm-9">
									<input type="text" name="title" class="form-control" id="title" value="[%$read.title%]" maxlength="150" data-validation-minlength="2" data-validation-maxlength="150" placeholder="[%pack:templates_pack-espcms_templates_mail_title_title%]" title="[%pack:templates_pack-espcms_templates_mail_title_title%]" data-validation-msg="[%pack:templates_pack-espcms_templates_mail_title_validation_msg%]"/>
								</div>
							</div>

							<div class="form-group issendtype1">
								<label class="col-sm-2 control-label">[%pack:templates_pack-espcms_templates_mail_label%]</label>
								<div class="col-sm-9">
									<select class="selectpicker form-control" name="label" id="label" data-size="8" title="[%pack:templates_pack-espcms_templates_mail_label_title%]">
										[%forlist from=$typeclass key=i%]
										<option value="[%$typeclass[i].key%]" [%$typeclass[i].selected%]>[%$typeclass[i].name%]</option>
										[%/forlist%]
									</select>
								</div>
							</div>
							<div class="form-group issendtype1">
								<label class="col-sm-2 control-label"></label>
								<div class="col-sm-9"><span class="input_exp"> <span class="exp_icon espcms_icon_fa espcms_icon_fa-exclamation-circle" aria-hidden="true"></span>[%pack:templates_pack-espcms_templates_mail_label_str%]</span></div>
							</div>
							<div class="form-group issendtype1">
								<label class="col-sm-2 control-label"></label>
								<div class="col-sm-9">
									<ul class="label_key">
										[%forlist from=$lable_list key=i%]
										<li data-key="[%$lable_list[i].title%]" class="lable_key_click" title="[%$lable_list[i].name%]"><button type="button" class="btn btn-addblue min-w-150 btn-xs"><i class="espcms_icon_fa espcms_icon_fa-tag"></i>[%$lable_list[i].name%]</button></li>
										[%/forlist%]
									</ul>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">[%pack:templates_pack-espcms_templates_mail_templatecontent%]</label>
								<div class="col-sm-9">
									<textarea style="width:100%;height:350px" name="templatecontent" id="templatecontent" data-validation-minlength="2" data-validation-maxlength="2000" placeholder="[%pack:templates_pack-espcms_templates_mail_templatecontent_title%]" title="[%pack:templates_pack-espcms_templates_mail_templatecontent_title%]" data-validation-msg="[%pack:templates_pack-espcms_templates_mail_templatecontent_validation_msg%]">[%$read.templatecontent%]</textarea>
									<script type="text/javascript">
										$(document).ready(function () {
											UE.getEditor('templatecontent', {toolbars: editconfing});
										});
									</script>
								</div>
							</div>
							[%if $type=='copy'%]
							<div class="form_button">
								<button type="submit" class="btn btn-green min-w-150" formmethod="POST">[%pack:botton_pack-espcms_botton_save_ok_copy%]</button>
								<button type="button" class="btn btn-lightgray min-w-150 espcms_save_cancel">[%pack:botton_pack-espcms_botton_save_cancel_copy%]</button>
							</div>
							[%/if%]
							[%if $type=='edit'%]
							<div class="form_button">
								<button type="submit" class="btn btn-green min-w-150" formmethod="POST">[%pack:botton_pack-espcms_botton_save_ok%]</button>
								<button type="button" class="btn btn-lightgray min-w-150 espcms_save_cancel">[%pack:botton_pack-espcms_botton_save_cancel_edit%]</button>
							</div>
							[%/if%]
						</form>
					</div>
				</div>

			</div>
		</div>
		[%link file="public/load.html"%]
		[%link file="public/load_height.html"%]
	</body>
</html>
