<!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" type="text/css" href="{{kg['tpl_url']}}style/category_update.css">
<script src="{{kg['tpl_url']}}script/jquery.min.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['server']['HTTP_HOST']}}/tools/amazeui/js/amazeui.min.js"></script>
<script src="{{kg['tpl_url']}}script/common.js"></script>
<script src="{{kg['tpl_url']}}script/category_update.js"></script>
</head>
<body data-type="generalComponents" style="overflow: hidden;">
	{% 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="category_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 am-no-margintop ">
						<div class="portlet-input input-small input-inline">
							<div class="input-icon right am-fr">
								<div class="am-btn-group am-btn-group-xs">
									<a class="am-btn am-btn-default am-btn-success am-edit am-btn-xs am-btn-add" href="{{kg['server']['HTTP_REFERER']}}"><span class="am-icon-plus"></span>&nbsp;返回上级</a>
								</div>
							</div>
							<div class="am-cf"></div>
						</div>
					</div>
				</div>
				<div class="tpl-block">
					<div class="am-g">
						<div class="tpl-form-body tpl-form-line">
							<form class="am-form tpl-form-line-form" method="post" action="">
								<div class="am-form-group am-form-icon am-form-feedback">
									<label class="am-u-sm-3 am-form-label">栏目名称&nbsp;/&nbsp;<span class="tpl-form-line-small-title">ColumnName
										</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<input type="text" class="tpl-form-input ngco_Ojs_bitian" id="title" name="title" value="{{data['title']}}">
										<i class=""></i>
									</div>
								</div>
								<div class="am-form-group default-tpl" {% if action=="edit" %}style="display:none"{% endif %}>
									<label class="am-u-sm-3 am-form-label">所属模块&nbsp;/&nbsp;<span	class="tpl-form-line-small-title">Module</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3 posi_box2 module-select">
										<select name="module" id="module" data-am-selected="{btnSize: 'sm'}" style="display: none;">
											<option selected="selected" value="0">请选择所属模块</option>
											<option {% if data['module'] == 'article' or (add and add.get('module') == 'article') %}selected="selected" {% endif %}value="article">文章模块</option>
											<option {% if data['module'] == 'product' or (add and add.get('module') == 'product') %}selected="selected" {% endif %}value="product">商品模块</option>
											<option {% if data['module'] == 'photo' or (add and add.get('module') == 'photo') %}selected="selected" {% endif %}value="photo">图集模块</option>
											<option {% if data['module'] == 'download' or (add and add.get('module') == 'download') %}selected="selected" {% endif %}value="download">下载模块</option>
											<option {% if data['module'] == 'research' or (add and add.get('module') == 'research') %}selected="selected" {% endif %}value="research">问卷调查</option>
											<option {% if data['module'] == 'vote' or (add and add.get('module') == 'vote') %}selected="selected" {% endif %}value="vote">投票</option>
										</select>
									</div>
								</div>
								<div class="am-form-group default-tpl select-box">
									<label class="am-u-sm-3 am-form-label">所属栏目&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Column</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
									<select name="category" id='category-box' data-am-selected="{searchBox: 1}">

									</select>
									</div>
								</div>
								<div class="am-form-group ngco-No-marginB">
									<label class="am-u-sm-3 am-form-label" id="in">栏目图片&nbsp;/&nbsp;<span class="tpl-form-line-small-title">ColumnImg</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<!-- 图片区域 -->
										<div class="am-form-group am-form-file">
											<div class="tpl-form-file-img ngco-none-display2" id="ngac_Nfu_box">
												<img src="{{data['picture']}}" id="finalImg" alt=""/>
											</div>
											<button type="button" title="未选择任何图片" class="am-btn am-btn-danger am-btn-sm title2div ngco-No-outline" id="originalImg">
												<i class="am-icon-cloud-upload"></i>&nbsp;原始上传
											</button>
											<input type="file" id="originalChoose" class="ngco-No-widht" />
											<input type="hidden" name="image" id="originalUpdate" value='' />
											<button type="button" title="未选择任何图片" class="am-btn am-btn-danger am-btn-sm title2div ngco-No-outline" 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>
								<div class="am-form-group">
									<label class="am-u-sm-3 am-form-label">SEO标题&nbsp;/&nbsp;<span class="tpl-form-line-small-title">SEOTitle</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<input type="text" class="tpl-form-input" name="seotitle" id="user-name2" value="{{data['seotitle']}}">
									</div>
								</div>
								<div class="am-form-group">
									<label class="am-u-sm-3 am-form-label">SEO关键字&nbsp;/&nbsp;<span class="tpl-form-line-small-title">SEOKeywords</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<input type="text" class="tpl-form-input" name="seokey" id="user-name3" value="{{data['seokey']}}">
									</div>
								</div>
								<div class="am-form-group">
									<label class="am-u-sm-3 am-form-label">SEO描述&nbsp;/&nbsp;<span class="tpl-form-line-small-title">SEODescription</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<input type="text" class="tpl-form-input" name="seodescr" id="user-name4" value="{{data['seodescr']}}">
									</div>
								</div>
								<div class="am-form-group">
									<label class="am-u-sm-3 am-form-label">栏目介绍&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Introduction
										</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<input type="text" class="tpl-form-input" id="Introduction"	value="{{data['introduction']}}" name="Introduction">
									</div>
								</div>
								<div class="am-form-group am-form-icon am-form-feedback">
									<label class="am-u-sm-3 am-form-label">栏目排序&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Sort
										</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<input type="text" class="tpl-form-input" id="sort" value="{{data['sort']}}" name="sort">
										<i class=""></i>
									</div>
								</div>
								<div class="am-form-group am-form-icon am-form-feedback">
									<label class="am-u-sm-3 am-form-label">自定义模板文件&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Template
										</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<input type="text" class="tpl-form-input" id="sort2" value="{{data['template']}}" name="template">
										<i class=""></i>
									</div>
								</div>
								<div class="am-form-group">
									<div class="tpl-switch">
										<label class="am-u-sm-3 am-form-label">是否启用&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Index</span></label>
										<div class="am-u-sm-6 am-u-sm-pull-3">
											<input name="enable" type="radio" class="ios-switch bigswitch tpl-switch-btn" {% if data['enable'] %}checked=""{%endif%}>
											<div class="tpl-switch-btn-view">
												<div></div>
											</div>
										</div>
									</div>
								</div>
								<div class="am-form-group">
									<div class="tpl-switch">
										<label class="am-u-sm-3 am-form-label">所有人可以访问&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Visit</span></label>
										<div class="am-u-sm-6 am-u-sm-pull-3">
											<input name="permission[]" type="radio" id="all" value="0" class="ios-switch bigswitch tpl-switch-btn" {% if 0 in data['permission'] %}checked=""{% endif %}>
											<div class="tpl-switch-btn-view">
												<div></div>
											</div>
										</div>
									</div>
								</div>
								<div class="am-form-group" id="permission">
									<label class="am-u-sm-3 am-form-label">权限设置&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Jurisdiction</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										{% for row in rank %}
										<label class="am-radio-inline">
											<input type="checkbox" {% if row['id'] in data['permission'] %}checked="checked"{% endif %} name="permission[]" value="{{row['id']}}"> {{row['rankname']}}
										</label>
										{% endfor %}
									</div>
								</div>
								<input type="hidden" value="submit" name="action">
								<div class="am-form-group">
									<div class="am-u-sm-9 am-u-sm-push-3">
										<button type="submit" class="am-btn am-btn-primary tpl-btn-bg-color-success">{{kg['lang'][action][3]}}</button>
									</div>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
			{% include 'component_footer.tpl' %}
		</div>
		</div><!-- /.scrollbar-wrap -->
	</div>
	<script>
		kg.title2div('title2div');	 //调用此方法， 把该元素的title属性替换成div
		$(function(){
			var upper = {{data['upper']}};
			var add = {{add.get('id', 0)}};
			// 下拉插入函数
			function deal_select(cate){
				$('#category-box').empty();
				for(var i=0;i < cate.length; i++){
					var str_level = '├';
					if(cate[i]['level'] == 1){
						str_level = '';
					}
					for(var m=0;m < (cate[i]['level']-1);m++){
						str_level += '───'
					}
					if(upper.length > 0){
						var up_id = upper[upper.length - 1]
						if(up_id == cate[i]['id']){
							$('#category-box').append('<option selected="selected" value="'+cate[i]['id']+'">' +str_level+ cate[i]['title'] + '</option>')
						}else{
							$('#category-box').append('<option value="'+cate[i]['id']+'">' +str_level+ cate[i]['title'] + '</option>')
						}
					}else{
						if(add == cate[i]['id']){
							$('#category-box').append('<option selected="selected" value="'+cate[i]['id']+'">' + str_level + cate[i]['title'] + '</option>')
						}else{
							$('#category-box').append('<option value="'+cate[i]['id']+'">' +str_level+ cate[i]['title'] + '</option>')
						}
					}
				}
			}
			// 点击事件
			var category = {{category}};
			$('.module-select li').click(function(){
				var module = $(this).attr('data-value');
				if(module != '0'){
					var cate = category[module];
					deal_select(cate)
				}
			})
			// 直接加载
			var module = $("#module").val()
			if(module !=0){
				deal_select(category[module])
			}		
		})
	</script>
</body>
</html>