<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><?=$da['title']?>-<?=TITLE?></title>
<link rel="stylesheet" href="webmain/css/css.css" />
<link rel="stylesheet" href="mode/kindeditor/themes/default/default.css" />
<link rel="shortcut icon" href="favicon.ico" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/js.js"></script>
<script type="text/javascript" src="mode/kindeditor/kindeditor-min.js"></script>
<script type="text/javascript">
var id  = '<?=$da['rs']['id']?>',adminid='<?=$da['adminid']?>';
var modenum = '<?=$da['rs']['num']?>',editor,atype='<?=$da['atype']?>';
function initbody(){
	resizes();
	$(window).resize(resizes);
	
	var cans  = {
		resizeType : 0,
		allowPreviewEmoticons : false,
		allowImageUpload : true,
		formatUploadUrl:false,
		allowFileManager:true,
		minWidth:'300px',
		items : [
			'forecolor', 'hilitecolor', 'bold', 'italic', 'underline','fontsize','hr',
			'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			'insertunorderedlist', '|','table', 'link','unlink','|','source','clearhtml','fullscreen'
		]
	};
	editor = KindEditor.create('#content', cans);
}
function resizes(){
	var s = winHb();
	$('#page_left').css('height',''+(s-80)+'px');
	$('#page_conent').css('height',''+s+'px');
	$('#content').css('height',''+(s-70)+'px');
}
var subdata={};
var c={
	insert1:function(o1,lx){
		var o  = $(o1).parent();
		var fid = o.attr('fields'),fss = o.attr('fname'),iszb=parseFloat(o.attr('iszb'));
		if(lx==0)editor.insertHtml(fss);
		if(lx==1){
			if(iszb=='0'){
				editor.insertHtml('{'+fid+'}');
			}else{
				editor.insertHtml('['+fid+''+(iszb-1)+',0]');
			}
		}
		if(lx==2){
			c.insertsubdata(iszb);
		}
	},
	save:function(){
		js.msg('wait','保存中...');
		var nr= editor.html();
		nr = nr.replace(/\n/gi,'');
		nr = nr.replace(/[	]/gi,'');
		var d = {content:nr,num:modenum,atype:atype};
		$.post(js.getajaxurl('viewsave','flow','main'),d,function(da){
			if(da=='success'){
				js.msg('success','保存成功');
			}else{
				js.msg('msg', da);
			}
		});
		return false;
	},
	addmobo:function(){
		if(atype=='1'){
			js.msg('msg','手机页面展示不能使用录入页面');
			return;
		}
		var s = '';
		$.get(js.getajaxurl('getinput','flow','main',{num:modenum}),function(s){
			editor.html(s);
		});
		
	}
};
</script>

<style>
select{font-size:12px}
.yangss{height:40px;line-height:40px;background:#e1e1e1;overflow:hidden}
#page_left div{text-align:left;padding:5px 10px;cursor:pointer}
#page_left div:hover{ background-color:#f1f1f1;color:#225DE8}
</style>
</head>
<body>
<div align="center">
<table width="100%">
<tr>
	<td  bgcolor="#f5f5f5">
		<div style="width:210px;">
			<div class="yangss"><h1>&nbsp;<?=$da['rs']['name']?>(元素)</h1></div>
			<div id="page_left" style="overflow:auto">
				<?php
				foreach($da['fleft'] as $k=>$rs){
					$str = '<div fields="'.$rs[0].'" fname="'.$rs[1].'" iszb="'.$rs[2].'">';
					$str.= ''.($k+1).'. '.$rs[1].'';
					if($rs[0]){
						$str.= ' <a href="javascript:" onclick="c.insert1(this,0)">＋</a> <a href="javascript:" onclick="c.insert1(this,1)">⊥</a>';
					}else{
						$str.= ' <a href="javascript:" title="插入表格" onclick="c.insert1(this,2)">＋</a>';
					}
					$str.= '</div>';
					echo $str;
				}
				?>
			</div>
			<div class="yangss" align="left">&nbsp; &nbsp;<a href="javascript:" onclick="return c.save()" class="webbtn">保存</a>&nbsp; 
			<a href="javascript:" onclick="return c.addmobo()" style="background-color:#888888" class="webbtn">使用录入页面</a>
			</div>
		</div>
	</td>
	<td width="100%">
		<div style="overflow:auto" id="page_conent">
			<div style="padding:10px"><textarea style="width:650px;" id="content"><?=$da['content']?></textarea></div>
			
		</div>
	</td>
</tr>
</table>
	
</div>
</body>
</html>