<!doctype html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="renderer" content="webkit"> 
  <title>当前模板配置</title>
  <link type="text/css" rel="Stylesheet" href="/admin/drag/css/drag.base.css">
  <link type="text/css" rel="Stylesheet" href="/admin/drag/css/kesion.form.css">
  <link type="text/css" rel="Stylesheet" href="/admin/drag/fonts/iconfont.css">
  
  <style>
		.form-label span{float:left;height:22px; line-height:22px; padding:0 10px;border:1px solid #ffcccc; color:#555; font-weight:bold; background:#ffffec;margin:0px 2px 2px 0px; cursor:pointer;}
  </style>    
  
</head>
<body>
   
   	
    <div id="content">
        <div class="clear blank20"></div>
        <div class="ks-tips-bar" style="margin:0 20px;"><i class="drag-font drag-i-tuli"></i>提示：修改完成需要保存当前模板才生效</div>
        <div class="clear blank10"></div>
        <div class="ks-form">
                <ul>
                    <li>
                        <div class="ks-form-title">站点标题</div>
                        <div class="ks-form-cont">
                            <div class="form-label"><span data-label="{$GetSiteTitle}">站点标题</span><span data-label="{$GetClassName}">栏目名称</span><span data-label="{KS:Field:Title}">内容标题</span></div>
                            <textarea name="title" cols="45" rows="1" class="ks-textarea"></textarea>
                        </div>
                    </li>
                    <li>
                        <div class="ks-form-title">网页关键词：</div>
                        <div class="ks-form-cont">
                            <div class="form-label"><span data-label="{$GetMetaKeyWords}">网站关键词</span><span data-label="{$GetClassMetaKeyWords}">栏目关键词</span><span data-label="{$GetClassName}">栏目名称</span><span data-label="{$GetClassIntro}">栏目介绍</span><span data-label="{KS:Field:Title}">内容标题</span></div>
                            <textarea name="keywords" cols="46" rows="3" class="ks-textarea"></textarea>
                        </div>
                    </li>
                    <li>
                        <div class="ks-form-title">网页描述：</div>
                        <div class="ks-form-cont">
                            <div class="form-label"><span data-label="{$GetMetaDescript}">网站描述</span><span data-label="{$GetClassMetaDescript}">栏目描述</span><span data-label="{$GetClassIntro}">栏目介绍</span><span data-label="{$GetClassIntro}">内容介绍</span></div>
                            <textarea name="description" cols="46" rows="3" class="ks-textarea"></textarea>
                        </div>
                    </li>
                </ul>
        </div>  
   

	</div>
 
     
    <div class="clear blank20" style="border-top:1px solid #ebebeb;"></div>
    <div class="ks-btn-center">
      <button class="ks-btn ks-btn-normal" onClick="page.determine()" id="btn-save">确定</button>
      &nbsp;
      <button class="ks-btn" onClick="parent.closeSetWindow()">取消</button>
    
    </div>
	
    <script src="/admin/drag/js/utils.js"></script>
    <script>utils.loadJs(['jquery','nicescroll'])</script>
	<script>
		var page = {
			target:{
				content:$('#content')
			},
			ready:function(){
				this.contHeight();
				this.target.content.niceScroll({  
					cursorcolor:"rgba(0,0,0,0.2)",  
					cursoropacitymax:1,  
					touchbehavior:false,  
					cursorwidth:"6px",  
					cursorborder:"0", 
					cursorborderradius:"10px"  
				}); 
				var title = parent.$contents.find('title:first')[0].innerText;
				$('textarea[name="title"]').val(title);
				parent.$contents.find('meta').each(function(){
					if(this.name=='Keywords'||this.name=='keywords'){
						$('textarea[name="keywords"]').val(this.content);
					}else if(this.name=='Description'||this.name=='description'){
						$('textarea[name="description"]').val(this.content);
					};
				});
				$('textarea[name="title"]').val(title);
				
				$('.form-label').on('click','span',function(){
					var labelName = $(this).attr('data-label');
					var $textarea = $(this).parent().next('.ks-textarea');
					var textareaVal = $textarea.val()+labelName;
					$textarea.val(textareaVal);
					$textarea[0].scrollTop = $textarea.outerHeight();
				});
				this.resize();
			},
			resize:function(){
				this.contHeight();
			},
			contHeight:function(){
				var contHeight = $(window).height()-$('.ks-btn-center').outerHeight()-41;
				this.target.content.height(contHeight);
			},
			determine:function(){
				var title = $('textarea[name="title"]').val();
				parent.$contents.find('title:first')[0].innerText = title;
				parent.$contents.find('meta').each(function(){
					if(this.name=='Keywords'||this.name=='keywords'){
						var keywords = $('textarea[name="keywords"]').val();
						this.content = keywords;
						
					}else if(this.name=='Description'||this.name=='description'){
						var description = $('textarea[name="description"]').val();
						this.content = description;
					};
				});
				parent.closeSetWindow();
				parent.popup.tips({
					title:'保存成功',
				});
			}

		};
		page.ready();

    </script>


</body>
</html>