<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>KGCMS企业应用管理平台 - Powered by KGCMS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<!-- <meta http-equiv="cache-control" content="no-siteapp" /> -->
<link rel="stylesheet" href="{{ kg['tpl_url'] }}style/article_update.css">
<script src="{{ kg['tpl_url'] }}script/jquery.min.js"></script>
<script src="{{ kg['server']['HTTP_HOST'] }}/tools/amazeui/js/amazeui.min.js"></script>
<script src="{{ kg['server']['HTTP_HOST'] }}/tools/ueditor/ueditor.config.js?dir=article&host={{ kg['server']['HTTP_HOST'] }}"></script>
<script src="{{ kg['server']['HTTP_HOST'] }}/tools/ueditor/ueditor.all.js"></script>
<script src="{{ kg['server']['HTTP_HOST'] }}/tools/ueditor/lang/zh-cn/zh-cn.js"></script>
<script src="{{kg['tpl_url']}}script/cropper.min.js"></script>
<script src="{{kg['tpl_url']}}script/amazeui.datetimepicker.min.js"></script>
<script src="{{kg['tpl_url']}}script/common.js"></script>
<script src="{{ kg['tpl_url'] }}script/article_update.js"></script>
</head>
<body data-type="generalComponents">
	{% include 'component_header.tpl' %}
	<div class="tpl-page-container tpl-page-header-fixed">
		<div class="scrollbar-wrap">
		{% include 'component_left.tpl' %}
		<div class="tpl-content-wrapper">
			<div class="tpl-content-page-title">
				{{kg['lang'][action][0]}}
			</div>
			<ol class="am-breadcrumb">
				<li><a href="#" class="am-icon-home">首页</a></li>
				<li><a href="article_manage">文章列表</a></li>
				<li class="am-active">{{kg['lang'][action][1]}}</li>
			</ol>
			<div class="tpl-portlet-components">
				<div class="portlet-title">
					<div class="caption font-green bold">
						<span class="am-icon-code"></span>&nbsp;{{kg['lang'][action][2]}}
					</div>
					<div class="tpl-portlet-input tpl-fz-ml ngco-No-marginT">
						<div class="am-btn-toolbar ngre-Hdadd-paddidngT">
							<div class="am-btn-group am-btn-group-xs">
								<button type="button" class="am-btn am-btn-secondary" id="regbaocun"><span class="am-icon-save"></span>&nbsp;保存</button>
								<a href="article_update" class="am-btn am-btn-success"><span class="am-icon-retweet"></span>&nbsp;重置</a>
								<a href="article_manage" class="am-btn  am-btn-danger"><span class="am-icon-mail-reply"></span>&nbsp;返回</a>
							</div>
						</div>
					</div>
				</div>
				<input type="hidden" id="data_id" value="{{data['id']}}"/>
				<div class="tpl-block ">
					<div class="am-g">
						<div class="tpl-form-body tpl-form-line">
							<form method="post" action="" class="am-form tpl-form-line-form" id="form-sublime">
								<div class="am-form-group posi_box ">
									<label for="Category" class="am-u-md-2 am-form-label">所属栏目&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Column</span></label>
									<div class="am-u-md-2  am_fl_zi_tihuan posi_box2 ng-add-span ag-add-width">
										<select name="category" data-am-selected="{searchBox: 1}" id="lanmu" style="display: none;">
											{% set cate = category|length %}
											{% if cate > 1 %}
											{% for row in category %}
											{% if row['title'] == data['category_title'] %}
											<option selected="selected" value="{{row['id']}}">
												{% if row['level'] > 1 %}
												├
												{%- for i in range(row['level']-1) -%}
												───
												{%- endfor -%}
												{% endif %}
												{{row['title']}}</option>
											{% else %}
											<option value="{{row['id']}}">
												{% if row['level'] > 1 %}
												├
												{%- for i in range(row['level']-1) -%}
												───
												{%- endfor -%}
												{% endif %}
												{{row['title']}}</option>
											{% endif %}
											{% endfor %}
											{% endif %}
											<select>
												<i class="ngar-Kjs-biaoji"></i>
									</div>
								</div>
								<div class="am-form-group am-form-icon am-form-feedback">
									<label for="Title" class="am-u-md-2 am-form-label">文章标题&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Title</span></label>
									<div class="am-u-md-8  am_fl_zi_tihuan posi_box">
										<input type="text" placeholder="输入你的文章标题" class="tpl-form-input am-reg-input ngco_Ojs_bitian" id="Title" name="title" value="{{data['title']}}">
										<i class=""></i>
									</div>
								</div>
								<div class="am-form-group">
									<label for="Tag" class="am-u-md-2 am-form-label">Tag标签&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Tag</span></label>
									<div class="am-u-md-8  am_fl_zi_tihuan">
										<input type="text" placeholder="" class="" id="Tag" name="tag" value="{{data['tag']}}">
									</div>
								</div>
								<div class="am-form-group">
									<label for="Sort" class="am-u-md-2 am-form-label"><span class="">自定义排序&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Sort</span></span></label>
									<div class="am-u-md-1  am_fl_zi_tihuan">
										<input type="text" placeholder="值越大越靠前" id="Sort" name="sort" value="{{data['sort']}}">
									</div>
									<label for="Author" class="am-u-md-1 am-form-label am-u-llg-1">文章作者&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Author</span></label>
									<div class="am-u-md-1  am_fl_zi_tihuan">
										<input type="text" placeholder="" class="" id="Author" name="author" value="{{data['author']}}">
									</div>
									<label for="Source" class="am-u-md-1 am-form-label am-u-llg-1">文章来源&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Source</span></label>
									<div class="am-u-md-1  am_fl_zi_tihuan">
										<input type="text" placeholder="" class="" id="Source" name="source" value="{{data['source']}}">
									</div>
									<label for="Sourceurl" class="am-u-md-1 am-form-label am-u-llg-1">来源网址&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Web</span></label>
									<div class="am-u-md-2  am_fl_zi_tihuan">
										<input type="text" placeholder="" class="" id="Sourceurl" name="sourceurl" value="{{data['sourceurl']}}">
									</div>
								</div>
								<div class="am-form-group">
									<label for="Keyword" class="am-u-md-2 am-form-label">SEO关键字&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Keyword</span></label>
									<div class="am-u-md-8  am_fl_zi_tihuan">
										<input type="text" placeholder="多个关键词请用逗号隔开" id="Keyword" name="keyword" value="{{data['keyword']}}">
									</div>
								</div>
								<div class="am-form-group">
									<label for="Introduction" class="am-u-md-2 am-form-label">SEO页面描述&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Describe</span></label>
									<div class="am-u-md-8  am_fl_zi_tihuan">
										<input type="text" placeholder="" id="Introduction" name="introduction" value="{{data['introduction']}}">
									</div>
								</div>
								<div class="am-form-group">
									<label for="Template" class="am-u-md-2 am-form-label">自定义模板&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Template</span></label>
									<div class="am-u-md-8  am_fl_zi_tihuan">
										<input type="text" placeholder="" id="Introduction" name="template" value="{{data['template']}}">
									</div>
								</div>
								<div class="am-form-group">
									<label for="Template" class="am-u-md-2 am-form-label">文章简介&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Introduce</span></label>
									<div class="am-u-md-8  am_fl_zi_tihuan">
										<textarea type="text" placeholder="" id="Introduction" name="description">{{data['description']}}</textarea>
									</div>
								</div>
								<div class="am-form-group">
									<label for="comment" class="am-u-md-2 am-form-label ngar-sty-label">是否允许评论&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Comment</span></label>
									<div class="am-u-md-1 am_fl_zi_tihuan">
										<div class="tpl-switch">
											{% if data['comment'] == 1 %}
											<input type="checkbox" id="Comment" name="comment" class="ios-switch bigswitch tpl-switch-btn" checked />
											{% else %}
											<input type="checkbox" id="Comment" name="comment" class="ios-switch bigswitch tpl-switch-btn" />
											{% endif %}
											<div class="tpl-switch-btn-view">
												<div>
												</div>
											</div>
										</div>
									</div>
									<label for="recom" class="am-u-md-1 am-form-label am-u-llg-1 ngar-sty-label">是否推荐</label>
									<div class="am-u-md-1  am_fl_zi_tihuan">
										<div class="tpl-switch">
											{% if data['recom'] == 1 %}
											<input type="checkbox" id="Recom" name="recom" class="ios-switch bigswitch tpl-switch-btn" checked />
											{% else %}
											<input type="checkbox" id="Recom" name="recom" class="ios-switch bigswitch tpl-switch-btn" />
											{% endif %}
											<div class="tpl-switch-btn-view">
												<div>
												</div>
											</div>
										</div>
									</div>
									<label for="published" class="am-u-md-1 am-form-label am-u-llg-1 ngar-sty-label">是否发布</label>
									<div class="am-u-md-1  am_fl_zi_tihuan">
										<div class="tpl-switch">
											{% if data['published'] == 1 %}
											<input type="checkbox" id="" name="published" class="ios-switch bigswitch tpl-switch-btn" checked />
											{% else %}
											<input type="checkbox" id="" name="published" class="ios-switch bigswitch tpl-switch-btn" />
											{% endif %}
											<div class="tpl-switch-btn-view">
												<div>
												</div>
											</div>
										</div>
									</div>
									<label for="audit" class="am-u-md-1 am-form-label am-u-llg-1 ngar-sty-label">审核</label>
									<div class="am-u-md-1  am_fl_zi_tihuan">
										<div class="tpl-switch">
											{% if data['audit'] == 1 %}
											<input type="checkbox" id="Audit" name="audit" class="ios-switch bigswitch tpl-switch-btn" checked />
											{% else %}
											<input type="checkbox" id="Audit" name="audit" class="ios-switch bigswitch tpl-switch-btn" />
											{% endif %}
											<div class="tpl-switch-btn-view">
												<div>
												</div>
											</div>
										</div>
									</div>
								</div>
								<!--缩略图-->
								<div class="am-form-group a-clic">
									<label class="am-u-md-2 am-form-label">缩略图&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Thumbnail</span></label>
									<ul data-am-widget="gallery" class="am-gallery sm-block-grid-2 md-block-grid-3 lg-block-grid-4 am-gallery-bordered ngsty-Iul am-no-layout" data-am-gallery="{ pureview: true }" id="picture_view">
										{% if data['thumbnail'] %}
										<li style="float: left;position: relative">
											<div class="tpl-table-images-content-i-info absolute-middle">
												<button type="button" class="btn1 btnsty am-btn-circle am-btn am-btn-success am-margin-horizontal btn-update ty-button" data-btn='update2'><i class="am-icon-pencil-square-o"></i>&nbsp;修改</button>
												<button type="button" class="btnsty am-btn-circle am-btn am-btn-danger am-margin-horizontal btn-remove ty-button" data-btn='remove2'><i class="am-icon-remove ngsty-rem"></i>&nbsp;删除</button>
												<button type="button" class="btnsty am-btn-circle am-btn am-btn-secondary am-margin-horizontal btn-search ty-button" data-btn='search'><span class="search1"><i class="am-icon-search ngsty-rem"></i>&nbsp;查看</span></button>
											</div>
											<img src="{{data['thumbnail']}}" height="120" alt="">
											<input type="hidden" name="thumbnail" value="{{data['thumbnail']}}" />
										</li>
										{% endif %}
									</ul>
									{% if not data['thumbnail'] %}
									<div class="ewm-upload  btn-add ngdo-GD" id="thumbnail" data-btn="add2">
										<input name="image" type="text" class="input-file" id="qrcodeInput">
										<div class="shuline"></div>
										<div class="hengline"></div>
									</div>
									{% endif %}
								</div>
								<!-- 上传图片 -->
								<div class="am-form-group a-clic ngar-Simg">
									<label class="am-u-md-2 am-form-label ngar-Simlab">上传图片&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Upload</span></label>
									<ul data-am-widget="gallery" data-am-gallery="{ pureview: true }" class="ngar-uljs  am-gallery sm-block-grid-2 md-block-grid-3 lg-block-grid-4 am-gallery-bordered ngsty-Iul am-no-layout" id="picture_view">
										{% for row in data['picture'] %}
										<li style="float: left;position: relative">
											<div class="tpl-table-images-content-i-info absolute-middle">
												<button type="button" class="btn1 btnsty am-btn-circle am-btn am-btn-success am-margin-horizontal btn-update ty-button" data-btn='update'><span class="square1"><i class="am-icon-pencil-square-o"></i>&nbsp;修改</span></button>
												<button type="button" class="btnsty am-btn-circle am-btn am-btn-danger am-margin-horizontal btn-remove ty-button" data-btn='remove'><span class="remoe1"><i class="am-icon-remove ngsty-rem"></i>&nbsp;删除</span></button>
												<button type="button" class="btnsty am-btn-circle am-btn am-btn-secondary am-margin-horizontal btn-search ty-button" data-btn='search'><span class="search1"><i class="am-icon-search ngsty-rem"></i>&nbsp;查看</span></button>
											</div>
											<img src="{{row}}" height="120" alt="">
											<input type="hidden" name="picture[]" value="{{row}}" />
										</li>
										{% endfor %}
									</ul>
									<div class="ewm-upload  btn-add ngdo-GD ngar-Yjs" id="qrcodeUpload" data-btn="add">
										<input name="image" type="text" class="input-file" id="qrcodeInput">
										<div class="shuline"></div>
										<div class="hengline"></div>
									</div>
								</div>
								<!-- 上传图片结束 -->
								<div class="am-form-group">
									<div class="tpl-switch">
										<label class="am-u-md-2 am-form-label">所有人可以访问&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Visit</span></label>
										<div class="am-u-md-1  am_fl_zi_tihuan">
											<input name="authority[]" type="radio" id="all" value="0" class="ios-switch bigswitch tpl-switch-btn" {% if 0 in data['authority'] %}checked=""{% endif %}>
											<div class="tpl-switch-btn-view" id="button-all">
												<div></div>
											</div>
										</div>
									</div>
								</div>
								<div class="am-form-group" id="permission">
									<label class="am-u-md-2 am-form-label">权限设置&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Jurisdiction</span></label>
									<div class="am-u-md-1  am_fl_zi_tihuan" style="width: 80%">
										{% for row in rank %}
										<label class="am-radio-inline">
											<input type="checkbox" {% if row['id'] in data['authority'] %}checked="checked"{% endif %} name="authority[]" value="{{ row['id'] }}"> {{ row['rankname'] }}
										</label>
										{% endfor %}
									</div>
								</div>
								<div class="am-form-group">
									<label for="Commenttotal" class="am-u-md-2 am-form-label">评论人数&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Comment</span></label>
									<div class="am-u-md-2  am_fl_zi_tihuan">
										<input type="text" placeholder="0" class="" id="Commenttotal" name="commenttotal" value="{{data['commenttotal']}}">
									</div>
									<label for="Like" class="am-u-llg-1 am-u-md-1 am-form-label ">点赞人数</label>
									<div class="am-u-md-2  am_fl_zi_tihuan">
										<input type="text" placeholder="0" class="" id="Like" name="like" value="{{data['like']}}">
									</div>
									<label for="Click" class="am-u-md-1 am-form-label am-u-llg-1 "><span class="">浏览次数</span></label>
									<div class="am-u-md-2  am_fl_zi_tihuan">
										<input type="text" placeholder="0" id="Click" name="click" value="{{data['click']}}">
									</div>
								</div>
								<div class="am-form-group">
									<label for="Publisher" class="am-u-md-2 am-form-label">发布者&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Publisher</span></label>
									<div class="am-u-md-3 am_fl_zi_tihuan">
										<input type="text" value="{{data['publisher']}}" id="Publisher" name="publisher">
									</div>
									<label for="datetimepicker" class="am-u-md-2 am-form-label ">发布日期</label>
									<div class="am-u-md-3 am_fl_zi_tihuan am-form-icon am-form-feedback" id="dateBox2">
										<div class="tpl-switch role-select">
											<div class="tpl-switch-btn-view" id="switch">
												<div>
												</div>
											</div>
										</div>
										<input type="text" id="ngre-Ainput" name="period_time" value="{{data['pushtime']}}" class="form-datetime-lang am-form-field time-table ngre-add-border ngre-add-radius2 ngre-Achange-form ngco_Ojs_bitian2 ngar-Qsz-borderco" />
										<i class=""></i>
									</div>
								</div>
								<div class="am-form-group ngsty-box-pre">
									<label for="ser-intro" class="am-u-md-2 am-form-label">详情内容&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Content</span></label>
									<textarea id="KgcmsEditor" style="width:83%; height:400px; margin:0; padding:0; overflow:hidden;position:relative;" class="edui-default">{{data['content']}}</textarea>
									<script>
									UE.getEditor('KgcmsEditor')
									</script>
								</div>
								<input type="hidden" name="action" value="submit" />
							</form>
							<div class="am-form-group">
								<div class="am-u-sm-8 am-u-sm-push-2">
									<button type="submit" class="am-btn am-btn-primary tpl-btn-bg-color-success" id="am-regSubmit">{{kg['lang'][action][3]}}</button>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			{% include 'component_footer.tpl' %}
		</div>
		</div><!-- /.scrollbar-wrap -->
	</div>




	<!-- 模态框 -->
	<div class="am-modal am-modal-confirm modal" tabindex="-1">
		<div class="am-modal-dialog">
			<div class="am-modal-hd modal-header ngdo-D2">
			</div>
			<div class="am-modal-bd am-padding-bottom-0">
				<form class="am-form" id="imgInFo">
					<div data-am-widget="list_news" class="am-list-news am-list-news-default">
						<div class="am-list-news-bd">
							<ul class="am-list">
								<li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-right border-none bg-transparent am-padding-bottom-0 ngdo-Li1">
									<div class="am-col am-u-md-8 am-list-main ngdo-D1">
										<div class="am-input-group am-input-group-primary am-margin-bottom-sm" style="    margin: 0px;">
											<div class="am-form-group am-form-file" style="margin-left: 4rem; margin-bottom: 0rem;">
												<button type="button" title="未选择任何图片" class="am-btn am-btn-danger am-btn-sm title2div ngdo-Bu1" id="originalImg">
													<i class="am-icon-cloud-upload"></i>&nbsp;原始上传
												</button>
												<input type="file" id="originalChoose" class="ngco-No-widht image" />
												<input type="hidden" name="image" id="originalUpdate" value='' />
												<button type="button" title="未选择任何图片" class="am-btn am-btn-danger am-btn-sm title2div" id="replaceImg">
													<i class="am-icon-cloud-upload"></i>&nbsp;裁切上传
												</button>
												<!--图片裁剪框 -->
												<div style="display: none" class="tailoring-container">
													<div class="black-cloth ngad-Jsj-click"></div>
													<div class="tailoring-content">
														<div class="tailoring-content-one">
															<label title="上传图片" for="chooseImg" class="l-btn choose-btn">
																<input type="file" name="filename" accept="image/*" id="chooseImg" class="hidden ngad-Ksj-change">
																选择图片
																<input type="hidden" name="image" id="imgUpdate" value='' />
															</label>
															<div class="close-tailoring ngad-Usj-click">×</div>
														</div>
														<div class="tailoring-content-two">
															<!-- 大裁剪图片 -->
															<div class="tailoring-box-parcel">
																<img id="tailoringImg" src="/" alt=""/>
															</div>
															<div class="preview-box-parcel">
																<p>图片预览：</p>
																<div class="square previewImg">
																</div>
																<div class="circular previewImg">
																</div>
															</div>
														</div>
														<div class="tailoring-content-three">
															<button class="l-btn cropper-reset-btn" type="button">复位</button>
															<button class="l-btn cropper-rotate-btn" type="button">旋转</button>
															<button class="l-btn cropper-scaleX-btn" type="button">换向</button>
															<button class="l-btn sureCut" id="sureCut" type="button">确定</button>
														</div>
													</div>
												</div>
												<!--图片裁剪框 -->
												<input id="doc-form-file" type="file" multiple="" class="ngco-No-widht">
											</div>
											<!-- 图片区域结束 -->
										</div>
										<div class="am-form-group am-form-file am-hide">
											<input type="file" multiple>
										</div>
									</div>
									<div class="am-col am-u-md-4 am-list-thumb fubox_img">
										<img src="{{kg['tpl_url']}}images/a1.png" id="finalImg" />
										<div id="loading"></div>
									</div>
								</li>
							</ul>
						</div>
					</div>
			</div>
			<div class="am-modal-footer">
				<span class="am-modal-btn" id="false" data-am-modal-cancel>取消</span>
				<span class="am-modal-btn" id="true" data-am-modal-confirm>确定</span>
			</div>
		</div>
	</div>







	<script>
	$(function() {
		var index = {{data['picture']|length}};
		$('#image').on('click', '.button-edit', function() {
			$(this).parent().find('input').attr('value', '')
			$(this).hide().siblings().hide();
			$(this).next().next().show();
			$(this).next().next().attr('src', $(this).next().next().attr('src'))
		})
		$('#image').on('click', '.button-del', function() {
			$(this).parent().remove();
		})
		$('#image').on('mouseover', '.li-picture', function() {
			if ($(this).find('input').val()) {
				$(this).find('a').show();
			}
		})
		$('#image').on('mouseout', '.li-picture', function() {
			$(this).find('a').hide();
		})
		$('#image').on('click', '.li-picture img', function() {
			index += 1;
			console.log($('#image').find('input[value=]').length)
			if ($('#image').find('input[value=]').length == 0) {
				var frame = '<li class="li-picture">' +
					'<img id="picture' + index + '" src="" alt=""/>' +
					'<input type="hidden" name="picture" value=""/>' +
					'<a href="javascript:void(0);" class="am-btn am-btn-danger button-edit" style="display: none"><span class="am-icon-pencil-square-o">&nbsp;修改</span></a>' +
					'<a href="javascript:void(0);" class="am-btn am-btn-success button-del" style="display: none"><span class="am-icon-trash-o">&nbsp;删除</span></a>' +
					'<iframe src="/api/admin_process?action=upload&dir=article{% if data["id"] %}&filename=article_{{data["id"]}}_' + index + '{% endif %}&return_id=picture' + index + '" width="80" height="75" border="0" scrolling="no" frameborder="0" style="display: block;"></iframe>' +
					'</li>'
				$("#image").append(frame);
			}
		})
	})
	</script>
</body>
</html>