<?php
 /**
 *      [XCECP] (C) COLNET Inc.
 *      This is NOT a freeware, use is subject to license terms
 */
if(!defined("IN_QKWEB")){exit("Access Denied");}
class Ueditor{
	private $content;
	function show($name=null,$content=null){
		$tmp =$this->html($name,$content);
		echo $tmp;
	}

	function html($name=null,$content=null){
		if(!$name){$name="content";}
		$tmp = "<script type=\"text/javascript\" src=\"/".APP_DIR."plugins/editor/ueditor/ueditor.config.js\"></script>";
		$tmp .= "<script type=\"text/javascript\" src=\"/".APP_DIR."plugins/editor/ueditor/ueditor.all.min.js\"></script>";		
		$tmp .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"/".APP_DIR."plugins/editor/ueditor/themes/default/css/ueditor.css\"/>";
		$tmp .= "<script type=\"text/plain\" id=\"editor\" name=\"".$name."\">".$this->content."</script>";
		$tmp .= "<script type=\"text/javascript\">";
		$tmp .= "var ue = UE.getEditor('editor',{initialFrameWidth:766,initialFrameHeight:320,initialContent:'',toolbars:[[
			'source', '|','undo', 'redo', '|','bold','italic','underline','forecolor','insertunorderedlist','insertorderedlist','fontsize', '|',
                'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
                'link', 'unlink', '|', 'imagenone', 'imageleft', 'imageright','imagecenter', '|',
                'simpleupload','insertimage', 'insertvideo','music', 'map','highlightcode', '|',
               'spechars','|',
                'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|',
                'print', 'preview', 'searchreplace']
		],zIndex:1,autoHeightEnabled:false,autoFloatEnabled:false,enableContextMenu:false,enableAutoSave:false});";
		$tmp .= "</script>";
		return $tmp;
	}

	function setContent($content=""){
		$this->content = $content;
	}

}
?>