Forráskód Böngészése

修复相对路径问题

zhujinhui 3 éve
szülő
commit
c916183ac0
100 módosított fájl, 11900 hozzáadás és 12331 törlés
  1. 5 5
      .gitignore
  2. 281 281
      README.md
  3. 315 315
      _cli.php
  4. 13 13
      _cli/.htaccess
  5. 102 102
      _cli/app.ini
  6. 24 24
      _cli/db.ini
  7. 4 4
      _cli/router.config.php
  8. 17 17
      composer.json
  9. 11 11
      demo/private/Bootstrap.php
  10. 42 42
      demo/private/actions/database/add.php
  11. 62 62
      demo/private/actions/database/creator.php
  12. 67 67
      demo/private/actions/database/rules.php
  13. 75 75
      demo/private/actions/database/table.php
  14. 53 53
      demo/private/actions/database/update.php
  15. 11 11
      demo/private/actions/demo.php
  16. 108 108
      demo/private/configure/app.ini
  17. 135 135
      demo/private/configure/database_form_data.rules.php
  18. 164 164
      demo/private/configure/database_form_setting.rules.config.php
  19. 26 26
      demo/private/configure/db.ini
  20. 56 56
      demo/private/configure/filetype.config.php
  21. 11 11
      demo/private/configure/path.config.php
  22. 6 6
      demo/private/configure/router.config.php
  23. 103 103
      demo/private/configure/table.rules.config.php
  24. 305 305
      demo/private/controller/api/database.php
  25. 43 43
      demo/private/controller/base.php
  26. 16 16
      demo/private/controller/database.php
  27. 91 91
      demo/private/controller/dirs.php
  28. 49 49
      demo/private/controller/index.php
  29. 9 9
      demo/private/controller/test.php
  30. 3 3
      demo/private/controller/view/index.tpl
  31. 12 12
      demo/private/helper/func.php
  32. 195 195
      demo/private/helper/globals.php
  33. 196 196
      demo/private/helper/tools.php
  34. 12 12
      demo/private/i18n/CN/common.php
  35. 7 7
      demo/private/i18n/language.php
  36. 35 35
      demo/private/model/code.php
  37. 594 594
      demo/private/model/table.php
  38. 38 38
      demo/private/plugins/loger.php
  39. 46 46
      demo/private/view/error.html
  40. 107 107
      demo/private/view/manage/data/add.html
  41. 14 14
      demo/private/view/manage/data/code.html
  42. 184 184
      demo/private/view/manage/data/creator.html
  43. 21 21
      demo/private/view/manage/data/pages.html
  44. 112 112
      demo/private/view/manage/data/rules.html
  45. 145 145
      demo/private/view/manage/data/table.html
  46. 96 96
      demo/private/view/manage/data/update.html
  47. 84 84
      demo/private/view/manage/folder/dir.html
  48. 56 56
      demo/private/view/manage/folder/file.html
  49. 83 83
      demo/private/view/manage/index.html
  50. 82 82
      demo/private/view/manage/left.html
  51. 93 93
      demo/private/view/manage/login.html
  52. 16 16
      demo/private/view/manage/main.html
  53. 52 52
      demo/private/view/manage/top.html
  54. 16 16
      demo/private/view/tips.html
  55. 13 13
      demo/public/.htaccess
  56. 12 12
      demo/public/index.php
  57. 6 6
      demo/public/static/css/jquery-ui.min.css
  58. 86 86
      demo/public/static/css/jquery.multiSelect.css
  59. 26 26
      demo/public/static/css/select.css
  60. 309 309
      demo/public/static/css/style.css
  61. 93 93
      demo/public/static/css/sumoselect.css
  62. 5 5
      demo/public/static/formbuilder/demo.css
  63. 0 220
      demo/public/static/formbuilder/form-builder.css
  64. 1353 1353
      demo/public/static/formbuilder/form-builder.js
  65. 312 312
      demo/public/static/formbuilder/form-render.css
  66. 247 247
      demo/public/static/formbuilder/form-render.js
  67. 64 64
      demo/public/static/formbuilder/language/cn.js
  68. 116 116
      demo/public/static/formbuilder/sass/_reset.scss
  69. 351 351
      demo/public/static/formbuilder/sass/_theme.scss
  70. 7 7
      demo/public/static/formbuilder/sass/_variables.scss
  71. 80 80
      demo/public/static/formbuilder/sass/demo.scss
  72. 96 96
      demo/public/static/js/PIE.htc
  73. 211 211
      demo/public/static/js/ajaxfileupload.js
  74. 46 46
      demo/public/static/js/cloud.js
  75. 2566 2566
      demo/public/static/js/editor/kindeditor.js
  76. 42 42
      demo/public/static/js/editor/plugins/about.html
  77. 44 44
      demo/public/static/js/editor/plugins/flash.html
  78. 86 86
      demo/public/static/js/editor/plugins/image.html
  79. 39 39
      demo/public/static/js/editor/plugins/link.html
  80. 44 44
      demo/public/static/js/editor/plugins/media.html
  81. 24 24
      demo/public/static/js/editor/plugins/plainpaste.html
  82. 66 66
      demo/public/static/js/editor/plugins/remote_image.html
  83. 36 36
      demo/public/static/js/editor/plugins/wordpaste.html
  84. 473 473
      demo/public/static/js/editor/skins/default.css
  85. 28 28
      demo/public/static/js/editor/skins/editor.css
  86. 475 475
      demo/public/static/js/editor/skins/tinymce.css
  87. 0 209
      demo/public/static/js/format+zh_CN,default,corechart.I.js
  88. 2 2
      demo/public/static/js/google-code-prettify/lang-apollo.js
  89. 3 3
      demo/public/static/js/google-code-prettify/lang-basic.js
  90. 18 18
      demo/public/static/js/google-code-prettify/lang-clj.js
  91. 2 2
      demo/public/static/js/google-code-prettify/lang-css.js
  92. 3 3
      demo/public/static/js/google-code-prettify/lang-dart.js
  93. 2 2
      demo/public/static/js/google-code-prettify/lang-erlang.js
  94. 1 1
      demo/public/static/js/google-code-prettify/lang-go.js
  95. 2 2
      demo/public/static/js/google-code-prettify/lang-hs.js
  96. 3 3
      demo/public/static/js/google-code-prettify/lang-lisp.js
  97. 1 1
      demo/public/static/js/google-code-prettify/lang-llvm.js
  98. 2 2
      demo/public/static/js/google-code-prettify/lang-lua.js
  99. 0 2
      demo/public/static/js/google-code-prettify/lang-matlab.js
  100. 2 2
      demo/public/static/js/google-code-prettify/lang-ml.js

+ 5 - 5
.gitignore

@@ -1,5 +1,5 @@
-.idea
-/private/tmp
-/demo/private/tmp
-
-/vendor/
+.idea
+/private/tmp
+/demo/private/tmp
+
+/vendor/

+ 281 - 281
README.md

@@ -1,282 +1,282 @@
-### 新版Qii
-
-使用方法:
-
-1、创建项目
-   通过命令行进入当前目录,并执行:php -q _cli.php create=yes workspace=../project cache=tmp useDB=1
-	Command line usage:
-    php -q _cli.php 并根据提示完成网站的配置
-	程序将自动创建工作目录,并生成首页及配置相关文件。设置好Web网站目录,开启.htaccess即可直接访问。
-	相关的配置文件见 configure/app.ini及configure/db.ini文件
-
-2、框架的使用
-	1) 命令行运行程序, 推荐使用short模式
-    仅支持GET方法
-		1. normal模式
-		php -q index.php control=index/action=home/id=100
-		php -q index.php control=plugins/action=index/page=2
-
-		2. middle模式
-		php -q index.php control/index/action/home/id/100
-		php -q index.php control/plugins/action/index/page/2
-
-		3. short模式
-		php -q index.php index/home/100
-		php -q index.php plugins/page/2.html
-	2) 自动加载类
-		new controller\user(); === require("controller<?=DS?>user.php"); new controller\user();
-		new model\user(); === require("model<?=DS?>user.php"); new model\user();
-		new model\test\user(); === require("model<?=DS?>test<?=DS?>user.php"); new model\test\user();
-
-	3) Qii 基本功能:
-		\Qii::getInstance(className, param1, param2, param3[,...]); === ($class = new className(param1, param2, param3[,...]));
-		_loadClass(className)->method(); === $class->method();
-		_require(fileName); 如果指定的文件无法找到则会在get_include_path()和站点配置文件的[path]的目录中去搜索,直到搜索到一个则停止。
-		_include(fileName); == include(fileName);
-		_config($key, $value);保存到私有变量 $_global[$key]中, $value可以为数组,如果是数组的话会将数组合并到已经存在$key的数组中去。
-		_config($key);获取$_global[$key][$index]的值
-		\Qii::setError($condition, $code, $argvs); 检查$condition是否成立,成立就没有错,返回false,否则有错,返回true并将错误信息,详细代码错误$code详情见<?php echo \Qii::getPrivate('qii_sys_language');?>。
-	4) 多域名支持:
-		开启多域名支持,不同域名可以访问不同目录中的controller,在app.ini中的common下添加以下内容,注意:hosts中的内容会覆盖网站中对应的配置
-        hosts[0.domain] = test.xxx.wang
-        hosts[0.path] = test
-
-        hosts[1.domain] = admin.xxx.wang
-        hosts[1.path] = admin
-	5) Module用法示例:
-		第一步,创建一个user的model
-		class user extends \Qii\Driver\Model
-		{
-			public function __construct()
-			{
-				parent::__construct();
-			}
-			public function userInfo($uid)
-			{
-				reutrn $this->db->where(['uid' => $uid])->selectRow('user');
-				//或者
-				return $this->db->getRow("SELECT * FROM user WHERE uid = '{$uid}'");
-			}
-
-			public function updateUserInfo($uid, $map)
-			{
-				return $this->db->updateObject('user', $map, array('uid' => $uid));
-			}
-
-			public function removeUser($uid)
-			{
-				return $this->db->exec("DELETE FROM user WHERE uid = ". intval($uid));
-				//或
-				return $this->db->where(['uid' => $uid])->deleteRows('user');
-			}
-		}
-		第二步,使用user model
-		namespace controler;
-
-		class user extends \Qii\Base\Controller
-		{
-			public function __construct()
-			{
-				$userClass = new \model\user();
-				$userInfo = $userClass->userInfo(10);
-
-				或
-				_loadClass("model\user")->userInfo(10);
-			}
-		}
-	6) ORM的使用示例:
-		第一步,创建表对应的ORM模型
-		/**
-		 * User ORM 模型
-		 * @author Zhu Jinhui 2015-02-13 11:26
-		 *
-		 */
-		class User extends Tables
-		{
-			public function getTableName()//返回User对应的数据表
-			{
-				return 'istudy_user';
-			}
-			public function getRelationMap()//返回alias对应的字段名
-			{
-				return array('id' => 'uid', 'email' => 'email', 'nick' => 'nickname');
-			}
-			public function getValidateSaveFields()//保存数据需要验证的字段
-			{
-				return array('email', 'password');
-			}
-			public function getValidateRules()//验证规则
-			{
-				return array('email' => array('email' => true), 'password' => array('password' => true, 'length' => 32));
-			}
-			public function getInvalidMessage()//验证不通过返回的消息内容
-			{
-				return array();
-			}
-		}
-		第二步,创建User Model:
-		namespace model;
-		class user extends \Qii\Driver\Model
-		{
-		    public function __construct()
-		    {
-		        parent::__construct();
-		    }
-		    /**
-		     * 注册
-		     * @param String $email
-		     * @param String $password
-		     * @return Array
-		     */
-		    public function register($email, $password)
-		    {
-		    	$data = array();
-		    	if(!$email || !$password)
-		    	{
-		    	    $data['code'] = 1;
-		    	    $data['error'] = array('result' => '参数不正确');
-		    		return $data;
-		    	}
-		    	$user = new User();
-		    	$user->email = $email;
-		    	$user->password = md5($password);
-		    	$user->active_code = substr(md5(uniqid(rand(), TRUE)), -6);
-		    	$user->add_time = time();
-		    	$user->update_time = time();
-		    	
-		    	$user->setPrivateKey('email');
-		    	$isExists = $user->isExits();
-		    	
-		    	if($isExists)
-		    	{
-		    	    $data['code'] = 10001;
-		    	    $data['data'] = $isExists;
-		    	}
-		    	else
-		    	{
-		    	   $data['code'] = 0;
-		    	   $data['uid'] = $user->execSave();
-		    	   if($user->getTablesError())
-		    	   {
-		    	       $data['error'] = $user->getTablesError();
-		    	   }
-		    	}
-		    	return $data;
-		    }
-		    
-		    public function login($email, $password)
-		    {
-		    	$data = array();
-		    	if(!$email || !$password)
-		    	{
-		    		return $data;
-		    	}
-		    	$user = new User();
-		    	$user->email = $email;
-		    	//$user->password = md5($password);
-		    	$userInfo = $user->isExits();
-		    	if($userInfo['uid'])
-		    	{
-		    	    if($userInfo['password'] != md5($password))
-		    	    {
-		    	        $data['code'] = 1;
-		    	        $data['msg'] = '密码不正确';
-		    	    }
-		    	    else
-		    	    {
-		    	       $data['code'] = 0;
-		    	       $cookie['uid'] = $userInfo['uid'];
-		    	       $cookie['email'] = $userInfo['email'];
-					   $data['cookie'] = $cookie;
-		    	    } 
-		    	}
-		    	return $data;
-		    }
-		}
-		第三步,使用user_model:
-		
-		class index_controller extends \Qii\Controller\Abstract
-		{
-			public function __construct()
-			{
-				$user = new user_model();
-				$status = $user->login('email@test.com', '119328118');
-				if($status['code'] === 0) echo '登录成功';
-			}
-		}
-	7) View的支持
-		view支持smarty及php
-		class index_controller extends \Qii\Controller\Abstract
-		{
-			public function __construct()
-			{
-				$this->enableView();//默认是app.ini中的view[engine],你可以在此处选择是用include或者require,只要将参数默认传给enableView即可
-				$this->view->display('tpl'); //$this->view即为使用的模板引擎
-			}
-		}
-	8) Controller的使用
-	class test_controller extends \Qii\Controller\Abstract
-	{
-		//为了避免Controller逻辑过于复杂,可以将Action拆到单独的文件
-		//当在调用dummy方法的时候会自动执行actions/dummy_action.php中的execute方法
-		public $actions = array(
-				"dummy" => "actions/dummy_action.php",
-		);
-		public function __construct()
-		{
-			parent::__construct();
-		}
-	}
-	9) Cache支持
-	Controller中使用Cache
-	class cache_controller extends Controller
-	{
-		public function __construct()
-		{
-			parent::__construct();
-		}
-		public function cacheTest()
-		{
-			$cache_id = 'cache_test';
-			//文件缓存
-			$this->setCache('file', array('path' => 'tmp'));
-			//Memcache缓存
-			$this->setCache('memcache', array('servers' => array( array('host'=>'127.0.0.1','port'=>11211) ) ,'life_time'=>600));
-			//xcache
-			$this->setCache('xcache', array('life_time'=>600));
-			//缓存内容
-			$this->cache($cache_id, 'cache内容');
-			//redis缓存
-			$this->setCache('redis', array('servers' => array('127.0.0.1.6379')));
-			$this->cache($cache_id, array('cache' => 'cache 内容'));
-			//获取缓存内容
-			$this->getCache($cache_id);
-			//移除缓存
-			$this->cache->remove($cache_id);
-		}
-	}
-	
-	Model中使用
-	class cache_model extends Model
-	{
-		public function __construct()
-		{
-			parent::__construct();
-		}
-		public function cacheTest()
-		{
-			$cache_id = 'cache_test';
-			//文件缓存
-			$this->setCache('file', array('path' => 'tmp'));
-			//Memcache缓存
-			$this->setCache('memcache', array('servers' => array( array('host'=>'127.0.0.1','port'=>11211) ) ,'life_time'=>600));
-			//xcache
-			$this->setCache('xcache', array('life_time'=>600));
-			//缓存内容
-			$this->cache($cache_id, 'cache内容');
-			//获取缓存内容
-			$this->getCache($cache_id);
-			//移除缓存
-			$this->cache->remove($cache_id);
-		}
+### 新版Qii
+
+使用方法:
+
+1、创建项目
+   通过命令行进入当前目录,并执行:php -q _cli.php create=yes workspace=../project cache=tmp useDB=1
+	Command line usage:
+    php -q _cli.php 并根据提示完成网站的配置
+	程序将自动创建工作目录,并生成首页及配置相关文件。设置好Web网站目录,开启.htaccess即可直接访问。
+	相关的配置文件见 configure/app.ini及configure/db.ini文件
+
+2、框架的使用
+	1) 命令行运行程序, 推荐使用short模式
+    仅支持GET方法
+		1. normal模式
+		php -q index.php control=index/action=home/id=100
+		php -q index.php control=plugins/action=index/page=2
+
+		2. middle模式
+		php -q index.php control/index/action/home/id/100
+		php -q index.php control/plugins/action/index/page/2
+
+		3. short模式
+		php -q index.php index/home/100
+		php -q index.php plugins/page/2.html
+	2) 自动加载类
+		new controller\user(); === require("controller<?=DS?>user.php"); new controller\user();
+		new model\user(); === require("model<?=DS?>user.php"); new model\user();
+		new model\test\user(); === require("model<?=DS?>test<?=DS?>user.php"); new model\test\user();
+
+	3) Qii 基本功能:
+		\Qii::getInstance(className, param1, param2, param3[,...]); === ($class = new className(param1, param2, param3[,...]));
+		_loadClass(className)->method(); === $class->method();
+		_require(fileName); 如果指定的文件无法找到则会在get_include_path()和站点配置文件的[path]的目录中去搜索,直到搜索到一个则停止。
+		_include(fileName); == include(fileName);
+		_config($key, $value);保存到私有变量 $_global[$key]中, $value可以为数组,如果是数组的话会将数组合并到已经存在$key的数组中去。
+		_config($key);获取$_global[$key][$index]的值
+		\Qii::setError($condition, $code, $argvs); 检查$condition是否成立,成立就没有错,返回false,否则有错,返回true并将错误信息,详细代码错误$code详情见<?php echo \Qii::getPrivate('qii_sys_language');?>。
+	4) 多域名支持:
+		开启多域名支持,不同域名可以访问不同目录中的controller,在app.ini中的common下添加以下内容,注意:hosts中的内容会覆盖网站中对应的配置
+        hosts[0.domain] = test.xxx.wang
+        hosts[0.path] = test
+
+        hosts[1.domain] = admin.xxx.wang
+        hosts[1.path] = admin
+	5) Module用法示例:
+		第一步,创建一个user的model
+		class user extends \Qii\Driver\Model
+		{
+			public function __construct()
+			{
+				parent::__construct();
+			}
+			public function userInfo($uid)
+			{
+				reutrn $this->db->where(['uid' => $uid])->selectRow('user');
+				//或者
+				return $this->db->getRow("SELECT * FROM user WHERE uid = '{$uid}'");
+			}
+
+			public function updateUserInfo($uid, $map)
+			{
+				return $this->db->updateObject('user', $map, array('uid' => $uid));
+			}
+
+			public function removeUser($uid)
+			{
+				return $this->db->exec("DELETE FROM user WHERE uid = ". intval($uid));
+				//或
+				return $this->db->where(['uid' => $uid])->deleteRows('user');
+			}
+		}
+		第二步,使用user model
+		namespace controler;
+
+		class user extends \Qii\Base\Controller
+		{
+			public function __construct()
+			{
+				$userClass = new \model\user();
+				$userInfo = $userClass->userInfo(10);
+
+				或
+				_loadClass("model\user")->userInfo(10);
+			}
+		}
+	6) ORM的使用示例:
+		第一步,创建表对应的ORM模型
+		/**
+		 * User ORM 模型
+		 * @author Zhu Jinhui 2015-02-13 11:26
+		 *
+		 */
+		class User extends Tables
+		{
+			public function getTableName()//返回User对应的数据表
+			{
+				return 'istudy_user';
+			}
+			public function getRelationMap()//返回alias对应的字段名
+			{
+				return array('id' => 'uid', 'email' => 'email', 'nick' => 'nickname');
+			}
+			public function getValidateSaveFields()//保存数据需要验证的字段
+			{
+				return array('email', 'password');
+			}
+			public function getValidateRules()//验证规则
+			{
+				return array('email' => array('email' => true), 'password' => array('password' => true, 'length' => 32));
+			}
+			public function getInvalidMessage()//验证不通过返回的消息内容
+			{
+				return array();
+			}
+		}
+		第二步,创建User Model:
+		namespace model;
+		class user extends \Qii\Driver\Model
+		{
+		    public function __construct()
+		    {
+		        parent::__construct();
+		    }
+		    /**
+		     * 注册
+		     * @param String $email
+		     * @param String $password
+		     * @return Array
+		     */
+		    public function register($email, $password)
+		    {
+		    	$data = array();
+		    	if(!$email || !$password)
+		    	{
+		    	    $data['code'] = 1;
+		    	    $data['error'] = array('result' => '参数不正确');
+		    		return $data;
+		    	}
+		    	$user = new User();
+		    	$user->email = $email;
+		    	$user->password = md5($password);
+		    	$user->active_code = substr(md5(uniqid(rand(), TRUE)), -6);
+		    	$user->add_time = time();
+		    	$user->update_time = time();
+		    	
+		    	$user->setPrivateKey('email');
+		    	$isExists = $user->isExits();
+		    	
+		    	if($isExists)
+		    	{
+		    	    $data['code'] = 10001;
+		    	    $data['data'] = $isExists;
+		    	}
+		    	else
+		    	{
+		    	   $data['code'] = 0;
+		    	   $data['uid'] = $user->execSave();
+		    	   if($user->getTablesError())
+		    	   {
+		    	       $data['error'] = $user->getTablesError();
+		    	   }
+		    	}
+		    	return $data;
+		    }
+		    
+		    public function login($email, $password)
+		    {
+		    	$data = array();
+		    	if(!$email || !$password)
+		    	{
+		    		return $data;
+		    	}
+		    	$user = new User();
+		    	$user->email = $email;
+		    	//$user->password = md5($password);
+		    	$userInfo = $user->isExits();
+		    	if($userInfo['uid'])
+		    	{
+		    	    if($userInfo['password'] != md5($password))
+		    	    {
+		    	        $data['code'] = 1;
+		    	        $data['msg'] = '密码不正确';
+		    	    }
+		    	    else
+		    	    {
+		    	       $data['code'] = 0;
+		    	       $cookie['uid'] = $userInfo['uid'];
+		    	       $cookie['email'] = $userInfo['email'];
+					   $data['cookie'] = $cookie;
+		    	    } 
+		    	}
+		    	return $data;
+		    }
+		}
+		第三步,使用model\user
+		
+		class index_controller extends \Qii\Controller\Abstract
+		{
+			public function __construct()
+			{
+				$user = new model\user();
+				$status = $user->login('email@test.com', '119328118');
+				if($status['code'] === 0) echo '登录成功';
+			}
+		}
+	7) View的支持
+		view支持smarty及php
+		class index_controller extends \Qii\Controller\Abstract
+		{
+			public function __construct()
+			{
+				$this->enableView();//默认是app.ini中的view[engine],你可以在此处选择是用include或者require,只要将参数默认传给enableView即可
+				$this->view->display('tpl'); //$this->view即为使用的模板引擎
+			}
+		}
+	8) Controller的使用
+	class test_controller extends \Qii\Controller\Abstract
+	{
+		//为了避免Controller逻辑过于复杂,可以将Action拆到单独的文件
+		//当在调用dummy方法的时候会自动执行actions/dummy_action.php中的execute方法
+		public $actions = array(
+				"dummy" => "actions/dummy_action.php",
+		);
+		public function __construct()
+		{
+			parent::__construct();
+		}
+	}
+	9) Cache支持
+	Controller中使用Cache
+	class cache_controller extends Controller
+	{
+		public function __construct()
+		{
+			parent::__construct();
+		}
+		public function cacheTest()
+		{
+			$cache_id = 'cache_test';
+			//文件缓存
+			$this->setCache('file', array('path' => 'tmp'));
+			//Memcache缓存
+			$this->setCache('memcache', array('servers' => array( array('host'=>'127.0.0.1','port'=>11211) ) ,'life_time'=>600));
+			//xcache
+			$this->setCache('xcache', array('life_time'=>600));
+			//缓存内容
+			$this->cache($cache_id, 'cache内容');
+			//redis缓存
+			$this->setCache('redis', array('servers' => array('127.0.0.1.6379')));
+			$this->cache($cache_id, array('cache' => 'cache 内容'));
+			//获取缓存内容
+			$this->getCache($cache_id);
+			//移除缓存
+			$this->cache->remove($cache_id);
+		}
+	}
+	
+	Model中使用
+	class cache_model extends Model
+	{
+		public function __construct()
+		{
+			parent::__construct();
+		}
+		public function cacheTest()
+		{
+			$cache_id = 'cache_test';
+			//文件缓存
+			$this->setCache('file', array('path' => 'tmp'));
+			//Memcache缓存
+			$this->setCache('memcache', array('servers' => array( array('host'=>'127.0.0.1','port'=>11211) ) ,'life_time'=>600));
+			//xcache
+			$this->setCache('xcache', array('life_time'=>600));
+			//缓存内容
+			$this->cache($cache_id, 'cache内容');
+			//获取缓存内容
+			$this->getCache($cache_id);
+			//移除缓存
+			$this->cache->remove($cache_id);
+		}
 	}

+ 315 - 315
_cli.php

@@ -1,315 +1,315 @@
-<?php
-/**
- * @author Jinhui Zhu  <jinhui.zhu@live.cn>
- * 通过命令行直接生成项目目录
- */
-ini_set("display_errors", "On");
-/**
- * 错误模式
- */
-error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
-
-/**
- * 自动生成目标目录
- *
- * php -q _cli.php create=yes workspace=../project cache=tmp useDB=1
- * create: 是否自动创建
- * workspace: 程序存放的目录
- * cache: 缓存目录
- * useDB: 是否使用数据库,值 0/1
- * 目前已经将配置文件写在db.ini中,配置内容将不在创建项目的时候提供,可以自行在目录中修改
- */
-class cmd
-{
-    const VERSION = '1.2';
-    public $dir = array('configure', 'controller', 'model', 'view', 'plugins', 'tmp');
-
-    public function __construct($args)
-    {
-        $param = $this->parseArgvs($args);
-        if (sizeof($param) < 1 || ($param['dbHost'] != '' && sizeof($param) < 7)) {
-            $this->stdout("命令行使用如下:\n
->php -q _cli.php create=yes workspace=../project cache=tmp dbHost=localhost dbName=test dbUser=root dbPassword=test\n
- * create: 是否自动创建:yes; \n
- * workspace: 工作目录\n
- * cache : 缓存目录\n
- * dbHost : 数据库服务器IP\n
- * dbName : 数据库名称 : \n
- * dbUser : 数据库用户名\n
- * dbPassword : 数据库密码 : \n
- ");
-            $this->stdout("是否自动创建 yes/no:");
-            $param['create'] = trim(fgets(\STDIN));
-            $this->stdout("工作目录:");
-            $param['workspace'] = trim(fgets(\STDIN));
-            $this->stdout("缓存目录:");
-            $param['cache'] = trim(fgets(\STDIN));
-            
-            $this->stdout('数据库服务器IP:');
-            $param['dbHost'] = trim(fgets(\STDIN));
-            if(!$param['dbHost']) $param['dbHost'] = 'localhost';
-            $this->stdout("数据库名称:");
-            $param['dbName'] = trim(fgets(\STDIN));
-
-            $this->stdout('请输入数据库用户名:');
-            $param['dbUser'] = trim(fgets(\STDIN));
-
-            $this->stdout('请输入数据库密码:');
-            $param['dbPassword'] = trim(fgets(\STDIN));
-
-            $this->stdout('将要在'. $param['workspace'] .'创建项目,确认请输入yes,取消请输入no:');
-
-            $param['create'] = trim(fgets(\STDIN));
-        }
-        $param['useDB'] = 0;
-        if($param['dbName'] != '')
-        {
-            $param['useDB'] = 1;
-        }
-        if ($param['create'] == 'yes') {
-            if ($this->workspace($param['workspace'])) {
-                $cache = $param['cache'];
-                if (empty($param['cache'])) $cache = 'tmp';
-                $this->dir[5] = $cache;
-                //创建目录工作区目录
-                $publicDir = $param['workspace'] . '/public';
-                if(!is_dir($publicDir))
-                {
-                    if(mkdir($publicDir, 0777))
-                    {
-                        $this->stdout('创建public目录'. $publicDir ."成功\n");
-                    }
-                    else
-                    {
-                        $this->stdout('创建public目录'. $publicDir ."失败\n");
-                    }
-                }
-                foreach ($this->dir AS $d) {
-                    $path = $param['workspace'] . '/private/' . $d;
-                    if (!is_dir($path)) {
-                        $date = date('Y-m-d H:i:s');
-                        if(mkdir($path, 0777, true))
-                        {
-                            $this->stdout('创建'. $path . "成功\n");
-                        }
-                        else
-                        {
-                            $this->stdout('创建'. $path . "失败\n");
-                        }
-                        //写入.htaccess文件到包含的目录,不允许通过Apache浏览
-                        $htaccess = array();
-                        $htaccess[] = "##";
-                        $htaccess[] = "#";
-                        $htaccess[] = "#	\$Id: .htaccess 268 {$date}Z Jinhui.Zhu $";
-                        $htaccess[] = "#";
-                        $htaccess[] = "#	Copyright (C) 2010-2012 All Rights Reserved.";
-                        $htaccess[] = "#";
-                        $htaccess[] = "##";
-                        $htaccess[] = "";
-                        $htaccess[] = "Options Includes";
-                        file_put_contents($path . '/.htaccess', join("\n", $htaccess));
-                    } else {
-                        $this->stdout("{$path} 已经存在.". PHP_EOL);
-                    }
-                }
-                //拷贝网站配置文件site.xml到项目目录
-                if($cache != 'tmp'){
-                    $appIni = file_get_contents('_cli/app.ini');
-                    $appIni = str_replace('tmp/compile', $cache . '/compile', $appIni);
-                    $appIni = str_replace('tmp/cache', $cache . '/cache', $appIni);
-                    file_put_contents($param['workspace'] . '/private/configure/app.ini', $appIni);
-                }else if (!copy("_cli/app.ini", $param['workspace'] . '/private/configure/app.ini')) {
-                     $this->stdout('拷贝 app.ini 到 ' . $param['workspace'] . '/private/configure/app.ini失败, 拒绝访问.');
-                    
-                }
-                if (!copy("_cli/router.config.php", $param['workspace'] . '/private/configure/router.config.php')) {
-                    $this->stdout('拷贝 router.config.php 到' . $param['workspace'] . '/private/configure/router.config.php 失败, 拒绝访问.');
-                }
-                if ($param['useDB'] != 'no') {
-                    $dbIni = file_get_contents('_cli/db.ini');
-                    $dbIni = str_replace('DB_NAME', $param['dbName'], $dbIni);
-                    $dbIni = str_replace('DB_HOST', $param['dbHost'], $dbIni);
-                    $dbIni = str_replace('DB_USER', $param['dbUser'], $dbIni);
-                    $dbIni = str_replace('DB_PASSWORD', $param['dbPassword'], $dbIni);
-                    
-                    file_put_contents($param['workspace'] . '/private/configure/db.ini', $dbIni);
-                }
-
-                //生成数据库文件
-                //--生成首页文件
-                //--获取文件的相对路径
-                $realPath = $this->getRealPath($param['workspace']);
-                $this->stdout("真实路径 " . $realPath . "\n");
-                $QiiPath = $this->getRelatePath($realPath . "/index.php", dirname(__FILE__) . "/src/Qii.php");
-                $this->stdout("Qii 路径 " . $QiiPath . "\n");
-                $date = date("Y/m/d H:i:s");
-                $indexPage = array();
-                $indexPage[] = "<?php";
-                $indexPage[] = "/**";
-                $indexPage[] = " * This is index page auto create by Qii, don't delete";
-                $indexPage[] = " * ";
-                $indexPage[] = " * @author Jinhui.zhu	<jinhui.zhu@live.cn>";
-                $indexPage[] = " * @version  \$Id: index.php,v 1.1 {$date} Jinhui.Zhu Exp $";
-                $indexPage[] = " */";
-                $indexPage[] = 'require("../'.$QiiPath.'");';
-                $indexPage[] = '$app = \\Qii::getInstance();';
-                $indexPage[] = '//如需更改网站源代码存储路径,请修改此路径';
-                $indexPage[] = '$app->setWorkspace(\'../private\');';
-                $indexPage[] = '$env = getenv(\'WEB_ENVIRONMENT\') ? getenv(\'WEB_ENVIRONMENT\') : \'product\';';
-                $indexPage[] = '$app->setEnv($env);';
-                $indexPage[] = '$app->setCachePath(\''.$cache.'\');';
-                $indexPage[] = '$app->setAppConfigure(\'../private/configure/app.ini\');';
-                if ($param['useDB']) $indexPage[] = '$app->setDB(\'../private/configure/db.ini\');';
-                $indexPage[] = '$app->setRouter(\'../private/configure/router.config.php\')';
-                $indexPage[] = '->run();';
-                if (!file_exists($realPath . "/public/index.php")) {
-                    //如果文件不存在就写入
-                    file_put_contents($realPath . "/public/index.php", join("\n", $indexPage));
-                }
-                //写入首页controller
-                if (!file_exists($realPath . "/private/controller/index.php")) {
-                    $indexContents = array();
-                    $indexContents[] = "<?php";
-                    $indexContents[] = 'namespace controller;' . PHP_EOL;
-                    $indexContents[] = 'use \Qii\Base\Controller;' . PHP_EOL;
-                    $indexContents[] = "class index extends Controller";
-                    $indexContents[] = "{";
-                    $indexContents[] = "\tpublic \$enableView = true;";
-                    $indexContents[] = "\tpublic function __construct()\n\t{";
-                    $indexContents[] = "\t\tparent::__construct();";
-                    $indexContents[] = "\t}";
-                    $indexContents[] = "\tpublic function indexAction()\n\t{";
-                    $indexContents[] = "\t\t return new \Qii\Base\Response(array('format' => 'html', 'body' => '请重写 '. __FILE__ . ' 中的 indexAction 方法, 第 ' . __LINE__ . ' 行'));";
-                    $indexContents[] = "\t}";
-                    $indexContents[] = "}";
-                    file_put_contents($realPath . "/private/controller/index.php", join("\n", $indexContents));
-                }
-                //apache rewrite file
-                $htaccessFile = $param['workspace'] . "/public/.htaccess";
-                if(!file_exists($htaccessFile)){
-                    if(!copy('_cli/.htaccess', $htaccessFile)){
-                        $this->stdout($this->stdout("拷贝 .htaccess 到 ". $htaccessFile . ' 失败, 拒绝访问') . PHP_EOL);
-                    }
-                }
-            }
-        } else if($param['create'] == 'no'){
-            $this->stdout('您已经取消');
-        }
-    }
-
-    /**
-     * 获取文件相对路径
-     *
-     * @param String $cur 路径1
-     * @param String $absp 路径2
-     * @return String 路径2相对于路径1的路径
-     */
-    public function getRelatePath($cur, $absp)
-    {
-        $cur = str_replace('\\', '/', $cur);
-        $absp = str_replace('\\', '/', $absp);
-        $sabsp = explode('/', $absp);
-        $scur = explode('/', $cur);
-        $la = count($sabsp) - 1;
-        $lb = count($scur) - 1;
-        $l = max($la, $lb);
-
-        for ($i = 0; $i <= $l; $i++) {
-            if ($sabsp[$i] != $scur[$i])
-                break;
-        }
-        $k = $i - 1;
-        $path = "";
-        for ($i = 1; $i <= ($lb - $k - 1); $i++)
-            $path .= "../";
-        for ($i = $k + 1; $i <= ($la - 1); $i++)
-            $path .= $sabsp[$i] . "/";
-        $path .= $sabsp[$la];
-        return $path;
-    }
-
-    /**
-     * 获取相对目录
-     *
-     * @param String $workspace 目标路径
-     * @return String 目标路径相对于当期路径的相对路径
-     */
-    public function getRealPath($workspace)
-    {
-        $currentDir = str_replace("\\", "/", dirname(__FILE__));
-        $workspace = str_replace("\\", "/", $workspace);
-
-        if ($workspace[0] == '/') {
-            return $workspace;
-        } else {
-            $workspaceArray = explode("/", $workspace);
-            $currentDirArray = explode("/", $currentDir);
-
-            $work = array();
-            foreach ($workspaceArray AS $k) {
-                if ($k == '..') {
-                    array_pop($currentDirArray);
-                } elseif ($k == '.') {
-
-                } else {
-                    $work[] = $k;
-                }
-            }
-            if (!empty($currentDirArray)) {
-                return join("/", $currentDirArray) . "/" . join("/", $work);
-            } else {
-                return false;
-            }
-        }
-    }
-
-    /**
-     * 创建工作区目录
-     *
-     * @param String $dir
-     * @return Bool
-     */
-    public function workspace($dir)
-    {
-        if (!empty($dir)) {
-            if (!is_dir($dir)) {
-                return mkdir($dir, 0777, true);
-            } else {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 匹配命令行参数
-     *
-     * @param String $argvs
-     * @return Array 返回参数对应的值
-     */
-    public function parseArgvs($argvs)
-    {
-        $keyValue = array();
-        foreach ($argvs AS $value) {
-            $valueArray = explode("=", $value);
-            $k = $valueArray[0];
-            $v = stripslashes($valueArray[1]);
-            $keyValue[$k] = $v;
-        }
-        return $keyValue;
-    }
-    /**
-     * 在windows cmd 情况下的中文输出乱码问题
-     * @param string $string
-     * @return bool|int
-     */
-    public function stdout($string)
-    {
-        if(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') $string = iconv('utf-8', 'gbk', $string);
-        fwrite(\STDOUT, $string);
-    }
-}
-
-array_shift($argv);
-new cmd($argv);
-?>
+<?php
+/**
+ * @author Jinhui Zhu  <jinhui.zhu@live.cn>
+ * 通过命令行直接生成项目目录
+ */
+ini_set("display_errors", "On");
+/**
+ * 错误模式
+ */
+error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
+
+/**
+ * 自动生成目标目录
+ *
+ * php -q _cli.php create=yes workspace=../project cache=tmp useDB=1
+ * create: 是否自动创建
+ * workspace: 程序存放的目录
+ * cache: 缓存目录
+ * useDB: 是否使用数据库,值 0/1
+ * 目前已经将配置文件写在db.ini中,配置内容将不在创建项目的时候提供,可以自行在目录中修改
+ */
+class cmd
+{
+    const VERSION = '1.2';
+    public $dir = array('configure', 'controller', 'model', 'view', 'plugins', 'tmp');
+
+    public function __construct($args)
+    {
+        $param = $this->parseArgvs($args);
+        if (sizeof($param) < 1 || ($param['dbHost'] != '' && sizeof($param) < 7)) {
+            $this->stdout("命令行使用如下:\n
+>php -q _cli.php create=yes workspace=../project cache=tmp dbHost=localhost dbName=test dbUser=root dbPassword=test\n
+ * create: 是否自动创建:yes; \n
+ * workspace: 工作目录\n
+ * cache : 缓存目录\n
+ * dbHost : 数据库服务器IP\n
+ * dbName : 数据库名称 : \n
+ * dbUser : 数据库用户名\n
+ * dbPassword : 数据库密码 : \n
+ ");
+            $this->stdout("是否自动创建 yes/no:");
+            $param['create'] = trim(fgets(\STDIN));
+            $this->stdout("工作目录:");
+            $param['workspace'] = trim(fgets(\STDIN));
+            $this->stdout("缓存目录:");
+            $param['cache'] = trim(fgets(\STDIN));
+            
+            $this->stdout('数据库服务器IP:');
+            $param['dbHost'] = trim(fgets(\STDIN));
+            if(!$param['dbHost']) $param['dbHost'] = 'localhost';
+            $this->stdout("数据库名称:");
+            $param['dbName'] = trim(fgets(\STDIN));
+
+            $this->stdout('请输入数据库用户名:');
+            $param['dbUser'] = trim(fgets(\STDIN));
+
+            $this->stdout('请输入数据库密码:');
+            $param['dbPassword'] = trim(fgets(\STDIN));
+
+            $this->stdout('将要在'. $param['workspace'] .'创建项目,确认请输入yes,取消请输入no:');
+
+            $param['create'] = trim(fgets(\STDIN));
+        }
+        $param['useDB'] = 0;
+        if($param['dbName'] != '')
+        {
+            $param['useDB'] = 1;
+        }
+        if ($param['create'] == 'yes') {
+            if ($this->workspace($param['workspace'])) {
+                $cache = $param['cache'];
+                if (empty($param['cache'])) $cache = 'tmp';
+                $this->dir[5] = $cache;
+                //创建目录工作区目录
+                $publicDir = $param['workspace'] . '/public';
+                if(!is_dir($publicDir))
+                {
+                    if(mkdir($publicDir, 0777))
+                    {
+                        $this->stdout('创建public目录'. $publicDir ."成功\n");
+                    }
+                    else
+                    {
+                        $this->stdout('创建public目录'. $publicDir ."失败\n");
+                    }
+                }
+                foreach ($this->dir AS $d) {
+                    $path = $param['workspace'] . '/private/' . $d;
+                    if (!is_dir($path)) {
+                        $date = date('Y-m-d H:i:s');
+                        if(mkdir($path, 0777, true))
+                        {
+                            $this->stdout('创建'. $path . "成功\n");
+                        }
+                        else
+                        {
+                            $this->stdout('创建'. $path . "失败\n");
+                        }
+                        //写入.htaccess文件到包含的目录,不允许通过Apache浏览
+                        $htaccess = array();
+                        $htaccess[] = "##";
+                        $htaccess[] = "#";
+                        $htaccess[] = "#	\$Id: .htaccess 268 {$date}Z Jinhui.Zhu $";
+                        $htaccess[] = "#";
+                        $htaccess[] = "#	Copyright (C) 2010-2012 All Rights Reserved.";
+                        $htaccess[] = "#";
+                        $htaccess[] = "##";
+                        $htaccess[] = "";
+                        $htaccess[] = "Options Includes";
+                        file_put_contents($path . '/.htaccess', join("\n", $htaccess));
+                    } else {
+                        $this->stdout("{$path} 已经存在.". PHP_EOL);
+                    }
+                }
+                //拷贝网站配置文件site.xml到项目目录
+                if($cache != 'tmp'){
+                    $appIni = file_get_contents('_cli/app.ini');
+                    $appIni = str_replace('tmp/compile', $cache . '/compile', $appIni);
+                    $appIni = str_replace('tmp/cache', $cache . '/cache', $appIni);
+                    file_put_contents($param['workspace'] . '/private/configure/app.ini', $appIni);
+                }else if (!copy("_cli/app.ini", $param['workspace'] . '/private/configure/app.ini')) {
+                     $this->stdout('拷贝 app.ini 到 ' . $param['workspace'] . '/private/configure/app.ini失败, 拒绝访问.');
+                    
+                }
+                if (!copy("_cli/router.config.php", $param['workspace'] . '/private/configure/router.config.php')) {
+                    $this->stdout('拷贝 router.config.php 到' . $param['workspace'] . '/private/configure/router.config.php 失败, 拒绝访问.');
+                }
+                if ($param['useDB'] != 'no') {
+                    $dbIni = file_get_contents('_cli/db.ini');
+                    $dbIni = str_replace('DB_NAME', $param['dbName'], $dbIni);
+                    $dbIni = str_replace('DB_HOST', $param['dbHost'], $dbIni);
+                    $dbIni = str_replace('DB_USER', $param['dbUser'], $dbIni);
+                    $dbIni = str_replace('DB_PASSWORD', $param['dbPassword'], $dbIni);
+                    
+                    file_put_contents($param['workspace'] . '/private/configure/db.ini', $dbIni);
+                }
+
+                //生成数据库文件
+                //--生成首页文件
+                //--获取文件的相对路径
+                $realPath = $this->getRealPath($param['workspace']);
+                $this->stdout("真实路径 " . $realPath . "\n");
+                $QiiPath = $this->getRelatePath($realPath . "/index.php", dirname(__FILE__) . "/src/Qii.php");
+                $this->stdout("Qii 路径 " . $QiiPath . "\n");
+                $date = date("Y/m/d H:i:s");
+                $indexPage = array();
+                $indexPage[] = "<?php";
+                $indexPage[] = "/**";
+                $indexPage[] = " * This is index page auto create by Qii, don't delete";
+                $indexPage[] = " * ";
+                $indexPage[] = " * @author Jinhui.zhu	<jinhui.zhu@live.cn>";
+                $indexPage[] = " * @version  \$Id: index.php,v 1.1 {$date} Jinhui.Zhu Exp $";
+                $indexPage[] = " */";
+                $indexPage[] = 'require("../'.$QiiPath.'");';
+                $indexPage[] = '$app = \\Qii::getInstance();';
+                $indexPage[] = '//如需更改网站源代码存储路径,请修改此路径';
+                $indexPage[] = '$app->setWorkspace(\'../private\');';
+                $indexPage[] = '$env = getenv(\'WEB_ENVIRONMENT\') ? getenv(\'WEB_ENVIRONMENT\') : \'product\';';
+                $indexPage[] = '$app->setEnv($env);';
+                $indexPage[] = '$app->setCachePath(\''.$cache.'\');';
+                $indexPage[] = '$app->setAppConfigure(\'../private/configure/app.ini\');';
+                if ($param['useDB']) $indexPage[] = '$app->setDB(\'../private/configure/db.ini\');';
+                $indexPage[] = '$app->setRouter(\'../private/configure/router.config.php\')';
+                $indexPage[] = '->run();';
+                if (!file_exists($realPath . "/public/index.php")) {
+                    //如果文件不存在就写入
+                    file_put_contents($realPath . "/public/index.php", join("\n", $indexPage));
+                }
+                //写入首页controller
+                if (!file_exists($realPath . "/private/controller/index.php")) {
+                    $indexContents = array();
+                    $indexContents[] = "<?php";
+                    $indexContents[] = 'namespace controller;' . PHP_EOL;
+                    $indexContents[] = 'use \Qii\Base\Controller;' . PHP_EOL;
+                    $indexContents[] = "class index extends Controller";
+                    $indexContents[] = "{";
+                    $indexContents[] = "\tpublic \$enableView = true;";
+                    $indexContents[] = "\tpublic function __construct()\n\t{";
+                    $indexContents[] = "\t\tparent::__construct();";
+                    $indexContents[] = "\t}";
+                    $indexContents[] = "\tpublic function indexAction()\n\t{";
+                    $indexContents[] = "\t\t return new \Qii\Base\Response(array('format' => 'html', 'body' => '请重写 '. __FILE__ . ' 中的 indexAction 方法, 第 ' . __LINE__ . ' 行'));";
+                    $indexContents[] = "\t}";
+                    $indexContents[] = "}";
+                    file_put_contents($realPath . "/private/controller/index.php", join("\n", $indexContents));
+                }
+                //apache rewrite file
+                $htaccessFile = $param['workspace'] . "/public/.htaccess";
+                if(!file_exists($htaccessFile)){
+                    if(!copy('_cli/.htaccess', $htaccessFile)){
+                        $this->stdout($this->stdout("拷贝 .htaccess 到 ". $htaccessFile . ' 失败, 拒绝访问') . PHP_EOL);
+                    }
+                }
+            }
+        } else if($param['create'] == 'no'){
+            $this->stdout('您已经取消');
+        }
+    }
+
+    /**
+     * 获取文件相对路径
+     *
+     * @param String $cur 路径1
+     * @param String $absp 路径2
+     * @return String 路径2相对于路径1的路径
+     */
+    public function getRelatePath($cur, $absp)
+    {
+        $cur = str_replace('\\', '/', $cur);
+        $absp = str_replace('\\', '/', $absp);
+        $sabsp = explode('/', $absp);
+        $scur = explode('/', $cur);
+        $la = count($sabsp) - 1;
+        $lb = count($scur) - 1;
+        $l = max($la, $lb);
+
+        for ($i = 0; $i <= $l; $i++) {
+            if ($sabsp[$i] != $scur[$i])
+                break;
+        }
+        $k = $i - 1;
+        $path = "";
+        for ($i = 1; $i <= ($lb - $k - 1); $i++)
+            $path .= "../";
+        for ($i = $k + 1; $i <= ($la - 1); $i++)
+            $path .= $sabsp[$i] . "/";
+        $path .= $sabsp[$la];
+        return $path;
+    }
+
+    /**
+     * 获取相对目录
+     *
+     * @param String $workspace 目标路径
+     * @return String 目标路径相对于当期路径的相对路径
+     */
+    public function getRealPath($workspace)
+    {
+        $currentDir = str_replace("\\", "/", dirname(__FILE__));
+        $workspace = str_replace("\\", "/", $workspace);
+
+        if ($workspace[0] == '/') {
+            return $workspace;
+        } else {
+            $workspaceArray = explode("/", $workspace);
+            $currentDirArray = explode("/", $currentDir);
+
+            $work = array();
+            foreach ($workspaceArray AS $k) {
+                if ($k == '..') {
+                    array_pop($currentDirArray);
+                } elseif ($k == '.') {
+
+                } else {
+                    $work[] = $k;
+                }
+            }
+            if (!empty($currentDirArray)) {
+                return join("/", $currentDirArray) . "/" . join("/", $work);
+            } else {
+                return false;
+            }
+        }
+    }
+
+    /**
+     * 创建工作区目录
+     *
+     * @param String $dir
+     * @return Bool
+     */
+    public function workspace($dir)
+    {
+        if (!empty($dir)) {
+            if (!is_dir($dir)) {
+                return mkdir($dir, 0777, true);
+            } else {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 匹配命令行参数
+     *
+     * @param String $argvs
+     * @return Array 返回参数对应的值
+     */
+    public function parseArgvs($argvs)
+    {
+        $keyValue = array();
+        foreach ($argvs AS $value) {
+            $valueArray = explode("=", $value);
+            $k = $valueArray[0];
+            $v = stripslashes($valueArray[1]);
+            $keyValue[$k] = $v;
+        }
+        return $keyValue;
+    }
+    /**
+     * 在windows cmd 情况下的中文输出乱码问题
+     * @param string $string
+     * @return bool|int
+     */
+    public function stdout($string)
+    {
+        if(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') $string = iconv('utf-8', 'gbk', $string);
+        fwrite(\STDOUT, $string);
+    }
+}
+
+array_shift($argv);
+new cmd($argv);
+?>

+ 13 - 13
_cli/.htaccess

@@ -1,13 +1,13 @@
-##
-#
-#	$Id: .htaccess 268 2009-12-16 06:18:19Z Jinhui.Zhu $
-#
-#	Copyright (C) 2008-2009 www.qiiframework.com. All Rights Reserved.
-#  
-##
-RewriteEngine On
-RewriteCond %{REQUEST_FILENAME} !-d
-RewriteCond %{REQUEST_FILENAME} !-f
-
-RewriteCond $1 !^(index.php|images|robots.txt)
-RewriteRule (.*)$ index.php/$1 [L,QSA,PT]
+##
+#
+#	$Id: .htaccess 268 2009-12-16 06:18:19Z Jinhui.Zhu $
+#
+#	Copyright (C) 2008-2009 www.qiiframework.com. All Rights Reserved.
+#  
+##
+RewriteEngine On
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{REQUEST_FILENAME} !-f
+
+RewriteCond $1 !^(index.php|images|robots.txt)
+RewriteRule (.*)$ index.php/$1 [L,QSA,PT]

+ 102 - 102
_cli/app.ini

@@ -1,102 +1,102 @@
-;通用配置,如果没有指定环境将使用通用配置,指定了环境,指定环境的配置将覆盖默认配置中的配置信息
-[author]
-name = 朱金辉
-email = jinhui.zhu@live.cn
-qq = 119328118
-
-[common]
-;程序是否使用命名空间
-namespace['use'] = true
-namespace[list.controller] = true
-namespace[list.model] = true
-namespace[list.library] = true
-namespace[list.action] = true
-;rewrite 方法, 此定义不能省略
-rewriteMethod = Short
-;rewrite匹配规则,可选
-rewriteRules = Normal
-;hosts中的属性将会覆盖掉默认的属性,当在不同域名上使用不同配置上很有用处
-;hosts[0.domain] = test.com
-;hosts[0.path] = test
-
-;hosts[1.domain] = admin.test.com
-;hosts[1.path] = admin
-
-;是否开启调试模式,调试模式下,所有的错误都将抛出来,并终止运行
-debug = 1
-;错误页面
-errorPage = Error:Index
-;时间区域
-timezone = Asia/Shanghai
-;文档类型
-contentType = text/html
-;文档编码
-charset = UTF-8
-;模板引擎
-view[engine] = smarty
-view[path] = view
-;smarty 引擎的相关配置
-view[smarty.view] = view
-view[smarty.path] = view
-view[smarty.ldelimiter] = {#
-view[smarty.rdelimiter] = #}
-view[smarty.compile] = tmp/compile
-view[smarty.cache] = tmp/cache
-view[smarty.lifetime] = 300
-;缓存类型
-cache = memcached
-
-;是否开启安全验证,enable:是否开启安全验证;key:POST数据的时候安全字符串加密用到的key
-security[enable] = true
-security[name] = security_sid
-security[expired] = 3600
-security[key] = 4cd780a986d5c30e03bdcb67d16c8320
-
-;memcached配置,多个服务器IP和端口以;隔开
-memcached[servers] = 127.0.0.1
-memcached[ports] = 11211
-;redis配置,多个服务器IP和端口以;隔开
-redis[servers] = 127.0.0.1
-redis[ports] = 6379
-
-;map:为参数的顺序,当启用短URI标签的情况下会按照这个顺序去遍历参数;
-query[] = controller
-query[] = action
-query[] = param
-
-;controller、action配置  name:参数名 ext:后缀;default:默认方法 
-controller[name] = controller
-controller[prefix] = controller
-controller[default] = index
-
-action[name] = action
-action[suffix] = Action
-action[default] = index
-;url模式,短链接模式
-mode = short
-controllerName = controller
-actionName = action
-
-normal[mode] = normal
-normal[trim] = 0
-normal[symbol] = "&"
-normal[extenstion] = .html
-
-middle[mode] = middle
-middle[trim] = 1
-middle[symbol] = "/"
-middle[extenstion] = .html
-
-short[mode] = short
-short[trim] = 1
-short[symbol] = "/"
-short[extenstion] = .html
-
-
-;url相关配置,用于生成链接用
-[uri]
-;以下这种写法将会继承:后边的section,如果是"."开头的话就放在当前key下边
-[common:.uri]
-[dev:common:.uri]
-[product:common:.uri]
-
+;通用配置,如果没有指定环境将使用通用配置,指定了环境,指定环境的配置将覆盖默认配置中的配置信息
+[author]
+name = 朱金辉
+email = jinhui.zhu@live.cn
+qq = 119328118
+
+[common]
+;程序是否使用命名空间
+namespace['use'] = true
+namespace[list.controller] = true
+namespace[list.model] = true
+namespace[list.library] = true
+namespace[list.action] = true
+;rewrite 方法, 此定义不能省略
+rewriteMethod = Short
+;rewrite匹配规则,可选
+rewriteRules = Normal
+;hosts中的属性将会覆盖掉默认的属性,当在不同域名上使用不同配置上很有用处
+;hosts[0.domain] = test.com
+;hosts[0.path] = test
+
+;hosts[1.domain] = admin.test.com
+;hosts[1.path] = admin
+
+;是否开启调试模式,调试模式下,所有的错误都将抛出来,并终止运行
+debug = 1
+;错误页面
+errorPage = Error:Index
+;时间区域
+timezone = Asia/Shanghai
+;文档类型
+contentType = text/html
+;文档编码
+charset = UTF-8
+;模板引擎
+view[engine] = smarty
+view[path] = view
+;smarty 引擎的相关配置
+view[smarty.view] = view
+view[smarty.path] = view
+view[smarty.ldelimiter] = {#
+view[smarty.rdelimiter] = #}
+view[smarty.compile] = tmp/compile
+view[smarty.cache] = tmp/cache
+view[smarty.lifetime] = 300
+;缓存类型
+cache = memcached
+
+;是否开启安全验证,enable:是否开启安全验证;key:POST数据的时候安全字符串加密用到的key
+security[enable] = true
+security[name] = security_sid
+security[expired] = 3600
+security[key] = 4cd780a986d5c30e03bdcb67d16c8320
+
+;memcached配置,多个服务器IP和端口以;隔开
+memcached[servers] = 127.0.0.1
+memcached[ports] = 11211
+;redis配置,多个服务器IP和端口以;隔开
+redis[servers] = 127.0.0.1
+redis[ports] = 6379
+
+;map:为参数的顺序,当启用短URI标签的情况下会按照这个顺序去遍历参数;
+query[] = controller
+query[] = action
+query[] = param
+
+;controller、action配置  name:参数名 ext:后缀;default:默认方法 
+controller[name] = controller
+controller[prefix] = controller
+controller[default] = index
+
+action[name] = action
+action[suffix] = Action
+action[default] = index
+;url模式,短链接模式
+mode = short
+controllerName = controller
+actionName = action
+
+normal[mode] = normal
+normal[trim] = 0
+normal[symbol] = "&"
+normal[extenstion] = .html
+
+middle[mode] = middle
+middle[trim] = 1
+middle[symbol] = "/"
+middle[extenstion] = .html
+
+short[mode] = short
+short[trim] = 1
+short[symbol] = "/"
+short[extenstion] = .html
+
+
+;url相关配置,用于生成链接用
+[uri]
+;以下这种写法将会继承:后边的section,如果是"."开头的话就放在当前key下边
+[common:.uri]
+[dev:common:.uri]
+[product:common:.uri]
+

+ 24 - 24
_cli/db.ini

@@ -1,24 +1,24 @@
-;数据库配置
-[common]
-;是否读写分离
-readOrWriteSeparation = 0
-driver = pdo
-;使用的数据库类型
-use_db_driver = mysql
-master[db] = DB_NAME
-master[host] = DB_HOST
-master[user] = DB_USER
-master[password] = DB_PASSWORD
-
-slave[0.db] = DB_NAME
-slave[0.host] = DB_HOST
-slave[0.user] = DB_USER
-slave[0.password] = DB_PASSWORD
-
-
-slave[1.db] = DB_NAME
-slave[1.host] = DB_HOST
-slave[1.user] = DB_USER
-slave[1.password] = DB_PASSWORD
-
-[product:common]
+;数据库配置
+[common]
+;是否读写分离
+readOrWriteSeparation = 0
+driver = pdo
+;使用的数据库类型
+use_db_driver = mysql
+master[db] = DB_NAME
+master[host] = DB_HOST
+master[user] = DB_USER
+master[password] = DB_PASSWORD
+
+slave[0.db] = DB_NAME
+slave[0.host] = DB_HOST
+slave[0.user] = DB_USER
+slave[0.password] = DB_PASSWORD
+
+
+slave[1.db] = DB_NAME
+slave[1.host] = DB_HOST
+slave[1.user] = DB_USER
+slave[1.password] = DB_PASSWORD
+
+[product:common]

+ 4 - 4
_cli/router.config.php

@@ -1,5 +1,5 @@
-<?php
-return [
-    //'home:index' => 'index:index',
-    //'manage:*' => 'manage\{1}:*'
+<?php
+return [
+    //'home:index' => 'index:index',
+    //'manage:*' => 'manage\{1}:*'
 ];

+ 17 - 17
composer.json

@@ -1,17 +1,17 @@
-{
-    "name": "jinhui.zhu/qii",
-    "description": "Qii framework",
-    "type": "library",
-    "license": "MIT",
-    "authors": [
-        {
-            "name": "Zhu Jinhui",
-            "email": "jinhui.zhu@live.cn"
-        }
-    ],
-    "minimum-stability": "dev",
-    "require": {
-        "php": ">=5.3.0",
-        "ext-gd" : ">=2.1.0"
-    }
-}
+{
+    "name": "jinhui.zhu/qii",
+    "description": "Qii framework",
+    "type": "library",
+    "license": "MIT",
+    "authors": [
+        {
+            "name": "Zhu Jinhui",
+            "email": "jinhui.zhu@live.cn"
+        }
+    ],
+    "minimum-stability": "dev",
+    "require": {
+        "php": ">=5.3.0",
+        "ext-gd" : ">=2.1.0"
+    }
+}

+ 11 - 11
demo/private/Bootstrap.php

@@ -1,12 +1,12 @@
-<?php
-class Bootstrap implements \Qii\Base\Bootstrap
-{
-	public function __construct()
-	{
-		
-	}
-
-	public function _initialize()
-	{
-	}
+<?php
+class Bootstrap implements \Qii\Base\Bootstrap
+{
+	public function __construct()
+	{
+		
+	}
+
+	public function _initialize()
+	{
+	}
 }

+ 42 - 42
demo/private/actions/database/add.php

@@ -1,43 +1,43 @@
-<?php
-/**
- * 添加数据
- * @author Jinhui Zhu <jinhui.zhu@live.cn>2015-09-21
- *
- */
-namespace actions\database;
-
-use Qii\Base\Action;
-
-class add extends Action
-{
-	public $enableView = true;
-	public $enableDB = true;
-
-	public function __construct()
-	{
-		parent::__construct();
-
-	}
-
-	/**
-	 * 创建规则
-	 * @author Jinhui Zhu 2015-08-23
-	 */
-	public function run()
-	{
-		$database = $this->request->get('database');
-		$tableName = $this->request->get('tableName');
-		if (!$database) throw new \Exception('数据库名不能为空', __LINE__);
-		if (!$tableName) throw new \Exception('数据表名不能为空', __LINE__);
-		$this->controller->view->assign('database', $database);
-		$this->controller->view->assign('tableName', $tableName);
-
-
-		$rules = $this->controller->load->model('table')->getRules($database, $tableName);
-		$fields = array_flip($rules['rules']['fields']);
-		$this->controller->view->assign('rules', $rules);
-		$this->controller->view->assign('fields', $fields);
-
-		$this->controller->view->display('manage/data/add.html');
-	}
+<?php
+/**
+ * 添加数据
+ * @author Jinhui Zhu <jinhui.zhu@live.cn>2015-09-21
+ *
+ */
+namespace actions\database;
+
+use Qii\Base\Action;
+
+class add extends Action
+{
+	public $enableView = true;
+	public $enableDB = true;
+
+	public function __construct()
+	{
+		parent::__construct();
+
+	}
+
+	/**
+	 * 创建规则
+	 * @author Jinhui Zhu 2015-08-23
+	 */
+	public function run()
+	{
+		$database = $this->request->get('database');
+		$tableName = $this->request->get('tableName');
+		if (!$database) throw new \Exception('数据库名不能为空', __LINE__);
+		if (!$tableName) throw new \Exception('数据表名不能为空', __LINE__);
+		$this->controller->view->assign('database', $database);
+		$this->controller->view->assign('tableName', $tableName);
+
+
+		$rules = $this->controller->load->model('table')->getRules($database, $tableName);
+		$fields = array_flip($rules['rules']['fields']);
+		$this->controller->view->assign('rules', $rules);
+		$this->controller->view->assign('fields', $fields);
+
+		$this->controller->view->display('manage/data/add.html');
+	}
 }

+ 62 - 62
demo/private/actions/database/creator.php

@@ -1,62 +1,62 @@
-<?php
-/**
- * 创建规则
- * @author Jinhui Zhu <jinhui.zhu@live.cn>2015-09-21
- *
- */
-namespace actions\database;
-
-use Qii\Base\Action;
-
-class creator extends Action
-{
-	public $enableView = true;
-	public $enableDB = true;
-
-	public function __construct()
-	{
-		parent::__construct();
-	}
-
-	/**
-	 * 创建规则
-	 * @author Jinhui Zhu 2015-08-23
-	 */
-	public function run()
-	{
-		$args = func_get_args();
-		list($database, $tableName) = array_pad($args, 2, '');
-		$loadDatabase = $database ? false : true;
-		$this->controller->view->assign('loadDatabase', $loadDatabase);
-		$tableName = $this->request->get('tableName', $tableName);
-		$database = $this->request->get('database', $database);
-		try {
-			$databases = $this->controller->load->model('table')->getDatabases();
-			if (!$database && count($database) > 0) $database = $databases[0];
-			$this->controller->view->assign('databases', $databases);
-			$tables = $this->controller->load->model('table')->getTableLists($database);
-			if (!$tableName && count($tables) > 0) {
-				$tableName = $tables[0];
-			}
-			$this->controller->view->assign('tables', $tables);
-			$fields = array();
-			$rules = array();
-			if ($tableName != '') {
-				$fields = $this->controller->load->model('table')->getFieldsLists($database, $tableName);
-				$rules = $this->controller->load->model('table')->getRules($database, $tableName);
-				if (!isset($rules['rules'])) $rules['rules'] = array();
-			}
-			$validateRules = isset($rules['rules']['validate']) ? $rules['rules']['validate'] : array();
-			$this->controller->view->assign('validateRules', $validateRules);
-			$validate = new \Qii\Library\Validate();
-			$this->controller->view->assign('validate', $validate->getRuleNames());
-			$this->controller->view->assign('fields', $fields);
-			$this->controller->view->assign('rules', isset($rules['rules']) ? $rules['rules'] : array());
-			$this->controller->view->assign('database', $database);
-			$this->controller->view->assign('tableName', $tableName);
-			$this->controller->view->display('manage/data/creator.html');
-		} catch (Exception $e) {
-			$this->showErrorPage($e->getMessage());
-		}
-	}
-}
+<?php
+/**
+ * 创建规则
+ * @author Jinhui Zhu <jinhui.zhu@live.cn>2015-09-21
+ *
+ */
+namespace actions\database;
+
+use Qii\Base\Action;
+
+class creator extends Action
+{
+	public $enableView = true;
+	public $enableDB = true;
+
+	public function __construct()
+	{
+		parent::__construct();
+	}
+
+	/**
+	 * 创建规则
+	 * @author Jinhui Zhu 2015-08-23
+	 */
+	public function run()
+	{
+		$args = func_get_args();
+		list($database, $tableName) = array_pad($args, 2, '');
+		$loadDatabase = $database ? false : true;
+		$this->controller->view->assign('loadDatabase', $loadDatabase);
+		$tableName = $this->request->get('tableName', $tableName);
+		$database = $this->request->get('database', $database);
+		try {
+			$databases = $this->controller->load->model('table')->getDatabases();
+			if (!$database && count($database) > 0) $database = $databases[0];
+			$this->controller->view->assign('databases', $databases);
+			$tables = $this->controller->load->model('table')->getTableLists($database);
+			if (!$tableName && count($tables) > 0) {
+				$tableName = $tables[0];
+			}
+			$this->controller->view->assign('tables', $tables);
+			$fields = array();
+			$rules = array();
+			if ($tableName != '') {
+				$fields = $this->controller->load->model('table')->getFieldsLists($database, $tableName);
+				$rules = $this->controller->load->model('table')->getRules($database, $tableName);
+				if (!isset($rules['rules'])) $rules['rules'] = array();
+			}
+			$validateRules = isset($rules['rules']['validate']) ? $rules['rules']['validate'] : array();
+			$this->controller->view->assign('validateRules', $validateRules);
+			$validate = new \Qii\Library\Validate();
+			$this->controller->view->assign('validate', $validate->getRuleNames());
+			$this->controller->view->assign('fields', $fields);
+			$this->controller->view->assign('rules', isset($rules['rules']) ? $rules['rules'] : array());
+			$this->controller->view->assign('database', $database);
+			$this->controller->view->assign('tableName', $tableName);
+			$this->controller->view->display('manage/data/creator.html');
+		} catch (Exception $e) {
+			$this->showErrorPage($e->getMessage());
+		}
+	}
+}

+ 67 - 67
demo/private/actions/database/rules.php

@@ -1,68 +1,68 @@
-<?php
-/**
- * 编辑详细规则
- * @author Jinhui Zhu <jinhui.zhu@live.cn>2015-09-21
- *
- */
-namespace actions\database;
-
-use Qii\Base\Action;
-
-class rules extends Action
-{
-	public $enableView = true;
-	public $enableDB = true;
-
-	public function __construct()
-	{
-		parent::__construct();
-
-	}
-
-	/**
-	 * 创建规则
-	 * @author Jinhui Zhu 2015-08-23
-	 */
-	public function run()
-	{
-		list($database, $tableName) = array_pad(func_get_args(), 2, '');
-		$loadDatabase = $database ? false : true;
-		$this->controller->view->assign('loadDatabase', $loadDatabase);
-		$tableName = $this->request->get('tableName', $tableName);
-		$database = $this->request->get('database', $database);
-		try {
-			$databases = $this->controller->load->model('table')->getDatabases();
-			if (!$database && count($database) > 0) $database = $databases[0];
-			$this->controller->view->assign('databases', $databases);
-			$tables = $this->controller->load->model('table')->getTableLists($database);
-			if (!$tableName && count($tables) > 0) {
-				$tableName = $tables[0];
-			}
-			$this->controller->view->assign('tables', $tables);
-			$fields = array();
-			$rules = array();
-			$rules['rules'] = array();
-			if ($tableName != '') {
-				$fields = $this->controller->load->model('table')->getFieldsLists($database, $tableName);
-				$rules = $this->controller->load->model('table')->getRules($database, $tableName);
-				if (isset($rules['rules'])) $rules['rules'] = $rules['rules'];
-			}
-			$validateRules = isset($rules['rules']['validate']) ? $rules['rules']['validate'] : array();
-			$invalidMessage = isset($rules['rules']['invalidMessage']) ? $rules['rules']['invalidMessage'] : array();
-			$extRules = isset($rules['rules']['extRules']) ? $rules['rules']['extRules'] : array();
-			$this->controller->view->assign('validateRules', $validateRules);
-			$this->controller->view->assign('invalidMessage', $invalidMessage);
-			$this->controller->view->assign('extRules', $extRules);
-
-			$validate = new \Qii\Library\Validate();
-			$this->controller->view->assign('validate', $validate->getRuleNames());
-			$this->controller->view->assign('fields', $fields);
-			$this->controller->view->assign('rules', isset($rules['rules']) ? $rules['rules'] : array());
-			$this->controller->view->assign('database', $database);
-			$this->controller->view->assign('tableName', $tableName);
-			$this->controller->view->display('manage/data/rules.html');
-		} catch (Exception $e) {
-			$this->showErrorPage($e->getMessage());
-		}
-	}
+<?php
+/**
+ * 编辑详细规则
+ * @author Jinhui Zhu <jinhui.zhu@live.cn>2015-09-21
+ *
+ */
+namespace actions\database;
+
+use Qii\Base\Action;
+
+class rules extends Action
+{
+	public $enableView = true;
+	public $enableDB = true;
+
+	public function __construct()
+	{
+		parent::__construct();
+
+	}
+
+	/**
+	 * 创建规则
+	 * @author Jinhui Zhu 2015-08-23
+	 */
+	public function run()
+	{
+		list($database, $tableName) = array_pad(func_get_args(), 2, '');
+		$loadDatabase = $database ? false : true;
+		$this->controller->view->assign('loadDatabase', $loadDatabase);
+		$tableName = $this->request->get('tableName', $tableName);
+		$database = $this->request->get('database', $database);
+		try {
+			$databases = $this->controller->load->model('table')->getDatabases();
+			if (!$database && count($database) > 0) $database = $databases[0];
+			$this->controller->view->assign('databases', $databases);
+			$tables = $this->controller->load->model('table')->getTableLists($database);
+			if (!$tableName && count($tables) > 0) {
+				$tableName = $tables[0];
+			}
+			$this->controller->view->assign('tables', $tables);
+			$fields = array();
+			$rules = array();
+			$rules['rules'] = array();
+			if ($tableName != '') {
+				$fields = $this->controller->load->model('table')->getFieldsLists($database, $tableName);
+				$rules = $this->controller->load->model('table')->getRules($database, $tableName);
+				if (isset($rules['rules'])) $rules['rules'] = $rules['rules'];
+			}
+			$validateRules = isset($rules['rules']['validate']) ? $rules['rules']['validate'] : array();
+			$invalidMessage = isset($rules['rules']['invalidMessage']) ? $rules['rules']['invalidMessage'] : array();
+			$extRules = isset($rules['rules']['extRules']) ? $rules['rules']['extRules'] : array();
+			$this->controller->view->assign('validateRules', $validateRules);
+			$this->controller->view->assign('invalidMessage', $invalidMessage);
+			$this->controller->view->assign('extRules', $extRules);
+
+			$validate = new \Qii\Library\Validate();
+			$this->controller->view->assign('validate', $validate->getRuleNames());
+			$this->controller->view->assign('fields', $fields);
+			$this->controller->view->assign('rules', isset($rules['rules']) ? $rules['rules'] : array());
+			$this->controller->view->assign('database', $database);
+			$this->controller->view->assign('tableName', $tableName);
+			$this->controller->view->display('manage/data/rules.html');
+		} catch (Exception $e) {
+			$this->showErrorPage($e->getMessage());
+		}
+	}
 }

+ 75 - 75
demo/private/actions/database/table.php

@@ -1,76 +1,76 @@
-<?php
-/**
- * 数据管理
- * @author Jinhui Zhu <jinhui.zhu@live.cn>2015-09-21
- *
- */
-namespace actions\database;
-
-use Qii\Base\Action;
-
-class table extends Action
-{
-	public $enableView = true;
-	public $enableDB = true;
-
-	public function __construct()
-	{
-		parent::__construct();
-
-	}
-
-	/**
-	 * 创建规则
-	 * @author Jinhui Zhu 2015-08-23
-	 */
-	public function run()
-	{
-		list($database, $tableName) = array_pad(func_get_args(), 2, '');
-		$loadDatabase = true;
-		$this->controller->view->assign('controller', $this->controllerId);
-		$this->controller->view->assign('action', $this->actionId);
-		try {
-			$this->controller->view->assign('loadDatabase', $loadDatabase);
-			$database = $this->request->get('database', $database);
-			$tableName = $this->request->get('tableName', $tableName);
-			$currentPage = $this->request->get('currentPage', 1);
-			$databases = array();
-			$tables = array();
-			if ($loadDatabase) {
-				$databases = $this->controller->load->model('table')->getDatabases();
-				if (!$database && count($database) > 0) $database = $databases[0];
-				if (!$database) throw new \Exception('数据库名不能为空', __LINE__);
-				$tables = $this->controller->load->model('table')->getTableLists($database);
-				if (!$tableName && count($tables) > 0) {
-					$tableName = $tables[0];
-				}
-			}
-			$this->controller->view->assign('databases', $databases);
-			$this->controller->view->assign('tables', $tables);
-
-			$this->controller->view->assign('database', $database);
-			$this->controller->view->assign('tableName', $tableName);
-			$data = array();
-			$data['page'] = array();
-			$data['page']['currentPage'] = 1;
-			$data['page']['totalPage'] = 0;
-			$data['page']['total'] = 0;
-			$data['rules'] = array();
-			$data['rules']['end'] = array();
-			$data['rows'] = array();
-			if ($tableName) {
-				$data = $this->controller->load->model('table')->loadTableData($database, $tableName, $currentPage);
-			}
-			$start = 0;
-			if ($data['page']['currentPage'] >= 6) {
-				$start = $data['page']['currentPage'] - 6;
-			}
-			$this->controller->view->assign('start', $start);
-			$this->controller->view->assign('data', $data);
-			$this->controller->view->assign('pages', $data['page']);
-			$this->controller->view->display('manage/data/table.html');
-		} catch (Exception $e) {
-			$this->showErrorPage($e->getMessage());
-		}
-	}
+<?php
+/**
+ * 数据管理
+ * @author Jinhui Zhu <jinhui.zhu@live.cn>2015-09-21
+ *
+ */
+namespace actions\database;
+
+use Qii\Base\Action;
+
+class table extends Action
+{
+	public $enableView = true;
+	public $enableDB = true;
+
+	public function __construct()
+	{
+		parent::__construct();
+
+	}
+
+	/**
+	 * 创建规则
+	 * @author Jinhui Zhu 2015-08-23
+	 */
+	public function run()
+	{
+		list($database, $tableName) = array_pad(func_get_args(), 2, '');
+		$loadDatabase = true;
+		$this->controller->view->assign('controller', $this->controllerId);
+		$this->controller->view->assign('action', $this->actionId);
+		try {
+			$this->controller->view->assign('loadDatabase', $loadDatabase);
+			$database = $this->request->get('database', $database);
+			$tableName = $this->request->get('tableName', $tableName);
+			$currentPage = $this->request->get('currentPage', 1);
+			$databases = array();
+			$tables = array();
+			if ($loadDatabase) {
+				$databases = $this->controller->load->model('table')->getDatabases();
+				if (!$database && count($database) > 0) $database = $databases[0];
+				if (!$database) throw new \Exception('数据库名不能为空', __LINE__);
+				$tables = $this->controller->load->model('table')->getTableLists($database);
+				if (!$tableName && count($tables) > 0) {
+					$tableName = $tables[0];
+				}
+			}
+			$this->controller->view->assign('databases', $databases);
+			$this->controller->view->assign('tables', $tables);
+
+			$this->controller->view->assign('database', $database);
+			$this->controller->view->assign('tableName', $tableName);
+			$data = array();
+			$data['page'] = array();
+			$data['page']['currentPage'] = 1;
+			$data['page']['totalPage'] = 0;
+			$data['page']['total'] = 0;
+			$data['rules'] = array();
+			$data['rules']['end'] = array();
+			$data['rows'] = array();
+			if ($tableName) {
+				$data = $this->controller->load->model('table')->loadTableData($database, $tableName, $currentPage);
+			}
+			$start = 0;
+			if ($data['page']['currentPage'] >= 6) {
+				$start = $data['page']['currentPage'] - 6;
+			}
+			$this->controller->view->assign('start', $start);
+			$this->controller->view->assign('data', $data);
+			$this->controller->view->assign('pages', $data['page']);
+			$this->controller->view->display('manage/data/table.html');
+		} catch (Exception $e) {
+			$this->showErrorPage($e->getMessage());
+		}
+	}
 }

+ 53 - 53
demo/private/actions/database/update.php

@@ -1,54 +1,54 @@
-<?php
-/**
- * 更新规则页面
- * @author Jinhui Zhu <jinhui.zhu@live.cn>2015-09-21
- *
- */
-namespace actions\database;
-
-use Qii\Base\Action;
-
-class update extends Action
-{
-	public $enableView = true;
-	public $enableDB = true;
-
-	public function __construct()
-	{
-		parent::__construct();
-
-	}
-
-	/**
-	 * 创建规则
-	 * @author Jinhui Zhu 2015-08-23
-	 */
-	public function run()
-	{
-		try {
-			$database = $this->request->get('__database');
-			$tableName = $this->request->get('__tableName');
-			$pri = explode(',', $this->request->get('__pri', ''));
-			$val = array();
-			foreach ($pri AS $key) {
-				$val[$key] = $this->request->get($key);
-			}
-			if (!$database || !$tableName || !$pri || !$val) {
-				throw new \Exception('参数不正确', __LINE__);
-			}
-			$rules = $this->controller->load->model('table')->getRules($database, $tableName);
-
-			$data = $this->controller->load->model('table')->loadDataFromTable($database, $tableName, $pri, $val);
-			$this->controller->view->assign('database', $database);
-			$this->controller->view->assign('tableName', $tableName);
-			$this->controller->view->assign('pri', $pri);
-			$this->controller->view->assign('rules', $rules);
-			$this->controller->view->assign('val', $val);
-			$this->controller->view->assign('data', $data);
-
-			$this->controller->view->display('manage/data/update.html');
-		} catch (Exception $e) {
-			$this->showErrorPage($e->getMessage());
-		}
-	}
+<?php
+/**
+ * 更新规则页面
+ * @author Jinhui Zhu <jinhui.zhu@live.cn>2015-09-21
+ *
+ */
+namespace actions\database;
+
+use Qii\Base\Action;
+
+class update extends Action
+{
+	public $enableView = true;
+	public $enableDB = true;
+
+	public function __construct()
+	{
+		parent::__construct();
+
+	}
+
+	/**
+	 * 创建规则
+	 * @author Jinhui Zhu 2015-08-23
+	 */
+	public function run()
+	{
+		try {
+			$database = $this->request->get('__database');
+			$tableName = $this->request->get('__tableName');
+			$pri = explode(',', $this->request->get('__pri', ''));
+			$val = array();
+			foreach ($pri AS $key) {
+				$val[$key] = $this->request->get($key);
+			}
+			if (!$database || !$tableName || !$pri || !$val) {
+				throw new \Exception('参数不正确', __LINE__);
+			}
+			$rules = $this->controller->load->model('table')->getRules($database, $tableName);
+
+			$data = $this->controller->load->model('table')->loadDataFromTable($database, $tableName, $pri, $val);
+			$this->controller->view->assign('database', $database);
+			$this->controller->view->assign('tableName', $tableName);
+			$this->controller->view->assign('pri', $pri);
+			$this->controller->view->assign('rules', $rules);
+			$this->controller->view->assign('val', $val);
+			$this->controller->view->assign('data', $data);
+
+			$this->controller->view->display('manage/data/update.html');
+		} catch (Exception $e) {
+			$this->showErrorPage($e->getMessage());
+		}
+	}
 }

+ 11 - 11
demo/private/actions/demo.php

@@ -1,12 +1,12 @@
-<?php
-namespace actions;
-
-use Qii\Base\Action;
-
-class demo extends Action
-{
-	public function execute()
-	{
-		print_r(__METHOD__);
-	}
+<?php
+namespace actions;
+
+use Qii\Base\Action;
+
+class demo extends Action
+{
+	public function execute()
+	{
+		print_r(__METHOD__);
+	}
 }

+ 108 - 108
demo/private/configure/app.ini

@@ -1,108 +1,108 @@
-;通用配置,如果没有指定环境将使用通用配置,指定了环境,指定环境的配置将覆盖默认配置中的配置信息
-[author]
-name = 朱金辉
-email = jinhui.zhu@live.cn
-qq = 119328118
-
-[common]
-;程序是否使用命名空间
-namespace['use'] = true
-namespace[list.controller] = true
-namespace[list.model] = true
-namespace[list.library] = true
-namespace[list.action] = true
-;rewrite 方法, 此定义不能省略
-rewriteMethod = Short
-;rewrite匹配规则,可选
-rewriteRules = Normal
-;hosts中的属性将会覆盖掉默认的属性,当在不同域名上使用不同配置上很有用处
-;hosts[0.domain] = test.istudy.wang
-;hosts[0.path] = test
-;hosts[0.password] = test
-
-;用于检查系统环境的时候用到的密码,如果不填写就可以直接通过url进入
-admin[user] = admin
-admin[password] = 119328118
-;是否开启调试模式,调试模式下,所有的错误都将抛出来,并终止运行
-debug = 1
-;错误页面
-errorPage = Error:Index
-;时间区域
-timezone = Asia/Shanghai
-;文档类型
-contentType = text/html
-;文档编码
-charset = UTF-8
-;模板引擎
-view[engine] = smarty
-view[path] = view
-;smarty 引擎的相关配置
-view[smarty.view] = view
-view[smarty.path] = view
-view[smarty.ldelimiter] = {#
-view[smarty.rdelimiter] = #}
-view[smarty.compile] = tmp/compile
-view[smarty.cache] = tmp/cache
-view[smarty.lifetime] = 300
-;缓存类型
-cache = memcache
-
-;是否开启安全验证,enable:是否开启安全验证;key:POST数据的时候安全字符串加密用到的key
-security[enable] = true
-security[name] = security_sid
-security[expired] = 3600
-security[key] = 4cd780a986d5c30e03bdcb67d16c8320
-
-;memcache配置,多个服务器IP和端口以;隔开
-memcache[servers] = 127.0.0.1
-memcache[ports] = 11211
-
-
-;搜索文件路径
-xpath[] = controller
-xpath[] = model
-xpath[] = class
-xpath[] = plugin
-
-;map:为参数的顺序,当启用短URI标签的情况下会按照这个顺序去遍历参数;
-query[] = controller
-query[] = action
-query[] = param
-
-;controller、action配置  name:参数名 ext:后缀;default:默认方法 
-controller[name] = controller
-controller[prefix] = controller
-controller[default] = index
-
-action[name] = action
-action[suffix] = Action
-action[default] = index
-
-;url相关配置,用于生成链接用
-[uri]
-
-;url模式,短链接模式
-mode = short
-controllerName = controller
-actionName = action
-
-normal[mode] = normal
-normal[trim] = 0
-normal[symbol] = "&"
-normal[extenstion] = .html
-
-middle[mode] = middle
-middle[trim] = 1
-middle[symbol] = "/"
-middle[extenstion] = .html
-
-short[mode] = short
-short[trim] = 1
-short[symbol] = "/"
-short[extenstion] = .html
-;以下这种写法将会继承:后边的section,如果是"."开头的话就放在当前key下边
-[dev:common:.uri]
-password = 12345
-[product:common:.uri]
-password = 119328118
-
+;通用配置,如果没有指定环境将使用通用配置,指定了环境,指定环境的配置将覆盖默认配置中的配置信息
+[author]
+name = 朱金辉
+email = jinhui.zhu@live.cn
+qq = 119328118
+
+[common]
+;程序是否使用命名空间
+namespace['use'] = true
+namespace[list.controller] = true
+namespace[list.model] = true
+namespace[list.library] = true
+namespace[list.action] = true
+;rewrite 方法, 此定义不能省略
+rewriteMethod = Short
+;rewrite匹配规则,可选
+rewriteRules = Normal
+;hosts中的属性将会覆盖掉默认的属性,当在不同域名上使用不同配置上很有用处
+;hosts[0.domain] = test.istudy.wang
+;hosts[0.path] = test
+;hosts[0.password] = test
+
+;用于检查系统环境的时候用到的密码,如果不填写就可以直接通过url进入
+admin[user] = admin
+admin[password] = 119328118
+;是否开启调试模式,调试模式下,所有的错误都将抛出来,并终止运行
+debug = 1
+;错误页面
+errorPage = Error:Index
+;时间区域
+timezone = Asia/Shanghai
+;文档类型
+contentType = text/html
+;文档编码
+charset = UTF-8
+;模板引擎
+view[engine] = smarty
+view[path] = view
+;smarty 引擎的相关配置
+view[smarty.view] = view
+view[smarty.path] = view
+view[smarty.ldelimiter] = {#
+view[smarty.rdelimiter] = #}
+view[smarty.compile] = tmp/compile
+view[smarty.cache] = tmp/cache
+view[smarty.lifetime] = 300
+;缓存类型
+cache = memcache
+
+;是否开启安全验证,enable:是否开启安全验证;key:POST数据的时候安全字符串加密用到的key
+security[enable] = true
+security[name] = security_sid
+security[expired] = 3600
+security[key] = 4cd780a986d5c30e03bdcb67d16c8320
+
+;memcache配置,多个服务器IP和端口以;隔开
+memcache[servers] = 127.0.0.1
+memcache[ports] = 11211
+
+
+;搜索文件路径
+xpath[] = controller
+xpath[] = model
+xpath[] = class
+xpath[] = plugin
+
+;map:为参数的顺序,当启用短URI标签的情况下会按照这个顺序去遍历参数;
+query[] = controller
+query[] = action
+query[] = param
+
+;controller、action配置  name:参数名 ext:后缀;default:默认方法 
+controller[name] = controller
+controller[prefix] = controller
+controller[default] = index
+
+action[name] = action
+action[suffix] = Action
+action[default] = index
+
+;url相关配置,用于生成链接用
+[uri]
+
+;url模式,短链接模式
+mode = short
+controllerName = controller
+actionName = action
+
+normal[mode] = normal
+normal[trim] = 0
+normal[symbol] = "&"
+normal[extenstion] = .html
+
+middle[mode] = middle
+middle[trim] = 1
+middle[symbol] = "/"
+middle[extenstion] = .html
+
+short[mode] = short
+short[trim] = 1
+short[symbol] = "/"
+short[extenstion] = .html
+;以下这种写法将会继承:后边的section,如果是"."开头的话就放在当前key下边
+[dev:common:.uri]
+password = 12345
+[product:common:.uri]
+password = 119328118
+

+ 135 - 135
demo/private/configure/database_form_data.rules.php

@@ -1,136 +1,136 @@
-<?php
-return array(
-	'database' => 'test',
-	'tableName' => 'database_form_data',
-	'rules' =>
-		array(
-			'end' =>
-				array(
-					'id' => '1',
-					'form_id' => '1',
-					'form_uniqid' => '1',
-					'form_value' => '1',
-					'status' => '1',
-					'add_time' => '1',
-					'update_time' => '1',
-				),
-			'front' =>
-				array(
-					'id' => '1',
-					'form_id' => '1',
-					'form_uniqid' => '1',
-					'form_value' => '1',
-					'status' => '1',
-					'add_time' => '1',
-					'update_time' => '1',
-				),
-			'alias' =>
-				array(
-					'id' => 'id',
-					'form_id' => 'form_id',
-					'form_uniqid' => 'form_uniqid',
-					'form_value' => 'form_value',
-					'status' => 'status',
-					'add_time' => 'add_time',
-					'update_time' => 'update_time',
-				),
-			'fields' =>
-				array(
-					0 => 'id',
-					1 => 'form_id',
-					2 => 'form_uniqid',
-					3 => 'form_value',
-					4 => 'status',
-					5 => 'add_time',
-					6 => 'update_time',
-				),
-			'length' =>
-				array(
-					'id' => '11',
-					'form_id' => '11',
-					'form_uniqid' => '41',
-					'form_value' => '0',
-					'status' => '1',
-					'add_time' => '11',
-					'update_time' => '11',
-				),
-			'type' =>
-				array(
-					'id' => 'int',
-					'form_id' => 'int',
-					'form_uniqid' => 'char',
-					'form_value' => 'text',
-					'status' => 'tinyint',
-					'add_time' => 'int',
-					'update_time' => 'int',
-				),
-			'null' =>
-				array(
-					'id' => 'no',
-					'form_id' => 'no',
-					'form_uniqid' => 'no',
-					'form_value' => 'no',
-					'status' => 'no',
-					'add_time' => 'yes',
-					'update_time' => 'yes',
-				),
-			'pri' =>
-				array(
-					'id' => '1',
-				),
-			'validate' =>
-				array(
-					'form_id' =>
-						array(
-							0 => 'required',
-						),
-					'form_uniqid' =>
-						array(
-							0 => 'required',
-						),
-					'form_value' =>
-						array(
-							0 => 'required',
-						),
-				),
-			'default' =>
-				array(
-					'id' => '',
-					'form_id' => '',
-					'form_uniqid' => '',
-					'form_value' => '',
-					'status' => '1',
-					'add_time' => '',
-					'update_time' => '',
-				),
-			'save' =>
-				array(
-					'form_id' => '1',
-					'form_uniqid' => '1',
-					'form_value' => '1',
-				),
-			'update' =>
-				array(
-					'form_id' => '1',
-					'form_uniqid' => '1',
-				),
-			'remove' =>
-				array(
-					'form_id' => '1',
-					'form_uniqid' => '1',
-				),
-		),
-	'table' => 'database_form_data',
-	'add_time' => '1454482716',
-	'update_time' => '1454482721',
-	'sql' => 'CREATE TABLE IF NOT EXISTS `database_form_data` (
-  `id` int(11) NOT NULL AUTO_INCREMENT,
-  `form_id` int(11) NOT NULL,
-  `form_uniqid` char(41) NOT NULL,
-  `form_value` text NOT NULL,
-  `status` tinyint(1) NOT NULL DEFAULT \\\'1\\\',
-  `add_time` int(11) DEFAULT NULL,
-  `update_time` int(11) DEFAULT NULL,
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;',
+<?php
+return array(
+	'database' => 'test',
+	'tableName' => 'database_form_data',
+	'rules' =>
+		array(
+			'end' =>
+				array(
+					'id' => '1',
+					'form_id' => '1',
+					'form_uniqid' => '1',
+					'form_value' => '1',
+					'status' => '1',
+					'add_time' => '1',
+					'update_time' => '1',
+				),
+			'front' =>
+				array(
+					'id' => '1',
+					'form_id' => '1',
+					'form_uniqid' => '1',
+					'form_value' => '1',
+					'status' => '1',
+					'add_time' => '1',
+					'update_time' => '1',
+				),
+			'alias' =>
+				array(
+					'id' => 'id',
+					'form_id' => 'form_id',
+					'form_uniqid' => 'form_uniqid',
+					'form_value' => 'form_value',
+					'status' => 'status',
+					'add_time' => 'add_time',
+					'update_time' => 'update_time',
+				),
+			'fields' =>
+				array(
+					0 => 'id',
+					1 => 'form_id',
+					2 => 'form_uniqid',
+					3 => 'form_value',
+					4 => 'status',
+					5 => 'add_time',
+					6 => 'update_time',
+				),
+			'length' =>
+				array(
+					'id' => '11',
+					'form_id' => '11',
+					'form_uniqid' => '41',
+					'form_value' => '0',
+					'status' => '1',
+					'add_time' => '11',
+					'update_time' => '11',
+				),
+			'type' =>
+				array(
+					'id' => 'int',
+					'form_id' => 'int',
+					'form_uniqid' => 'char',
+					'form_value' => 'text',
+					'status' => 'tinyint',
+					'add_time' => 'int',
+					'update_time' => 'int',
+				),
+			'null' =>
+				array(
+					'id' => 'no',
+					'form_id' => 'no',
+					'form_uniqid' => 'no',
+					'form_value' => 'no',
+					'status' => 'no',
+					'add_time' => 'yes',
+					'update_time' => 'yes',
+				),
+			'pri' =>
+				array(
+					'id' => '1',
+				),
+			'validate' =>
+				array(
+					'form_id' =>
+						array(
+							0 => 'required',
+						),
+					'form_uniqid' =>
+						array(
+							0 => 'required',
+						),
+					'form_value' =>
+						array(
+							0 => 'required',
+						),
+				),
+			'default' =>
+				array(
+					'id' => '',
+					'form_id' => '',
+					'form_uniqid' => '',
+					'form_value' => '',
+					'status' => '1',
+					'add_time' => '',
+					'update_time' => '',
+				),
+			'save' =>
+				array(
+					'form_id' => '1',
+					'form_uniqid' => '1',
+					'form_value' => '1',
+				),
+			'update' =>
+				array(
+					'form_id' => '1',
+					'form_uniqid' => '1',
+				),
+			'remove' =>
+				array(
+					'form_id' => '1',
+					'form_uniqid' => '1',
+				),
+		),
+	'table' => 'database_form_data',
+	'add_time' => '1454482716',
+	'update_time' => '1454482721',
+	'sql' => 'CREATE TABLE IF NOT EXISTS `database_form_data` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `form_id` int(11) NOT NULL,
+  `form_uniqid` char(41) NOT NULL,
+  `form_value` text NOT NULL,
+  `status` tinyint(1) NOT NULL DEFAULT \\\'1\\\',
+  `add_time` int(11) DEFAULT NULL,
+  `update_time` int(11) DEFAULT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;',
 );

+ 164 - 164
demo/private/configure/database_form_setting.rules.config.php

@@ -1,165 +1,165 @@
-<?php
-return array(
-	'database' => 'test',
-	'tableName' => 'database_form_setting',
-	'rules' =>
-		array(
-			'end' =>
-				array(
-					'id' => '1',
-					'uid' => '1',
-					'uniqid' => '1',
-					'mask' => '1',
-					'form' => '1',
-					'form_serialize' => '1',
-					'status' => '1',
-					'add_time' => '1',
-					'update_time' => '1',
-				),
-			'front' =>
-				array(
-					'id' => '1',
-					'uid' => '1',
-					'uniqid' => '1',
-					'mask' => '1',
-					'form' => '1',
-					'form_serialize' => '1',
-					'status' => '1',
-					'add_time' => '1',
-					'update_time' => '1',
-				),
-			'alias' =>
-				array(
-					'id' => 'id',
-					'uid' => 'uid',
-					'uniqid' => 'uniqid',
-					'mask' => '',
-					'form' => 'form',
-					'form_serialize' => 'form_serialize',
-					'status' => 'status',
-					'add_time' => 'add_time',
-					'update_time' => 'update_time',
-				),
-			'fields' =>
-				array(
-					0 => 'id',
-					1 => 'uid',
-					2 => 'uniqid',
-					3 => 'mask',
-					4 => 'form',
-					5 => 'form_serialize',
-					6 => 'status',
-					7 => 'add_time',
-					8 => 'update_time',
-				),
-			'length' =>
-				array(
-					'id' => '11',
-					'uid' => '11',
-					'uniqid' => '41',
-					'mask' => '32',
-					'form' => '0',
-					'form_serialize' => '0',
-					'status' => '1',
-					'add_time' => '11',
-					'update_time' => '11',
-				),
-			'type' =>
-				array(
-					'id' => 'int',
-					'uid' => 'int',
-					'uniqid' => 'char',
-					'mask' => 'char',
-					'form' => 'text',
-					'form_serialize' => 'text',
-					'status' => 'tinyint',
-					'add_time' => 'int',
-					'update_time' => 'int',
-				),
-			'null' =>
-				array(
-					'id' => 'no',
-					'uid' => 'yes',
-					'uniqid' => 'no',
-					'mask' => 'no',
-					'form' => 'yes',
-					'form_serialize' => 'yes',
-					'status' => 'no',
-					'add_time' => 'yes',
-					'update_time' => 'yes',
-				),
-			'pri' =>
-				array(
-					'id' => '1',
-				),
-			'uni' =>
-				array(
-					'uniqid' => '1',
-					'mask' => '1',
-				),
-			'validate' =>
-				array(
-					'uniqid' =>
-						array(
-							0 => 'required',
-						),
-					'form' =>
-						array(
-							0 => 'required',
-						),
-					'form_serialize' =>
-						array(
-							0 => 'required',
-						),
-				),
-			'default' =>
-				array(
-					'id' => '',
-					'uid' => '',
-					'uniqid' => '',
-					'mask' => '',
-					'form' => '',
-					'form_serialize' => '',
-					'status' => '1',
-					'add_time' => '',
-					'update_time' => '',
-				),
-			'update' =>
-				array(
-					'id' => '1',
-					'uniqid' => '1',
-					'mask' => '1',
-					'form' => '1',
-					'form_serialize' => '1',
-				),
-			'remove' =>
-				array(
-					'id' => '1',
-					'uniqid' => '1',
-				),
-			'save' =>
-				array(
-					'uniqid' => '1',
-					'mask' => '1',
-					'form' => '1',
-					'form_serialize' => '1',
-				),
-		),
-	'table' => 'database_form_setting',
-	'add_time' => '1454470879',
-	'update_time' => '1454471891',
-	'sql' => 'CREATE TABLE IF NOT EXISTS `database_form_setting` (
-  `id` int(11) NOT NULL AUTO_INCREMENT,
-  `uid` int(11) DEFAULT NULL,
-  `uniqid` char(41) NOT NULL,
-  `mask` char(32) NOT NULL,
-  `form` text,
-  `form_serialize` text,
-  `status` tinyint(1) NOT NULL DEFAULT \\\'1\\\',
-  `add_time` int(11) DEFAULT NULL,
-  `update_time` int(11) DEFAULT NULL,
-  PRIMARY KEY (`id`),
-  UNIQUE KEY `uniqid_UNIQUE` (`uniqid`),
-  UNIQUE KEY `mask_UNIQUE` (`mask`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;',
+<?php
+return array(
+	'database' => 'test',
+	'tableName' => 'database_form_setting',
+	'rules' =>
+		array(
+			'end' =>
+				array(
+					'id' => '1',
+					'uid' => '1',
+					'uniqid' => '1',
+					'mask' => '1',
+					'form' => '1',
+					'form_serialize' => '1',
+					'status' => '1',
+					'add_time' => '1',
+					'update_time' => '1',
+				),
+			'front' =>
+				array(
+					'id' => '1',
+					'uid' => '1',
+					'uniqid' => '1',
+					'mask' => '1',
+					'form' => '1',
+					'form_serialize' => '1',
+					'status' => '1',
+					'add_time' => '1',
+					'update_time' => '1',
+				),
+			'alias' =>
+				array(
+					'id' => 'id',
+					'uid' => 'uid',
+					'uniqid' => 'uniqid',
+					'mask' => '',
+					'form' => 'form',
+					'form_serialize' => 'form_serialize',
+					'status' => 'status',
+					'add_time' => 'add_time',
+					'update_time' => 'update_time',
+				),
+			'fields' =>
+				array(
+					0 => 'id',
+					1 => 'uid',
+					2 => 'uniqid',
+					3 => 'mask',
+					4 => 'form',
+					5 => 'form_serialize',
+					6 => 'status',
+					7 => 'add_time',
+					8 => 'update_time',
+				),
+			'length' =>
+				array(
+					'id' => '11',
+					'uid' => '11',
+					'uniqid' => '41',
+					'mask' => '32',
+					'form' => '0',
+					'form_serialize' => '0',
+					'status' => '1',
+					'add_time' => '11',
+					'update_time' => '11',
+				),
+			'type' =>
+				array(
+					'id' => 'int',
+					'uid' => 'int',
+					'uniqid' => 'char',
+					'mask' => 'char',
+					'form' => 'text',
+					'form_serialize' => 'text',
+					'status' => 'tinyint',
+					'add_time' => 'int',
+					'update_time' => 'int',
+				),
+			'null' =>
+				array(
+					'id' => 'no',
+					'uid' => 'yes',
+					'uniqid' => 'no',
+					'mask' => 'no',
+					'form' => 'yes',
+					'form_serialize' => 'yes',
+					'status' => 'no',
+					'add_time' => 'yes',
+					'update_time' => 'yes',
+				),
+			'pri' =>
+				array(
+					'id' => '1',
+				),
+			'uni' =>
+				array(
+					'uniqid' => '1',
+					'mask' => '1',
+				),
+			'validate' =>
+				array(
+					'uniqid' =>
+						array(
+							0 => 'required',
+						),
+					'form' =>
+						array(
+							0 => 'required',
+						),
+					'form_serialize' =>
+						array(
+							0 => 'required',
+						),
+				),
+			'default' =>
+				array(
+					'id' => '',
+					'uid' => '',
+					'uniqid' => '',
+					'mask' => '',
+					'form' => '',
+					'form_serialize' => '',
+					'status' => '1',
+					'add_time' => '',
+					'update_time' => '',
+				),
+			'update' =>
+				array(
+					'id' => '1',
+					'uniqid' => '1',
+					'mask' => '1',
+					'form' => '1',
+					'form_serialize' => '1',
+				),
+			'remove' =>
+				array(
+					'id' => '1',
+					'uniqid' => '1',
+				),
+			'save' =>
+				array(
+					'uniqid' => '1',
+					'mask' => '1',
+					'form' => '1',
+					'form_serialize' => '1',
+				),
+		),
+	'table' => 'database_form_setting',
+	'add_time' => '1454470879',
+	'update_time' => '1454471891',
+	'sql' => 'CREATE TABLE IF NOT EXISTS `database_form_setting` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `uid` int(11) DEFAULT NULL,
+  `uniqid` char(41) NOT NULL,
+  `mask` char(32) NOT NULL,
+  `form` text,
+  `form_serialize` text,
+  `status` tinyint(1) NOT NULL DEFAULT \\\'1\\\',
+  `add_time` int(11) DEFAULT NULL,
+  `update_time` int(11) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `uniqid_UNIQUE` (`uniqid`),
+  UNIQUE KEY `mask_UNIQUE` (`mask`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;',
 );

+ 26 - 26
demo/private/configure/db.ini

@@ -1,26 +1,26 @@
-;数据库配置
-[common]
-;是否读写分离
-readOrWriteSeparation = 0
-driver = pdo
-debug = true
-;使用的数据库类型
-use_db_driver = mysql
-
-master[db] = qii
-master[host] = 127.0.0.1
-master[user] = root
-master[password] = A119328118a
-
-slave[0.db] = qii
-slave[0.host] = 127.0.0.1
-slave[0.user] = root
-slave[0.password] = A119328118a
-
-
-slave[1.db] = qii
-slave[1.host] = 127.0.0.1
-slave[1.user] = root
-slave[1.password] = A119328118a
-
-[product:common]
+;数据库配置
+[common]
+;是否读写分离
+readOrWriteSeparation = 0
+driver = pdo
+debug = true
+;使用的数据库类型
+use_db_driver = mysql
+
+master[db] = qii
+master[host] = 127.0.0.1
+master[user] = root
+master[password] = A119328118a
+
+slave[0.db] = qii
+slave[0.host] = 127.0.0.1
+slave[0.user] = root
+slave[0.password] = A119328118a
+
+
+slave[1.db] = qii
+slave[1.host] = 127.0.0.1
+slave[1.user] = root
+slave[1.password] = A119328118a
+
+[product:common]

+ 56 - 56
demo/private/configure/filetype.config.php

@@ -1,57 +1,57 @@
-<?php
-return array(
-	0 => '7z',
-	1 => 'asp',
-	2 => 'aspx',
-	3 => 'bat',
-	4 => 'bmp',
-	5 => 'chm',
-	6 => 'css',
-	7 => 'db',
-	8 => 'dll',
-	9 => 'doc',
-	10 => 'exe',
-	11 => 'file',
-	12 => 'fla',
-	13 => 'folder',
-	14 => 'gif',
-	15 => 'htm',
-	16 => 'html',
-	17 => 'images',
-	18 => 'index',
-	19 => 'ini',
-	20 => 'jpeg',
-	21 => 'jpg',
-	22 => 'js',
-	23 => 'jsp',
-	24 => 'lnk',
-	25 => 'mdb',
-	26 => 'mov',
-	27 => 'mp3',
-	28 => 'pdf',
-	29 => 'php',
-	30 => 'png',
-	31 => 'ppt',
-	32 => 'psd',
-	33 => 'qt',
-	34 => 'quicktime',
-	35 => 'rar',
-	36 => 'reg',
-	37 => 'rm',
-	38 => 'rmvb',
-	39 => 'shtml',
-	40 => 'swf',
-	41 => 'tif',
-	42 => 'torrent',
-	43 => 'txt',
-	44 => 'vbs',
-	45 => 'video',
-	46 => 'video2',
-	47 => 'video3',
-	48 => 'vsd',
-	49 => 'wmv',
-	50 => 'xls',
-	51 => 'xml',
-	52 => 'xsl',
-	53 => 'zip',
+<?php
+return array(
+	0 => '7z',
+	1 => 'asp',
+	2 => 'aspx',
+	3 => 'bat',
+	4 => 'bmp',
+	5 => 'chm',
+	6 => 'css',
+	7 => 'db',
+	8 => 'dll',
+	9 => 'doc',
+	10 => 'exe',
+	11 => 'file',
+	12 => 'fla',
+	13 => 'folder',
+	14 => 'gif',
+	15 => 'htm',
+	16 => 'html',
+	17 => 'images',
+	18 => 'index',
+	19 => 'ini',
+	20 => 'jpeg',
+	21 => 'jpg',
+	22 => 'js',
+	23 => 'jsp',
+	24 => 'lnk',
+	25 => 'mdb',
+	26 => 'mov',
+	27 => 'mp3',
+	28 => 'pdf',
+	29 => 'php',
+	30 => 'png',
+	31 => 'ppt',
+	32 => 'psd',
+	33 => 'qt',
+	34 => 'quicktime',
+	35 => 'rar',
+	36 => 'reg',
+	37 => 'rm',
+	38 => 'rmvb',
+	39 => 'shtml',
+	40 => 'swf',
+	41 => 'tif',
+	42 => 'torrent',
+	43 => 'txt',
+	44 => 'vbs',
+	45 => 'video',
+	46 => 'video2',
+	47 => 'video3',
+	48 => 'vsd',
+	49 => 'wmv',
+	50 => 'xls',
+	51 => 'xml',
+	52 => 'xsl',
+	53 => 'zip',
 );

+ 11 - 11
demo/private/configure/path.config.php

@@ -1,12 +1,12 @@
-<?php
-return array(
-	'weburl' => 'http://www.qiiframework.com',
-	'left' => _link('/menu/left'),
-	'top' => _link('/menu/top'),
-	'index' => _link('/main/index'),
-	'creator' => _link('/database/creator'),
-	'rules' => _link('/database/rules'),
-	'update' => _link('/database/update'),
-	'table' => _link('/database/table'),
-	'loginCheck' => _link('/database/checkLogin'),
+<?php
+return array(
+	'weburl' => 'http://www.qiiframework.com',
+	'left' => _link('/menu/left'),
+	'top' => _link('/menu/top'),
+	'index' => _link('/main/index'),
+	'creator' => _link('/database/creator'),
+	'rules' => _link('/database/rules'),
+	'update' => _link('/database/update'),
+	'table' => _link('/database/table'),
+	'loginCheck' => _link('/database/checkLogin'),
 );

+ 6 - 6
demo/private/configure/router.config.php

@@ -1,7 +1,7 @@
-<?php
-return [
-    //'index:index' => 'dirs:index',
-    'home:index' => 'index:index',
-    'main:*' => 'index:index',
-    'api:*' => 'api\{1}:*'
+<?php
+return [
+    //'index:index' => 'dirs:index',
+    'home:index' => 'index:index',
+    'main:*' => 'index:index',
+    'api:*' => 'api\{1}:*'
 ];

+ 103 - 103
demo/private/configure/table.rules.config.php

@@ -1,104 +1,104 @@
-<?php
-return array(
-	'database' => 'qii',
-	'tableName' => 'database_table_rules',
-	'rules' => array(
-		'length' => array(
-			'database' => '20',
-			'table' => '20',
-			'rules' => '0',
-			'add_time' => '10',
-			'update_time' => '10'
-		),
-		'type' => array(
-			'database' => 'varchar',
-			'table' => 'varchar',
-			'rules' => 'text',
-			'add_time' => 'int',
-			'update_time' => 'int'
-		),
-		'fields' => array(
-			0 => 'database',
-			1 => 'table',
-			2 => 'rules',
-			3 => 'add_time',
-			4 => 'update_time'
-		),
-		'pri' => array(
-			'database' => '1',
-			'table' => '1'
-		),
-		'alias' => array(
-			'database' => '数据库名',
-			'table' => '数据表',
-			'rules' => '规则',
-			'add_time' => '添加时间',
-			'update_time' => '更新时间'
-		),
-		'front' => array(
-			'database' => '1',
-			'table' => '1',
-			'rules' => '1',
-			'add_time' => '1',
-			'update_time' => '1'
-		),
-		'end' => array(
-			'database' => '1',
-			'table' => '1',
-			'rules' => '1',
-			'add_time' => '1',
-			'update_time' => '1'
-		),
-		'default' => array(
-			'database' => '',
-			'table' => '',
-			'rules' => '',
-			'add_time' => '',
-			'update_time' => ''
-		),
-		'validate' => array(
-			'database' => array(
-				0 => 'required',
-				1 => 'string',
-			),
-			'table' => array(
-				0 => 'required',
-				1 => 'string'
-			),
-			'rules' => array(
-				0 => 'required'
-			)
-		),
-		'update' => array(
-			'database' => '1',
-			'table' => '1',
-			'rules' => '1'
-		),
-		'save' => array(
-			'database' => '1',
-			'table' => '1',
-			'rules' => '1'
-		),
-		'remove' => array(
-			'database' => '1',
-			'table' => '1'
-		),
-		'null' => array(
-			'database' => 'no',
-			'table' => 'no',
-			'rules' => 'no',
-			'add_time' => 'yes',
-			'update_time' => 'yes'
-		)
-	),
-	'add_time' => '1442888805',
-	'update_time' => '1451032338',
-	'sql' => 'CREATE TABLE IF NOT EXISTS `database_table_rules` (
-              `database` varchar(50) NOT NULL,
-              `table` varchar(50) NOT NULL,
-              `rules` text NOT NULL,
-              `add_time` int(10) DEFAULT NULL,
-              `update_time` int(10) DEFAULT NULL,
-              PRIMARY KEY (`database`,`table`)
-            ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'
+<?php
+return array(
+	'database' => 'qii',
+	'tableName' => 'database_table_rules',
+	'rules' => array(
+		'length' => array(
+			'database' => '20',
+			'table' => '20',
+			'rules' => '0',
+			'add_time' => '10',
+			'update_time' => '10'
+		),
+		'type' => array(
+			'database' => 'varchar',
+			'table' => 'varchar',
+			'rules' => 'text',
+			'add_time' => 'int',
+			'update_time' => 'int'
+		),
+		'fields' => array(
+			0 => 'database',
+			1 => 'table',
+			2 => 'rules',
+			3 => 'add_time',
+			4 => 'update_time'
+		),
+		'pri' => array(
+			'database' => '1',
+			'table' => '1'
+		),
+		'alias' => array(
+			'database' => '数据库名',
+			'table' => '数据表',
+			'rules' => '规则',
+			'add_time' => '添加时间',
+			'update_time' => '更新时间'
+		),
+		'front' => array(
+			'database' => '1',
+			'table' => '1',
+			'rules' => '1',
+			'add_time' => '1',
+			'update_time' => '1'
+		),
+		'end' => array(
+			'database' => '1',
+			'table' => '1',
+			'rules' => '1',
+			'add_time' => '1',
+			'update_time' => '1'
+		),
+		'default' => array(
+			'database' => '',
+			'table' => '',
+			'rules' => '',
+			'add_time' => '',
+			'update_time' => ''
+		),
+		'validate' => array(
+			'database' => array(
+				0 => 'required',
+				1 => 'string',
+			),
+			'table' => array(
+				0 => 'required',
+				1 => 'string'
+			),
+			'rules' => array(
+				0 => 'required'
+			)
+		),
+		'update' => array(
+			'database' => '1',
+			'table' => '1',
+			'rules' => '1'
+		),
+		'save' => array(
+			'database' => '1',
+			'table' => '1',
+			'rules' => '1'
+		),
+		'remove' => array(
+			'database' => '1',
+			'table' => '1'
+		),
+		'null' => array(
+			'database' => 'no',
+			'table' => 'no',
+			'rules' => 'no',
+			'add_time' => 'yes',
+			'update_time' => 'yes'
+		)
+	),
+	'add_time' => '1442888805',
+	'update_time' => '1451032338',
+	'sql' => 'CREATE TABLE IF NOT EXISTS `database_table_rules` (
+              `database` varchar(50) NOT NULL,
+              `table` varchar(50) NOT NULL,
+              `rules` text NOT NULL,
+              `add_time` int(10) DEFAULT NULL,
+              `update_time` int(10) DEFAULT NULL,
+              PRIMARY KEY (`database`,`table`)
+            ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'
 );

+ 305 - 305
demo/private/controller/api/database.php

@@ -1,305 +1,305 @@
-<?php
-/**
- * 提供data_controller类使用的接口
- */
-namespace controller\api;
-
-use \controller\base;
-
-class database extends base
-{
-	public function __construct()
-	{
-		parent::__construct();
-		$this->load->model('table')->checkRuleTable();
-	}
-
-	/**
-	 * 保存creator
-	 */
-	public function creatorAction()
-	{
-		$data = array();
-		$database = $this->request->post('database');
-		$tableName = $this->request->post('tableName');
-		$rules = $this->request->post($tableName);
-		if (!$rules) {
-			$data['code'] = 1;
-			echo $this->jsonEncode($data);
-			return;
-		}
-		$result = $this->load->model('table')->saveRules($database, $tableName, $rules);
-		if ($result) {
-			$data['code'] = 0;
-		} else {
-			$data['code'] = 1;
-			$data['error'] = $this->load->model('table')->tablesError;
-		}
-		$this->echoJson($data);
-	}
-
-	/**
-	 * 编辑详细的规则
-	 */
-	public function rulesAction()
-	{
-		$data = array();
-		$database = $this->request->post('database');
-		$tableName = $this->request->post('tableName');
-		$rules = $this->request->post('rules');
-		if (!$rules) {
-			$data['code'] = 1;
-			echo $this->jsonEncode($data);
-			return;
-		}
-		$result = $this->load->model('table')->updateRules($database, $tableName, $rules);
-		if ($result) {
-			$data['code'] = 0;
-		} else {
-			$data['code'] = 1;
-			$data['error'] = $this->load->model('table')->tablesError;
-		}
-		$this->echoJson($data);
-	}
-
-	/**
-	 * 获取制定数据库的数据包
-	 */
-	public function tableListsAction()
-	{
-		$tableName = $this->request->get('tableName', '');
-		$this->echoJson($this->load->model('table')->getTableLists($this->load->model('table')->getUseDB(), $tableName));
-	}
-
-	/**
-	 * 获取自定表的字段
-	 */
-	public function fieldsListsAction()
-	{
-		$tableName = $this->request->get('tableName');
-		$this->echoJson($this->load->model('table')->getFieldsLists($this->load->model('table')->getUseDB(), $tableName));
-	}
-
-	/**
-	 * 删除数据表中的数据
-	 */
-	public function tableAction()
-	{
-		$data = array();
-		$database = $this->request->get('__database', $this->load->model('table')->getUseDB());
-		$tableName = $this->request->get('__tableName', '');
-		if (!$database || !$tableName) {
-			$data['code'] = 1;
-			$data['msg'] = '参数不全';
-			echo $this->jsonEncode($data);
-			return;
-		}
-
-		$pri = explode(',', $this->request->get('__pri'));
-
-		$priVal = array();
-		foreach ($pri as $val) {
-			if (!$this->request->keyExists($_GET, $val)) {
-				$data['code'] = 1;
-				break;
-			}
-			$priVal[$val] = $this->request->get($val);
-		}
-		$result = $this->load->model('table')->removeTableData($database, $tableName, $priVal);
-		if ($result) {
-			$data['code'] = 0;
-		} else {
-			$data['code'] = 1;
-			$data['error'] = $this->load->model('table')->getError() === false ? '删除数据失败' : $this->load->model('table')->getError();
-		}
-		$this->echoJson($data);
-	}
-
-	/**
-	 * 更新数据表中的数据
-	 */
-	public function updateAction()
-	{
-		try {
-
-			$data = array();
-			$data['code'] = 0;
-			$database = $this->request->post('__database');
-			$tableName = $this->request->post('__tableName');
-			$pri = explode(',', $this->request->post('__pri'));
-
-
-			$fields = $this->request->post('fields');
-			$priVal = array();
-			foreach ($pri as $val) {
-				if (!$this->request->keyExists($_POST, $val)) {
-					$data['code'] = 1;
-					break;
-				}
-				$priVal[$val] = $this->request->post($val);
-			}
-			if ($data['code'] != 1) {
-				$result = $this->load->model('table')->updateTableData($database, $tableName, $priVal, $fields);
-				if (!$result->isError()) {
-					$data['code'] = 0;
-				} else {
-					$data['code'] = 1;
-					$data['error'] = $result->getResult();
-				}
-			}
-		} catch (Exception $e) {
-			$data['code'] = 1;
-			$data['msg'] = $e->getMessage();
-		}
-
-		$this->echoJson($data);
-	}
-
-
-	/**
-	 * 添加数据表中的数据
-	 */
-	public function addAction()
-	{
-		try {
-
-			$data = array();
-			$data['code'] = 0;
-			$database = $this->request->post('database');
-			$tableName = $this->request->post('tableName');
-
-
-			$fields = $this->request->post('fields');
-			if ($data['code'] != 1) {
-				$result = $this->load->model('table')->addTableData($database, $tableName, $fields);
-				if ($result->getCode() == 0) {
-					$data['code'] = 0;
-				} else {
-					$data['code'] = 1;
-					$data['error'] = $result->getMessage();
-				}
-			}
-		} catch (Exception $e) {
-			$data['code'] = 1;
-			$data['msg'] = $e->getMessage();
-		}
-
-		$this->echoJson($data);
-	}
-
-	/**
-	 * 下载数据表的配置文件
-	 * @author Jinhui Zhu<jinhui.zhu@live.cn> 2015-09-28 11:16
-	 */
-	public function downloadConfigAction()
-	{
-		$database = $this->request->get('database');
-		$tableName = $this->request->get('tableName');
-		try {
-			if (!$database || !$tableName) {
-				$data['code'] = 1;
-				$data['msg'] = '参数不全';
-				throw new Exception($data['msg'], $data['code']);
-			}
-			$result = $this->load->model('table')->autoRules($database, $tableName);
-			if ($result) {
-				$tableStruct = $this->load->model('table')->getTableSQL($database, $tableName);
-				$result['sql'] = '';
-				if ($tableStruct['sql']) $result['sql'] = str_replace("'", "\'", $tableStruct['sql']);
-				$downloadStr = "<?php\n\t return " . var_export($result, true) . ';';
-				_loadClass('\Qii\Library\Download')->downloadByString($database . '.' . $tableName . '.config.php', $downloadStr);
-			}
-		} catch (Exception $e) {
-			$this->showErrorPage($e->getMessage());
-		}
-	}
-
-	/**
-	 * 获取数据表建表URL
-	 * @author Jinhui Zhu <jinhui.zhu@live.cn> 2015-09-28 12:03
-	 *
-	 */
-	public function tableSQLAction()
-	{
-		$database = $this->request->get('database');
-		$tableName = $this->request->get('tableName');
-		$data = array();
-		try {
-			$data = $this->load->model('table')->getTableSQL($database, $tableName);
-			$data['code'] = 0;
-		} catch (Exception $e) {
-			$data['code'] = 1;
-			$data['msg'] = $e->getMessage();
-		}
-		$this->echoJson($data);
-	}
-
-	/**
-	 * 备份数据表及数据
-	 */
-	public function backupAction()
-	{
-		$database = $this->request->get('database');
-		$tableName = $this->request->get('tableName');
-		try {
-			$downloadStr = $this->load->model('table')->backupTable($database, $tableName);
-			_loadClass('\Qii\Library\Download')->downloadByString($database . '.' . $tableName . '.sql', $downloadStr);
-		} catch (Exception $e) {
-			$data['code'] = 1;
-			$data['msg'] = $e->getMessage();
-			$this->echoJson($data);
-		}
-	}
-
-	public function restoreAction()
-	{
-		$database = $this->request->post('database');
-		$tableName = $this->request->post('tableName');
-		if (!$database || !$tableName || !isset($_FILES['restoreSQL']) ||
-			!isset($_FILES['restoreSQL']['tmp_name']) ||
-			$_FILES['restoreSQL']['tmp_name'] == '' ||
-			$_FILES['restoreSQL']['error'] != UPLOAD_ERR_OK
-		) {
-			$data['code'] = 1;
-			$data['msg'] = '参数或文件错误';
-			$this->echoJson($data);
-			return;
-		}
-		$fileName = $_FILES['restoreSQL']['tmp_name'];
-		$data = $this->load->model('table')->restore($database, $tableName, $fileName);
-		echo $this->jsonEncode($data);
-	}
-
-	public function creatBasicCodeAction()
-	{
-		$database = $this->request->get('database');
-		$tableName = $this->request->get('tableName');
-		try {
-			if (!$database || !$tableName) {
-				$data['code'] = 1;
-				$data['msg'] = '参数或文件错误';
-				throw new \Exception($data['msg'], $data['code']);
-			}
-			$rules = $this->load->model('table')->getRules($database, $tableName);
-			if(!isset($rules['rules']))
-			{
-				$data['code'] = 1;
-				$data['msg'] = '请先设置规则';
-				throw new \Exception($data['msg'], $data['code']);
-			}
-            $privateKeys = '';
-			if(isset($rules['rules']['pri']) && $rules['rules']['pri']) {
-                $privateKeys = 'array(\'' . join('\', \'', array_keys($rules['rules']['pri'])) . '\')';
-            }
-			$this->view->assign('privateKeys', $privateKeys);
-			$code = $this->load->model('code');
-			$code->setDatabase($database);
-			$code->setClass($tableName);
-			$this->view->assign('code', $code->output());
-			$sampleCode = $this->view->fetch('manage/data/code.html');
-			_loadClass('\Qii\Library\Download')->downloadByString($tableName . '.php', $sampleCode);
-		} catch (\Exception $e) {
-			echo $e->getMessage();
-		}
-	}
-}
+<?php
+/**
+ * 提供data_controller类使用的接口
+ */
+namespace controller\api;
+
+use \controller\base;
+
+class database extends base
+{
+	public function __construct()
+	{
+		parent::__construct();
+		$this->load->model('table')->checkRuleTable();
+	}
+
+	/**
+	 * 保存creator
+	 */
+	public function creatorAction()
+	{
+		$data = array();
+		$database = $this->request->post('database');
+		$tableName = $this->request->post('tableName');
+		$rules = $this->request->post($tableName);
+		if (!$rules) {
+			$data['code'] = 1;
+			echo $this->jsonEncode($data);
+			return;
+		}
+		$result = $this->load->model('table')->saveRules($database, $tableName, $rules);
+		if ($result) {
+			$data['code'] = 0;
+		} else {
+			$data['code'] = 1;
+			$data['error'] = $this->load->model('table')->tablesError;
+		}
+		$this->echoJson($data);
+	}
+
+	/**
+	 * 编辑详细的规则
+	 */
+	public function rulesAction()
+	{
+		$data = array();
+		$database = $this->request->post('database');
+		$tableName = $this->request->post('tableName');
+		$rules = $this->request->post('rules');
+		if (!$rules) {
+			$data['code'] = 1;
+			echo $this->jsonEncode($data);
+			return;
+		}
+		$result = $this->load->model('table')->updateRules($database, $tableName, $rules);
+		if ($result) {
+			$data['code'] = 0;
+		} else {
+			$data['code'] = 1;
+			$data['error'] = $this->load->model('table')->tablesError;
+		}
+		$this->echoJson($data);
+	}
+
+	/**
+	 * 获取制定数据库的数据包
+	 */
+	public function tableListsAction()
+	{
+		$tableName = $this->request->get('tableName', '');
+		$this->echoJson($this->load->model('table')->getTableLists($this->load->model('table')->getUseDB(), $tableName));
+	}
+
+	/**
+	 * 获取自定表的字段
+	 */
+	public function fieldsListsAction()
+	{
+		$tableName = $this->request->get('tableName');
+		$this->echoJson($this->load->model('table')->getFieldsLists($this->load->model('table')->getUseDB(), $tableName));
+	}
+
+	/**
+	 * 删除数据表中的数据
+	 */
+	public function tableAction()
+	{
+		$data = array();
+		$database = $this->request->get('__database', $this->load->model('table')->getUseDB());
+		$tableName = $this->request->get('__tableName', '');
+		if (!$database || !$tableName) {
+			$data['code'] = 1;
+			$data['msg'] = '参数不全';
+			echo $this->jsonEncode($data);
+			return;
+		}
+
+		$pri = explode(',', $this->request->get('__pri'));
+
+		$priVal = array();
+		foreach ($pri as $val) {
+			if (!$this->request->keyExists($_GET, $val)) {
+				$data['code'] = 1;
+				break;
+			}
+			$priVal[$val] = $this->request->get($val);
+		}
+		$result = $this->load->model('table')->removeTableData($database, $tableName, $priVal);
+		if ($result) {
+			$data['code'] = 0;
+		} else {
+			$data['code'] = 1;
+			$data['error'] = $this->load->model('table')->getError() === false ? '删除数据失败' : $this->load->model('table')->getError();
+		}
+		$this->echoJson($data);
+	}
+
+	/**
+	 * 更新数据表中的数据
+	 */
+	public function updateAction()
+	{
+		try {
+
+			$data = array();
+			$data['code'] = 0;
+			$database = $this->request->post('__database');
+			$tableName = $this->request->post('__tableName');
+			$pri = explode(',', $this->request->post('__pri'));
+
+
+			$fields = $this->request->post('fields');
+			$priVal = array();
+			foreach ($pri as $val) {
+				if (!$this->request->keyExists($_POST, $val)) {
+					$data['code'] = 1;
+					break;
+				}
+				$priVal[$val] = $this->request->post($val);
+			}
+			if ($data['code'] != 1) {
+				$result = $this->load->model('table')->updateTableData($database, $tableName, $priVal, $fields);
+				if (!$result->isError()) {
+					$data['code'] = 0;
+				} else {
+					$data['code'] = 1;
+					$data['error'] = $result->getResult();
+				}
+			}
+		} catch (Exception $e) {
+			$data['code'] = 1;
+			$data['msg'] = $e->getMessage();
+		}
+
+		$this->echoJson($data);
+	}
+
+
+	/**
+	 * 添加数据表中的数据
+	 */
+	public function addAction()
+	{
+		try {
+
+			$data = array();
+			$data['code'] = 0;
+			$database = $this->request->post('database');
+			$tableName = $this->request->post('tableName');
+
+
+			$fields = $this->request->post('fields');
+			if ($data['code'] != 1) {
+				$result = $this->load->model('table')->addTableData($database, $tableName, $fields);
+				if ($result->getCode() == 0) {
+					$data['code'] = 0;
+				} else {
+					$data['code'] = 1;
+					$data['error'] = $result->getMessage();
+				}
+			}
+		} catch (Exception $e) {
+			$data['code'] = 1;
+			$data['msg'] = $e->getMessage();
+		}
+
+		$this->echoJson($data);
+	}
+
+	/**
+	 * 下载数据表的配置文件
+	 * @author Jinhui Zhu<jinhui.zhu@live.cn> 2015-09-28 11:16
+	 */
+	public function downloadConfigAction()
+	{
+		$database = $this->request->get('database');
+		$tableName = $this->request->get('tableName');
+		try {
+			if (!$database || !$tableName) {
+				$data['code'] = 1;
+				$data['msg'] = '参数不全';
+				throw new Exception($data['msg'], $data['code']);
+			}
+			$result = $this->load->model('table')->autoRules($database, $tableName);
+			if ($result) {
+				$tableStruct = $this->load->model('table')->getTableSQL($database, $tableName);
+				$result['sql'] = '';
+				if ($tableStruct['sql']) $result['sql'] = str_replace("'", "\'", $tableStruct['sql']);
+				$downloadStr = "<?php\n\t return " . var_export($result, true) . ';';
+				_loadClass('\Qii\Library\Download')->downloadByString($database . '.' . $tableName . '.config.php', $downloadStr);
+			}
+		} catch (Exception $e) {
+			$this->showErrorPage($e->getMessage());
+		}
+	}
+
+	/**
+	 * 获取数据表建表URL
+	 * @author Jinhui Zhu <jinhui.zhu@live.cn> 2015-09-28 12:03
+	 *
+	 */
+	public function tableSQLAction()
+	{
+		$database = $this->request->get('database');
+		$tableName = $this->request->get('tableName');
+		$data = array();
+		try {
+			$data = $this->load->model('table')->getTableSQL($database, $tableName);
+			$data['code'] = 0;
+		} catch (Exception $e) {
+			$data['code'] = 1;
+			$data['msg'] = $e->getMessage();
+		}
+		$this->echoJson($data);
+	}
+
+	/**
+	 * 备份数据表及数据
+	 */
+	public function backupAction()
+	{
+		$database = $this->request->get('database');
+		$tableName = $this->request->get('tableName');
+		try {
+			$downloadStr = $this->load->model('table')->backupTable($database, $tableName);
+			_loadClass('\Qii\Library\Download')->downloadByString($database . '.' . $tableName . '.sql', $downloadStr);
+		} catch (Exception $e) {
+			$data['code'] = 1;
+			$data['msg'] = $e->getMessage();
+			$this->echoJson($data);
+		}
+	}
+
+	public function restoreAction()
+	{
+		$database = $this->request->post('database');
+		$tableName = $this->request->post('tableName');
+		if (!$database || !$tableName || !isset($_FILES['restoreSQL']) ||
+			!isset($_FILES['restoreSQL']['tmp_name']) ||
+			$_FILES['restoreSQL']['tmp_name'] == '' ||
+			$_FILES['restoreSQL']['error'] != UPLOAD_ERR_OK
+		) {
+			$data['code'] = 1;
+			$data['msg'] = '参数或文件错误';
+			$this->echoJson($data);
+			return;
+		}
+		$fileName = $_FILES['restoreSQL']['tmp_name'];
+		$data = $this->load->model('table')->restore($database, $tableName, $fileName);
+		echo $this->jsonEncode($data);
+	}
+
+	public function creatBasicCodeAction()
+	{
+		$database = $this->request->get('database');
+		$tableName = $this->request->get('tableName');
+		try {
+			if (!$database || !$tableName) {
+				$data['code'] = 1;
+				$data['msg'] = '参数或文件错误';
+				throw new \Exception($data['msg'], $data['code']);
+			}
+			$rules = $this->load->model('table')->getRules($database, $tableName);
+			if(!isset($rules['rules']))
+			{
+				$data['code'] = 1;
+				$data['msg'] = '请先设置规则';
+				throw new \Exception($data['msg'], $data['code']);
+			}
+            $privateKeys = '';
+			if(isset($rules['rules']['pri']) && $rules['rules']['pri']) {
+                $privateKeys = 'array(\'' . join('\', \'', array_keys($rules['rules']['pri'])) . '\')';
+            }
+			$this->view->assign('privateKeys', $privateKeys);
+			$code = $this->load->model('code');
+			$code->setDatabase($database);
+			$code->setClass($tableName);
+			$this->view->assign('code', $code->output());
+			$sampleCode = $this->view->fetch('manage/data/code.html');
+			_loadClass('\Qii\Library\Download')->downloadByString($tableName . '.php', $sampleCode);
+		} catch (\Exception $e) {
+			echo $e->getMessage();
+		}
+	}
+}

+ 43 - 43
demo/private/controller/base.php

@@ -1,44 +1,44 @@
-<?php
-namespace controller;
-
-class base extends \Qii\Base\Controller
-{
-    public $enableDB = true;
-    public $enableView = true;
-    public function indexAction()
-    {
-        parent::__construct();
-    }
-
-	/**
-	 * 初始化view后执行方法
-	 */
-	protected function initView()
-	{
-		$this->view->assign('pathes', _include('../private/configure/path.config.php'));
-	}
-	/**
-	 * 当data中带code的时候,自动添加msg
-	 *
-	 * @param $data
-	 * @return string
-	 */
-	public function jsonEncode($data)
-	{
-		if (empty($data)) return '{}';
-		if (isset($data['code']) && $data['code'] > 0 && !isset($data['msg'])) $data['msg'] = _i($data['code']);
-		return json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
-	}
-
-	/**
-	 * 输出JSON数据后直接退出
-	 * @param array $data 数据
-	 * @param bool $exit 是否输出数据以后退出
-	 */
-	public function echoJson($data, $exit = true)
-	{
-		ob_end_clean();
-		echo $this->jsonEncode($data);
-		if ($exit) exit();
-	}
+<?php
+namespace controller;
+
+class base extends \Qii\Base\Controller
+{
+    public $enableDB = true;
+    public $enableView = true;
+    public function indexAction()
+    {
+        parent::__construct();
+    }
+
+	/**
+	 * 初始化view后执行方法
+	 */
+	protected function initView()
+	{
+		$this->view->assign('pathes', _include('../private/configure/path.config.php'));
+	}
+	/**
+	 * 当data中带code的时候,自动添加msg
+	 *
+	 * @param $data
+	 * @return string
+	 */
+	public function jsonEncode($data)
+	{
+		if (empty($data)) return '{}';
+		if (isset($data['code']) && $data['code'] > 0 && !isset($data['msg'])) $data['msg'] = _i($data['code']);
+		return json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
+	}
+
+	/**
+	 * 输出JSON数据后直接退出
+	 * @param array $data 数据
+	 * @param bool $exit 是否输出数据以后退出
+	 */
+	public function echoJson($data, $exit = true)
+	{
+		ob_end_clean();
+		echo $this->jsonEncode($data);
+		if ($exit) exit();
+	}
 }

+ 16 - 16
demo/private/controller/database.php

@@ -1,17 +1,17 @@
-<?php
-namespace controller;
-class database extends base
-{
-	public $actions = array(
-		'creator' => 'actions\database\creator',//创建规则
-		'rules' => 'actions\database\rules',//编辑详细的规则哦
-		'table' => 'actions\database\table',//管理数据表数据
-		'update' => 'actions\database\update',//更新规则页面
-		'add' => 'actions\database\add',//添加数据
-	);
-
-	public function __construct()
-	{
-		parent::__construct();
-	}
+<?php
+namespace controller;
+class database extends base
+{
+	public $actions = array(
+		'creator' => 'actions\database\creator',//创建规则
+		'rules' => 'actions\database\rules',//编辑详细的规则哦
+		'table' => 'actions\database\table',//管理数据表数据
+		'update' => 'actions\database\update',//更新规则页面
+		'add' => 'actions\database\add',//添加数据
+	);
+
+	public function __construct()
+	{
+		parent::__construct();
+	}
 }

+ 91 - 91
demo/private/controller/dirs.php

@@ -1,92 +1,92 @@
-<?php
-namespace controller;
-
-class dirs extends base
-{
-	public $defaultPath = './';
-
-	public function __construct()
-	{
-		parent::__construct();
-		$this->view->assign('defaultPath', $this->defaultPath);
-	}
-
-	public function indexAction()
-	{
-		$path = $this->request->get('path', './');
-		if (!is_dir($path)) {
-			$this->showErrorPage('指定文件不存在');
-			return;
-		}
-		$files = \helper\tools::getFolders($path);
-		$usePath = explode('/', $path);
-		$visitPathes = \helper\tools::getVisitPath($path);
-		$this->view->assign('visitPathes', $visitPathes);
-		$currentPath = array_pop($usePath);
-		$this->view->assign('currentPath', $currentPath);
-		$this->view->assign('usePath', join('/', $usePath));
-		$this->view->assign('files', $files);
-		$this->view->display('manage/folder/dir.html');
-	}
-
-	/**
-	 * 查看指定文件内容,仅限于php、css、js、cpp、.h、java、python类型文件
-	 */
-	public function fileAction()
-	{
-		$file = $this->request->get('file');
-		if (!is_file($file)) {
-			$this->showErrorPage($file . '指定文件不存在');
-			return;
-		}
-		//如果是php、css、js、cpp、.h、java、python文件就直接显示内容,否则下载
-		$extension = pathinfo($file, PATHINFO_EXTENSION);
-		if (!in_array($extension, array('php', 'css', 'js', 'html', 'cpp', 'h', 'py', 'java', 'ini'))) {
-			$download = new \Qii\Library\Download();
-			$download->download($file);
-			return;
-		}
-		$visitPathes = \helper\tools::getVisitPath(pathinfo($file, PATHINFO_DIRNAME));
-		$this->view->assign('visitPathes', $visitPathes);
-		$this->view->assign('file', pathinfo($file, PATHINFO_BASENAME));
-		$usePath = pathinfo($file, PATHINFO_DIRNAME);
-		$this->view->assign('usePath', $usePath);
-		$content = file_get_contents($file);
-		$encode = mb_detect_encoding($content, array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5'));
-		if ($encode != 'UTF-8') {
-			$content = mb_convert_encoding($content, 'UTF-8', $encode);
-		}
-		$this->view->assign('code', $content);
-		$this->view->display('manage/folder/file.html');
-	}
-
-	public function removeAction()
-	{
-		$file = $this->request->get('file');
-		$isAjax = $this->request->get('isAjax', 0);
-		if (!\helper\tools::allowRemove($file)) {
-			$isAjax == 1 ? $this->echoJson(array('code' => 1, 'msg' => '此目录或文件不允许删除')) : $this->showTipsPage('此目录或文件不允许删除');
-			return;
-		}
-		$result = \helper\tools::removeFile($file);
-		if ($result) {
-			$isAjax == 1 ? $this->echoJson(array('code' => 0, 'msg' => '删除成功')) : $this->showTipsPage('删除成功');
-			return;
-		}
-		$isAjax == 1 ? $this->echoJson(array('code' => 1, 'msg' => '删除失败')) : $this->showTipsPage('删除失败');
-	}
-
-	/**
-	 * 下载指定文件
-	 */
-	public function downAction()
-	{
-		$file = $this->request->get('file');
-		if (!is_file($file)) {
-			$this->showErrorPage($file . '指定文件不存在');
-			return;
-		}
-		$download = new \Qii\Library\Download();
-		$download->download($file);
-	}
+<?php
+namespace controller;
+
+class dirs extends base
+{
+	public $defaultPath = './';
+
+	public function __construct()
+	{
+		parent::__construct();
+		$this->view->assign('defaultPath', $this->defaultPath);
+	}
+
+	public function indexAction()
+	{
+		$path = $this->request->get('path', './');
+		if (!is_dir($path)) {
+			$this->showErrorPage('指定文件不存在');
+			return;
+		}
+		$files = \helper\tools::getFolders($path);
+		$usePath = explode('/', $path);
+		$visitPathes = \helper\tools::getVisitPath($path);
+		$this->view->assign('visitPathes', $visitPathes);
+		$currentPath = array_pop($usePath);
+		$this->view->assign('currentPath', $currentPath);
+		$this->view->assign('usePath', join('/', $usePath));
+		$this->view->assign('files', $files);
+		$this->view->display('manage/folder/dir.html');
+	}
+
+	/**
+	 * 查看指定文件内容,仅限于php、css、js、cpp、.h、java、python类型文件
+	 */
+	public function fileAction()
+	{
+		$file = $this->request->get('file');
+		if (!is_file($file)) {
+			$this->showErrorPage($file . '指定文件不存在');
+			return;
+		}
+		//如果是php、css、js、cpp、.h、java、python文件就直接显示内容,否则下载
+		$extension = pathinfo($file, PATHINFO_EXTENSION);
+		if (!in_array($extension, array('php', 'css', 'js', 'html', 'cpp', 'h', 'py', 'java', 'ini'))) {
+			$download = new \Qii\Library\Download();
+			$download->download($file);
+			return;
+		}
+		$visitPathes = \helper\tools::getVisitPath(pathinfo($file, PATHINFO_DIRNAME));
+		$this->view->assign('visitPathes', $visitPathes);
+		$this->view->assign('file', pathinfo($file, PATHINFO_BASENAME));
+		$usePath = pathinfo($file, PATHINFO_DIRNAME);
+		$this->view->assign('usePath', $usePath);
+		$content = file_get_contents($file);
+		$encode = mb_detect_encoding($content, array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5'));
+		if ($encode != 'UTF-8') {
+			$content = mb_convert_encoding($content, 'UTF-8', $encode);
+		}
+		$this->view->assign('code', $content);
+		$this->view->display('manage/folder/file.html');
+	}
+
+	public function removeAction()
+	{
+		$file = $this->request->get('file');
+		$isAjax = $this->request->get('isAjax', 0);
+		if (!\helper\tools::allowRemove($file)) {
+			$isAjax == 1 ? $this->echoJson(array('code' => 1, 'msg' => '此目录或文件不允许删除')) : $this->showTipsPage('此目录或文件不允许删除');
+			return;
+		}
+		$result = \helper\tools::removeFile($file);
+		if ($result) {
+			$isAjax == 1 ? $this->echoJson(array('code' => 0, 'msg' => '删除成功')) : $this->showTipsPage('删除成功');
+			return;
+		}
+		$isAjax == 1 ? $this->echoJson(array('code' => 1, 'msg' => '删除失败')) : $this->showTipsPage('删除失败');
+	}
+
+	/**
+	 * 下载指定文件
+	 */
+	public function downAction()
+	{
+		$file = $this->request->get('file');
+		if (!is_file($file)) {
+			$this->showErrorPage($file . '指定文件不存在');
+			return;
+		}
+		$download = new \Qii\Library\Download();
+		$download->download($file);
+	}
 }

+ 49 - 49
demo/private/controller/index.php

@@ -1,50 +1,50 @@
-<?php
-namespace controller;
-
-class index extends \Qii\Base\Controller
-{
-    public $enableDB = true;
-    public $enableView = true;
-    public function indexAction()
-    {
-        $html = [];
-        $html[] = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>示例程序</title><style>ul{list-style:none;}</style></head><body>';
-        $html[] = '<ul>示例程序';
-        $html[] = '<li>><a href="'. _link('dirs.html') .'">文件管理</a></li>';
-        $html[] = '<li>><a href="'. _link('database/creator.html') .'">数据表管理</a></li>';
-        $html[] = '<li>><a href="'. _link('index/dispatch.html') .'">Dispatch</a></li>';
-        $html[] = '<li>><a href="'. _link('index/forward.html') .'">Forward</a></li>';
-        $html[] = '<li>><a href="'. _link('index/display.html') .'">使用指定目录中的模板</a></li>';
-        $html[] = '</ul>';
-        $html[] = '</body></html>';
-        return $this->setResponse(new \Qii\Base\Response(array('format' => 'html', 'body' => join("\n", $html))));
-        return;
-        $data = array();
-        $data['lists'][] = $this->db->getRow('SELECT * FROM ipAddress ORDER BY id DESC LIMIT 1');
-        $data['lists'][] = $this->db->getRow('SELECT * FROM ipAddress ORDER BY id ASC LIMIT 1');
-        $data['querySeconds'] = $this->db->querySeconds;
-        
-        return new \Qii\Base\Response(array('format' => 'json', 'body' => $data));
-    }
-    
-    public function dispatchAction()
-    {
-        echo "<p>Dispatch start ". __CLASS__ ."</p>";
-        $this->dispatch('test', 'index');
-        echo "<p>Dispatch end ". __CLASS__ ."</p>";
-    }
-    
-    public function forwardAction()
-    {
-        echo "<p>This is start section " . __CLASS__ . " Forward</p>";
-        $this->setForward('test', 'index');
-        echo "<p>This is end section " . __CLASS__ . " Forward</p>";
-    }
-
-    public function displayAction()
-    {
-        //可以从这里设置加载模板的路径
-        $this->view->setTemplateDir(__DIR__ . "/view/");
-        echo $this->view->fetch('index.tpl');
-    }
+<?php
+namespace controller;
+
+class index extends \Qii\Base\Controller
+{
+    public $enableDB = true;
+    public $enableView = true;
+    public function indexAction()
+    {
+        $html = [];
+        $html[] = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>示例程序</title><style>ul{list-style:none;}</style></head><body>';
+        $html[] = '<ul>示例程序';
+        $html[] = '<li>><a href="'. _link('dirs.html') .'">文件管理</a></li>';
+        $html[] = '<li>><a href="'. _link('database/creator.html') .'">数据表管理</a></li>';
+        $html[] = '<li>><a href="'. _link('index/dispatch.html') .'">Dispatch</a></li>';
+        $html[] = '<li>><a href="'. _link('index/forward.html') .'">Forward</a></li>';
+        $html[] = '<li>><a href="'. _link('index/display.html') .'">使用指定目录中的模板</a></li>';
+        $html[] = '</ul>';
+        $html[] = '</body></html>';
+        return $this->setResponse(new \Qii\Base\Response(array('format' => 'html', 'body' => join("\n", $html))));
+        return;
+        $data = array();
+        $data['lists'][] = $this->db->getRow('SELECT * FROM ipAddress ORDER BY id DESC LIMIT 1');
+        $data['lists'][] = $this->db->getRow('SELECT * FROM ipAddress ORDER BY id ASC LIMIT 1');
+        $data['querySeconds'] = $this->db->querySeconds;
+        
+        return new \Qii\Base\Response(array('format' => 'json', 'body' => $data));
+    }
+    
+    public function dispatchAction()
+    {
+        echo "<p>Dispatch start ". __CLASS__ ."</p>";
+        $this->dispatch('test', 'index');
+        echo "<p>Dispatch end ". __CLASS__ ."</p>";
+    }
+    
+    public function forwardAction()
+    {
+        echo "<p>This is start section " . __CLASS__ . " Forward</p>";
+        $this->setForward('test', 'index');
+        echo "<p>This is end section " . __CLASS__ . " Forward</p>";
+    }
+
+    public function displayAction()
+    {
+        //可以从这里设置加载模板的路径
+        $this->view->setTemplateDir(__DIR__ . "/view/");
+        echo $this->view->fetch('index.tpl');
+    }
 }

+ 9 - 9
demo/private/controller/test.php

@@ -1,10 +1,10 @@
-<?php
-namespace controller;
-
-class test extends \Qii\Base\Controller
-{
-    public function indexAction()
-    {
-        echo __CLASS__;
-    }
+<?php
+namespace controller;
+
+class test extends \Qii\Base\Controller
+{
+    public function indexAction()
+    {
+        echo __CLASS__;
+    }
 }

+ 3 - 3
demo/private/controller/view/index.tpl

@@ -1,4 +1,4 @@
-<p>{#include file="../../view/_layout.tpl"#}</p>
-
-<p>{#include file="_layout.tpl"#}</p>
+<p>{#include file="../../view/_layout.tpl"#}</p>
+
+<p>{#include file="_layout.tpl"#}</p>
 This is tpl from controller dir

+ 12 - 12
demo/private/helper/func.php

@@ -1,13 +1,13 @@
-<?php
-function getRequest()
-{
-    return \Qii\Autoloader\Psr4::getInstance()->loadClass('\Qii\Request\Http');
-}
-/**
- * 生成link
- * @param string $url
- */
-function _link($url)
-{
-	return getRequest()->url::getAbsluteUrl($url);
+<?php
+function getRequest()
+{
+    return \Qii\Autoloader\Psr4::getInstance()->loadClass('\Qii\Request\Http');
+}
+/**
+ * 生成link
+ * @param string $url
+ */
+function _link($url)
+{
+	return getRequest()->url::getAbsluteUrl($url);
 }

+ 195 - 195
demo/private/helper/globals.php

@@ -1,195 +1,195 @@
-<?php
-
-/**
- * Class global_helper
- *
- * 全局方法,主要使用在模板中
- */
-namespace helper;
-class globals
-{
-	public static function rules($rule, $name, $validate, $invalidMessage = array(), $extRules = array())
-	{
-		$ruleText = isset($validate[$rule]) ? $validate[$rule] : $rule;
-		$message = isset($invalidMessage[$name]) && isset($invalidMessage[$name][$rule]) ? $invalidMessage[$name][$rule] : '';
-		$ruleValue = isset($extRules[$name]) && isset($extRules[$name][$rule]) ? $extRules[$name][$rule] : '';
-
-		if (in_array($rule, array('length', 'minlength', 'maxlength', 'rangeof', 'sets'))) {
-			return '<label class="w160">' . $ruleText . '&nbsp;<input type="text" class="scinput display_left" name="rules[extRules][' . $name . '][' . $rule . ']" id="rules[extRules][' . $name . '][' . $rule . ']" placeholder="' . $ruleText . '规则" value="' . $ruleValue . '"  />&nbsp;<input type="text" class="scinput" name="rules[invalidMessage][' . $name . '][' . $rule . ']" id="rules[invalidMessage][' . $name . '][' . $rule . ']" placeholder="' . $ruleText . '错误提示" value="' . $message . '" /></label>';
-		}
-		return '<label class="w160">' . $ruleText . '&nbsp;<input type="text" class="scinput" name="rules[invalidMessage][' . $name . '][' . $rule . ']" id="rules[invalidMessage][' . $name . '][' . $rule . ']" placeholder="' . $ruleText . '错误提示" value="' . $message . '" /></label>';
-	}
-
-	/**
-	 * 判断string是否包含html标签
-	 *
-	 * @param $string
-	 * @return bool
-	 */
-	public static function hasHtmlTag($string)
-	{
-		return $string != strip_tags($string);
-	}
-
-	/**
-	 * 生成带参数的URL
-	 *
-	 * @param String $url
-	 * @param Array $param
-	 * @return String
-	 */
-	public static function createURL($url, $param = array())
-	{
-		return \Qii::getInstance('Request')->url($url, $param);
-	}
-
-	/**
-	 * 跳转连接
-	 *
-	 */
-	public static function location($url, $param = array())
-	{
-		$url = self::createURL($url, $param);
-		header('Location: ' . $url);
-		die();
-	}
-
-	/**
-	 * POST数据的时候需要将此参数带上
-	 *
-	 */
-	public static function safeForm()
-	{
-		return;
-	}
-
-	/**
-	 * 设置Cookie
-	 *
-	 */
-	public static function cookie($key, $value = null, $expired = 86400)
-	{
-		if ($value === null) return isset($_COOKIE[$key]) ? $_COOKIE[$key] : '';
-		setcookie($key, $value, time() + $expired, '/');
-	}
-
-	/**
-	 * 获取get值
-	 *
-	 */
-	public static function get($key)
-	{
-		return \Qii::segment($key);
-	}
-
-	/**
-	 * 获取当前连接地址
-	 *
-	 */
-	public static function getCURL()
-	{
-		return \Qii::instance('URI')->getCurrentURL();
-	}
-
-	/**
-	 * 获取网站路径的URL
-	 * @return string
-	 */
-	public static function pathUrl()
-	{
-		return \Qii\Autoloader\Psr4::getInstance()->loadClass('\Qii\Request\Http')->getWebHost() . \Qii\Autoloader\Psr4::getInstance()->loadClass('\Qii\Request\Http')->getPath();
-	}
-
-	/**
-	 * 获取文件的路径
-	 * @param String $file
-	 * @return String
-	 */
-	public static function getFile($file)
-	{
-		return self::pathUrl() . '/' . ltrim($file, '/');
-	}
-
-	/**
-	 * 将绝对地址补成全路径URL
-	 * @param String $url
-	 * @return string
-	 */
-
-	public static function getFullUrl($url = 'index', $ext = '.html')
-	{
-		if (is_array($url)) {
-			$url = join('/', $url);
-		}
-		$url = str_replace('//', '/', $url);
-		$query = parse_url($url);
-		$url = $query['path'];
-		$params = array();
-		if (isset($query['query'])) {
-			parse_str($query['query'], $params);
-		}
-		if ($url == '/') $url = 'index';
-		if ($ext == null) {
-			$ext = '';
-		}
-		$query = count($params) > 0 ? '?' . http_build_query($params) : '';
-		//去掉url中末尾的扩展名,避免重复
-		$url = preg_replace('/(\.' . $ext . ')$/', '', $url);
-		return rtrim(self::pathUrl(), '/') . '/' . ltrim($url, '/') . $ext . (count($params) > 0 ? '?' . http_build_query($params) : '');
-	}
-
-	/**
-	 * 获取Image全路径
-	 * @param String $image
-	 * @return string
-	 */
-	public static function getImage($image)
-	{
-		$image = explode('.', $image);
-		$ext = '.' . array_pop($image);
-		return self::getFullUrl('/static/images/' . join('.', $image), $ext);
-	}
-
-	/**
-	 * 获取Css全路径
-	 * @param String $css
-	 * @return string
-	 */
-	public static function getCss($css)
-	{
-		return self::getFullUrl('/static/css/' . $css, '.css');
-	}
-
-	/**
-	 * 获取JS全路径
-	 * @param String $js
-	 * @return string
-	 */
-	public static function getJS($js)
-	{
-		return self::getFullUrl('/static/js/' . $js, '.js');
-	}
-
-	/**
-	 * 通过制定url路径,不局限于static/images目录返回全路径url
-	 * @param $image
-	 * @return string
-	 */
-	public static function getImageFullUrl($image)
-	{
-		return self::getSourceFullUrl($image);
-	}
-
-	/**
-	 * 通过path直接返回全路径
-	 *
-	 * @param $url
-	 * @return string
-	 */
-	public static function getSourceFullUrl($url)
-	{
-		$ext = pathinfo($url, PATHINFO_EXTENSION);
-		$url = preg_replace('/' . $ext . '$/', '', $url);
-		return self::getFullUrl($url, $ext);
-	}
-}
+<?php
+
+/**
+ * Class global_helper
+ *
+ * 全局方法,主要使用在模板中
+ */
+namespace helper;
+class globals
+{
+	public static function rules($rule, $name, $validate, $invalidMessage = array(), $extRules = array())
+	{
+		$ruleText = isset($validate[$rule]) ? $validate[$rule] : $rule;
+		$message = isset($invalidMessage[$name]) && isset($invalidMessage[$name][$rule]) ? $invalidMessage[$name][$rule] : '';
+		$ruleValue = isset($extRules[$name]) && isset($extRules[$name][$rule]) ? $extRules[$name][$rule] : '';
+
+		if (in_array($rule, array('length', 'minlength', 'maxlength', 'rangeof', 'sets'))) {
+			return '<label class="w160">' . $ruleText . '&nbsp;<input type="text" class="scinput display_left" name="rules[extRules][' . $name . '][' . $rule . ']" id="rules[extRules][' . $name . '][' . $rule . ']" placeholder="' . $ruleText . '规则" value="' . $ruleValue . '"  />&nbsp;<input type="text" class="scinput" name="rules[invalidMessage][' . $name . '][' . $rule . ']" id="rules[invalidMessage][' . $name . '][' . $rule . ']" placeholder="' . $ruleText . '错误提示" value="' . $message . '" /></label>';
+		}
+		return '<label class="w160">' . $ruleText . '&nbsp;<input type="text" class="scinput" name="rules[invalidMessage][' . $name . '][' . $rule . ']" id="rules[invalidMessage][' . $name . '][' . $rule . ']" placeholder="' . $ruleText . '错误提示" value="' . $message . '" /></label>';
+	}
+
+	/**
+	 * 判断string是否包含html标签
+	 *
+	 * @param $string
+	 * @return bool
+	 */
+	public static function hasHtmlTag($string)
+	{
+		return $string != strip_tags($string);
+	}
+
+	/**
+	 * 生成带参数的URL
+	 *
+	 * @param String $url
+	 * @param Array $param
+	 * @return String
+	 */
+	public static function createURL($url, $param = array())
+	{
+		return \Qii::getInstance('Request')->url($url, $param);
+	}
+
+	/**
+	 * 跳转连接
+	 *
+	 */
+	public static function location($url, $param = array())
+	{
+		$url = self::createURL($url, $param);
+		header('Location: ' . $url);
+		die();
+	}
+
+	/**
+	 * POST数据的时候需要将此参数带上
+	 *
+	 */
+	public static function safeForm()
+	{
+		return;
+	}
+
+	/**
+	 * 设置Cookie
+	 *
+	 */
+	public static function cookie($key, $value = null, $expired = 86400)
+	{
+		if ($value === null) return isset($_COOKIE[$key]) ? $_COOKIE[$key] : '';
+		setcookie($key, $value, time() + $expired, '/');
+	}
+
+	/**
+	 * 获取get值
+	 *
+	 */
+	public static function get($key)
+	{
+		return \Qii::segment($key);
+	}
+
+	/**
+	 * 获取当前连接地址
+	 *
+	 */
+	public static function getCURL()
+	{
+		return \Qii::instance('URI')->getCurrentURL();
+	}
+
+	/**
+	 * 获取网站路径的URL
+	 * @return string
+	 */
+	public static function pathUrl()
+	{
+		return \Qii\Autoloader\Psr4::getInstance()->loadClass('\Qii\Request\Http')->getWebHost() . \Qii\Autoloader\Psr4::getInstance()->loadClass('\Qii\Request\Http')->getPath();
+	}
+
+	/**
+	 * 获取文件的路径
+	 * @param String $file
+	 * @return String
+	 */
+	public static function getFile($file)
+	{
+		return self::pathUrl() . '/' . ltrim($file, '/');
+	}
+
+	/**
+	 * 将绝对地址补成全路径URL
+	 * @param String $url
+	 * @return string
+	 */
+
+	public static function getFullUrl($url = 'index', $ext = '.html')
+	{
+		if (is_array($url)) {
+			$url = join('/', $url);
+		}
+		$url = str_replace('//', '/', $url);
+		$query = parse_url($url);
+		$url = $query['path'];
+		$params = array();
+		if (isset($query['query'])) {
+			parse_str($query['query'], $params);
+		}
+		if ($url == '/') $url = 'index';
+		if ($ext == null) {
+			$ext = '';
+		}
+		$query = count($params) > 0 ? '?' . http_build_query($params) : '';
+		//去掉url中末尾的扩展名,避免重复
+		$url = preg_replace('/(\.' . $ext . ')$/', '', $url);
+		return rtrim(self::pathUrl(), '/') . '/' . ltrim($url, '/') . $ext . (count($params) > 0 ? '?' . http_build_query($params) : '');
+	}
+
+	/**
+	 * 获取Image全路径
+	 * @param String $image
+	 * @return string
+	 */
+	public static function getImage($image)
+	{
+		$image = explode('.', $image);
+		$ext = '.' . array_pop($image);
+		return self::getFullUrl('/static/images/' . join('.', $image), $ext);
+	}
+
+	/**
+	 * 获取Css全路径
+	 * @param String $css
+	 * @return string
+	 */
+	public static function getCss($css)
+	{
+		return self::getFullUrl('/static/css/' . $css, '.css');
+	}
+
+	/**
+	 * 获取JS全路径
+	 * @param String $js
+	 * @return string
+	 */
+	public static function getJS($js)
+	{
+		return self::getFullUrl('/static/js/' . $js, '.js');
+	}
+
+	/**
+	 * 通过制定url路径,不局限于static/images目录返回全路径url
+	 * @param $image
+	 * @return string
+	 */
+	public static function getImageFullUrl($image)
+	{
+		return self::getSourceFullUrl($image);
+	}
+
+	/**
+	 * 通过path直接返回全路径
+	 *
+	 * @param $url
+	 * @return string
+	 */
+	public static function getSourceFullUrl($url)
+	{
+		$ext = pathinfo($url, PATHINFO_EXTENSION);
+		$url = preg_replace('/' . $ext . '$/', '', $url);
+		return self::getFullUrl($url, $ext);
+	}
+}

+ 196 - 196
demo/private/helper/tools.php

@@ -1,197 +1,197 @@
-<?php
-namespace helper;
-class tools
-{
-	/**
-	 * 将数组生成树结构
-	 * @param Array $items
-	 * @param String $id
-	 * @param String $pid
-	 * @param String $son
-	 * @return Array
-	 */
-	public static function tree($items, $id = 'cid', $pid = 'pid', $son = 'children')
-	{
-		$tree = array(); //格式化的树
-		$tmpMap = array();  //临时扁平数据
-		foreach ($items as $item) {
-			$tmpMap[$item[$id]] = $item;
-		}
-		foreach ($items as $item) {
-			if ($item[$id] != $item[$pid] && isset($tmpMap[$item[$pid]])) {
-				$tmpMap[$item[$pid]][$son][$item[$id]] = &$tmpMap[$item[$id]];
-			} else {
-				$tree[$item[$id]] = &$tmpMap[$item[$id]];
-			}
-		}
-		return $tree;
-	}
-
-	/**
-	 * 格式化文件大小
-	 */
-	public static function formatSize($bytes, $unit = "", $decimals = 2, $showUnit = true)
-	{
-		$units = array('B' => 0, 'KB' => 1, 'MB' => 2, 'GB' => 3, 'TB' => 4, 'PB' => 5, 'EB' => 6, 'ZB' => 7, 'YB' => 8);
-		$bytes = (int)$bytes;
-		$value = 0;
-		if ($bytes > 0) {
-			if (!array_key_exists($unit, $units)) {
-				$pow = floor(log($bytes) / log(1024));
-				$unit = array_search($pow, $units);
-			}
-			$value = (intval($bytes) / pow(1024, floor($units[$unit])));
-		}
-		if (!is_numeric($decimals) || $decimals < 0) {
-			$decimals = 2;
-		}
-		if ($unit == 'KB' && $value < 0.1) {
-			$decimals = 0;
-		}
-		if ($showUnit) {
-			return sprintf('%.' . $decimals . 'f' . $unit, $value);
-		} else {
-			return sprintf('%.' . $decimals . 'f ', $value);
-		}
-	}
-
-	/**
-	 * 获取用户访问目录路径
-	 * @param string $path 目录
-	 */
-	public static function getVisitPath($path)
-	{
-		$usePath = explode('/', $path);
-		$dirPathes = array();
-		$lastDir = $usePath[0];
-		foreach ($usePath AS $key => $path) {
-			if (!$path) continue;
-			$array = array();
-			$array['name'] = $path;
-			if ($key > 0) {
-				$lastDir = $lastDir . '/' . $path;
-			}
-			$array['path'] = $lastDir;
-			$array['url'] = _link('/dirs?path=' . urlencode($lastDir));
-			$dirPathes[] = $array;
-		}
-		return $dirPathes;
-	}
-
-	public static function fileType($fullPath)
-	{
-		if (is_dir($fullPath)) return 'folder';
-		return pathinfo($fullPath, PATHINFO_EXTENSION);
-	}
-
-	/**
-	 * 是否是图片文件
-	 * @param string $fullPath 文件路径
-	 * @return bool
-	 */
-	public static function isImage($fullPath)
-	{
-		$fileType = self::fileType($fullPath);
-		if (in_array($fileType, array('gif', 'jpg', 'jpeg', 'webp', 'png', 'bmp'))) {
-			return true;
-		}
-		return false;
-	}
-
-	/**
-	 * 获取目录中文件及目录
-	 * @param string $path 目录
-	 * @return array
-	 */
-	public static function getFolders($path, $filter = '*')
-	{
-		$dir = dir($path);
-		$filetype = _include('../private/configure/filetype.config.php');
-		$files = array();
-		while (($file = $dir->read()) !== false) {
-			if ($file == '.' || $file == '..') continue;
-			$fullPath = str_replace('//', '/', $path . '/' . $file);
-			$isDir = is_dir($fullPath);
-			if ($filter != '*' && !$isDir && !preg_match('/' . $filter . '$/', $file)) continue;
-			$array = array();
-			$type = self::fileType($fullPath);
-			$array['name'] = iconv('GBK', 'UTF-8', $file);
-			if (!in_array($type, $filetype)) {
-				$array['icon'] = _link('filetype/unknow.png');
-			} else {
-				$array['icon'] = _link('filetype/' . $type . '.gif');
-			}
-			$array['type'] = is_dir($fullPath) ? 'folder' : 'file';
-			$array['url'] = $array['type'] == 'folder' ? '/dirs?path=' . urlencode($fullPath) : '/dirs/file?file=' . urlencode($fullPath);
-			$array['remove'] = _link('/dirs/remove?file=' . $fullPath . '&isAjax=1');
-			$array['path'] = _link($fullPath);
-			$size = $array['type'] == 'folder' ? '' : filesize($fullPath);
-			$array['size'] = $array['type'] == 'folder' ? '' : \helper\tools::formatSize($size, 'KB');
-			$array['isImage'] = self::isImage($fullPath);
-			//如果文件超过200k就不让直接查看,让下载后查看
-			if ($size > 1024 * 200) {
-				$array['url'] = '/dirs/down?file=' . urlencode($fullPath);
-			}
-			$array['url'] = _link($array['url']);
-			$array['extension'] = $type;
-			$array['createAt'] = filectime($fullPath);
-			$array['updateAt'] = fileatime($fullPath);
-			$files[] = $array;
-
-		}
-		$dir->close();
-		return $files;
-	}
-
-	/**
-	 * 不在指定目录的文件不让删除
-	 *
-	 * @param $file
-	 * @return bool
-	 */
-	public static function allowRemove($file)
-	{
-		$allowFolder = array('tmp', 'tmp/compile');
-		$file = ltrim($file, './');
-
-		foreach ($allowFolder AS $allow) {
-			if (stristr($file, $allow)) return true;
-		}
-		return false;
-	}
-
-	/**
-	 * 删除指定文件夹或文件
-	 * @param $dir
-	 * @return bool
-	 */
-	public static function removeFile($dir)
-	{
-		//只让删除指定文件夹的文件,其他文件夹中的不让删除
-		if (!self::allowRemove($dir)) {
-			return false;
-		}
-
-		if (is_file($dir)) return unlink($dir);
-		$dh = opendir($dir);
-
-		while ($file = readdir($dh)) {
-			if ($file != "." && $file != "..") {
-				$fullpath = $dir . "/" . $file;
-				if (!is_dir($fullpath)) {
-					unlink($fullpath);
-				} else {
-					self::removeFile($fullpath);
-				}
-			}
-		}
-
-		closedir($dh);
-		//删除当前文件夹:
-		if (rmdir($dir)) {
-			return true;
-		} else {
-			return false;
-		}
-	}
+<?php
+namespace helper;
+class tools
+{
+	/**
+	 * 将数组生成树结构
+	 * @param Array $items
+	 * @param String $id
+	 * @param String $pid
+	 * @param String $son
+	 * @return Array
+	 */
+	public static function tree($items, $id = 'cid', $pid = 'pid', $son = 'children')
+	{
+		$tree = array(); //格式化的树
+		$tmpMap = array();  //临时扁平数据
+		foreach ($items as $item) {
+			$tmpMap[$item[$id]] = $item;
+		}
+		foreach ($items as $item) {
+			if ($item[$id] != $item[$pid] && isset($tmpMap[$item[$pid]])) {
+				$tmpMap[$item[$pid]][$son][$item[$id]] = &$tmpMap[$item[$id]];
+			} else {
+				$tree[$item[$id]] = &$tmpMap[$item[$id]];
+			}
+		}
+		return $tree;
+	}
+
+	/**
+	 * 格式化文件大小
+	 */
+	public static function formatSize($bytes, $unit = "", $decimals = 2, $showUnit = true)
+	{
+		$units = array('B' => 0, 'KB' => 1, 'MB' => 2, 'GB' => 3, 'TB' => 4, 'PB' => 5, 'EB' => 6, 'ZB' => 7, 'YB' => 8);
+		$bytes = (int)$bytes;
+		$value = 0;
+		if ($bytes > 0) {
+			if (!array_key_exists($unit, $units)) {
+				$pow = floor(log($bytes) / log(1024));
+				$unit = array_search($pow, $units);
+			}
+			$value = (intval($bytes) / pow(1024, floor($units[$unit])));
+		}
+		if (!is_numeric($decimals) || $decimals < 0) {
+			$decimals = 2;
+		}
+		if ($unit == 'KB' && $value < 0.1) {
+			$decimals = 0;
+		}
+		if ($showUnit) {
+			return sprintf('%.' . $decimals . 'f' . $unit, $value);
+		} else {
+			return sprintf('%.' . $decimals . 'f ', $value);
+		}
+	}
+
+	/**
+	 * 获取用户访问目录路径
+	 * @param string $path 目录
+	 */
+	public static function getVisitPath($path)
+	{
+		$usePath = explode('/', $path);
+		$dirPathes = array();
+		$lastDir = $usePath[0];
+		foreach ($usePath AS $key => $path) {
+			if (!$path) continue;
+			$array = array();
+			$array['name'] = $path;
+			if ($key > 0) {
+				$lastDir = $lastDir . '/' . $path;
+			}
+			$array['path'] = $lastDir;
+			$array['url'] = _link('/dirs?path=' . urlencode($lastDir));
+			$dirPathes[] = $array;
+		}
+		return $dirPathes;
+	}
+
+	public static function fileType($fullPath)
+	{
+		if (is_dir($fullPath)) return 'folder';
+		return pathinfo($fullPath, PATHINFO_EXTENSION);
+	}
+
+	/**
+	 * 是否是图片文件
+	 * @param string $fullPath 文件路径
+	 * @return bool
+	 */
+	public static function isImage($fullPath)
+	{
+		$fileType = self::fileType($fullPath);
+		if (in_array($fileType, array('gif', 'jpg', 'jpeg', 'webp', 'png', 'bmp'))) {
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * 获取目录中文件及目录
+	 * @param string $path 目录
+	 * @return array
+	 */
+	public static function getFolders($path, $filter = '*')
+	{
+		$dir = dir($path);
+		$filetype = _include('../private/configure/filetype.config.php');
+		$files = array();
+		while (($file = $dir->read()) !== false) {
+			if ($file == '.' || $file == '..') continue;
+			$fullPath = str_replace('//', '/', $path . '/' . $file);
+			$isDir = is_dir($fullPath);
+			if ($filter != '*' && !$isDir && !preg_match('/' . $filter . '$/', $file)) continue;
+			$array = array();
+			$type = self::fileType($fullPath);
+			$array['name'] = iconv('GBK', 'UTF-8', $file);
+			if (!in_array($type, $filetype)) {
+				$array['icon'] = _link('filetype/unknow.png');
+			} else {
+				$array['icon'] = _link('filetype/' . $type . '.gif');
+			}
+			$array['type'] = is_dir($fullPath) ? 'folder' : 'file';
+			$array['url'] = $array['type'] == 'folder' ? '/dirs?path=' . urlencode($fullPath) : '/dirs/file?file=' . urlencode($fullPath);
+			$array['remove'] = _link('/dirs/remove?file=' . $fullPath . '&isAjax=1');
+			$array['path'] = _link($fullPath);
+			$size = $array['type'] == 'folder' ? '' : filesize($fullPath);
+			$array['size'] = $array['type'] == 'folder' ? '' : \helper\tools::formatSize($size, 'KB');
+			$array['isImage'] = self::isImage($fullPath);
+			//如果文件超过200k就不让直接查看,让下载后查看
+			if ($size > 1024 * 200) {
+				$array['url'] = '/dirs/down?file=' . urlencode($fullPath);
+			}
+			$array['url'] = _link($array['url']);
+			$array['extension'] = $type;
+			$array['createAt'] = filectime($fullPath);
+			$array['updateAt'] = fileatime($fullPath);
+			$files[] = $array;
+
+		}
+		$dir->close();
+		return $files;
+	}
+
+	/**
+	 * 不在指定目录的文件不让删除
+	 *
+	 * @param $file
+	 * @return bool
+	 */
+	public static function allowRemove($file)
+	{
+		$allowFolder = array('tmp', 'tmp/compile');
+		$file = ltrim($file, './');
+
+		foreach ($allowFolder AS $allow) {
+			if (stristr($file, $allow)) return true;
+		}
+		return false;
+	}
+
+	/**
+	 * 删除指定文件夹或文件
+	 * @param $dir
+	 * @return bool
+	 */
+	public static function removeFile($dir)
+	{
+		//只让删除指定文件夹的文件,其他文件夹中的不让删除
+		if (!self::allowRemove($dir)) {
+			return false;
+		}
+
+		if (is_file($dir)) return unlink($dir);
+		$dh = opendir($dir);
+
+		while ($file = readdir($dh)) {
+			if ($file != "." && $file != "..") {
+				$fullpath = $dir . "/" . $file;
+				if (!is_dir($fullpath)) {
+					unlink($fullpath);
+				} else {
+					self::removeFile($fullpath);
+				}
+			}
+		}
+
+		closedir($dh);
+		//删除当前文件夹:
+		if (rmdir($dir)) {
+			return true;
+		} else {
+			return false;
+		}
+	}
 }

+ 12 - 12
demo/private/i18n/CN/common.php

@@ -1,13 +1,13 @@
-<?php
-/**
- * User: zhujinhui
- * Date: 15/5/1
- * Time: 下午9:28
- */
-return array(
-	1 => '参数错误',
-	2 => '保存数据错误',
-	10001 => '已经存在相关数据',
-	10002 => '未找到相关数据',
-	10003 => '更新数据失败'
+<?php
+/**
+ * User: zhujinhui
+ * Date: 15/5/1
+ * Time: 下午9:28
+ */
+return array(
+	1 => '参数错误',
+	2 => '保存数据错误',
+	10001 => '已经存在相关数据',
+	10002 => '未找到相关数据',
+	10003 => '更新数据失败'
 );

+ 7 - 7
demo/private/i18n/language.php

@@ -1,8 +1,8 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: zhujinhui
- * Date: 15/5/1
- * Time: 下午9:30
- */
+<?php
+/**
+ * Created by PhpStorm.
+ * User: zhujinhui
+ * Date: 15/5/1
+ * Time: 下午9:30
+ */
 return 'CN';

+ 35 - 35
demo/private/model/code.php

@@ -1,36 +1,36 @@
-<?php
-/**
- * 数据表的显示规则
- *
- * @author Jinhui Zhu<jinhui.zhu@live.cn> 2015-08-23 10:07
- */
-namespace Model;
-
-use \Qii\Driver\Model;
-use \Qii\Driver\Response;
-
-class code extends Model
-{
-	public $tableName;
-	public $codes = array();
-	public function __construct()
-	{
-		parent::__construct();
-	}
-	public function setDatabase($database)
-	{
-		$this->database = $database;
-	}
-	public function setClass($tableName)
-	{
-		$this->tableName = $tableName;
-	}
-
-	public function output()
-	{
-		if(!$this->tableName) throw new \Exception("未设置类名", __LINE__);
-		$output['className'] = $this->tableName;
-		$output['database'] = $this->database;
-		return $output;
-	}
+<?php
+/**
+ * 数据表的显示规则
+ *
+ * @author Jinhui Zhu<jinhui.zhu@live.cn> 2015-08-23 10:07
+ */
+namespace Model;
+
+use \Qii\Driver\Model;
+use \Qii\Driver\Response;
+
+class code extends Model
+{
+	public $tableName;
+	public $codes = array();
+	public function __construct()
+	{
+		parent::__construct();
+	}
+	public function setDatabase($database)
+	{
+		$this->database = $database;
+	}
+	public function setClass($tableName)
+	{
+		$this->tableName = $tableName;
+	}
+
+	public function output()
+	{
+		if(!$this->tableName) throw new \Exception("未设置类名", __LINE__);
+		$output['className'] = $this->tableName;
+		$output['database'] = $this->database;
+		return $output;
+	}
 }

+ 594 - 594
demo/private/model/table.php

@@ -1,594 +1,594 @@
-<?php
-/**
- * 数据表的显示规则
- *
- * @author Jinhui Zhu<jinhui.zhu@live.cn> 2015-08-23 10:07
- */
-namespace model;
-
-use \Qii\Driver\Model;
-use \Qii\Driver\Response;
-
-class table extends Model
-{
-	public $tablesError;
-
-	public function __construct()
-	{
-		parent::__construct();
-		$this->checkRuleTable();
-	}
-	public function getRuleTableInfo()
-	{
-		$table = _include('../private/configure/table.rules.config.php');
-		$table['database'] = $this->db->currentDB;
-		return $table;
-	}
-	public function checkRuleTable()
-	{
-		$config = $this->getRuleTableInfo();
-		if($config['sql'])
-		{
-			$this->db->exec($config['sql']);
-		}
-	}
-
-	/**
-	 * 获取数据库列表
-	 * @return array
-	 */
-	public function getDatabases()
-	{
-		$databases = array();
-		$sql = "SHOW DATABASES";
-
-		$rs = $this->db->setQuery($sql);
-		while ($row = $rs->fetch()) {
-			if (!in_array($row['Database'], array('information_schema', 'mysql', 'performance_schema', 'test'))) $databases[] = $row['Database'];
-		}
-		return $databases;
-	}
-
-	public function getTableSQL($db, $table)
-	{
-		if (!$db || !$table) {
-			$this->tablesError = '参数不正确';
-			return array('code' => 1, 'msg' => '参数不正确');
-		}
-		$data = array();
-		$data['database'] = $db;
-		$data['table'] = $table;
-		try {
-			$data['code'] = 0;
-			$sql = "SHOW CREATE TABLE {$db}.{$table}";
-			$rs = $this->db->setQuery($sql);
-			$row = $rs->fetch();
-			$createTableSQL = preg_replace('/AUTO_INCREMENT\=[\d]/', 'AUTO_INCREMENT=1', $row['Create Table']);
-			if ($row) $data['sql'] = str_replace("CREATE TABLE ", "CREATE TABLE IF NOT EXISTS ", $createTableSQL) . ';';
-		} catch (Exception $e) {
-			$data['code'] = 1;
-			$data['msg'] = $e->getMessage();
-			$data['sql'] = '';
-		}
-		return $data;
-	}
-
-	/**
-	 * 获取指定数据库中的表名
-	 * @param string $db
-	 * @return array
-	 */
-	public function getTableLists($db = 'istudy', $table = '')
-	{
-		if (!$db) {
-			$this->tablesError = '参数不正确';
-			return array();
-		}
-		$tables = array();
-		$sql = "SHOW TABLES IN " . $db;
-		$rs = $this->db->setQuery($sql);
-		while ($row = $rs->fetch()) {
-			$tableName = $row['Tables_in_' . $db];
-			$insert = true;
-			if (!empty($table)) $insert = stristr($tableName, $table) ? true : false;
-			if ($insert) $tables[] = $tableName;
-		}
-		return $tables;
-	}
-
-	/**
-	 * 匹配类型并返回类型字段长度
-	 * @param string $type
-	 * @return Array
-	 */
-	public function parseType($type)
-	{
-		preg_match("/(.*)\(.*?\)/", $type, $matches);
-		$data = array();
-		$data['source'] = $type;
-		$data['type'] = isset($matches[1]) ? $matches[1] : $type;
-		$ext = isset($matches[1]) ? str_replace(array($data['type'] . '(', ')'), '', $type) : 0;
-
-		if ($data['type'] == 'enum') {
-			$data['length'] = 0;
-			$data['sets'] = $ext;
-			$data['setsArray'] = preg_replace("/\"|\'/", "", explode(",", $ext));
-		} else {
-			$data['length'] = (int)$ext;
-		}
-		return $data;
-	}
-
-	/**
-	 * 获取数据库中某个表的字段
-	 * @param string $db
-	 * @param string $table
-	 * @return array 表中的字段列表
-	 */
-	public function getFieldsLists($db = 'istudy', $table)
-	{
-		$fields = array();
-		$sql = 'DESC ' . $db . '.' . $table;
-		$rs = $this->db->setQuery($sql);
-		while ($row = $rs->fetch()) {
-			$val = array();
-			$val['field'] = $row['Field'];
-			$val['null'] = strtolower($row['Null']);
-			$matches = $this->parseType($row['Type']);
-			$val['length'] = 0;
-			$val['type'] = $row['Type'];
-			if (isset($matches['length'])) {
-				$val['length'] = intval($matches['length']);
-				$val['type'] = $matches['type'];
-			}
-			if ($matches['type'] == 'enum') {
-				$val['sets'] = $matches['sets'];
-				$val['setsArray'] = $matches['setsArray'];
-			}
-			$val['length'] = intval($matches['length']);
-			if ($row['Null'] == 'NO') $val['require'] = true;
-			if ($row['Key'] != '') {
-				if ($row['Key'] == 'PRI') $val['pri'] = true;//主键,用于查询用
-				if ($row['Key'] == 'UNI') $val['uni'] = true;
-			}
-			if ($row['Default']) $val['default'] = $row['Default'];
-			if ($row['Extra']) $val['extra'] = $row['Extra'];
-			$fields[$row['Field']] = $val;
-		}
-		return $fields;
-	}
-
-	/**
-	 * 获取指定数据库、数据表的规则
-	 * @param  string $database 数据库
-	 * @param  string $table 数据表
-	 * @return array  返回表的显示规则
-	 */
-	public function getRules($database, $table)
-	{
-		if (!$database || !$table) {
-			$this->tablesError = '参数不正确';
-			return array();
-		}
-		$rules = (new \Qii\Driver\Easy())->_initialize();
-		$rules->setPrivateKey(array('database', 'table'));
-		$rules->setRules(new \Qii\Driver\Rules($this->getRuleTableInfo()));
-		$rules->database = $database;
-		$rules->table = $table;
-		$tableRules = $rules->_exist();
-		$tableRule = array();
-		$tableRule['rules'] = array();
-		if (!$tableRules->isError()) {
-			$tableRule = $tableRules->getResult();
-			$rule = isset($tableRule['rules']) ? $tableRule['rules'] : '';
-			if ($rule != '') {
-				$tableRule['rules'] = json_decode($rule, true);
-			} else {
-				$tableRule['rules'] = array();
-			}
-		}
-		$defaultRules = $this->tableRules($database, $table);
-		if ($defaultRules['rules']) $tableRule['rules'] = array_merge($defaultRules['rules'], $tableRule['rules']);
-		return $tableRule;
-	}
-
-	/**
-	 * 保存数据库表的显示规则
-	 * @param  string $database 数据库
-	 * @param  string $table 数据表
-	 * @param  string $rule 显示规则
-	 * @return bool 保存成功或失败
-	 */
-	public function saveRules($database, $table, array $rule)
-	{
-		$rules = (new \Qii\Driver\Easy())->_initialize();
-		$rules->setPrivateKey(array('database', 'table'));
-		$rules->setRules(new \Qii\Driver\Rules($this->getRuleTableInfo()));
-		$rules->database = $database;
-		$rules->table = $table;
-
-		$isExists = $rules->_exist();
-		if ($isExists->isError()) {
-			$this->tablesError = $isExists->getErrors();
-			return false;
-		}
-		if (isset($isExists->getResult()['database'])) {
-			//保存额外的规则,确保更新不影响
-			$databaseRules = $this->getRules($database, $table);
-			if (isset($databaseRules['rules']['invalidMessage']) && is_array($databaseRules['rules']['invalidMessage'])) {
-				$rule['invalidMessage'] = $databaseRules['rules']['invalidMessage'];
-			}
-			if (isset($databaseRules['rules']['extRules']) && is_array($databaseRules['rules']['extRules'])) {
-				$rule['extRules'] = $databaseRules['rules']['extRules'];
-			}
-			$rules->rules = json_encode($rule);
-			$rules->update_time = time();
-			//更新
-			$result = $rules->_update();
-		} else {
-			$rules->rules = json_encode($rule);
-			$rules->add_time = time();
-			$result = $rules->_save();
-		}
-		$result = true;
-		if ($rules->getErrors()) {
-			$result = false;
-			$this->tablesError = $rules->getErrors();
-		}
-		return $result;
-	}
-
-	/**
-	 * 更新数据表规则
-	 *
-	 * @param string $database 数据库名称
-	 * @param string $table 数据表名称
-	 * @param array $rule 规则
-	 * @return bool
-	 */
-	public function updateRules($database, $table, array $rule)
-	{
-		if (!$database || !$table) {
-			$this->tablesError = '参数不正确';
-			return false;
-		}
-		$databaseRules = $this->getRules($database, $table);
-		if (!isset($databaseRules['rules']) || !is_array($databaseRules['rules'])) {
-			$this->tablesError = '规则不存在';
-			return false;
-		}
-		$rule = array_merge($databaseRules['rules'], $rule);
-		$rules = (new \Qii\Driver\Easy())->_initialize();
-		$rules->setPrivateKey(array('database', 'table'));
-		$rules->setRules(new \Qii\Driver\Rules($this->getRuleTableInfo()));
-		$rules->database = $database;
-		$rules->table = $table;
-		$rules->rules = json_encode($rule);
-
-		$isExists = $rules->_exist();
-		if ($isExists->isError()) {
-			$this->tablesError = $isExists->getError();
-			return false;
-		}
-		if ($isExists->getResult()['database']) {
-			$rules->update_time = time();
-			//更新
-			$result = $rules->_update();
-		} else {
-			$rules->add_time = time();
-			$result = $rules->_save();
-		}
-		$result = true;
-		if ($rules->isError()) {
-			$result = false;
-			$this->tablesError = $rules->getErrors();
-		}
-		return $result;
-	}
-
-	/**
-	 * 自动表的规则
-	 *
-	 * @param $database
-	 * @param $tableName
-	 * @return array
-	 */
-	public function tableRules($database, $tableName)
-	{
-		if (!$database || !$tableName) {
-			$this->tablesError = '参数不正确';
-			return array();
-		}
-		$data = array();
-		$rules = $this->getFieldsLists($database, $tableName);
-		$data['database'] = $database;
-		$data['tableName'] = $tableName;
-		$data['rules'] = array();
-		$data['rules']['end'] = array();
-		$data['rules']['front'] = array();
-		$data['rules']['alias'] = array();
-		$data['rules']['fields'] = array();
-		foreach ($rules AS $key => $val) {
-			$data['rules']['fields'][] = $key;
-			$data['rules']['end'][$key] = $data['rules']['front'][$key] = 1;
-			$data['rules']['alias'][$key] = $key;
-			$data['rules']['length'][$key] = $val['length'];
-			$data['rules']['type'][$key] = $val['type'];
-			$data['rules']['null'][$key] = $val['null'];
-			if (isset($val['sets'])) $data['rules']['sets'][$key] = $val['sets'];
-			if (isset($val['setsArray'])) $data['rules']['setsArray'][$key] = $val['setsArray'];
-			if (isset($val['pri'])) $data['rules']['pri'][$key] = 1;
-			if (isset($val['uni'])) $data['rules']['uni'][$key] = 1;
-		}
-		if (!isset($data['rules']['validate'])) $data['rules']['validate'] = array();
-		return $data;
-	}
-
-	/**
-	 * 合并表的规则,当没有存储相关规则的时候就用系统默认规则
-	 *
-	 * @param $database
-	 * @param $tableName
-	 * @param $rules
-	 */
-	public function mergeRules($database, $tableName, &$rules)
-	{
-		$tableRules = $this->tableRules($database, $tableName);
-		$rules = array_merge($tableRules, $rules);
-		foreach ($tableRules['rules'] AS $key => $val) {
-			if (!isset($rules['rules'][$key]) || count($rules['rules'][$key]) == 0) $rules['rules'][$key] = $val;
-		}
-		return $rules;
-	}
-
-	/**
-	 * 自动合并数据表规则
-	 *
-	 * @param $database
-	 * @param $tableName
-	 * @return array
-	 */
-	public function autoRules($database, $tableName)
-	{
-		if (!$database || !$tableName) {
-			$this->tablesError = '参数不正确';
-			return array();
-		}
-		$rules = $this->getRules($database, $tableName);
-		$this->mergeRules($database, $tableName, $rules);
-		return $rules;
-	}
-
-	/**
-	 * 获取数据表的数据
-	 *
-	 * @param $database 当前数据表
-	 * @param $tableName 当前表名称
-	 * @param int $currentPage 当前页码
-	 * @param int $pageSize 每一页数据条数
-	 * @return mixed
-	 */
-	public function loadTableData($database, $tableName, $currentPage = 1, $pageSize = 12)
-	{
-		if (!$database || !$tableName) {
-			$this->tablesError = '参数不正确';
-			return array();
-		}
-		$currentPage = max(1, $currentPage);
-		$start = ($currentPage - 1) * $pageSize;
-		/*
-		$rules = $this->getRules($database, $tableName);
-		//当rules为空的时候,通过数据表结构自动生成规则
-		if(empty($rules['rules']))
-		{
-			$rules = $this->tableRules($database, $tableName);
-		}
-		else
-		{
-			$this->mergeRules($database, $tableName, $rules);
-		}*/
-		$rules = $this->autoRules($database, $tableName);
-		$data = array();
-		$data['rows'] = array();
-		$data['page'] = array('total' => 0, 'currentPage' => 0, 'totalPage' => 0);
-		$data['page']['total'] = $this->db->getOne("SELECT COUNT(*) FROM {$database}.{$tableName}");
-		$data['page']['currentPage'] = $currentPage;
-		$data['page']['totalPage'] = ceil($data['page']['total'] / $pageSize);
-		$sql = "SELECT * FROM {$database}.{$tableName} LIMIT " . $start . ',' . $pageSize;
-		$rs = $this->db->setQuery($sql);
-		$rulesCount = isset($rules['rules']['end']) && count($rules['rules']['end']) > 0 ? $rules['rules']['end'] : 0;
-		while ($row = $rs->fetch()) {
-			$val = array();
-			if ($rulesCount > 0) {
-				foreach ($rules['rules']['end'] AS $key => $field) {
-					if ($field == 1) $val[$key] = $row[$key];
-				}
-			}
-			$updateFields = array();
-			$priKeys = array();
-			foreach ($rules['rules']['pri'] AS $key => $pri) {
-				$priKeys[] = $key;
-				$updateFields[$key] = $row[$key];
-			}
-			//为了避免表中字段跟主要参数冲突,主要参数前边添加两个下划线
-			$updateFields['__pri'] = join(',', $priKeys);
-			$updateFields['__database'] = $database;
-			$updateFields['__tableName'] = $tableName;
-			$val['__updateFields'] = http_build_query($updateFields);
-			$data['rows'][] = $val;
-			unset($val);
-		}
-		$data['rules'] = $rules['rules'];
-		return $data;
-	}
-
-	/**
-	 * 获取表中的数据
-	 * @author Jinhui Zhu 2015-08-26
-	 * @param string $database
-	 * @param string $tableName
-	 * @param string $pri
-	 * @param Array $val
-	 * @return mixed
-	 */
-	public function loadDataFromTable($database, $tableName, $pri, $val)
-	{
-		if (!$database || !$tableName || (!$val && count($val) == 0)) {
-			$this->tablesError = '参数不正确';
-			return array();
-		}
-		return $this->db->whereArray($val)->selectRow($database . '.' . $tableName);
-	}
-
-	/**
-	 * 更新数据表数据
-	 * @param string $database
-	 * @param string $tableName
-	 * @param array $priVal
-	 * @param array $fields
-	 * @return bool
-	 */
-	public function updateTableData($database, $tableName, $priVal, $fields)
-	{
-		if (!$database || !$tableName || !$fields) {
-			$this->tablesError = '参数不正确';
-			return array();
-		}
-		$rules = $this->autoRules($database, $tableName);
-		$privateKey = array();
-		if (empty($priVal) && isset($rules['rules']['uni'])) $privateKey = array_keys($rules['rules']['uni']);
-		$table = (new \Qii\Driver\Easy())->_initialize();
-		$table->setPrivateKey($priVal);
-		$table->setRules(new \Qii\Driver\Rules($rules));
-		foreach ($fields AS $key => $val) {
-			$table->{$key} = $val;
-		}
-		return $result = $table->_update();
-	}
-
-	/**
-	 * 删除指定数据表中数据
-	 * 避免删除整张表的数据,验证val,如果为空就不删除
-	 * @param string $database
-	 * @param string $tableName
-	 * @param array $val {key : val}
-	 * @return bool
-	 */
-	public function removeTableData($database, $tableName, $val)
-	{
-		if (empty($val)) {
-			$this->tablesError = '参数不正确';
-			return false;
-		}
-		return $this->db->deleteObject($database . '.' . $tableName, $val);
-	}
-
-	/**
-	 * 向指定数据库中插入数据
-	 *
-	 * @param $database
-	 * @param $tableName
-	 * @param $value
-	 */
-	public function addTableData($database, $tableName, $value)
-	{
-		if (!$database || !$tableName || !$value) {
-			$this->tablesError = '参数不正确';
-			return array();
-		}
-		$rules = $this->autoRules($database, $tableName);
-		//去掉自动privateKey,通过配置文件来做
-		//$privateKey = array();
-		//if(isset($rules['rules']['uni'])) $privateKey = array_keys($rules['rules']['uni']);
-		$table = (new \Qii\Driver\Easy())->_initialize();
-		//$table->setPrivateKey($privateKey);
-		$table->setRules(new \Qii\Driver\Rules($rules));
-		foreach ($value AS $key => $val) {
-			$table->{$key} = $val;
-		}
-		try {
-			$result = $table->_save();
-			if ($result->isError()) {
-				return $result;
-			}
-			return Response::Success('addTableData', '操作成功');
-		} catch (\Exception $e) {
-			$msg = strip_tags($e->getMessage());
-			return Response::Instance(10010, 'addTableData', array('message' => $msg));
-		}
-	}
-
-	/**
-	 * 备份指定数据表
-	 *
-	 * @param $database  数据库名称
-	 * @param $tableName  数据表名称
-	 * @return string
-	 */
-	public function backupTable($database, $tableName)
-	{
-		$sql = "SELECT * FROM {$database}.{$tableName}";
-		$rs = $this->db->setQuery($sql);
-		$data = array();
-		$backupSQL = "USE {$database};\n";
-		$tableSQL = $this->getTableSQL($database, $tableName);
-		if ($tableSQL['sql'] == '') _e('获取数据表错误', __LINE__);
-		$backupSQL .= $tableSQL['sql'];
-		$i = 0;
-		$fields = array();
-		while ($row = $this->db->fetch($rs)) {
-			$fields = array_keys($row);
-			$row = array_map('addslashes', $row);
-			$data[] = '(\'' . join("','", $row) . '\')';
-			if ($i == 500) {
-				//执行一次合并操作
-				$backupSQL .= "\nINSERT INTO {$database}.{$tableName}(`" . join('`, `', $fields) . "`) VALUES " . join(', ', $data) . ";\n";
-				$data = array();
-				$i = 0;
-			} else {
-				$i++;
-			}
-		}
-		if (count($data) > 0) {
-			$backupSQL .= "\nINSERT INTO {$database}.{$tableName}(`" . join('`, `', $fields) . "`) VALUES " . join(', ', $data) . ";\n";
-		}
-		return $backupSQL;
-	}
-
-	/**
-	 * 还原数据
-	 *
-	 * @param $database  数据库名
-	 * @param $tableName  数据表名
-	 * @param $fileName  文件名
-	 * @return array|void
-	 */
-	public function restore($database, $tableName, $fileName)
-	{
-		$data = array();
-		$data['code'] = 1;
-		if (!$data || !$tableName || !$fileName) {
-			$data['msg'] = '参数错误或文件错误';
-			return $data;
-		}
-		$contents = file_get_contents($fileName);
-		$tableSQL = explode(';', $contents);
-		if (count($tableSQL) == 0) {
-			$data['msg'] = '上传的文件无相关据';
-			return $data;
-		}
-		try {
-			foreach ($tableSQL AS $sql) {
-				$sql = trim($sql);
-				if ($sql == '') continue;
-				$this->db->setQuery($sql);
-			}
-			$data['code'] = 0;
-			$data['msg'] = '成功';
-		} catch (\Exception $e) {
-			$data['code'] = $e->getCode();
-			$data['msg'] = strip_tags($e->getMessage());
-		}
-		return $data;
-	}
-}
+<?php
+/**
+ * 数据表的显示规则
+ *
+ * @author Jinhui Zhu<jinhui.zhu@live.cn> 2015-08-23 10:07
+ */
+namespace model;
+
+use \Qii\Driver\Model;
+use \Qii\Driver\Response;
+
+class table extends Model
+{
+	public $tablesError;
+
+	public function __construct()
+	{
+		parent::__construct();
+		$this->checkRuleTable();
+	}
+	public function getRuleTableInfo()
+	{
+		$table = _include('../private/configure/table.rules.config.php');
+		$table['database'] = $this->db->currentDB;
+		return $table;
+	}
+	public function checkRuleTable()
+	{
+		$config = $this->getRuleTableInfo();
+		if($config['sql'])
+		{
+			$this->db->exec($config['sql']);
+		}
+	}
+
+	/**
+	 * 获取数据库列表
+	 * @return array
+	 */
+	public function getDatabases()
+	{
+		$databases = array();
+		$sql = "SHOW DATABASES";
+
+		$rs = $this->db->setQuery($sql);
+		while ($row = $rs->fetch()) {
+			if (!in_array($row['Database'], array('information_schema', 'mysql', 'performance_schema', 'test'))) $databases[] = $row['Database'];
+		}
+		return $databases;
+	}
+
+	public function getTableSQL($db, $table)
+	{
+		if (!$db || !$table) {
+			$this->tablesError = '参数不正确';
+			return array('code' => 1, 'msg' => '参数不正确');
+		}
+		$data = array();
+		$data['database'] = $db;
+		$data['table'] = $table;
+		try {
+			$data['code'] = 0;
+			$sql = "SHOW CREATE TABLE {$db}.{$table}";
+			$rs = $this->db->setQuery($sql);
+			$row = $rs->fetch();
+			$createTableSQL = preg_replace('/AUTO_INCREMENT\=[\d]/', 'AUTO_INCREMENT=1', $row['Create Table']);
+			if ($row) $data['sql'] = str_replace("CREATE TABLE ", "CREATE TABLE IF NOT EXISTS ", $createTableSQL) . ';';
+		} catch (Exception $e) {
+			$data['code'] = 1;
+			$data['msg'] = $e->getMessage();
+			$data['sql'] = '';
+		}
+		return $data;
+	}
+
+	/**
+	 * 获取指定数据库中的表名
+	 * @param string $db
+	 * @return array
+	 */
+	public function getTableLists($db = 'istudy', $table = '')
+	{
+		if (!$db) {
+			$this->tablesError = '参数不正确';
+			return array();
+		}
+		$tables = array();
+		$sql = "SHOW TABLES IN " . $db;
+		$rs = $this->db->setQuery($sql);
+		while ($row = $rs->fetch()) {
+			$tableName = $row['Tables_in_' . $db];
+			$insert = true;
+			if (!empty($table)) $insert = stristr($tableName, $table) ? true : false;
+			if ($insert) $tables[] = $tableName;
+		}
+		return $tables;
+	}
+
+	/**
+	 * 匹配类型并返回类型字段长度
+	 * @param string $type
+	 * @return Array
+	 */
+	public function parseType($type)
+	{
+		preg_match("/(.*)\(.*?\)/", $type, $matches);
+		$data = array();
+		$data['source'] = $type;
+		$data['type'] = isset($matches[1]) ? $matches[1] : $type;
+		$ext = isset($matches[1]) ? str_replace(array($data['type'] . '(', ')'), '', $type) : 0;
+
+		if ($data['type'] == 'enum') {
+			$data['length'] = 0;
+			$data['sets'] = $ext;
+			$data['setsArray'] = preg_replace("/\"|\'/", "", explode(",", $ext));
+		} else {
+			$data['length'] = (int)$ext;
+		}
+		return $data;
+	}
+
+	/**
+	 * 获取数据库中某个表的字段
+	 * @param string $db
+	 * @param string $table
+	 * @return array 表中的字段列表
+	 */
+	public function getFieldsLists($db = 'istudy', $table)
+	{
+		$fields = array();
+		$sql = 'DESC ' . $db . '.' . $table;
+		$rs = $this->db->setQuery($sql);
+		while ($row = $rs->fetch()) {
+			$val = array();
+			$val['field'] = $row['Field'];
+			$val['null'] = strtolower($row['Null']);
+			$matches = $this->parseType($row['Type']);
+			$val['length'] = 0;
+			$val['type'] = $row['Type'];
+			if (isset($matches['length'])) {
+				$val['length'] = intval($matches['length']);
+				$val['type'] = $matches['type'];
+			}
+			if ($matches['type'] == 'enum') {
+				$val['sets'] = $matches['sets'];
+				$val['setsArray'] = $matches['setsArray'];
+			}
+			$val['length'] = intval($matches['length']);
+			if ($row['Null'] == 'NO') $val['require'] = true;
+			if ($row['Key'] != '') {
+				if ($row['Key'] == 'PRI') $val['pri'] = true;//主键,用于查询用
+				if ($row['Key'] == 'UNI') $val['uni'] = true;
+			}
+			if ($row['Default']) $val['default'] = $row['Default'];
+			if ($row['Extra']) $val['extra'] = $row['Extra'];
+			$fields[$row['Field']] = $val;
+		}
+		return $fields;
+	}
+
+	/**
+	 * 获取指定数据库、数据表的规则
+	 * @param  string $database 数据库
+	 * @param  string $table 数据表
+	 * @return array  返回表的显示规则
+	 */
+	public function getRules($database, $table)
+	{
+		if (!$database || !$table) {
+			$this->tablesError = '参数不正确';
+			return array();
+		}
+		$rules = (new \Qii\Driver\Easy())->_initialize();
+		$rules->setPrivateKey(array('database', 'table'));
+		$rules->setRules(new \Qii\Driver\Rules($this->getRuleTableInfo()));
+		$rules->database = $database;
+		$rules->table = $table;
+		$tableRules = $rules->_exist();
+		$tableRule = array();
+		$tableRule['rules'] = array();
+		if (!$tableRules->isError()) {
+			$tableRule = $tableRules->getResult();
+			$rule = isset($tableRule['rules']) ? $tableRule['rules'] : '';
+			if ($rule != '') {
+				$tableRule['rules'] = json_decode($rule, true);
+			} else {
+				$tableRule['rules'] = array();
+			}
+		}
+		$defaultRules = $this->tableRules($database, $table);
+		if ($defaultRules['rules']) $tableRule['rules'] = array_merge($defaultRules['rules'], $tableRule['rules']);
+		return $tableRule;
+	}
+
+	/**
+	 * 保存数据库表的显示规则
+	 * @param  string $database 数据库
+	 * @param  string $table 数据表
+	 * @param  string $rule 显示规则
+	 * @return bool 保存成功或失败
+	 */
+	public function saveRules($database, $table, array $rule)
+	{
+		$rules = (new \Qii\Driver\Easy())->_initialize();
+		$rules->setPrivateKey(array('database', 'table'));
+		$rules->setRules(new \Qii\Driver\Rules($this->getRuleTableInfo()));
+		$rules->database = $database;
+		$rules->table = $table;
+
+		$isExists = $rules->_exist();
+		if ($isExists->isError()) {
+			$this->tablesError = $isExists->getErrors();
+			return false;
+		}
+		if (isset($isExists->getResult()['database'])) {
+			//保存额外的规则,确保更新不影响
+			$databaseRules = $this->getRules($database, $table);
+			if (isset($databaseRules['rules']['invalidMessage']) && is_array($databaseRules['rules']['invalidMessage'])) {
+				$rule['invalidMessage'] = $databaseRules['rules']['invalidMessage'];
+			}
+			if (isset($databaseRules['rules']['extRules']) && is_array($databaseRules['rules']['extRules'])) {
+				$rule['extRules'] = $databaseRules['rules']['extRules'];
+			}
+			$rules->rules = json_encode($rule);
+			$rules->update_time = time();
+			//更新
+			$result = $rules->_update();
+		} else {
+			$rules->rules = json_encode($rule);
+			$rules->add_time = time();
+			$result = $rules->_save();
+		}
+		$result = true;
+		if ($rules->getErrors()) {
+			$result = false;
+			$this->tablesError = $rules->getErrors();
+		}
+		return $result;
+	}
+
+	/**
+	 * 更新数据表规则
+	 *
+	 * @param string $database 数据库名称
+	 * @param string $table 数据表名称
+	 * @param array $rule 规则
+	 * @return bool
+	 */
+	public function updateRules($database, $table, array $rule)
+	{
+		if (!$database || !$table) {
+			$this->tablesError = '参数不正确';
+			return false;
+		}
+		$databaseRules = $this->getRules($database, $table);
+		if (!isset($databaseRules['rules']) || !is_array($databaseRules['rules'])) {
+			$this->tablesError = '规则不存在';
+			return false;
+		}
+		$rule = array_merge($databaseRules['rules'], $rule);
+		$rules = (new \Qii\Driver\Easy())->_initialize();
+		$rules->setPrivateKey(array('database', 'table'));
+		$rules->setRules(new \Qii\Driver\Rules($this->getRuleTableInfo()));
+		$rules->database = $database;
+		$rules->table = $table;
+		$rules->rules = json_encode($rule);
+
+		$isExists = $rules->_exist();
+		if ($isExists->isError()) {
+			$this->tablesError = $isExists->getError();
+			return false;
+		}
+		if ($isExists->getResult()['database']) {
+			$rules->update_time = time();
+			//更新
+			$result = $rules->_update();
+		} else {
+			$rules->add_time = time();
+			$result = $rules->_save();
+		}
+		$result = true;
+		if ($rules->isError()) {
+			$result = false;
+			$this->tablesError = $rules->getErrors();
+		}
+		return $result;
+	}
+
+	/**
+	 * 自动表的规则
+	 *
+	 * @param $database
+	 * @param $tableName
+	 * @return array
+	 */
+	public function tableRules($database, $tableName)
+	{
+		if (!$database || !$tableName) {
+			$this->tablesError = '参数不正确';
+			return array();
+		}
+		$data = array();
+		$rules = $this->getFieldsLists($database, $tableName);
+		$data['database'] = $database;
+		$data['tableName'] = $tableName;
+		$data['rules'] = array();
+		$data['rules']['end'] = array();
+		$data['rules']['front'] = array();
+		$data['rules']['alias'] = array();
+		$data['rules']['fields'] = array();
+		foreach ($rules AS $key => $val) {
+			$data['rules']['fields'][] = $key;
+			$data['rules']['end'][$key] = $data['rules']['front'][$key] = 1;
+			$data['rules']['alias'][$key] = $key;
+			$data['rules']['length'][$key] = $val['length'];
+			$data['rules']['type'][$key] = $val['type'];
+			$data['rules']['null'][$key] = $val['null'];
+			if (isset($val['sets'])) $data['rules']['sets'][$key] = $val['sets'];
+			if (isset($val['setsArray'])) $data['rules']['setsArray'][$key] = $val['setsArray'];
+			if (isset($val['pri'])) $data['rules']['pri'][$key] = 1;
+			if (isset($val['uni'])) $data['rules']['uni'][$key] = 1;
+		}
+		if (!isset($data['rules']['validate'])) $data['rules']['validate'] = array();
+		return $data;
+	}
+
+	/**
+	 * 合并表的规则,当没有存储相关规则的时候就用系统默认规则
+	 *
+	 * @param $database
+	 * @param $tableName
+	 * @param $rules
+	 */
+	public function mergeRules($database, $tableName, &$rules)
+	{
+		$tableRules = $this->tableRules($database, $tableName);
+		$rules = array_merge($tableRules, $rules);
+		foreach ($tableRules['rules'] AS $key => $val) {
+			if (!isset($rules['rules'][$key]) || count($rules['rules'][$key]) == 0) $rules['rules'][$key] = $val;
+		}
+		return $rules;
+	}
+
+	/**
+	 * 自动合并数据表规则
+	 *
+	 * @param $database
+	 * @param $tableName
+	 * @return array
+	 */
+	public function autoRules($database, $tableName)
+	{
+		if (!$database || !$tableName) {
+			$this->tablesError = '参数不正确';
+			return array();
+		}
+		$rules = $this->getRules($database, $tableName);
+		$this->mergeRules($database, $tableName, $rules);
+		return $rules;
+	}
+
+	/**
+	 * 获取数据表的数据
+	 *
+	 * @param $database 当前数据表
+	 * @param $tableName 当前表名称
+	 * @param int $currentPage 当前页码
+	 * @param int $pageSize 每一页数据条数
+	 * @return mixed
+	 */
+	public function loadTableData($database, $tableName, $currentPage = 1, $pageSize = 12)
+	{
+		if (!$database || !$tableName) {
+			$this->tablesError = '参数不正确';
+			return array();
+		}
+		$currentPage = max(1, $currentPage);
+		$start = ($currentPage - 1) * $pageSize;
+		/*
+		$rules = $this->getRules($database, $tableName);
+		//当rules为空的时候,通过数据表结构自动生成规则
+		if(empty($rules['rules']))
+		{
+			$rules = $this->tableRules($database, $tableName);
+		}
+		else
+		{
+			$this->mergeRules($database, $tableName, $rules);
+		}*/
+		$rules = $this->autoRules($database, $tableName);
+		$data = array();
+		$data['rows'] = array();
+		$data['page'] = array('total' => 0, 'currentPage' => 0, 'totalPage' => 0);
+		$data['page']['total'] = $this->db->getOne("SELECT COUNT(*) FROM {$database}.{$tableName}");
+		$data['page']['currentPage'] = $currentPage;
+		$data['page']['totalPage'] = ceil($data['page']['total'] / $pageSize);
+		$sql = "SELECT * FROM {$database}.{$tableName} LIMIT " . $start . ',' . $pageSize;
+		$rs = $this->db->setQuery($sql);
+		$rulesCount = isset($rules['rules']['end']) && count($rules['rules']['end']) > 0 ? $rules['rules']['end'] : 0;
+		while ($row = $rs->fetch()) {
+			$val = array();
+			if ($rulesCount > 0) {
+				foreach ($rules['rules']['end'] AS $key => $field) {
+					if ($field == 1) $val[$key] = $row[$key];
+				}
+			}
+			$updateFields = array();
+			$priKeys = array();
+			foreach ($rules['rules']['pri'] AS $key => $pri) {
+				$priKeys[] = $key;
+				$updateFields[$key] = $row[$key];
+			}
+			//为了避免表中字段跟主要参数冲突,主要参数前边添加两个下划线
+			$updateFields['__pri'] = join(',', $priKeys);
+			$updateFields['__database'] = $database;
+			$updateFields['__tableName'] = $tableName;
+			$val['__updateFields'] = http_build_query($updateFields);
+			$data['rows'][] = $val;
+			unset($val);
+		}
+		$data['rules'] = $rules['rules'];
+		return $data;
+	}
+
+	/**
+	 * 获取表中的数据
+	 * @author Jinhui Zhu 2015-08-26
+	 * @param string $database
+	 * @param string $tableName
+	 * @param string $pri
+	 * @param Array $val
+	 * @return mixed
+	 */
+	public function loadDataFromTable($database, $tableName, $pri, $val)
+	{
+		if (!$database || !$tableName || (!$val && count($val) == 0)) {
+			$this->tablesError = '参数不正确';
+			return array();
+		}
+		return $this->db->whereArray($val)->selectRow($database . '.' . $tableName);
+	}
+
+	/**
+	 * 更新数据表数据
+	 * @param string $database
+	 * @param string $tableName
+	 * @param array $priVal
+	 * @param array $fields
+	 * @return bool
+	 */
+	public function updateTableData($database, $tableName, $priVal, $fields)
+	{
+		if (!$database || !$tableName || !$fields) {
+			$this->tablesError = '参数不正确';
+			return array();
+		}
+		$rules = $this->autoRules($database, $tableName);
+		$privateKey = array();
+		if (empty($priVal) && isset($rules['rules']['uni'])) $privateKey = array_keys($rules['rules']['uni']);
+		$table = (new \Qii\Driver\Easy())->_initialize();
+		$table->setPrivateKey($priVal);
+		$table->setRules(new \Qii\Driver\Rules($rules));
+		foreach ($fields AS $key => $val) {
+			$table->{$key} = $val;
+		}
+		return $result = $table->_update();
+	}
+
+	/**
+	 * 删除指定数据表中数据
+	 * 避免删除整张表的数据,验证val,如果为空就不删除
+	 * @param string $database
+	 * @param string $tableName
+	 * @param array $val {key : val}
+	 * @return bool
+	 */
+	public function removeTableData($database, $tableName, $val)
+	{
+		if (empty($val)) {
+			$this->tablesError = '参数不正确';
+			return false;
+		}
+		return $this->db->deleteObject($database . '.' . $tableName, $val);
+	}
+
+	/**
+	 * 向指定数据库中插入数据
+	 *
+	 * @param $database
+	 * @param $tableName
+	 * @param $value
+	 */
+	public function addTableData($database, $tableName, $value)
+	{
+		if (!$database || !$tableName || !$value) {
+			$this->tablesError = '参数不正确';
+			return array();
+		}
+		$rules = $this->autoRules($database, $tableName);
+		//去掉自动privateKey,通过配置文件来做
+		//$privateKey = array();
+		//if(isset($rules['rules']['uni'])) $privateKey = array_keys($rules['rules']['uni']);
+		$table = (new \Qii\Driver\Easy())->_initialize();
+		//$table->setPrivateKey($privateKey);
+		$table->setRules(new \Qii\Driver\Rules($rules));
+		foreach ($value AS $key => $val) {
+			$table->{$key} = $val;
+		}
+		try {
+			$result = $table->_save();
+			if ($result->isError()) {
+				return $result;
+			}
+			return Response::Success('addTableData', '操作成功');
+		} catch (\Exception $e) {
+			$msg = strip_tags($e->getMessage());
+			return Response::Instance(10010, 'addTableData', array('message' => $msg));
+		}
+	}
+
+	/**
+	 * 备份指定数据表
+	 *
+	 * @param $database  数据库名称
+	 * @param $tableName  数据表名称
+	 * @return string
+	 */
+	public function backupTable($database, $tableName)
+	{
+		$sql = "SELECT * FROM {$database}.{$tableName}";
+		$rs = $this->db->setQuery($sql);
+		$data = array();
+		$backupSQL = "USE {$database};\n";
+		$tableSQL = $this->getTableSQL($database, $tableName);
+		if ($tableSQL['sql'] == '') _e('获取数据表错误', __LINE__);
+		$backupSQL .= $tableSQL['sql'];
+		$i = 0;
+		$fields = array();
+		while ($row = $this->db->fetch($rs)) {
+			$fields = array_keys($row);
+			$row = array_map('addslashes', $row);
+			$data[] = '(\'' . join("','", $row) . '\')';
+			if ($i == 500) {
+				//执行一次合并操作
+				$backupSQL .= "\nINSERT INTO {$database}.{$tableName}(`" . join('`, `', $fields) . "`) VALUES " . join(', ', $data) . ";\n";
+				$data = array();
+				$i = 0;
+			} else {
+				$i++;
+			}
+		}
+		if (count($data) > 0) {
+			$backupSQL .= "\nINSERT INTO {$database}.{$tableName}(`" . join('`, `', $fields) . "`) VALUES " . join(', ', $data) . ";\n";
+		}
+		return $backupSQL;
+	}
+
+	/**
+	 * 还原数据
+	 *
+	 * @param $database  数据库名
+	 * @param $tableName  数据表名
+	 * @param $fileName  文件名
+	 * @return array|void
+	 */
+	public function restore($database, $tableName, $fileName)
+	{
+		$data = array();
+		$data['code'] = 1;
+		if (!$data || !$tableName || !$fileName) {
+			$data['msg'] = '参数错误或文件错误';
+			return $data;
+		}
+		$contents = file_get_contents($fileName);
+		$tableSQL = explode(';', $contents);
+		if (count($tableSQL) == 0) {
+			$data['msg'] = '上传的文件无相关据';
+			return $data;
+		}
+		try {
+			foreach ($tableSQL AS $sql) {
+				$sql = trim($sql);
+				if ($sql == '') continue;
+				$this->db->setQuery($sql);
+			}
+			$data['code'] = 0;
+			$data['msg'] = '成功';
+		} catch (\Exception $e) {
+			$data['code'] = $e->getCode();
+			$data['msg'] = strip_tags($e->getMessage());
+		}
+		return $data;
+	}
+}

+ 38 - 38
demo/private/plugins/loger.php

@@ -1,39 +1,39 @@
-<?php
-namespace plugins;
-
-class loger implements \Qii\Loger\Writer
-{
-	public $logerPath = 'tmp';
-	public $fileName = 'loger.log';
-
-	public function __construct()
-	{
-		$this->logerPath = dirname(dirname(__FILE__)) .DS. $this->logerPath;
-		$this->fileName = $this->logerPath . DS . date('Y-m-d') .'.'. $this->fileName;
-		return $this;
-	}
-
-	public function setFileName($fileName)
-	{
-		$this->fileName = $this->logerPath . DS . date('Y-m-d') .'.'. $fileName . '.log';
-		return $this;
-	}
-	protected function trimSpace($text)
-	{
-	    return  str_replace(array("\r\n", "\r", "\n", "\t", "\s", ' ', chr(32)), "", $text);
-	}
-
-	public function formatLog($log)
-	{
-		if(!is_array($log)) return $log;
-		return json_encode($log);
-		return $this->trimSpace(print_r($log, true));
-	}
-
-	public function writeLog($loger)
-	{
-		if(is_array($loger)) $loger = $this->formatLog($loger);
-
-		file_put_contents($this->fileName, date('Y-m-d H:i:s') ."\n\t". $loger . "\n", FILE_APPEND);
-	}
+<?php
+namespace plugins;
+
+class loger implements \Qii\Loger\Writer
+{
+	public $logerPath = 'tmp';
+	public $fileName = 'loger.log';
+
+	public function __construct()
+	{
+		$this->logerPath = dirname(dirname(__FILE__)) .DS. $this->logerPath;
+		$this->fileName = $this->logerPath . DS . date('Y-m-d') .'.'. $this->fileName;
+		return $this;
+	}
+
+	public function setFileName($fileName)
+	{
+		$this->fileName = $this->logerPath . DS . date('Y-m-d') .'.'. $fileName . '.log';
+		return $this;
+	}
+	protected function trimSpace($text)
+	{
+	    return  str_replace(array("\r\n", "\r", "\n", "\t", "\s", ' ', chr(32)), "", $text);
+	}
+
+	public function formatLog($log)
+	{
+		if(!is_array($log)) return $log;
+		return json_encode($log);
+		return $this->trimSpace(print_r($log, true));
+	}
+
+	public function writeLog($loger)
+	{
+		if(is_array($loger)) $loger = $this->formatLog($loger);
+
+		file_put_contents($this->fileName, date('Y-m-d H:i:s') ."\n\t". $loger . "\n", FILE_APPEND);
+	}
 }

+ 46 - 46
demo/private/view/error.html

@@ -1,46 +1,46 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title>{#if $code == 0#}提示{#else#}出错了{#/if#}</title>
-<link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
-<script type="text/javascript" src="{#helper\globals::getJs("jquery")#}"></script>
-
-<script language="javascript">
-	$(function(){
-    $('.error').css({'position':'absolute','left':($(window).width()-490)/2});
-	$(window).resize(function(){  
-    $('.error').css({'position':'absolute','left':($(window).width()-490)/2});
-    })  
-});  
-</script> 
-
-
-</head>
-
-
-<body style="background:#edf6fa;">
-
-	<div class="place">
-    <span>位置:</span>
-    <ul class="placeul">
-    <li><a href="{#helper\globals::getFullUrl("main/index")#}">首页</a></li>
-    <li>{#if $code == 0#}提示{#else#}错误提示{#/if#}</li>
-    </ul>
-    </div>
-    
-    <div class="error {#if $code == 404#}error404{#/if#}">
-    
-    <h2>{#if $code != 0#}非常遗憾,{#/if#}{#$desc|default:'您访问的页面存在问题!'#}</h2>
-    <p>{#if $code != 0#}看到这个提示,就自认倒霉吧!{#/if#}</p>
-    {#if $code != 0#}
-    <div class="reindex"><a href="{#helper\globals::getFullUrl("/main/index")#}" target="_parent">返回首页
-    {#/if#}
-    </a></div>
-    
-    </div>
-
-
-</body>
-
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>{#if $code == 0#}提示{#else#}出错了{#/if#}</title>
+<link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
+<script type="text/javascript" src="{#helper\globals::getJs("jquery")#}"></script>
+
+<script language="javascript">
+	$(function(){
+    $('.error').css({'position':'absolute','left':($(window).width()-490)/2});
+	$(window).resize(function(){  
+    $('.error').css({'position':'absolute','left':($(window).width()-490)/2});
+    })  
+});  
+</script> 
+
+
+</head>
+
+
+<body style="background:#edf6fa;">
+
+	<div class="place">
+    <span>位置:</span>
+    <ul class="placeul">
+    <li><a href="{#helper\globals::getFullUrl("main/index")#}">首页</a></li>
+    <li>{#if $code == 0#}提示{#else#}错误提示{#/if#}</li>
+    </ul>
+    </div>
+    
+    <div class="error {#if $code == 404#}error404{#/if#}">
+    
+    <h2>{#if $code != 0#}非常遗憾,{#/if#}{#$desc|default:'您访问的页面存在问题!'#}</h2>
+    <p>{#if $code != 0#}看到这个提示,就自认倒霉吧!{#/if#}</p>
+    {#if $code != 0#}
+    <div class="reindex"><a href="{#helper\globals::getFullUrl("/main/index")#}" target="_parent">返回首页
+    {#/if#}
+    </a></div>
+    
+    </div>
+
+
+</body>
+
+</html>

+ 107 - 107
demo/private/view/manage/data/add.html

@@ -1,107 +1,107 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <title>数据编辑器</title>
-
-
-    <link href="{#_link("static/css/style.css")#}" rel="stylesheet" type="text/css" />
-    <link href="{#_link("static/css/select.css")#}" rel="stylesheet" type="text/css" />
-    <script type="text/javascript" src="{#_link("static/js/jquery.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/jquery.idTabs.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/select-ui.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/jquery.bgiframe.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/jquery.multiSelect.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/tips.js")#}"></script>
-	<script type="text/javascript" src="{#_link("static/js/notify-custom.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link('static/js/xheditor/xheditor-1.2.2.min.js')#}"></script>
-    <script type="text/javascript" src="{#_link('static/js/xheditor/xheditor_lang/zh-cn.js')#}"></script>
-	<script>
-	$(document).ready(function(){
-		$("#modifyForm").submit(function()
-		{
-			$('input').removeClass('input_error');
-			$.post($(this).attr('action'), $(this).serialize(), function(r)
-		    {
-				if(r == null)
-				{
-					$.notify("系统错误,请重试", "error");
-				};
-
-				if(typeof r.code != 'undefined' && r.code == 0)
-		        {
-					$.notify("保存成功", "success");
-		        }
-		        else
-		        {
-					$.notify((r.error || "保存失败"), "error");
-                    if(r.error && r.error.fields)
-                    {
-                        for(var field in r.error.fields)
-                        {
-                            $('input[name="fields['+field+']"]').addClass('input_error');
-                        }
-                    }
-                    if(r.error && r.error.opt && r.error.opt._save)
-                    {
-                    	$.notify(r.error.opt._save, "error");
-                    }
-		        }
-			}, 'json');
-			return false;
-		});
-	});
-	</script>
-</head>
-
-<body>
-
-<div class="place">
-    <span>位置:</span>
-    <ul class="placeul">
-        <li><a href="{#$pathes.index#}">首页</a></li>
-        <li><a href="{#_link("database/creator")#}?database={#$database#}&tableName={#$tableName#}">规则管理</a></li>
-        <li><a href="{#$pathes.table#}?database={#$database#}&tableName={#$tableName#}">数据管理</a></li>
-        <li>添加数据</li>
-    </ul>
-</div>
-
-<div class="formbody">
-
-    <div class="formtitle"><span>基本信息</span></div>
-    <form name="modifyForm" id="modifyForm" method="POST" action="{#_link("api/database/add.json")#}?isAjax=1">
-		<input type="hidden" name="database" value="{#$database#}" id="database" />
-		<input type="hidden" name="tableName" value="{#$tableName#}" id="tableName" />
-	    <ul class="forminfo">
-	        {#foreach key=key item=item from=$fields#}
-	        <li><label>{#if isset($rules['rules']['alias'][$key]) && $rules['rules']['alias'][$key] != ''#}{#$rules['rules']['alias'][$key]#}{#else#}{#$key#}{#/if#}</label>
-	            {#if $rules['rules']['type'][$key] == 'mediumtext' || $rules['rules']['type'][$key] == 'text'#}
-	            <textarea name="fields[{#$key#}]" cols="100" rows="20" class="textinput {#if helper\globals::hasHtmlTag($item)#}xheditor{#/if#}"></textarea>
-	            {#else if $rules['rules']['type'][$key] == 'enum'#}
-	            <div class="vocation">
-	            <select class="select1" name="fields[{#$key#}]" id="fields[{#$key#}]">
-	            {#foreach key=set item=sitem from=$rules['rules']['setsArray'][$key]#}
-	            	<option value="{#$sitem#}"  {#if $item == $sitem#}selected{#/if#}>{#$sitem#}</option>
-	            {#/foreach#}
-	            </select>
-	            </div>
-	            {#else#}
-	            <input name="fields[{#$key#}]" type="text" class="dfinput" value="" />
-	            {#/if#}
-	            <i>{#if isset($rules['rules']['length'][$key]) && $rules['rules']['length'][$key] > 0 #}最大长度{#$rules['rules']['length'][$key]#}个字符{#else#}{#/if#}</i></li>
-	        {#/foreach#}
-	        <li><label>&nbsp;</label><input name="submit" type="submit" class="btn" value="确认保存"/></li>
-	    </ul>
-    </form>
-
-</div>
-<script>
-$('.xheditor').xheditor({skin:'nostyle'});
-$(".select1").uedSelect({
-	width : 345			  
-});
-</script>
-
-</body>
-
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>数据编辑器</title>
+
+
+    <link href="{#_link("static/css/style.css")#}" rel="stylesheet" type="text/css" />
+    <link href="{#_link("static/css/select.css")#}" rel="stylesheet" type="text/css" />
+    <script type="text/javascript" src="{#_link("static/js/jquery.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.idTabs.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/select-ui.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.bgiframe.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.multiSelect.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/tips.js")#}"></script>
+	<script type="text/javascript" src="{#_link("static/js/notify-custom.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link('static/js/xheditor/xheditor-1.2.2.min.js')#}"></script>
+    <script type="text/javascript" src="{#_link('static/js/xheditor/xheditor_lang/zh-cn.js')#}"></script>
+	<script>
+	$(document).ready(function(){
+		$("#modifyForm").submit(function()
+		{
+			$('input').removeClass('input_error');
+			$.post($(this).attr('action'), $(this).serialize(), function(r)
+		    {
+				if(r == null)
+				{
+					$.notify("系统错误,请重试", "error");
+				};
+
+				if(typeof r.code != 'undefined' && r.code == 0)
+		        {
+					$.notify("保存成功", "success");
+		        }
+		        else
+		        {
+					$.notify((r.error || "保存失败"), "error");
+                    if(r.error && r.error.fields)
+                    {
+                        for(var field in r.error.fields)
+                        {
+                            $('input[name="fields['+field+']"]').addClass('input_error');
+                        }
+                    }
+                    if(r.error && r.error.opt && r.error.opt._save)
+                    {
+                    	$.notify(r.error.opt._save, "error");
+                    }
+		        }
+			}, 'json');
+			return false;
+		});
+	});
+	</script>
+</head>
+
+<body>
+
+<div class="place">
+    <span>位置:</span>
+    <ul class="placeul">
+        <li><a href="{#$pathes.index#}">首页</a></li>
+        <li><a href="{#_link("database/creator")#}?database={#$database#}&tableName={#$tableName#}">规则管理</a></li>
+        <li><a href="{#$pathes.table#}?database={#$database#}&tableName={#$tableName#}">数据管理</a></li>
+        <li>添加数据</li>
+    </ul>
+</div>
+
+<div class="formbody">
+
+    <div class="formtitle"><span>基本信息</span></div>
+    <form name="modifyForm" id="modifyForm" method="POST" action="{#_link("api/database/add.json")#}?isAjax=1">
+		<input type="hidden" name="database" value="{#$database#}" id="database" />
+		<input type="hidden" name="tableName" value="{#$tableName#}" id="tableName" />
+	    <ul class="forminfo">
+	        {#foreach key=key item=item from=$fields#}
+	        <li><label>{#if isset($rules['rules']['alias'][$key]) && $rules['rules']['alias'][$key] != ''#}{#$rules['rules']['alias'][$key]#}{#else#}{#$key#}{#/if#}</label>
+	            {#if $rules['rules']['type'][$key] == 'mediumtext' || $rules['rules']['type'][$key] == 'text'#}
+	            <textarea name="fields[{#$key#}]" cols="100" rows="20" class="textinput {#if helper\globals::hasHtmlTag($item)#}xheditor{#/if#}"></textarea>
+	            {#else if $rules['rules']['type'][$key] == 'enum'#}
+	            <div class="vocation">
+	            <select class="select1" name="fields[{#$key#}]" id="fields[{#$key#}]">
+	            {#foreach key=set item=sitem from=$rules['rules']['setsArray'][$key]#}
+	            	<option value="{#$sitem#}"  {#if $item == $sitem#}selected{#/if#}>{#$sitem#}</option>
+	            {#/foreach#}
+	            </select>
+	            </div>
+	            {#else#}
+	            <input name="fields[{#$key#}]" type="text" class="dfinput" value="" />
+	            {#/if#}
+	            <i>{#if isset($rules['rules']['length'][$key]) && $rules['rules']['length'][$key] > 0 #}最大长度{#$rules['rules']['length'][$key]#}个字符{#else#}{#/if#}</i></li>
+	        {#/foreach#}
+	        <li><label>&nbsp;</label><input name="submit" type="submit" class="btn" value="确认保存"/></li>
+	    </ul>
+    </form>
+
+</div>
+<script>
+$('.xheditor').xheditor({skin:'nostyle'});
+$(".select1").uedSelect({
+	width : 345			  
+});
+</script>
+
+</body>
+
+</html>

+ 14 - 14
demo/private/view/manage/data/code.html

@@ -1,15 +1,15 @@
-<?php
-namespace Model;
-
-use \Qii\Driver\Model;
-
-class {#$code.className#} extends Model
-{
-	public function __construct()
-	{
-		parent::__construct();
-		$this->setRules(new \Qii\Driver\Rules(\Qii\Import::includes('configure/table/{#$code.database#}.{#$code.className#}.config.php')));
-	}
-}
-
+<?php
+namespace Model;
+
+use \Qii\Driver\Model;
+
+class {#$code.className#} extends Model
+{
+	public function __construct()
+	{
+		parent::__construct();
+		$this->setRules(new \Qii\Driver\Rules(\Qii\Import::includes('configure/table/{#$code.database#}.{#$code.className#}.config.php')));
+	}
+}
+
 ?>

+ 184 - 184
demo/private/view/manage/data/creator.html

@@ -1,184 +1,184 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <title>规则生成</title>
-    <link href="{#_link("static/css/style.css")#}" rel="stylesheet" type="text/css" />
-    <link href="{#_link("static/css/select.css")#}" rel="stylesheet" type="text/css" />
-    <link href="{#_link("static/css/jquery.multiSelect.css")#}" rel="stylesheet" type="text/css" />
-    <script type="text/javascript" src="{#_link("static/js/jquery.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/jquery.idTabs.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/select-ui.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/jquery.bgiframe.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/jquery.multiSelect.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/tips.js")#}"></script>
-	<script type="text/javascript" src="{#_link("static/js/notify-custom.min.js")#}"></script>
-
-    <script type="text/javascript">
-            $(document).ready(function(){
-				$(".multi").multiSelect({selectAllText: '选择所有', noneSelected: '请选择', oneOrMoreSelected:'共选择%项'});
-
-				$("#creatorForm").submit( function()
-                {
-					$.post($(this).attr('action'), $(this).serialize(), function(r)
-                    {
-						if(typeof r.code != 'undefined' && r.code == 0)
-                        {
-							$.notify("保存成功", "success");
-                        }
-                        else
-                        {
-							$.notify("保存失败", "error");
-                        }
-					}, 'json');
-					return false;
-				});
-				
-	            $('input[name="download"]').on('click', function(){
-	            	var database = $('input[name="database"]').val();
-	            	var tableName = $('input[name="tableName"]').val();
-	            	var url = '{#_link("api/database/downloadConfig.json")#}?database='+ database + '&tableName='+ tableName;
-	            	window.location.href = url;
-	            });
-                $('input[name="creatBasicCode"]').on('click', function(){
-                    var database = $('input[name="database"]').val();
-                    var tableName = $('input[name="tableName"]').val();
-                    var url = '{#_link("api/database/creatBasicCode.json")#}?database='+ database + '&tableName='+ tableName;
-                    window.location.href = url;
-                });
-            });
-    </script>
-
-
-</head>
-
-
-<body>
-
-{#if $loadDatabase#}
-<div class="place">
-    <span>位置:</span>
-    <ul class="placeul">
-        <li><a href="{#$pathes.index#}">首页</a></li>
-        <li><a href="{#$pathes.creator#}?database={#$database#}&tableName={#$tableName#}">规则管理</a></li>
-        <li>规则生成器</a></li>
-    </ul>
-</div>
-{#/if#}
-<div class="rightinfo">
-    {#if $loadDatabase#}
-    <div class="tools">
-    	<select id="database" name="database" onchange="if(this.value != ''){window.location.href = '{#_link("database/creator")#}?database='+ $('#database').val()}">
-    		<option value="">请选择数据库</option>
-            {#foreach key=key item=item from=$databases#}
-            <option value="{#$item#}" {#if $database == $item#}selected{#/if#}>{#$item#}</option>
-            {#/foreach#}
-    	</select>
-        <select name="tableName" onchange="if(this.value != ''){window.location.href = '{#_link("database/creator")#}?tableName='+ this.value +'&database='+ $('#database').val() }">
-            <option>请选择数据表</option>
-            {#foreach key=key item=item from=$tables#}
-            <option value="{#$item#}" {#if $tableName == $item#}selected{#/if#}>{#$item#}</option>
-            {#/foreach#}
-        </select>
-        {#if $tables|count > 0#}
-        <a href="{#_link("database/table")#}?database={#$database#}&tableName={#$tableName#}">数据管理</a>
-        {#/if#}
-    </div>
-    {#/if#}
-    {#if $fields#}
-    <form name="creatorForm" id="creatorForm" action="{#_link("api/database/creator.json")#}?isAjax=1" method="POST">
-    <input type="hidden" name="tableName" value="{#$tableName#}"  />
-    <input type="hidden" name="database" value="{#$database#}"  />
-    <table class="tablelist">
-        <thead>
-        <tr>
-            <th>字段名</th>
-            <th>显示名</th>
-            <th><input type="checkbox" name="selectFrontAll">前端使用</th>
-            <th><input type="checkbox" name="selectEndAll">后端使用</th>
-            <th>默认值</th>
-            <th>验证类型</th>
-            <th><input type="checkbox" name="selectSaveAll">保存验证</th>
-            <th><input type="checkbox" name="selectSaveAllValid">保存查询字段</th>
-            <th><input type="checkbox" name="selectUpdateAll">更新验证</th>
-            <th><input type="checkbox" name="selectUpdateAllValid">更新查询字段</th>
-            <th><input type="checkbox" name="selectRemoveAll">删除验证</th>
-            <th><input type="checkbox" name="selectRemoveAllValid">删除查询字段</th>
-        </tr>
-        </thead>
-        <tbody>
-        {#foreach item=item key=key from=$fields#}
-    	<input type="hidden" name="{#$tableName#}[length][{#$key#}]" value="{#$item.length#}"  />
-    	<input type="hidden" name="{#$tableName#}[type][{#$key#}]" value="{#$item.type#}"  />
-        <input type="hidden" name="{#$tableName#}[fields][]" value="{#$key#}" />
-    	{#if isset($item.pri)#}<input type="hidden" name="{#$tableName#}[pri][{#$key#}]" value="{#$item.pri#}"  />{#/if#}
-    	{#if isset($item.uni)#}<input type="hidden" name="{#$tableName#}[uni][{#$key#}]" value="{#$item.uni#}"  />{#/if#}
-        <tr>
-            <td>{#$key#}</td>
-            <td><input type="text" name="{#$tableName#}[alias][{#$key#}]" class="dfinputmin" value="{#if isset($rules['alias'][$key])#}{#$rules['alias'][$key]#}{#/if#}" /></td>
-            <td><input class="selectFrontFields" type="checkbox" name="{#$tableName#}[front][{#$key#}]" value="1" {#if isset($rules['front'][$key])#} checked="checked"{#/if#} /></td>
-            <td><input class="selectEndFields" type="checkbox" name="{#$tableName#}[end][{#$key#}]" value="1" {#if isset($rules['end'][$key])#} checked="checked"{#/if#} /></td>
-            <td><input type="text" name="{#$tableName#}[default][{#$key#}]" class="dfinputmin" value="{#if isset($rules['default'][$key])#}{#$rules['default'][$key]#}{#elseif isset($item.default)#}{#$item.default#}{#/if#}" /></td>
-            <td>
-			<select id="{#$tableName#}[validate][{#$key#}]" name="{#$tableName#}[validate][{#$key#}]" class="multi" multiple="multiple" size="1">
-                	<option value=""></option>
-                    {#foreach from=$validate key=k item=v#}
-					<option value="{#$k#}"{#if isset($validateRules[$key]) && ($k|in_array:$validateRules[$key])#} selected{#/if#}>{#$v#}</option>
-                    {#/foreach#}
-                </select>
-            </td>
-            <td><input class="selectSaveFields" type="checkbox" name="{#$tableName#}[save][{#$key#}]" value="1" {#if isset($rules['save'][$key])#} checked="checked"{#/if#} /></td>
-            <td><input class="selectSaveFieldsValid" type="checkbox" name="{#$tableName#}[saveValid][{#$key#}]" value="1" {#if isset($rules['saveValid'][$key])#} checked="checked"{#/if#} /></td>
-            <td><input class="selectUpdateFields" type="checkbox" name="{#$tableName#}[update][{#$key#}]" value="1" {#if isset($rules['update'][$key])#} checked="checked"{#/if#} /></td>
-            <td><input class="selectUpdateFieldsValid" type="checkbox" name="{#$tableName#}[updateValid][{#$key#}]" value="1" {#if isset($rules['updateValid'][$key])#} checked="checked"{#/if#} /></td>
-            <td><input class="selectRemoveFields" type="checkbox" name="{#$tableName#}[remove][{#$key#}]" value="1" {#if isset($rules['remove'][$key])#} checked="checked"{#/if#} /></td>
-            <td><input class="selectRemoveFieldsValid" type="checkbox" name="{#$tableName#}[removeValid][{#$key#}]" value="1" {#if isset($rules['removeValid'][$key])#} checked="checked"{#/if#} /></td>
-        </tr>
-        {#/foreach#}
-        </tbody>
-    </table>
-
-
-    <div class="pagin">
-        <div class="message">&nbsp;</div>
-        <ul class="paginList">
-           <li><input type="button" name="rulesManager" value="详细规则管理" class="btn" /> <input type="submit" name="submit" value="保存规则" class="btn" /> <input type="button" name="download" value="下载规则" class="btn" /> <input type="button" name="creatBasicCode" value="生成基础代码" class="btn" /></li>
-        </ul>
-    </div>
-    {#/if#}
-	</form>
-</div>
-
-<script type="text/javascript">
-    $('.tablelist tbody tr:odd').addClass('odd');
-    $('input[name="rulesManager"]').on('click', function(){
-    	window.location.href = '{#_link("database/rules")#}?database={#$database#}&tableName={#$tableName#}';
-    });
-    $('input[name="selectFrontAll"]').on('click', function(){
-    	$('.selectFrontFields').prop('checked', $('input[name="selectFrontAll"]').prop('checked'));
-    });
-    $('input[name="selectEndAll"]').on('click', function(){
-    	$('.selectEndFields').prop('checked', $('input[name="selectEndAll"]').prop('checked'));
-    });
-    $('input[name="selectSaveAll"]').on('click', function(){
-    	$('.selectSaveFields').prop('checked', $('input[name="selectSaveAll"]').prop('checked'));
-    });
-    $('input[name="selectSaveAllValid"]').on('click', function(){
-    	$('.selectSaveFieldsValid').prop('checked', $('input[name="selectSaveAllValid"]').prop('checked'));
-    });
-    $('input[name="selectUpdateAll"]').on('click', function(){
-    	$('.selectUpdateFields').prop('checked', $('input[name="selectUpdateAll"]').prop('checked'));
-    });
-    $('input[name="selectUpdateAllValid"]').on('click', function(){
-    	$('.selectUpdateFieldsValid').prop('checked', $('input[name="selectUpdateAllValid"]').prop('checked'));
-    });
-    $('input[name="selectRemoveAll"]').on('click', function(){
-    	$('.selectRemoveFields').prop('checked', $('input[name="selectRemoveAll"]').prop('checked'));
-    });
-    $('input[name="selectRemoveAllValid"]').on('click', function(){
-    	$('.selectRemoveFieldsValid').prop('checked', $('input[name="selectRemoveAllValid"]').prop('checked'));
-    });
-</script>
-</body>
-
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>规则生成</title>
+    <link href="{#_link("static/css/style.css")#}" rel="stylesheet" type="text/css" />
+    <link href="{#_link("static/css/select.css")#}" rel="stylesheet" type="text/css" />
+    <link href="{#_link("static/css/jquery.multiSelect.css")#}" rel="stylesheet" type="text/css" />
+    <script type="text/javascript" src="{#_link("static/js/jquery.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.idTabs.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/select-ui.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.bgiframe.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.multiSelect.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/tips.js")#}"></script>
+	<script type="text/javascript" src="{#_link("static/js/notify-custom.min.js")#}"></script>
+
+    <script type="text/javascript">
+            $(document).ready(function(){
+				$(".multi").multiSelect({selectAllText: '选择所有', noneSelected: '请选择', oneOrMoreSelected:'共选择%项'});
+
+				$("#creatorForm").submit( function()
+                {
+					$.post($(this).attr('action'), $(this).serialize(), function(r)
+                    {
+						if(typeof r.code != 'undefined' && r.code == 0)
+                        {
+							$.notify("保存成功", "success");
+                        }
+                        else
+                        {
+							$.notify("保存失败", "error");
+                        }
+					}, 'json');
+					return false;
+				});
+				
+	            $('input[name="download"]').on('click', function(){
+	            	var database = $('input[name="database"]').val();
+	            	var tableName = $('input[name="tableName"]').val();
+	            	var url = '{#_link("api/database/downloadConfig.json")#}?database='+ database + '&tableName='+ tableName;
+	            	window.location.href = url;
+	            });
+                $('input[name="creatBasicCode"]').on('click', function(){
+                    var database = $('input[name="database"]').val();
+                    var tableName = $('input[name="tableName"]').val();
+                    var url = '{#_link("api/database/creatBasicCode.json")#}?database='+ database + '&tableName='+ tableName;
+                    window.location.href = url;
+                });
+            });
+    </script>
+
+
+</head>
+
+
+<body>
+
+{#if $loadDatabase#}
+<div class="place">
+    <span>位置:</span>
+    <ul class="placeul">
+        <li><a href="{#$pathes.index#}">首页</a></li>
+        <li><a href="{#$pathes.creator#}?database={#$database#}&tableName={#$tableName#}">规则管理</a></li>
+        <li>规则生成器</a></li>
+    </ul>
+</div>
+{#/if#}
+<div class="rightinfo">
+    {#if $loadDatabase#}
+    <div class="tools">
+    	<select id="database" name="database" onchange="if(this.value != ''){window.location.href = '{#_link("database/creator")#}?database='+ $('#database').val()}">
+    		<option value="">请选择数据库</option>
+            {#foreach key=key item=item from=$databases#}
+            <option value="{#$item#}" {#if $database == $item#}selected{#/if#}>{#$item#}</option>
+            {#/foreach#}
+    	</select>
+        <select name="tableName" onchange="if(this.value != ''){window.location.href = '{#_link("database/creator")#}?tableName='+ this.value +'&database='+ $('#database').val() }">
+            <option>请选择数据表</option>
+            {#foreach key=key item=item from=$tables#}
+            <option value="{#$item#}" {#if $tableName == $item#}selected{#/if#}>{#$item#}</option>
+            {#/foreach#}
+        </select>
+        {#if $tables|count > 0#}
+        <a href="{#_link("database/table")#}?database={#$database#}&tableName={#$tableName#}">数据管理</a>
+        {#/if#}
+    </div>
+    {#/if#}
+    {#if $fields#}
+    <form name="creatorForm" id="creatorForm" action="{#_link("api/database/creator.json")#}?isAjax=1" method="POST">
+    <input type="hidden" name="tableName" value="{#$tableName#}"  />
+    <input type="hidden" name="database" value="{#$database#}"  />
+    <table class="tablelist">
+        <thead>
+        <tr>
+            <th>字段名</th>
+            <th>显示名</th>
+            <th><input type="checkbox" name="selectFrontAll">前端使用</th>
+            <th><input type="checkbox" name="selectEndAll">后端使用</th>
+            <th>默认值</th>
+            <th>验证类型</th>
+            <th><input type="checkbox" name="selectSaveAll">保存验证</th>
+            <th><input type="checkbox" name="selectSaveAllValid">保存查询字段</th>
+            <th><input type="checkbox" name="selectUpdateAll">更新验证</th>
+            <th><input type="checkbox" name="selectUpdateAllValid">更新查询字段</th>
+            <th><input type="checkbox" name="selectRemoveAll">删除验证</th>
+            <th><input type="checkbox" name="selectRemoveAllValid">删除查询字段</th>
+        </tr>
+        </thead>
+        <tbody>
+        {#foreach item=item key=key from=$fields#}
+    	<input type="hidden" name="{#$tableName#}[length][{#$key#}]" value="{#$item.length#}"  />
+    	<input type="hidden" name="{#$tableName#}[type][{#$key#}]" value="{#$item.type#}"  />
+        <input type="hidden" name="{#$tableName#}[fields][]" value="{#$key#}" />
+    	{#if isset($item.pri)#}<input type="hidden" name="{#$tableName#}[pri][{#$key#}]" value="{#$item.pri#}"  />{#/if#}
+    	{#if isset($item.uni)#}<input type="hidden" name="{#$tableName#}[uni][{#$key#}]" value="{#$item.uni#}"  />{#/if#}
+        <tr>
+            <td>{#$key#}</td>
+            <td><input type="text" name="{#$tableName#}[alias][{#$key#}]" class="dfinputmin" value="{#if isset($rules['alias'][$key])#}{#$rules['alias'][$key]#}{#/if#}" /></td>
+            <td><input class="selectFrontFields" type="checkbox" name="{#$tableName#}[front][{#$key#}]" value="1" {#if isset($rules['front'][$key])#} checked="checked"{#/if#} /></td>
+            <td><input class="selectEndFields" type="checkbox" name="{#$tableName#}[end][{#$key#}]" value="1" {#if isset($rules['end'][$key])#} checked="checked"{#/if#} /></td>
+            <td><input type="text" name="{#$tableName#}[default][{#$key#}]" class="dfinputmin" value="{#if isset($rules['default'][$key])#}{#$rules['default'][$key]#}{#elseif isset($item.default)#}{#$item.default#}{#/if#}" /></td>
+            <td>
+			<select id="{#$tableName#}[validate][{#$key#}]" name="{#$tableName#}[validate][{#$key#}]" class="multi" multiple="multiple" size="1">
+                	<option value=""></option>
+                    {#foreach from=$validate key=k item=v#}
+					<option value="{#$k#}"{#if isset($validateRules[$key]) && ($k|in_array:$validateRules[$key])#} selected{#/if#}>{#$v#}</option>
+                    {#/foreach#}
+                </select>
+            </td>
+            <td><input class="selectSaveFields" type="checkbox" name="{#$tableName#}[save][{#$key#}]" value="1" {#if isset($rules['save'][$key])#} checked="checked"{#/if#} /></td>
+            <td><input class="selectSaveFieldsValid" type="checkbox" name="{#$tableName#}[saveValid][{#$key#}]" value="1" {#if isset($rules['saveValid'][$key])#} checked="checked"{#/if#} /></td>
+            <td><input class="selectUpdateFields" type="checkbox" name="{#$tableName#}[update][{#$key#}]" value="1" {#if isset($rules['update'][$key])#} checked="checked"{#/if#} /></td>
+            <td><input class="selectUpdateFieldsValid" type="checkbox" name="{#$tableName#}[updateValid][{#$key#}]" value="1" {#if isset($rules['updateValid'][$key])#} checked="checked"{#/if#} /></td>
+            <td><input class="selectRemoveFields" type="checkbox" name="{#$tableName#}[remove][{#$key#}]" value="1" {#if isset($rules['remove'][$key])#} checked="checked"{#/if#} /></td>
+            <td><input class="selectRemoveFieldsValid" type="checkbox" name="{#$tableName#}[removeValid][{#$key#}]" value="1" {#if isset($rules['removeValid'][$key])#} checked="checked"{#/if#} /></td>
+        </tr>
+        {#/foreach#}
+        </tbody>
+    </table>
+
+
+    <div class="pagin">
+        <div class="message">&nbsp;</div>
+        <ul class="paginList">
+           <li><input type="button" name="rulesManager" value="详细规则管理" class="btn" /> <input type="submit" name="submit" value="保存规则" class="btn" /> <input type="button" name="download" value="下载规则" class="btn" /> <input type="button" name="creatBasicCode" value="生成基础代码" class="btn" /></li>
+        </ul>
+    </div>
+    {#/if#}
+	</form>
+</div>
+
+<script type="text/javascript">
+    $('.tablelist tbody tr:odd').addClass('odd');
+    $('input[name="rulesManager"]').on('click', function(){
+    	window.location.href = '{#_link("database/rules")#}?database={#$database#}&tableName={#$tableName#}';
+    });
+    $('input[name="selectFrontAll"]').on('click', function(){
+    	$('.selectFrontFields').prop('checked', $('input[name="selectFrontAll"]').prop('checked'));
+    });
+    $('input[name="selectEndAll"]').on('click', function(){
+    	$('.selectEndFields').prop('checked', $('input[name="selectEndAll"]').prop('checked'));
+    });
+    $('input[name="selectSaveAll"]').on('click', function(){
+    	$('.selectSaveFields').prop('checked', $('input[name="selectSaveAll"]').prop('checked'));
+    });
+    $('input[name="selectSaveAllValid"]').on('click', function(){
+    	$('.selectSaveFieldsValid').prop('checked', $('input[name="selectSaveAllValid"]').prop('checked'));
+    });
+    $('input[name="selectUpdateAll"]').on('click', function(){
+    	$('.selectUpdateFields').prop('checked', $('input[name="selectUpdateAll"]').prop('checked'));
+    });
+    $('input[name="selectUpdateAllValid"]').on('click', function(){
+    	$('.selectUpdateFieldsValid').prop('checked', $('input[name="selectUpdateAllValid"]').prop('checked'));
+    });
+    $('input[name="selectRemoveAll"]').on('click', function(){
+    	$('.selectRemoveFields').prop('checked', $('input[name="selectRemoveAll"]').prop('checked'));
+    });
+    $('input[name="selectRemoveAllValid"]').on('click', function(){
+    	$('.selectRemoveFieldsValid').prop('checked', $('input[name="selectRemoveAllValid"]').prop('checked'));
+    });
+</script>
+</body>
+
+</html>

+ 21 - 21
demo/private/view/manage/data/pages.html

@@ -1,22 +1,22 @@
-<script type="text/javascript" src="{#helper\globals::getJs("pages")#}"></script>
-<div class="pagin" data-js="page" data-total="{#$pagesData.totalPage#}" data-current="{#$pagesData.currentPage#}" data-ref="{#$pagesRef#}">
-<div class="message">{#if $pagesData.total > 0#}共&nbsp;<i class="blue">{#$pagesData.total#}</i>&nbsp;条记录{#else#}无相关记录{#/if#},当前显示第&nbsp;<i class="blue"><span class="inner" data-page="{#$pagesData.currentPage#}">{#$pagesData.currentPage#}</span>&nbsp;{#if $pagesData.totalPage >= 1#}/&nbsp;<span class="inner" data-page="{#$pagesData.totalPage#}">{#$pagesData.totalPage#}</span>{#/if#}</i>&nbsp;页</div>
-<ul class="paginList">
-    {#if $pagesData.totalPage > 1#}
-    <li class="paginItem" data-page="pre"><a href="javascript:;"><span class="{#if $pagesData.currentPage == 1 || $pagesData.totalPage == 1#}pagepre{#else#}pagepre_highlight{#/if#}"></span></a></li>
-    {#if $pagesData.currentPage - 5 > 1#}
-    <li data-page="less" class="paginItem less"><a href="javascript:;">...</a></li>
-    {#/if#}
-    {#section name="loop" loop=$pagesData.totalPage start=$start max=10 #}
-    <li data-page="{#$smarty.section.loop.index  + 1#}" class="paginItem {#if $smarty.section.loop.index + 1 == $pagesData.currentPage#}current{#/if#}"><a href="javascript:;">{#$smarty.section.loop.index  + 1#}</a></li>
-    {#/section#}
-    {#if $pagesData.totalPage >= $pagesData.currentPage + 10#}
-    <li data-page="more" class="paginItem more"><a href="javascript:;">...</a></li>
-    {#/if#}
-    <li data-page="next" class="paginItem"><a href="javascript:;"><span class="{#if $pagesData.totalPage == 1 || $pagesData.currentPage >= $pagesData.totalPage#}pagenxt{#else#}pagenxt_highlight{#/if#}"></span></a></li>
-    {#/if#}
-</ul>
-</div>
-<script>
-$('[data-js=page]').pages({ref : 'data-ref', total : 'data-total', current : 'data-current'});
+<script type="text/javascript" src="{#helper\globals::getJs("pages")#}"></script>
+<div class="pagin" data-js="page" data-total="{#$pagesData.totalPage#}" data-current="{#$pagesData.currentPage#}" data-ref="{#$pagesRef#}">
+<div class="message">{#if $pagesData.total > 0#}共&nbsp;<i class="blue">{#$pagesData.total#}</i>&nbsp;条记录{#else#}无相关记录{#/if#},当前显示第&nbsp;<i class="blue"><span class="inner" data-page="{#$pagesData.currentPage#}">{#$pagesData.currentPage#}</span>&nbsp;{#if $pagesData.totalPage >= 1#}/&nbsp;<span class="inner" data-page="{#$pagesData.totalPage#}">{#$pagesData.totalPage#}</span>{#/if#}</i>&nbsp;页</div>
+<ul class="paginList">
+    {#if $pagesData.totalPage > 1#}
+    <li class="paginItem" data-page="pre"><a href="javascript:;"><span class="{#if $pagesData.currentPage == 1 || $pagesData.totalPage == 1#}pagepre{#else#}pagepre_highlight{#/if#}"></span></a></li>
+    {#if $pagesData.currentPage - 5 > 1#}
+    <li data-page="less" class="paginItem less"><a href="javascript:;">...</a></li>
+    {#/if#}
+    {#section name="loop" loop=$pagesData.totalPage start=$start max=10 #}
+    <li data-page="{#$smarty.section.loop.index  + 1#}" class="paginItem {#if $smarty.section.loop.index + 1 == $pagesData.currentPage#}current{#/if#}"><a href="javascript:;">{#$smarty.section.loop.index  + 1#}</a></li>
+    {#/section#}
+    {#if $pagesData.totalPage >= $pagesData.currentPage + 10#}
+    <li data-page="more" class="paginItem more"><a href="javascript:;">...</a></li>
+    {#/if#}
+    <li data-page="next" class="paginItem"><a href="javascript:;"><span class="{#if $pagesData.totalPage == 1 || $pagesData.currentPage >= $pagesData.totalPage#}pagenxt{#else#}pagenxt_highlight{#/if#}"></span></a></li>
+    {#/if#}
+</ul>
+</div>
+<script>
+$('[data-js=page]').pages({ref : 'data-ref', total : 'data-total', current : 'data-current'});
 </script>

+ 112 - 112
demo/private/view/manage/data/rules.html

@@ -1,112 +1,112 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <title>规则管理</title>
-    <link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
-    <link href="{#helper\globals::getCss("select")#}" rel="stylesheet" type="text/css" />
-    <link href="{#helper\globals::getCss("jquery.multiSelect")#}" rel="stylesheet" type="text/css" />
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.idTabs.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("select-ui.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.bgiframe.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.multiSelect")#}"></script>
-	<script type="text/javascript" src="{#helper\globals::getJs("notify-custom.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("tips")#}"></script>
-
-    <script type="text/javascript">
-            $(document).ready(function(){
-				$(".multi").multiSelect({selectAllText: '选择所有', noneSelected: '请选择', oneOrMoreSelected:'共选择%项'}, function(el){
-
-				});
-
-				$("#creatorForm").submit( function()
-                {
-					$.post($(this).attr('action'), $(this).serialize(), function(r)
-                    {
-						if(typeof r.code != 'undefined' && r.code == 0)
-                        {
-                			$.notify("保存成功", "success");
-                        }
-                        else
-                        {
-                			$.notify("保存失败", "error");
-                        }
-					}, 'json');
-					return false;
-				});
-            });
-    </script>
-
-
-</head>
-
-
-<body>
-
-{#if $loadDatabase#}
-<div class="place">
-    <span>位置:</span>
-    <ul class="placeul">
-        <li><a href="{#$pathes.index#}">首页</a></li>
-        <li><a href="{#$pathes.creator#}?database={#$database#}&tableName={#$tableName#}">规则管理</a></li>
-        <li>规则管理</li>
-    </ul>
-</div>
-{#/if#}
-<div class="rightinfo">
-    {#if $loadDatabase#}
-    <div class="tools">
-    	<select id="database" name="database" onchange="if(this.value != ''){window.location.href = '{#helper\globals::getFullUrl("database/rules")#}?database='+ $('#database').val()}">
-    		<option value="">请选择数据库</option>
-            {#foreach key=key item=item from=$databases#}
-            <option value="{#$item#}" {#if $database == $item#}selected{#/if#}>{#$item#}</option>
-            {#/foreach#}
-    	</select>
-        <select name="tableName" onchange="if(this.value != ''){window.location.href = '{#helper\globals::getFullUrl("database/rules")#}?tableName='+ this.value +'&database='+ $('#database').val() }">
-            <option value="">请选择数据表</option>
-            {#foreach key=key item=item from=$tables#}
-            <option value="{#$item#}" {#if $tableName == $item#}selected{#/if#}>{#$item#}</option>
-            {#/foreach#}
-        </select>
-        {#if $tables|count > 0#}
-        <a href="{#$pathes.table#}?database={#$database#}&tableName={#$tableName#}">数据管理</a>
-        {#/if#}
-    </div>
-    {#/if#}
-    {#if $fields#}
-    <form name="creatorForm" id="creatorForm" action="{#helper\globals::getFullUrl("api/database/rules", ".json")#}?isAjax=1" method="POST">
-    {#helper\globals::safeForm()#}
-    <input type="hidden" name="tableName" value="{#$tableName#}"  />
-    <input type="hidden" name="database" value="{#$database#}"  />
-    <ul class="forminfo">
-        {#foreach key=key item=item from=$validateRules#}
-        <li>
-            <label>{#if isset($rules['alias'][$key])#}{#$rules['alias'][$key]#}{#/if#}</label>
-            {#assign var=item value=$item#}
-            {#foreach key=k item=it from=$item#}
-            {#helper\globals::rules($it, $key, $validate, $invalidMessage, $extRules)#}
-            {#/foreach#}
-        </li>
-        {#foreachelse#}
-        <li><a href="{#$pathes.creator#}?database={#$database#}&tableName={#$tableName#}" class="red bold">请先添加规则,再设置详细规则,点击添加。</a></li>
-        {#/foreach#}
-        <li><label>&nbsp;</label><input name="submit" type="submit" class="btn" value="确认保存"/>  <input type="button" name="download" value="下载规则" class="btn" /></li>
-    </ul>
-    {#/if#}
-	</form>
-</div>
-
-<script type="text/javascript">
-    $('.tablelist tbody tr:odd').addClass('odd');
-
-    $('input[name="download"]').on('click', function(){
-        var database = '{#$database#}';
-        var tableName = '{#$tableName#}';
-        var url = '{#helper\globals::getFullUrl("api/database/downloadConfig", ".json")#}?database='+ database + '&tableName='+ tableName;
-        window.location.href = url;
-    });
-</script>
-</body>
-
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>规则管理</title>
+    <link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
+    <link href="{#helper\globals::getCss("select")#}" rel="stylesheet" type="text/css" />
+    <link href="{#helper\globals::getCss("jquery.multiSelect")#}" rel="stylesheet" type="text/css" />
+    <script type="text/javascript" src="{#helper\globals::getJs("jquery.min")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs("jquery.idTabs.min")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs("select-ui.min")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs("jquery.bgiframe.min")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs("jquery.multiSelect")#}"></script>
+	<script type="text/javascript" src="{#helper\globals::getJs("notify-custom.min")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs("tips")#}"></script>
+
+    <script type="text/javascript">
+            $(document).ready(function(){
+				$(".multi").multiSelect({selectAllText: '选择所有', noneSelected: '请选择', oneOrMoreSelected:'共选择%项'}, function(el){
+
+				});
+
+				$("#creatorForm").submit( function()
+                {
+					$.post($(this).attr('action'), $(this).serialize(), function(r)
+                    {
+						if(typeof r.code != 'undefined' && r.code == 0)
+                        {
+                			$.notify("保存成功", "success");
+                        }
+                        else
+                        {
+                			$.notify("保存失败", "error");
+                        }
+					}, 'json');
+					return false;
+				});
+            });
+    </script>
+
+
+</head>
+
+
+<body>
+
+{#if $loadDatabase#}
+<div class="place">
+    <span>位置:</span>
+    <ul class="placeul">
+        <li><a href="{#$pathes.index#}">首页</a></li>
+        <li><a href="{#$pathes.creator#}?database={#$database#}&tableName={#$tableName#}">规则管理</a></li>
+        <li>规则管理</li>
+    </ul>
+</div>
+{#/if#}
+<div class="rightinfo">
+    {#if $loadDatabase#}
+    <div class="tools">
+    	<select id="database" name="database" onchange="if(this.value != ''){window.location.href = '{#helper\globals::getFullUrl("database/rules")#}?database='+ $('#database').val()}">
+    		<option value="">请选择数据库</option>
+            {#foreach key=key item=item from=$databases#}
+            <option value="{#$item#}" {#if $database == $item#}selected{#/if#}>{#$item#}</option>
+            {#/foreach#}
+    	</select>
+        <select name="tableName" onchange="if(this.value != ''){window.location.href = '{#helper\globals::getFullUrl("database/rules")#}?tableName='+ this.value +'&database='+ $('#database').val() }">
+            <option value="">请选择数据表</option>
+            {#foreach key=key item=item from=$tables#}
+            <option value="{#$item#}" {#if $tableName == $item#}selected{#/if#}>{#$item#}</option>
+            {#/foreach#}
+        </select>
+        {#if $tables|count > 0#}
+        <a href="{#$pathes.table#}?database={#$database#}&tableName={#$tableName#}">数据管理</a>
+        {#/if#}
+    </div>
+    {#/if#}
+    {#if $fields#}
+    <form name="creatorForm" id="creatorForm" action="{#helper\globals::getFullUrl("api/database/rules", ".json")#}?isAjax=1" method="POST">
+    {#helper\globals::safeForm()#}
+    <input type="hidden" name="tableName" value="{#$tableName#}"  />
+    <input type="hidden" name="database" value="{#$database#}"  />
+    <ul class="forminfo">
+        {#foreach key=key item=item from=$validateRules#}
+        <li>
+            <label>{#if isset($rules['alias'][$key])#}{#$rules['alias'][$key]#}{#/if#}</label>
+            {#assign var=item value=$item#}
+            {#foreach key=k item=it from=$item#}
+            {#helper\globals::rules($it, $key, $validate, $invalidMessage, $extRules)#}
+            {#/foreach#}
+        </li>
+        {#foreachelse#}
+        <li><a href="{#$pathes.creator#}?database={#$database#}&tableName={#$tableName#}" class="red bold">请先添加规则,再设置详细规则,点击添加。</a></li>
+        {#/foreach#}
+        <li><label>&nbsp;</label><input name="submit" type="submit" class="btn" value="确认保存"/>  <input type="button" name="download" value="下载规则" class="btn" /></li>
+    </ul>
+    {#/if#}
+	</form>
+</div>
+
+<script type="text/javascript">
+    $('.tablelist tbody tr:odd').addClass('odd');
+
+    $('input[name="download"]').on('click', function(){
+        var database = '{#$database#}';
+        var tableName = '{#$tableName#}';
+        var url = '{#helper\globals::getFullUrl("api/database/downloadConfig", ".json")#}?database='+ database + '&tableName='+ tableName;
+        window.location.href = url;
+    });
+</script>
+</body>
+
+</html>

+ 145 - 145
demo/private/view/manage/data/table.html

@@ -1,145 +1,145 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <title>数据生成器</title>
-    <link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
-    <link href="{#helper\globals::getCss("select")#}" rel="stylesheet" type="text/css" />
-    <link href="{#helper\globals::getCss("jquery.multiSelect")#}" rel="stylesheet" type="text/css" />
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("ajaxfileupload")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.idTabs.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("select-ui.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.bgiframe.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.multiSelect")#}"></script>
-	<script type="text/javascript" src="{#helper\globals::getJs("notify-custom.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("tips")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getSourceFullUrl("static/layer/layer.js")#}"></script>
-</head>
-
-
-<body>
-{#if $loadDatabase#}
-<div class="place">
-    <span>位置:</span>
-    <ul class="placeul">
-        <li><a href="{#$pathes.index#}">首页</a></li>
-        <li><a href="{#helper\globals::getFullUrl("database/creator")#}?database={#$database#}&tableName={#$tableName#}">规则管理</a></li>
-        <li>数据管理</li>
-    </ul>
-</div>
-{#/if#}
-<div class="rightinfo">
-    {#if $loadDatabase#}
-    <div class="tools">
-        <select id="database" name="database" onchange="if(this.value != ''){window.location.href = '{#helper\globals::getFullUrl("database/table")#}?database='+ $('#database').val()}">
-        <option value="">请选择数据库</option>
-        {#foreach key=key item=item from=$databases#}
-        <option value="{#$item#}" {#if $database == $item#}selected{#/if#}>{#$item#}</option>
-        {#/foreach#}
-        </select>
-        <select name="tableName" onchange="if(this.value != ''){window.location.href = '{#helper\globals::getFullUrl("database/table")#}?tableName='+ this.value +'&database='+ $('#database').val() }">
-        <option value="">请选择数据表</option>
-        {#foreach key=key item=item from=$tables#}
-        <option value="{#$item#}" {#if $tableName == $item#}selected{#/if#}>{#$item#}</option>
-        {#/foreach#}
-        </select>
-        {#if $tables|count > 0#}
-        <a href="{#helper\globals::getFullUrl("database/add")#}?database={#$database#}&tableName={#$tableName#}">添加数据</a>
-        {#/if#}
-    </div>
-    {#/if#}
-    {#if $tableName#}
-    <table class="tablelist">
-        <thead>
-        <tr>
-            {#foreach key=rkey item=ritem from=$data.rules.end#}
-            <th>{#if isset($data.rules.alias[$rkey]) && $data.rules.alias[$rkey] != ''#}{#$data.rules.alias[$rkey]#}{#else#}{#$rkey#}{#/if#}</th>
-            {#/foreach#}
-            {#if !$data.rules#}
-            <th><a href="{#helper\globals::getFullUrl("database/creator")#}?database={#$database#}&tableName={#$tableName#}">请先去数据生成器中生成数据</a></th>
-            {#else#}
-            <th>操作</th>
-            {#/if#}
-        </tr>
-        </thead>
-        <tbody>
-        {#foreach key=key item=item from=$data.rows#}
-        <tr>
-            {#foreach key=rkey item=ritem from=$data.rules.end#}
-            <td>{#if isset($item[$rkey])#}{#$item[$rkey]|strip_tags|trim|htmlspecialchars|truncate:50#}{#else#}&nbsp;{#/if#}</td>
-            {#/foreach#}
-            <td><a data-operate="modify" data-src="{#$item['__updateFields']#}">修改</a> <a data-operate="remove" data-src="{#$item['__updateFields']#}">删除</a></td>
-        </tr>
-        {#/foreach#}
-        </tbody>
-    </table>
-    
-    {#include file="manage/data/pages.html" pagesData=$pages pagesRef="{#helper\globals::getFullUrl("database/$action")#}?database={#$database#}&tableName={#$tableName#}"#}
-    </form>
-    <div class="pagin">
-        <div class="message">&nbsp;</div>
-        <ul class="paginList">
-            <li>
-                <input type="file" id="fileUpload" name="restoreSQL" value=""/>
-                <input type="button" name="restoreTable" value="还原数据" class="btn" />
-                <input type="button" name="backupTable" value="备份数据" class="btn" />
-            </li>
-        </ul>
-    </div>
-    {#/if#}
-</div>
-
-<script type="text/javascript">
-    $('.tablelist tbody tr:odd').addClass('odd');
-    $('[data-operate=modify]').on('click', function(){
-        var pri = $(this).attr('data-src');
-        var url = '{#helper\globals::getFullUrl("database/update")#}?' + pri;
-        window.location.href = url;
-    });
-    $('[data-operate=remove]').on('click', function(){
-        var pri = $(this).attr('data-src');
-        var url = '{#helper\globals::getFullUrl("api/database/table")#}?operate=remove&database={#$database#}&tableName={#$tableName#}';
-        layer.confirm("数据一旦删除,将无法恢复,请确认", {
-          btn: ['确认','取消'] //按钮
-        }, function(){
-            $.get(url, pri, function(r){
-                    if(typeof r.code != 'undefined' && r.code == 0){
-                        r.code == 0 ? layer.msg('删除成功') : layer.msg(data.msg);
-                        setTimeout(function(){window.location.href = window.location.href;}, 2000);
-                    }else{
-                        layer.msg("删除失败");
-                    }
-                }, 'json');
-        });
-    });
-    $('input[name=backupTable]').on('click', function(){
-    	window.location.href = "{#\helper\globals::getFullUrl('api/database/backup')#}?database={#$database#}&tableName={#$tableName#}";
-    });
-    $('input[name=restoreTable]').on('click', function(){
-        var data = {};
-        data.database = '{#$database#}';
-        data.tableName = '{#$tableName#}';
-        $.ajaxFileUpload({
-            url : '{#\helper\globals::getFullUrl('api/database/restore')#}?random='+ Math.random(),
-            data : data,
-            type : 'POST',
-            secureuri : false,
-            fileElementId : 'fileUpload',
-            dataType : 'json',
-            success : function(msg){
-                if(msg.code == 0){
-                	$.notify("还原成功", "success");
-                	return;
-                }
-                $.notify(msg.msg, "error");
-            },
-            error : function(data, status, e){
-                $.notify("系统错误", "error");
-            }
-        });
-    });
-</script>
-</body>
-
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>数据生成器</title>
+    <link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
+    <link href="{#helper\globals::getCss("select")#}" rel="stylesheet" type="text/css" />
+    <link href="{#helper\globals::getCss("jquery.multiSelect")#}" rel="stylesheet" type="text/css" />
+    <script type="text/javascript" src="{#helper\globals::getJs("jquery.min")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs("ajaxfileupload")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs("jquery.idTabs.min")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs("select-ui.min")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs("jquery.bgiframe.min")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs("jquery.multiSelect")#}"></script>
+	<script type="text/javascript" src="{#helper\globals::getJs("notify-custom.min")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs("tips")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getSourceFullUrl("static/layer/layer.js")#}"></script>
+</head>
+
+
+<body>
+{#if $loadDatabase#}
+<div class="place">
+    <span>位置:</span>
+    <ul class="placeul">
+        <li><a href="{#$pathes.index#}">首页</a></li>
+        <li><a href="{#helper\globals::getFullUrl("database/creator")#}?database={#$database#}&tableName={#$tableName#}">规则管理</a></li>
+        <li>数据管理</li>
+    </ul>
+</div>
+{#/if#}
+<div class="rightinfo">
+    {#if $loadDatabase#}
+    <div class="tools">
+        <select id="database" name="database" onchange="if(this.value != ''){window.location.href = '{#helper\globals::getFullUrl("database/table")#}?database='+ $('#database').val()}">
+        <option value="">请选择数据库</option>
+        {#foreach key=key item=item from=$databases#}
+        <option value="{#$item#}" {#if $database == $item#}selected{#/if#}>{#$item#}</option>
+        {#/foreach#}
+        </select>
+        <select name="tableName" onchange="if(this.value != ''){window.location.href = '{#helper\globals::getFullUrl("database/table")#}?tableName='+ this.value +'&database='+ $('#database').val() }">
+        <option value="">请选择数据表</option>
+        {#foreach key=key item=item from=$tables#}
+        <option value="{#$item#}" {#if $tableName == $item#}selected{#/if#}>{#$item#}</option>
+        {#/foreach#}
+        </select>
+        {#if $tables|count > 0#}
+        <a href="{#helper\globals::getFullUrl("database/add")#}?database={#$database#}&tableName={#$tableName#}">添加数据</a>
+        {#/if#}
+    </div>
+    {#/if#}
+    {#if $tableName#}
+    <table class="tablelist">
+        <thead>
+        <tr>
+            {#foreach key=rkey item=ritem from=$data.rules.end#}
+            <th>{#if isset($data.rules.alias[$rkey]) && $data.rules.alias[$rkey] != ''#}{#$data.rules.alias[$rkey]#}{#else#}{#$rkey#}{#/if#}</th>
+            {#/foreach#}
+            {#if !$data.rules#}
+            <th><a href="{#helper\globals::getFullUrl("database/creator")#}?database={#$database#}&tableName={#$tableName#}">请先去数据生成器中生成数据</a></th>
+            {#else#}
+            <th>操作</th>
+            {#/if#}
+        </tr>
+        </thead>
+        <tbody>
+        {#foreach key=key item=item from=$data.rows#}
+        <tr>
+            {#foreach key=rkey item=ritem from=$data.rules.end#}
+            <td>{#if isset($item[$rkey])#}{#$item[$rkey]|strip_tags|trim|htmlspecialchars|truncate:50#}{#else#}&nbsp;{#/if#}</td>
+            {#/foreach#}
+            <td><a data-operate="modify" data-src="{#$item['__updateFields']#}">修改</a> <a data-operate="remove" data-src="{#$item['__updateFields']#}">删除</a></td>
+        </tr>
+        {#/foreach#}
+        </tbody>
+    </table>
+    
+    {#include file="manage/data/pages.html" pagesData=$pages pagesRef="{#helper\globals::getFullUrl("database/$action")#}?database={#$database#}&tableName={#$tableName#}"#}
+    </form>
+    <div class="pagin">
+        <div class="message">&nbsp;</div>
+        <ul class="paginList">
+            <li>
+                <input type="file" id="fileUpload" name="restoreSQL" value=""/>
+                <input type="button" name="restoreTable" value="还原数据" class="btn" />
+                <input type="button" name="backupTable" value="备份数据" class="btn" />
+            </li>
+        </ul>
+    </div>
+    {#/if#}
+</div>
+
+<script type="text/javascript">
+    $('.tablelist tbody tr:odd').addClass('odd');
+    $('[data-operate=modify]').on('click', function(){
+        var pri = $(this).attr('data-src');
+        var url = '{#helper\globals::getFullUrl("database/update")#}?' + pri;
+        window.location.href = url;
+    });
+    $('[data-operate=remove]').on('click', function(){
+        var pri = $(this).attr('data-src');
+        var url = '{#helper\globals::getFullUrl("api/database/table")#}?operate=remove&database={#$database#}&tableName={#$tableName#}';
+        layer.confirm("数据一旦删除,将无法恢复,请确认", {
+          btn: ['确认','取消'] //按钮
+        }, function(){
+            $.get(url, pri, function(r){
+                    if(typeof r.code != 'undefined' && r.code == 0){
+                        r.code == 0 ? layer.msg('删除成功') : layer.msg(data.msg);
+                        setTimeout(function(){window.location.href = window.location.href;}, 2000);
+                    }else{
+                        layer.msg("删除失败");
+                    }
+                }, 'json');
+        });
+    });
+    $('input[name=backupTable]').on('click', function(){
+    	window.location.href = "{#\helper\globals::getFullUrl('api/database/backup')#}?database={#$database#}&tableName={#$tableName#}";
+    });
+    $('input[name=restoreTable]').on('click', function(){
+        var data = {};
+        data.database = '{#$database#}';
+        data.tableName = '{#$tableName#}';
+        $.ajaxFileUpload({
+            url : '{#\helper\globals::getFullUrl('api/database/restore')#}?random='+ Math.random(),
+            data : data,
+            type : 'POST',
+            secureuri : false,
+            fileElementId : 'fileUpload',
+            dataType : 'json',
+            success : function(msg){
+                if(msg.code == 0){
+                	$.notify("还原成功", "success");
+                	return;
+                }
+                $.notify(msg.msg, "error");
+            },
+            error : function(data, status, e){
+                $.notify("系统错误", "error");
+            }
+        });
+    });
+</script>
+</body>
+
+</html>

+ 96 - 96
demo/private/view/manage/data/update.html

@@ -1,96 +1,96 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <title>数据编辑器</title>
-    <link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
-    <link href="{#helper\globals::getCss("select")#}" rel="stylesheet" type="text/css" />
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.idTabs.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("select-ui.min")#}"></script>
-	<script type="text/javascript" src="{#helper\globals::getJs("notify-custom.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs('xheditor/xheditor-1.2.2.min')#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs('xheditor/xheditor_lang/zh-cn')#}"></script>
-	<script>
-	$(document).ready(function(){
-		$("#modifyForm").submit(function()
-		{
-			$.post($(this).attr('action'), $(this).serialize(), function(r)
-		    {
-				if(r == null)
-				{
-					$.notify("系统错误,请重试", "error");
-				};
-				console.log(r);
-
-				if(typeof r.code != 'undefined' && r.code == 0)
-		        {
-					$.notify("保存成功", "success");
-		        }
-		        else
-		        {
-					$.notify("保存失败", "error");
-		        }
-			}, 'json');
-			return false;
-		});
-	});
-	</script>
-</head>
-
-<body>
-
-<div class="place">
-    <span>位置:</span>
-    <ul class="placeul">
-        <li><a href="{#$pathes.index#}">首页</a></li>
-        <li><a href="{#$pathes.creator#}?database={#$database#}&tableName={#$tableName#}">规则管理</a></li>
-        <li><a href="{#$pathes.table#}?database={#$database#}&tableName={#$tableName#}">数据管理</a></li>
-        <li>数据编辑</li>
-    </ul>
-</div>
-
-<div class="formbody">
-
-    <div class="formtitle"><span>基本信息</span></div>
-    <form name="modifyForm" id="modifyForm" method="POST" action="{#helper\globals::getFullUrl("api/database/update", ".json")#}?isAjax=1">
-		{#helper\globals::safeForm()#}
-		<input type="hidden" name="__database" value="{#$database#}" id="__database" />
-		<input type="hidden" name="__tableName" value="{#$tableName#}" id="__tableName" />
-		<input type="hidden" name="__pri" value="{#$pri|join:","#}" id="__pri" />
-		{#foreach key=key item=item from=$val#}
-		<input type="hidden" name="{#$key#}" value="{#$item#}" />
-		{#/foreach#}
-	    <ul class="forminfo">
-	        {#foreach key=key item=item from=$data#}
-	        <li><label>{#if isset($rules['rules']['alias'][$key]) && $rules['rules']['alias'][$key] != ''#}{#$rules['rules']['alias'][$key]#}{#else#}{#$key#}{#/if#}</label>
-	            {#if isset($rules['rules']['type'][$key]) && ($rules['rules']['type'][$key] == 'mediumtext' || $rules['rules']['type'][$key] == 'text')#}
-	            <textarea name="fields[{#$key#}]" cols="100" rows="20" class="textinput overflow-auto {#if helper\globals::hasHtmlTag($item)#}xheditor{#/if#}">{#$item#}</textarea>
-	            {#else if isset($rules['rules']['type'][$key]) && $rules['rules']['type'][$key] == 'enum'#}
-	            <div class="vocation">
-	            <select class="select1" name="fields[{#$key#}]" id="fields[{#$key#}]">
-	            {#foreach key=set item=sitem from=$rules['rules']['setsArray'][$key]#}
-	            	<option value="{#$sitem#}"  {#if $item == $sitem#}selected{#/if#}>{#$sitem#}</option>
-	            {#/foreach#}
-	            </select>
-	            </div>
-	            {#else#}
-	            <input name="fields[{#$key#}]" type="text" class="dfinput" value="{#$item#}" />
-	            {#/if#}
-	            <i>{#if isset($rules['rules']['length'][$key]) && $rules['rules']['length'][$key] > 0 #}最大长度{#$rules['rules']['length'][$key]#}个字符{#else#}{#/if#}</i></li>
-	        {#/foreach#}
-	        <li><label>&nbsp;</label><input name="submit" type="submit" class="btn" value="确认保存"/></li>
-	    </ul>
-    </form>
-
-</div>
-<script>
-$('.xheditor').xheditor({skin:'nostyle'});
-$(".select1").uedSelect({
-	width : 345			  
-});
-</script>
-
-</body>
-
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>数据编辑器</title>
+    <link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
+    <link href="{#helper\globals::getCss("select")#}" rel="stylesheet" type="text/css" />
+    <script type="text/javascript" src="{#helper\globals::getJs("jquery.min")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs("jquery.idTabs.min")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs("select-ui.min")#}"></script>
+	<script type="text/javascript" src="{#helper\globals::getJs("notify-custom.min")#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs('xheditor/xheditor-1.2.2.min')#}"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs('xheditor/xheditor_lang/zh-cn')#}"></script>
+	<script>
+	$(document).ready(function(){
+		$("#modifyForm").submit(function()
+		{
+			$.post($(this).attr('action'), $(this).serialize(), function(r)
+		    {
+				if(r == null)
+				{
+					$.notify("系统错误,请重试", "error");
+				};
+				console.log(r);
+
+				if(typeof r.code != 'undefined' && r.code == 0)
+		        {
+					$.notify("保存成功", "success");
+		        }
+		        else
+		        {
+					$.notify("保存失败", "error");
+		        }
+			}, 'json');
+			return false;
+		});
+	});
+	</script>
+</head>
+
+<body>
+
+<div class="place">
+    <span>位置:</span>
+    <ul class="placeul">
+        <li><a href="{#$pathes.index#}">首页</a></li>
+        <li><a href="{#$pathes.creator#}?database={#$database#}&tableName={#$tableName#}">规则管理</a></li>
+        <li><a href="{#$pathes.table#}?database={#$database#}&tableName={#$tableName#}">数据管理</a></li>
+        <li>数据编辑</li>
+    </ul>
+</div>
+
+<div class="formbody">
+
+    <div class="formtitle"><span>基本信息</span></div>
+    <form name="modifyForm" id="modifyForm" method="POST" action="{#helper\globals::getFullUrl("api/database/update", ".json")#}?isAjax=1">
+		{#helper\globals::safeForm()#}
+		<input type="hidden" name="__database" value="{#$database#}" id="__database" />
+		<input type="hidden" name="__tableName" value="{#$tableName#}" id="__tableName" />
+		<input type="hidden" name="__pri" value="{#$pri|join:","#}" id="__pri" />
+		{#foreach key=key item=item from=$val#}
+		<input type="hidden" name="{#$key#}" value="{#$item#}" />
+		{#/foreach#}
+	    <ul class="forminfo">
+	        {#foreach key=key item=item from=$data#}
+	        <li><label>{#if isset($rules['rules']['alias'][$key]) && $rules['rules']['alias'][$key] != ''#}{#$rules['rules']['alias'][$key]#}{#else#}{#$key#}{#/if#}</label>
+	            {#if isset($rules['rules']['type'][$key]) && ($rules['rules']['type'][$key] == 'mediumtext' || $rules['rules']['type'][$key] == 'text')#}
+	            <textarea name="fields[{#$key#}]" cols="100" rows="20" class="textinput overflow-auto {#if helper\globals::hasHtmlTag($item)#}xheditor{#/if#}">{#$item#}</textarea>
+	            {#else if isset($rules['rules']['type'][$key]) && $rules['rules']['type'][$key] == 'enum'#}
+	            <div class="vocation">
+	            <select class="select1" name="fields[{#$key#}]" id="fields[{#$key#}]">
+	            {#foreach key=set item=sitem from=$rules['rules']['setsArray'][$key]#}
+	            	<option value="{#$sitem#}"  {#if $item == $sitem#}selected{#/if#}>{#$sitem#}</option>
+	            {#/foreach#}
+	            </select>
+	            </div>
+	            {#else#}
+	            <input name="fields[{#$key#}]" type="text" class="dfinput" value="{#$item#}" />
+	            {#/if#}
+	            <i>{#if isset($rules['rules']['length'][$key]) && $rules['rules']['length'][$key] > 0 #}最大长度{#$rules['rules']['length'][$key]#}个字符{#else#}{#/if#}</i></li>
+	        {#/foreach#}
+	        <li><label>&nbsp;</label><input name="submit" type="submit" class="btn" value="确认保存"/></li>
+	    </ul>
+    </form>
+
+</div>
+<script>
+$('.xheditor').xheditor({skin:'nostyle'});
+$(".select1").uedSelect({
+	width : 345			  
+});
+</script>
+
+</body>
+
+</html>

+ 84 - 84
demo/private/view/manage/folder/dir.html

@@ -1,85 +1,85 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <title>文件管理</title>
-    <link href="{#_link("static/css/style.css")#}" rel="stylesheet" type="text/css" />
-    <link href="{#_link("static/css/select.css")#}" rel="stylesheet" type="text/css" />
-    <link href="{#_link("static/css/jquery.multiSelect.css")#}" rel="stylesheet" type="text/css" />
-    <script type="text/javascript" src="{#_link("static/js/jquery.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/jquery.idTabs.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/select-ui.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/jquery.bgiframe.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/jquery.multiSelect.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/tips.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/notify-custom.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/layer/layer.js")#}"></script>
-</head>
- <body>
-  <div class="place"> 
-   <span>位置:</span> 
-   <ul class="placeul"> 
-    <li><a href="{#$pathes.index#}">首页</a></li> 
-    <li><a href="{#_link('/dirs')#}?path={#$defaultPath#}">文件管理</a></li> 
-    {#foreach item=item from=$visitPathes#}
-    <li><a href="{#$item.url#}">{#$item.name#}</a></li>
-    {#/foreach#}
-   </ul> 
-  </div> 
-  <table class="filetable"> 
-   <thead> 
-    <tr> 
-     <th width="25%">名称</th> 
-     <th width="21%">修改日期</th> 
-     <th width="10%">类型</th> 
-     <th width="6%">大小</th> 
-     <th width="38%">操作</th>
-    </tr> 
-   </thead> 
-   <tbody> 
-   {#foreach item=item from=$files#}
-    <tr data-js="link" data-url="{#$item.url#}"> 
-     <td><img src="{#$item.icon#}" />{#if $item.isImage#}<img src="{#$item.path#}" height="20" style="vertical-align:middle;" />{#/if#}<a href="{#$item.url#}">{#$item.name#}</a></td> 
-     <td>{#$item.updateAt|date_format:'Y-m-d H:i:s'#}</td> 
-     <td>{#if $item.type == 'folder'#}文件夹{#else#}文件{#/if#}</td> 
-     <td class="tdlast">{#$item.size#}</td> 
-     <td><a href="{#$item.url#}">查看</a>  <a data-js="remove" data-ref="{#$item.remove#}">删除</a></td>
-    </tr> 
-    {#foreachelse#}
-    <tr>
-    	<td colspan="5">此文件夹下没有文件</td>
-    </tr>
-    {#/foreach#}
-   </tbody> 
-  </table>
-  <script>
-  $('[data-js=link]').on('click', function(event){
-    if($(event.target).attr('data-js') == 'remove') return;
-  	window.location.href =$(this).attr('data-url');
-  });
-  $('[data-js=remove]').on('click', function(event){
-    var _this = $(this);
-    layer.confirm('确定要删除此文件?', {
-      btn: ['确认','取消'] //按钮
-    }, function(){
-      $.ajax({
-          url : _this.attr('data-ref'),
-          method : 'GET',
-          dataType : 'json',
-          success: function(data){
-            if(typeof data.code != 'undefined'){
-              data.code == 0 ? layer.msg('删除成功') : layer.msg(data.msg);
-              setTimeout(function(){window.location.href=window.location.href;}, 2000);
-            }else{
-              layer.msg(data);
-            }
-          },
-          error : function(){
-            layer.msg('系统错误');
-          }
-      });0 
-    });
-  });
-  </script>
- </body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>文件管理</title>
+    <link href="{#_link("static/css/style.css")#}" rel="stylesheet" type="text/css" />
+    <link href="{#_link("static/css/select.css")#}" rel="stylesheet" type="text/css" />
+    <link href="{#_link("static/css/jquery.multiSelect.css")#}" rel="stylesheet" type="text/css" />
+    <script type="text/javascript" src="{#_link("static/js/jquery.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.idTabs.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/select-ui.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.bgiframe.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.multiSelect.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/tips.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/notify-custom.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/layer/layer.js")#}"></script>
+</head>
+ <body>
+  <div class="place"> 
+   <span>位置:</span> 
+   <ul class="placeul"> 
+    <li><a href="{#$pathes.index#}">首页</a></li> 
+    <li><a href="{#_link('/dirs')#}?path={#$defaultPath#}">文件管理</a></li> 
+    {#foreach item=item from=$visitPathes#}
+    <li><a href="{#$item.url#}">{#$item.name#}</a></li>
+    {#/foreach#}
+   </ul> 
+  </div> 
+  <table class="filetable"> 
+   <thead> 
+    <tr> 
+     <th width="25%">名称</th> 
+     <th width="21%">修改日期</th> 
+     <th width="10%">类型</th> 
+     <th width="6%">大小</th> 
+     <th width="38%">操作</th>
+    </tr> 
+   </thead> 
+   <tbody> 
+   {#foreach item=item from=$files#}
+    <tr data-js="link" data-url="{#$item.url#}"> 
+     <td><img src="{#$item.icon#}" />{#if $item.isImage#}<img src="{#$item.path#}" height="20" style="vertical-align:middle;" />{#/if#}<a href="{#$item.url#}">{#$item.name#}</a></td> 
+     <td>{#$item.updateAt|date_format:'Y-m-d H:i:s'#}</td> 
+     <td>{#if $item.type == 'folder'#}文件夹{#else#}文件{#/if#}</td> 
+     <td class="tdlast">{#$item.size#}</td> 
+     <td><a href="{#$item.url#}">查看</a>  <a data-js="remove" data-ref="{#$item.remove#}">删除</a></td>
+    </tr> 
+    {#foreachelse#}
+    <tr>
+    	<td colspan="5">此文件夹下没有文件</td>
+    </tr>
+    {#/foreach#}
+   </tbody> 
+  </table>
+  <script>
+  $('[data-js=link]').on('click', function(event){
+    if($(event.target).attr('data-js') == 'remove') return;
+  	window.location.href =$(this).attr('data-url');
+  });
+  $('[data-js=remove]').on('click', function(event){
+    var _this = $(this);
+    layer.confirm('确定要删除此文件?', {
+      btn: ['确认','取消'] //按钮
+    }, function(){
+      $.ajax({
+          url : _this.attr('data-ref'),
+          method : 'GET',
+          dataType : 'json',
+          success: function(data){
+            if(typeof data.code != 'undefined'){
+              data.code == 0 ? layer.msg('删除成功') : layer.msg(data.msg);
+              setTimeout(function(){window.location.href=window.location.href;}, 2000);
+            }else{
+              layer.msg(data);
+            }
+          },
+          error : function(){
+            layer.msg('系统错误');
+          }
+      });0 
+    });
+  });
+  </script>
+ </body>
 </html>

+ 56 - 56
demo/private/view/manage/folder/file.html

@@ -1,57 +1,57 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <title>文件管理</title>
-    <link href="{#_link("static/css/style.css")#}" rel="stylesheet" type="text/css" />
-    <link href="{#_link("static/css/select.css")#}" rel="stylesheet" type="text/css" />
-    <link href="{#_link("static/css/jquery.multiSelect.css")#}" rel="stylesheet" type="text/css" />
-    <script type="text/javascript" src="{#_link("static/js/jquery.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/jquery.idTabs.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/select-ui.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/jquery.bgiframe.min.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/jquery.multiSelect.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/tips.js")#}"></script>
-    <script type="text/javascript" src="{#_link("static/js/notify-custom.min.js")#}"></script>
-    <link href="{#_link('static/js/google-code-prettify/prettify.css')#}" type="text/css" rel="stylesheet" />
-    <script type="text/javascript" src="{#_link('static/js/google-code-prettify/prettify.js')#}"></script>
-    <style>
-    pre span{display:inline;font-size:14px;}
-    pre.prettyprint{border:0px;}
-    </style>
-</head>
- <body>
-  <div class="place"> 
-   <span>位置:</span> 
-   <ul class="placeul"> 
-    <li><a href="{#$pathes.index#}">首页</a></li> 
-    <li><a href="{#_link('/dirs')#}?path={#$defaultPath#}">文件管理</a></li> 
-    {#foreach item=item from=$visitPathes#}
-    <li><a href="{#$item.url#}">{#$item.name#}</a></li>
-    {#/foreach#}
-    <li>{#$file#}</li>
-   </ul> 
-  </div> 
-  <table class="filetable"> 
-   <thead>
-   <tr>
-    <td><h3>&nbsp;&nbsp;&nbsp;&nbsp;文件内容:</h3></td>
-   </tr>
-   </thead> 
-   <tbody>
-   <tr>
-       <td width="100%">
-       <pre class="prettyprint linenums Lang-html">
-{#$code|htmlspecialchars#}
-       </pre>
-       </td>
-   </tr>
-   </tbody> 
-  </table>
-  <script>
-  $(function(){
-  prettyPrint();
-  });
-  </script>
- </body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>文件管理</title>
+    <link href="{#_link("static/css/style.css")#}" rel="stylesheet" type="text/css" />
+    <link href="{#_link("static/css/select.css")#}" rel="stylesheet" type="text/css" />
+    <link href="{#_link("static/css/jquery.multiSelect.css")#}" rel="stylesheet" type="text/css" />
+    <script type="text/javascript" src="{#_link("static/js/jquery.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.idTabs.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/select-ui.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.bgiframe.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.multiSelect.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/tips.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/notify-custom.min.js")#}"></script>
+    <link href="{#_link('static/js/google-code-prettify/prettify.css')#}" type="text/css" rel="stylesheet" />
+    <script type="text/javascript" src="{#_link('static/js/google-code-prettify/prettify.js')#}"></script>
+    <style>
+    pre span{display:inline;font-size:14px;}
+    pre.prettyprint{border:0px;}
+    </style>
+</head>
+ <body>
+  <div class="place"> 
+   <span>位置:</span> 
+   <ul class="placeul"> 
+    <li><a href="{#$pathes.index#}">首页</a></li> 
+    <li><a href="{#_link('/dirs')#}?path={#$defaultPath#}">文件管理</a></li> 
+    {#foreach item=item from=$visitPathes#}
+    <li><a href="{#$item.url#}">{#$item.name#}</a></li>
+    {#/foreach#}
+    <li>{#$file#}</li>
+   </ul> 
+  </div> 
+  <table class="filetable"> 
+   <thead>
+   <tr>
+    <td><h3>&nbsp;&nbsp;&nbsp;&nbsp;文件内容:</h3></td>
+   </tr>
+   </thead> 
+   <tbody>
+   <tr>
+       <td width="100%">
+       <pre class="prettyprint linenums Lang-html">
+{#$code|htmlspecialchars#}
+       </pre>
+       </td>
+   </tr>
+   </tbody> 
+  </table>
+  <script>
+  $(function(){
+  prettyPrint();
+  });
+  </script>
+ </body>
 </html>

+ 83 - 83
demo/private/view/manage/index.html

@@ -1,83 +1,83 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title>Dishboard</title>
-<link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
-<script type="text/javascript" src="{#helper\globals::getJs("jquery")#}"></script>
-
-</head>
-
-
-<body>
-
-	<div class="place">
-    <span>位置:</span>
-    <ul class="placeul">
-    <li><a href="javascript:;">首页</a></li>
-    </ul>
-    </div>
-    
-    <div class="mainindex">
-    
-    
-    <div class="welinfo">
-    <span><img src="{#helper\globals::getImage("sun.png")#}" alt="天气" /></span>
-    <b>Admin早上好,欢迎使用信息管理系统</b>
-    <a href="#">帐号设置</a>
-    </div>
-    
-    <div class="welinfo">
-    <span><img src="{#helper\globals::getImage("time.png")#}" alt="时间" /></span>
-    <i>您上次登录的时间:2013-10-09 15:22</i> (不是您登录的?<a href="{#\helper\globals::getFullUrl('main/logout')#}" target="_parent">请点这里</a>)
-    </div>
-    
-    <div class="xline"></div>
-    
-    <ul class="iconlist">
-    
-    <li><img src="{#helper\globals::getImage("ico01.png")#}" /><p><a href="#">管理设置</a></p></li>
-    <li><img src="{#helper\globals::getImage("ico02.png")#}" /><p><a href="{#helper\globals::getFullUrl("/database/creator")#}">规则生成器</a></p></li>
-    <li><img src="{#helper\globals::getImage("ico03.png")#}" /><p><a href="{#helper\globals::getFullUrl("/database/rules")#}">详细规则管理</a></p></li>
-    <li><img src="{#helper\globals::getImage("ico04.png")#}" /><p><a href="{#helper\globals::getFullUrl("/database/table")#}">数据管理</a></p></li>
-    <li><img src="{#helper\globals::getImage("ico05.png")#}" /><p><a href="{#helper\globals::getFullUrl("/dirs")#}">目录管理</a></p></li>
-    <li><img src="{#helper\globals::getImage("ico06.png")#}" /><p><a href="{#helper\globals::getFullUrl("/formbuilder")#}">表单生成器</a></p></li>
-            
-    </ul>
-    
-    <div class="ibox"><a class="ibtn" href="{#helper\globals::getFullUrl('shortcut')#}"><img src="{#helper\globals::getImage("iadd.png")#}" />添加新的快捷功能</a></div>
-    
-    <div class="xline"></div>
-    <div class="box"></div>
-    
-    <div class="welinfo">
-    <span><img src="{#helper\globals::getImage("dp.png")#}" alt="提醒" /></span>
-    <b>Uimaker信息管理系统使用指南</b>
-    </div>
-    
-    <ul class="infolist">
-    <li><span>您可以快速进行文章发布管理操作</span><a class="ibtn">发布或管理文章</a></li>
-    <li><span>您可以快速发布产品</span><a class="ibtn">发布或管理产品</a></li>
-    <li><span>您可以进行密码修改、账户设置等操作</span><a class="ibtn">账户管理</a></li>
-    </ul>
-    
-    <div class="xline"></div>
-    
-    <div class="uimakerinfo"><b>查看Uimaker网站使用指南,您可以了解到多种风格的B/S后台管理界面,软件界面设计,图标设计,手机界面等相关信息</b>(<a href="http://www.uimaker.com" target="_blank">www.uimaker.com</a>)</div>
-    
-    <ul class="umlist">
-    <li><a href="#">如何发布文章</a></li>
-    <li><a href="#">如何访问网站</a></li>
-    <li><a href="#">如何管理广告</a></li>
-    <li><a href="#">后台用户设置(权限)</a></li>
-    <li><a href="#">系统设置</a></li>
-    </ul>
-    
-    
-    </div>
-    
-    
-
-</body>
-
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Dishboard</title>
+<link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
+<script type="text/javascript" src="{#helper\globals::getJs("jquery")#}"></script>
+
+</head>
+
+
+<body>
+
+	<div class="place">
+    <span>位置:</span>
+    <ul class="placeul">
+    <li><a href="javascript:;">首页</a></li>
+    </ul>
+    </div>
+    
+    <div class="mainindex">
+    
+    
+    <div class="welinfo">
+    <span><img src="{#helper\globals::getImage("sun.png")#}" alt="天气" /></span>
+    <b>Admin早上好,欢迎使用信息管理系统</b>
+    <a href="#">帐号设置</a>
+    </div>
+    
+    <div class="welinfo">
+    <span><img src="{#helper\globals::getImage("time.png")#}" alt="时间" /></span>
+    <i>您上次登录的时间:2013-10-09 15:22</i> (不是您登录的?<a href="{#\helper\globals::getFullUrl('main/logout')#}" target="_parent">请点这里</a>)
+    </div>
+    
+    <div class="xline"></div>
+    
+    <ul class="iconlist">
+    
+    <li><img src="{#helper\globals::getImage("ico01.png")#}" /><p><a href="#">管理设置</a></p></li>
+    <li><img src="{#helper\globals::getImage("ico02.png")#}" /><p><a href="{#helper\globals::getFullUrl("/database/creator")#}">规则生成器</a></p></li>
+    <li><img src="{#helper\globals::getImage("ico03.png")#}" /><p><a href="{#helper\globals::getFullUrl("/database/rules")#}">详细规则管理</a></p></li>
+    <li><img src="{#helper\globals::getImage("ico04.png")#}" /><p><a href="{#helper\globals::getFullUrl("/database/table")#}">数据管理</a></p></li>
+    <li><img src="{#helper\globals::getImage("ico05.png")#}" /><p><a href="{#helper\globals::getFullUrl("/dirs")#}">目录管理</a></p></li>
+    <li><img src="{#helper\globals::getImage("ico06.png")#}" /><p><a href="{#helper\globals::getFullUrl("/formbuilder")#}">表单生成器</a></p></li>
+            
+    </ul>
+    
+    <div class="ibox"><a class="ibtn" href="{#helper\globals::getFullUrl('shortcut')#}"><img src="{#helper\globals::getImage("iadd.png")#}" />添加新的快捷功能</a></div>
+    
+    <div class="xline"></div>
+    <div class="box"></div>
+    
+    <div class="welinfo">
+    <span><img src="{#helper\globals::getImage("dp.png")#}" alt="提醒" /></span>
+    <b>Uimaker信息管理系统使用指南</b>
+    </div>
+    
+    <ul class="infolist">
+    <li><span>您可以快速进行文章发布管理操作</span><a class="ibtn">发布或管理文章</a></li>
+    <li><span>您可以快速发布产品</span><a class="ibtn">发布或管理产品</a></li>
+    <li><span>您可以进行密码修改、账户设置等操作</span><a class="ibtn">账户管理</a></li>
+    </ul>
+    
+    <div class="xline"></div>
+    
+    <div class="uimakerinfo"><b>查看Uimaker网站使用指南,您可以了解到多种风格的B/S后台管理界面,软件界面设计,图标设计,手机界面等相关信息</b>(<a href="http://www.uimaker.com" target="_blank">www.uimaker.com</a>)</div>
+    
+    <ul class="umlist">
+    <li><a href="#">如何发布文章</a></li>
+    <li><a href="#">如何访问网站</a></li>
+    <li><a href="#">如何管理广告</a></li>
+    <li><a href="#">后台用户设置(权限)</a></li>
+    <li><a href="#">系统设置</a></li>
+    </ul>
+    
+    
+    </div>
+    
+    
+
+</body>
+
+</html>

+ 82 - 82
demo/private/view/manage/left.html

@@ -1,83 +1,83 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <title>无标题文档</title>
-    <link href="{#\helper\globals::getCss("style")#}"="" rel="stylesheet" type="text/css" />
-    <script language="JavaScript" src="{#\helper\globals::getJs("jquery")#}"=""></script>
-    <script type="text/javascript">
-            $(function(){
-                //导航切换
-                $(".menuson li").click(function(){
-                    $(".menuson li.active").removeClass("active")
-                    $(this).addClass("active");
-                });
-
-                $('.title').click(function(){
-                    var $ul = $(this).next('ul');
-                    $('dd').find('ul').slideUp();
-                    if($ul.is(':visible')){
-                        $(this).next('ul').slideUp();
-                    }else{
-                        $(this).next('ul').slideDown();
-                    }
-                });
-            })
-    </script>
-</head>
-<body style="background:#f0f9fd;">
-<div class="lefttop">
-    <span></span>管理菜单
-</div>
-<dl class="leftmenu">
-    <dd>
-        <div class="title">
-            <span><img src="{#\helper\globals::getImage("leftico01.png")#}"="" /></span>数据库功能
-        </div>
-        <ul class="menuson">
-            <li><cite></cite><a href="{#helper\globals::getFullUrl("/database/creator")#}" target="rightFrame">规则生成器</a><i></i></li>
-            <li><cite></cite><a href="{#helper\globals::getFullUrl("/database/rules")#}" target="rightFrame">详细规则管理</a><i></i></li>
-            <li><cite></cite><a href="{#helper\globals::getFullUrl("/database/table")#}" target="rightFrame">数据管理</a><i></i></li>
-        </ul>
-    </dd>
-    <dd>
-        <div class="title">
-            <span><img src="{#\helper\globals::getImage("leftico01.png")#}"="" /></span>目录管理
-        </div>
-        <ul class="menuson">
-            <li><cite></cite><a href="{#helper\globals::getFullUrl("/dirs")#}" target="rightFrame">文件管理</a><i></i></li>
-        </ul>
-    </dd>
-    <dd>
-        <div class="title">
-            <span><img src="{#\helper\globals::getImage("leftico02.png")#}"="" /></span>表单工具
-        </div>
-        <ul class="menuson">
-            <li><cite></cite><a href="{#helper\globals::getFullUrl("/formbuilder")#}" target="rightFrame">表单生成器</a><i></i></li>
-        </ul>
-    </dd>
-    <dd>
-        <div class="title">
-            <span><img src="{#\helper\globals::getImage("leftico03.png")#}"="" /></span>编辑器
-        </div>
-        <ul class="menuson">
-            <li><cite></cite><a href="#">自定义</a><i></i></li>
-            <li><cite></cite><a href="#">常用资料</a><i></i></li>
-            <li><cite></cite><a href="#">信息列表</a><i></i></li>
-            <li><cite></cite><a href="#">其他</a><i></i></li>
-        </ul>
-    </dd>
-    <dd>
-        <div class="title">
-            <span><img src="{#\helper\globals::getImage("leftico04.png")#}"="" /></span>日期管理
-        </div>
-        <ul class="menuson">
-            <li><cite></cite><a href="#">自定义</a><i></i></li>
-            <li><cite></cite><a href="#">常用资料</a><i></i></li>
-            <li><cite></cite><a href="#">信息列表</a><i></i></li>
-            <li><cite></cite><a href="#">其他</a><i></i></li>
-        </ul>
-    </dd>
-</dl>
-</body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>无标题文档</title>
+    <link href="{#\helper\globals::getCss("style")#}"="" rel="stylesheet" type="text/css" />
+    <script language="JavaScript" src="{#\helper\globals::getJs("jquery")#}"=""></script>
+    <script type="text/javascript">
+            $(function(){
+                //导航切换
+                $(".menuson li").click(function(){
+                    $(".menuson li.active").removeClass("active")
+                    $(this).addClass("active");
+                });
+
+                $('.title').click(function(){
+                    var $ul = $(this).next('ul');
+                    $('dd').find('ul').slideUp();
+                    if($ul.is(':visible')){
+                        $(this).next('ul').slideUp();
+                    }else{
+                        $(this).next('ul').slideDown();
+                    }
+                });
+            })
+    </script>
+</head>
+<body style="background:#f0f9fd;">
+<div class="lefttop">
+    <span></span>管理菜单
+</div>
+<dl class="leftmenu">
+    <dd>
+        <div class="title">
+            <span><img src="{#\helper\globals::getImage("leftico01.png")#}"="" /></span>数据库功能
+        </div>
+        <ul class="menuson">
+            <li><cite></cite><a href="{#helper\globals::getFullUrl("/database/creator")#}" target="rightFrame">规则生成器</a><i></i></li>
+            <li><cite></cite><a href="{#helper\globals::getFullUrl("/database/rules")#}" target="rightFrame">详细规则管理</a><i></i></li>
+            <li><cite></cite><a href="{#helper\globals::getFullUrl("/database/table")#}" target="rightFrame">数据管理</a><i></i></li>
+        </ul>
+    </dd>
+    <dd>
+        <div class="title">
+            <span><img src="{#\helper\globals::getImage("leftico01.png")#}"="" /></span>目录管理
+        </div>
+        <ul class="menuson">
+            <li><cite></cite><a href="{#helper\globals::getFullUrl("/dirs")#}" target="rightFrame">文件管理</a><i></i></li>
+        </ul>
+    </dd>
+    <dd>
+        <div class="title">
+            <span><img src="{#\helper\globals::getImage("leftico02.png")#}"="" /></span>表单工具
+        </div>
+        <ul class="menuson">
+            <li><cite></cite><a href="{#helper\globals::getFullUrl("/formbuilder")#}" target="rightFrame">表单生成器</a><i></i></li>
+        </ul>
+    </dd>
+    <dd>
+        <div class="title">
+            <span><img src="{#\helper\globals::getImage("leftico03.png")#}"="" /></span>编辑器
+        </div>
+        <ul class="menuson">
+            <li><cite></cite><a href="#">自定义</a><i></i></li>
+            <li><cite></cite><a href="#">常用资料</a><i></i></li>
+            <li><cite></cite><a href="#">信息列表</a><i></i></li>
+            <li><cite></cite><a href="#">其他</a><i></i></li>
+        </ul>
+    </dd>
+    <dd>
+        <div class="title">
+            <span><img src="{#\helper\globals::getImage("leftico04.png")#}"="" /></span>日期管理
+        </div>
+        <ul class="menuson">
+            <li><cite></cite><a href="#">自定义</a><i></i></li>
+            <li><cite></cite><a href="#">常用资料</a><i></i></li>
+            <li><cite></cite><a href="#">信息列表</a><i></i></li>
+            <li><cite></cite><a href="#">其他</a><i></i></li>
+        </ul>
+    </dd>
+</dl>
+</body>
 </html>

+ 93 - 93
demo/private/view/manage/login.html

@@ -1,93 +1,93 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title>欢迎登录后台管理系统</title>
-<link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
-<script language="JavaScript" src="{#helper\globals::getJs("jquery")#}"></script>
-<script src="{#helper\globals::getJs("cloud")#}" type="text/javascript"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("tips")#}"></script>
-	<script type="text/javascript" src="{#helper\globals::getJs("notify-custom.min")#}"></script>
-
-<script language="javascript">
-	$(function(){
-    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
-	$(window).resize(function(){  
-    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
-    })  
-});  
-</script> 
-
-</head>
-
-<body style="background-color:#1c77ac; background-image:url(images/light.png); background-repeat:no-repeat; background-position:center top; overflow:hidden;">
-
-
-
-    <div id="mainBody">
-      <div id="cloud1" class="cloud"></div>
-      <div id="cloud2" class="cloud"></div>
-    </div>  
-
-
-<div class="logintop">    
-    <span>欢迎登录后台管理界面平台</span>    
-    <ul>
-	    <li><a href="#">回首页</a></li>
-	    <li><a href="#">帮助</a></li>
-	    <li><a href="#">关于</a></li>
-    </ul>    
-    </div>
-    
-    <div class="loginbody">
-    
-    <span class="systemlogo"></span> 
-       
-    <div class="loginbox">
-    	{#helper\globals::safeForm()#}
-	    <ul>
-		    <li><input name="user" id="user" type="text" class="loginuser" value="admin"  placeholder="请输入用户名" /></li>
-		    <li><input name="password" id="passwrod" type="password" class="loginpwd" placeholder="请输入密码" /></li>
-		    <li><input name="login" type="button" class="loginbtn" value="登录"  /><label><input name="" type="checkbox" value="" checked="checked" />记住密码</label><label><a href="#">忘记密码?</a></label></li>
-	    </ul>
-    </div>
-    <p style="text-align:center;">请在配置文件中设置登录密码</p>
-    </div>
-    <div class="loginbm">2016  <a href="{#$pathes.weburl#}">{#$pathes.weburl#}</a> </div>
-	<script>
-		$('input[name="login"]').on('click', function(){
-			var user = $('input[name="user"]').val();
-			var password = $('input[name="password"]').val();
-			var security_sid = $('input[name="security_sid"]').val();
-			if(user == '' || password == '')
-			{
-				$.notify('用户名和密码不能为空', 'error');
-				return;
-			}
-			$.ajax({
-					url : '{#$pathes.loginCheck#}?isAjax=1',
-					data : {user: user, password : password, security_sid : security_sid},
-					method : 'POST',
-					dataType : 'json',
-					success : function(data)
-					{
-						if(data.code == 0)
-						{
-							$.notify("登录成功", "success", {callback: function(){window.location.href = window.location.href;}});
-						}
-						else
-						{
-							$.notify(data.msg, "error");
-						}
-					},
-					error : function()
-					{
-						$.notify("网络连接失败,请重试", "error");
-					}
-			});
-		});
-	</script>
-    
-</body>
-
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>欢迎登录后台管理系统</title>
+<link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
+<script language="JavaScript" src="{#helper\globals::getJs("jquery")#}"></script>
+<script src="{#helper\globals::getJs("cloud")#}" type="text/javascript"></script>
+    <script type="text/javascript" src="{#helper\globals::getJs("tips")#}"></script>
+	<script type="text/javascript" src="{#helper\globals::getJs("notify-custom.min")#}"></script>
+
+<script language="javascript">
+	$(function(){
+    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
+	$(window).resize(function(){  
+    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
+    })  
+});  
+</script> 
+
+</head>
+
+<body style="background-color:#1c77ac; background-image:url(images/light.png); background-repeat:no-repeat; background-position:center top; overflow:hidden;">
+
+
+
+    <div id="mainBody">
+      <div id="cloud1" class="cloud"></div>
+      <div id="cloud2" class="cloud"></div>
+    </div>  
+
+
+<div class="logintop">    
+    <span>欢迎登录后台管理界面平台</span>    
+    <ul>
+	    <li><a href="#">回首页</a></li>
+	    <li><a href="#">帮助</a></li>
+	    <li><a href="#">关于</a></li>
+    </ul>    
+    </div>
+    
+    <div class="loginbody">
+    
+    <span class="systemlogo"></span> 
+       
+    <div class="loginbox">
+    	{#helper\globals::safeForm()#}
+	    <ul>
+		    <li><input name="user" id="user" type="text" class="loginuser" value="admin"  placeholder="请输入用户名" /></li>
+		    <li><input name="password" id="passwrod" type="password" class="loginpwd" placeholder="请输入密码" /></li>
+		    <li><input name="login" type="button" class="loginbtn" value="登录"  /><label><input name="" type="checkbox" value="" checked="checked" />记住密码</label><label><a href="#">忘记密码?</a></label></li>
+	    </ul>
+    </div>
+    <p style="text-align:center;">请在配置文件中设置登录密码</p>
+    </div>
+    <div class="loginbm">2016  <a href="{#$pathes.weburl#}">{#$pathes.weburl#}</a> </div>
+	<script>
+		$('input[name="login"]').on('click', function(){
+			var user = $('input[name="user"]').val();
+			var password = $('input[name="password"]').val();
+			var security_sid = $('input[name="security_sid"]').val();
+			if(user == '' || password == '')
+			{
+				$.notify('用户名和密码不能为空', 'error');
+				return;
+			}
+			$.ajax({
+					url : '{#$pathes.loginCheck#}?isAjax=1',
+					data : {user: user, password : password, security_sid : security_sid},
+					method : 'POST',
+					dataType : 'json',
+					success : function(data)
+					{
+						if(data.code == 0)
+						{
+							$.notify("登录成功", "success", {callback: function(){window.location.href = window.location.href;}});
+						}
+						else
+						{
+							$.notify(data.msg, "error");
+						}
+					},
+					error : function()
+					{
+						$.notify("网络连接失败,请重试", "error");
+					}
+			});
+		});
+	</script>
+    
+</body>
+
+</html>

+ 16 - 16
demo/private/view/manage/main.html

@@ -1,16 +1,16 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title>信息管理系统界面</title>
-</head>
-<frameset rows="88,*" cols="*" frameborder="no" border="0" framespacing="0">
-	<frame src="{#\helper\globals::getFullUrl("/menu/top", ".html")#}" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
-  <frameset cols="187,*" frameborder="no" border="0" framespacing="0">
-	  <frame src="{#\helper\globals::getFullUrl("/menu/left", ".html")#}" name="leftFrame" scrolling="No" noresize="noresize" id="leftFrame" title="leftFrame" />
-	  <frame src="{#if $url#}{#$url#}{#else#}{#\helper\globals::getFullUrl("/menu/index", ".html")#}{#/if#}" name="rightFrame" id="rightFrame" title="rightFrame" />
-  </frameset>
-</frameset>
-<noframes><body>
-</body></noframes>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>信息管理系统界面</title>
+</head>
+<frameset rows="88,*" cols="*" frameborder="no" border="0" framespacing="0">
+	<frame src="{#\helper\globals::getFullUrl("/menu/top", ".html")#}" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
+  <frameset cols="187,*" frameborder="no" border="0" framespacing="0">
+	  <frame src="{#\helper\globals::getFullUrl("/menu/left", ".html")#}" name="leftFrame" scrolling="No" noresize="noresize" id="leftFrame" title="leftFrame" />
+	  <frame src="{#if $url#}{#$url#}{#else#}{#\helper\globals::getFullUrl("/menu/index", ".html")#}{#/if#}" name="rightFrame" id="rightFrame" title="rightFrame" />
+  </frameset>
+</frameset>
+<noframes><body>
+</body></noframes>
+</html>

+ 52 - 52
demo/private/view/manage/top.html

@@ -1,52 +1,52 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title>无标题文档</title>
-<link href="{#\helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
-<script language="JavaScript" src="{#\helper\globals::getJs("jquery")#}"></script>
-<script type="text/javascript">
-$(function(){	
-	//顶部导航切换
-	$(".nav li a").click(function(){
-		$(".nav li a.selected").removeClass("selected")
-		$(this).addClass("selected");
-	})	
-})	
-</script>
-
-
-</head>
-
-<body style="background:url({#\helper\globals::getImage("topbg.gif")#}) repeat-x;">
-
-    <div class="topleft">
-    <a href="{#\helper\globals::getFullUrl('main/index')#}" target="_parent"><img src="{#\helper\globals::getImage("logo.png")#}" title="系统首页" /></a>
-    </div>
-        
-    <ul class="nav">
-    <li><a href="{#\helper\globals::getFullUrl('menu/index')#}" target="rightFrame" class="selected"><img src="{#\helper\globals::getImage("icon01.png")#}" title="工作台" /><h2>工作台</h2></a></li>
-    <li><a href="imgtable.html" target="rightFrame"><img src="{#\helper\globals::getImage("icon02.png")#}" title="模型管理" /><h2>模型管理</h2></a></li>
-    <li><a href="imglist.html"  target="rightFrame"><img src="{#\helper\globals::getImage("icon03.png")#}" title="模块设计" /><h2>模块设计</h2></a></li>
-    <li><a href="tools.html"  target="rightFrame"><img src="{#\helper\globals::getImage("icon04.png")#}" title="常用工具" /><h2>常用工具</h2></a></li>
-    <li><a href="{#\helper\globals::getFullUrl('dirs')#}" target="rightFrame"><img src="{#\helper\globals::getImage("icon05.png")#}" title="文件管理" /><h2>文件管理</h2></a></li>
-    <li><a href="{#\helper\globals::getFullUrl('main/setting')#}"  target="rightFrame"><img src="{#\helper\globals::getImage("icon06.png")#}" title="系统设置" /><h2>系统设置</h2></a></li>
-    </ul>
-            
-    <div class="topright">    
-    <ul>
-    <li><span><img src="{#\helper\globals::getImage("help.png")#}" title="帮助"  class="helpimg"/></span><a href="#">帮助</a></li>
-    <li><a href="#">关于</a></li>
-    <li><a href="{#\helper\globals::getFullUrl('main/logout')#}" target="_parent">退出</a></li>
-    </ul>
-     
-    <div class="user">
-    <span>{#$admin.user#}</span>
-    <i>消息</i>
-    <b>0</b>
-    </div>    
-    
-    </div>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>无标题文档</title>
+<link href="{#\helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
+<script language="JavaScript" src="{#\helper\globals::getJs("jquery")#}"></script>
+<script type="text/javascript">
+$(function(){	
+	//顶部导航切换
+	$(".nav li a").click(function(){
+		$(".nav li a.selected").removeClass("selected")
+		$(this).addClass("selected");
+	})	
+})	
+</script>
+
+
+</head>
+
+<body style="background:url({#\helper\globals::getImage("topbg.gif")#}) repeat-x;">
+
+    <div class="topleft">
+    <a href="{#\helper\globals::getFullUrl('main/index')#}" target="_parent"><img src="{#\helper\globals::getImage("logo.png")#}" title="系统首页" /></a>
+    </div>
+        
+    <ul class="nav">
+    <li><a href="{#\helper\globals::getFullUrl('menu/index')#}" target="rightFrame" class="selected"><img src="{#\helper\globals::getImage("icon01.png")#}" title="工作台" /><h2>工作台</h2></a></li>
+    <li><a href="imgtable.html" target="rightFrame"><img src="{#\helper\globals::getImage("icon02.png")#}" title="模型管理" /><h2>模型管理</h2></a></li>
+    <li><a href="imglist.html"  target="rightFrame"><img src="{#\helper\globals::getImage("icon03.png")#}" title="模块设计" /><h2>模块设计</h2></a></li>
+    <li><a href="tools.html"  target="rightFrame"><img src="{#\helper\globals::getImage("icon04.png")#}" title="常用工具" /><h2>常用工具</h2></a></li>
+    <li><a href="{#\helper\globals::getFullUrl('dirs')#}" target="rightFrame"><img src="{#\helper\globals::getImage("icon05.png")#}" title="文件管理" /><h2>文件管理</h2></a></li>
+    <li><a href="{#\helper\globals::getFullUrl('main/setting')#}"  target="rightFrame"><img src="{#\helper\globals::getImage("icon06.png")#}" title="系统设置" /><h2>系统设置</h2></a></li>
+    </ul>
+            
+    <div class="topright">    
+    <ul>
+    <li><span><img src="{#\helper\globals::getImage("help.png")#}" title="帮助"  class="helpimg"/></span><a href="#">帮助</a></li>
+    <li><a href="#">关于</a></li>
+    <li><a href="{#\helper\globals::getFullUrl('main/logout')#}" target="_parent">退出</a></li>
+    </ul>
+     
+    <div class="user">
+    <span>{#$admin.user#}</span>
+    <i>消息</i>
+    <b>0</b>
+    </div>    
+    
+    </div>
+
+</body>
+</html>

+ 16 - 16
demo/private/view/tips.html

@@ -1,17 +1,17 @@
-    <div class="tip">
-        <div class="tiptop"><span>提示信息</span><a></a></div>
-
-        <div class="tipinfo">
-            <span><img src="{#helper\globals::getImage("ticon.png")#}" /></span>
-            <div class="tipright">
-                <p>是否确认对信息的修改 ?</p>
-                <cite>如果是请点击确定按钮 ,否则请点取消。</cite>
-            </div>
-        </div>
-
-        <div class="tipbtn">
-            <input name="" type="button"  class="sure" value="确定" />&nbsp;
-            <input name="" type="button"  class="cancel" value="取消" />
-        </div>
-
+    <div class="tip">
+        <div class="tiptop"><span>提示信息</span><a></a></div>
+
+        <div class="tipinfo">
+            <span><img src="{#helper\globals::getImage("ticon.png")#}" /></span>
+            <div class="tipright">
+                <p>是否确认对信息的修改 ?</p>
+                <cite>如果是请点击确定按钮 ,否则请点取消。</cite>
+            </div>
+        </div>
+
+        <div class="tipbtn">
+            <input name="" type="button"  class="sure" value="确定" />&nbsp;
+            <input name="" type="button"  class="cancel" value="取消" />
+        </div>
+
     </div>

+ 13 - 13
demo/public/.htaccess

@@ -1,13 +1,13 @@
-##
-#
-#	$Id: .htaccess 268 2009-12-16 06:18:19Z Jinhui.Zhu $
-#
-#	Copyright (C) 2008-2009 www.qiiframework.com. All Rights Reserved.
-#  
-##
-RewriteEngine On
-RewriteCond %{REQUEST_FILENAME} !-d
-RewriteCond %{REQUEST_FILENAME} !-f
-
-RewriteCond $1 !^(index.php|images|robots.txt)
-RewriteRule (.*)$ index.php/$1 [L,QSA,PT]
+##
+#
+#	$Id: .htaccess 268 2009-12-16 06:18:19Z Jinhui.Zhu $
+#
+#	Copyright (C) 2008-2009 www.qiiframework.com. All Rights Reserved.
+#  
+##
+RewriteEngine On
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{REQUEST_FILENAME} !-f
+
+RewriteCond $1 !^(index.php|images|robots.txt)
+RewriteRule (.*)$ index.php/$1 [L,QSA,PT]

+ 12 - 12
demo/public/index.php

@@ -1,13 +1,13 @@
-<?php
-require_once('../../src/Qii.php');
-
-$app = \Qii::getInstance();
-$app->setWorkspace('../private')
-->setCachePath('tmp')
-->setAppConfigure('configure/app.ini')
-->setUseNamespace('Bootstrap', false)
-->setLoger('plugins\loger')
-->setDB('configure/db.ini')
-->setRouter('configure/router.config.php')
-->setBootstrap()
+<?php
+require_once('../../src/Qii.php');
+
+$app = \Qii::getInstance();
+$app->setWorkspace('../private')
+->setCachePath('tmp')
+->setAppConfigure('configure/app.ini')
+->setUseNamespace('Bootstrap', false)
+->setLoger('plugins\loger')
+->setDB('configure/db.ini')
+->setRouter('configure/router.config.php')
+->setBootstrap()
 ->run();

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 6 - 6
demo/public/static/css/jquery-ui.min.css


+ 86 - 86
demo/public/static/css/jquery.multiSelect.css

@@ -1,87 +1,87 @@
-a.multiSelect {
-	background: #FFF url(../images/dropdown.blue.png) right center no-repeat;
-	border: solid 1px #BBB;
-	padding-right: 20px;
-	position: relative;
-	cursor: default;
-	text-decoration: none;
-	color: black;
-	display: -moz-inline-stack;
-	display: inline-block;
-	vertical-align: top;
-}
-
-a.multiSelect:link, a.multiSelect:visited, a.multiSelect:hover, a.multiSelect:active {
-	color: black;
-	text-decoration: none;
-}
-
-a.multiSelect span
-{
-	margin: 1px 0px 1px 3px;
-	overflow: hidden;
-	display: -moz-inline-stack;
-	display: inline-block;
-	white-space: nowrap;
-	line-height:15px;
-	text-indent:0px;
-}
-
-a.multiSelect.hover {
-	background-image: url(../images/dropdown.blue.hover.png);
-}
-
-a.multiSelect.active, 
-a.multiSelect.focus {
-	border: inset 1px #000;
-}
-
-a.multiSelect.active {
-	background-image: url(../images/dropdown.blue.active.png);
-}
-
-.multiSelectOptions {
-	margin-top: -1px;
-	overflow-y: auto;
-	overflow-x: hidden;
-	border: solid 1px #B2B2B2;
-	background: #FFF;
-}
-
-.multiSelectOptions LABEL {
-	padding: 0px 2px;
-	display: block;
-	white-space: nowrap;
-}
-
-.multiSelectOptions LABEL.optGroup
-{
-	font-weight: bold;
-}
-
-.multiSelectOptions .optGroupContainer LABEL
-{
-	padding-left: 10px;
-}
-
-.multiSelectOptions.optGroupHasCheckboxes .optGroupContainer LABEL
-{
-	padding-left: 18px;
-}
-
-.multiSelectOptions input{
-	vertical-align: middle;
-}
-
-.multiSelectOptions LABEL.checked {
-	background-color: #dce5f8;
-}
-
-.multiSelectOptions LABEL.selectAll {
-	border-bottom: dotted 1px #CCC;
-}
-
-.multiSelectOptions LABEL.hover {
-	background-color: #3399ff;
-	color: white;
+a.multiSelect {
+	background: #FFF url(../images/dropdown.blue.png) right center no-repeat;
+	border: solid 1px #BBB;
+	padding-right: 20px;
+	position: relative;
+	cursor: default;
+	text-decoration: none;
+	color: black;
+	display: -moz-inline-stack;
+	display: inline-block;
+	vertical-align: top;
+}
+
+a.multiSelect:link, a.multiSelect:visited, a.multiSelect:hover, a.multiSelect:active {
+	color: black;
+	text-decoration: none;
+}
+
+a.multiSelect span
+{
+	margin: 1px 0px 1px 3px;
+	overflow: hidden;
+	display: -moz-inline-stack;
+	display: inline-block;
+	white-space: nowrap;
+	line-height:15px;
+	text-indent:0px;
+}
+
+a.multiSelect.hover {
+	background-image: url(../images/dropdown.blue.hover.png);
+}
+
+a.multiSelect.active, 
+a.multiSelect.focus {
+	border: inset 1px #000;
+}
+
+a.multiSelect.active {
+	background-image: url(../images/dropdown.blue.active.png);
+}
+
+.multiSelectOptions {
+	margin-top: -1px;
+	overflow-y: auto;
+	overflow-x: hidden;
+	border: solid 1px #B2B2B2;
+	background: #FFF;
+}
+
+.multiSelectOptions LABEL {
+	padding: 0px 2px;
+	display: block;
+	white-space: nowrap;
+}
+
+.multiSelectOptions LABEL.optGroup
+{
+	font-weight: bold;
+}
+
+.multiSelectOptions .optGroupContainer LABEL
+{
+	padding-left: 10px;
+}
+
+.multiSelectOptions.optGroupHasCheckboxes .optGroupContainer LABEL
+{
+	padding-left: 18px;
+}
+
+.multiSelectOptions input{
+	vertical-align: middle;
+}
+
+.multiSelectOptions LABEL.checked {
+	background-color: #dce5f8;
+}
+
+.multiSelectOptions LABEL.selectAll {
+	border-bottom: dotted 1px #CCC;
+}
+
+.multiSelectOptions LABEL.hover {
+	background-color: #3399ff;
+	color: white;
 }

+ 26 - 26
demo/public/static/css/select.css

@@ -1,26 +1,26 @@
-/***** 输入框(无边框悬停状态) *****/
-.uew-select .uew-select-value{height:32px;padding:0 5px; margin-top:0px; margin-bottom:12px;line-height:32px;font-family:Tahoma,'微软雅黑','宋体';*font-family:'微软雅黑','宋体';color:#000;resize:none;border-width:1px;border-style:solid;border-color:#a7b5bc #ced9df #ced9df #a7b5bc;}
-.uew-border-flag,.uew-border-flag,textarea.uew-border-flag,.uew-select .uew-select-value.uew-border-flag{border-width:1px;border-style:solid;border-color:#bababa #e9e9e9 #e9e9e9 #bababa;}
-/***** 下拉框 *****/
-.uew-select{position:relative;}
-.uew-select .uew-select-value{z-index:1;position:relative;padding-right:20px;background:#fff;font-size:12px; text-indent:5px;background:url(../images/inputbg.gif) repeat-x;_background:none;_border:none;}
-.uew-select-value em{font-style:normal;}
-.uew-select .uew-icon{position:absolute;right:5px;top:10px;}
-.uew-select select{z-index:2;position:absolute;top:3px;_top:6px;cursor:pointer; height:28px;}
-/***** 去除聚焦虚线框 *****/
-a:focus,input[type=checkbox]:focus,input[type=radio]:focus,button:focus,.uew-select select{outline:none;}
-.uew-select select{opacity:0;filter:alpha(opacity=0);}
-option{overflow:auto;outline:none;}
-
-/*----------------------------------*
- * 	组件公用图标库         				*
- *----------------------------------*/
-.uew-icon,.ue-state-default .uew-icon{display:inline-block;width:16px;height:16px;background-image:url(../images/uew_icon.png);}
-.ue-state-hover .uew-icon{background-image:url(../images/uew_icon_hover.png);}
-.uew-icon-triangle-1-s{background-position:-80px 0;}
-
-.vocation,.usercity{float:left;}
-.cityleft{float:left; padding-right:10px;_padding-right:15px;}
-.cityright{float:left;}
-
-
+/***** 输入框(无边框悬停状态) *****/
+.uew-select .uew-select-value{height:32px;padding:0 5px; margin-top:0px; margin-bottom:12px;line-height:32px;font-family:Tahoma,'微软雅黑','宋体';*font-family:'微软雅黑','宋体';color:#000;resize:none;border-width:1px;border-style:solid;border-color:#a7b5bc #ced9df #ced9df #a7b5bc;}
+.uew-border-flag,.uew-border-flag,textarea.uew-border-flag,.uew-select .uew-select-value.uew-border-flag{border-width:1px;border-style:solid;border-color:#bababa #e9e9e9 #e9e9e9 #bababa;}
+/***** 下拉框 *****/
+.uew-select{position:relative;}
+.uew-select .uew-select-value{z-index:1;position:relative;padding-right:20px;background:#fff;font-size:12px; text-indent:5px;background:url(../images/inputbg.gif) repeat-x;_background:none;_border:none;}
+.uew-select-value em{font-style:normal;}
+.uew-select .uew-icon{position:absolute;right:5px;top:10px;}
+.uew-select select{z-index:2;position:absolute;top:3px;_top:6px;cursor:pointer; height:28px;}
+/***** 去除聚焦虚线框 *****/
+a:focus,input[type=checkbox]:focus,input[type=radio]:focus,button:focus,.uew-select select{outline:none;}
+.uew-select select{opacity:0;filter:alpha(opacity=0);}
+option{overflow:auto;outline:none;}
+
+/*----------------------------------*
+ * 	组件公用图标库         				*
+ *----------------------------------*/
+.uew-icon,.ue-state-default .uew-icon{display:inline-block;width:16px;height:16px;background-image:url(../images/uew_icon.png);}
+.ue-state-hover .uew-icon{background-image:url(../images/uew_icon_hover.png);}
+.uew-icon-triangle-1-s{background-position:-80px 0;}
+
+.vocation,.usercity{float:left;}
+.cityleft{float:left; padding-right:10px;_padding-right:15px;}
+.cityright{float:left;}
+
+

+ 309 - 309
demo/public/static/css/style.css

@@ -1,310 +1,310 @@
-@charset "utf-8";
-/* CSS Document */
-/***
- * uimaker
- * http://www.uimaker.com
- * e-mail: admin@uimaker.com
- */
-*{font-size:9pt;border:0;margin:0;padding:0;}
-body{font-family:'微软雅黑'; margin:0 auto;min-width:980px;}
-ul{display:block;margin:0;padding:0;list-style:none;height:auto;overflow:hidden;}
-li{display:block;margin:0;padding:0;list-style: none;height:auto;overflow:hidden;}
-img{border:0;}
-dl,dt,dd,span{margin:0;padding:0;display:block;}
-a,a:focus{text-decoration:none;color:#000;outline:none;blr:expression(this.onFocus=this.blur());}
-a:hover{color:#00a4ac;text-decoration:none;}
-table{border-collapse:collapse;border-spacing: 0;}
-cite{font-style:normal;}
-h2{font-weight:normal;}
-
-/*cloud*/
-
-#mainBody {width:100%;height:100%;position:absolute;z-index:-1;}
-.cloud {position:absolute;top:0px;left:0px;width:100%;height:100%;background:url(../images/cloud.png) no-repeat;z-index:1;opacity:0.5;}
-#cloud2 {z-index:2;}
-
-
-/*login*/
-.logintop{height:47px; position:absolute; top:0; background:url(../images/loginbg1.png) repeat-x;z-index:100; width:100%;}
-.logintop span{color:#fff; line-height:47px; background:url(../images/loginsj.png) no-repeat 21px 18px; text-indent:44px; color:#afc5d2; float:left;}
-.logintop ul{float:right; padding-right:30px;}
-.logintop ul li{float:left; margin-left:20px; line-height:47px;}
-.logintop ul li a{color:#afc5d2;}
-.logintop ul li a:hover{color:#fff;}
-.loginbody{background:url(../images/loginbg3.png) no-repeat center center; width:100%; height:585px; overflow:hidden; position:absolute; top:47px;}
-.systemlogo{background:url(../images/loginlogo.png) no-repeat center;width:100%; height:71px; margin-top:75px;}
-.loginbox{width:692px; height:336px; background:url(../images/logininfo.png) no-repeat; margin-top:30px;}
-.loginbox ul{margin-top:88px; margin-left:285px;}
-.loginbox ul li{margin-bottom:25px;}
-.loginbox ul li label{color:#687f92; padding-left:25px;}
-.loginbox ul li label a{color:#687f92;}
-.loginbox ul li label a:hover{color:#3d96c9;}
-.loginbox ul li label input{margin-right:5px;}
-.loginuser{width:299px; height:48px; background:url(../images/loginuser.png) no-repeat; border:none; line-height:48px; padding-left:44px; font-size:14px; font-weight:bold;}
-.loginpwd{width:299px; height:48px; background:url(../images/loginpassword.png) no-repeat; border:none;line-height:48px; padding-left:44px; font-size:14px; color:#90a2bc;}
-.loginbtn{width:111px;height:35px; background:url(../images/buttonbg.png) repeat-x; font-size:14px; font-weight:bold; color:#fff;cursor:pointer; line-height:35px;}
-.loginbm{height:50px; line-height:50px; text-align:center; background:url(../images/loginbg2.png) repeat-x;position:absolute; bottom:0; width:100%; color:#0b3a58;}
-.loginbm a{font-weight:bold;color:#0b3a58;}
-.loginbm a:hover{color:#fff;}
-
-
-/*top.html*/
-.header{height:88px;}
-.topleft{height:88px;background:url(../images/topleft.jpg) no-repeat;float:left; width:300px;}
-.topleft img{margin-top:12px;margin-left:10px;}
-.topright{height:88px;background:url(../images/topright.jpg) no-repeat right;float:right;}
-.nav{float:left;}
-.nav li{float:left;width:87px;height:88px; text-align:center;}
-.nav li a{display:block;width:87px;height:88px;-moz-transition: none; transition: background-color 0.3s linear; -moz-transition: background-color 0.3s linear; -webkit-transition: background-color 0.3s linear; -o-transition: background-color 0.3s linear; }
-.nav li a.selected{background:url(../images/navbg.png) no-repeat;}
-.nav li a:hover{display:block;background:#000;color:#fff;background: none repeat scroll 0% 0% rgb(43, 127, 181);}
-.nav li img{margin-top:10px;}
-.nav li a{display:block;}
-.nav a h2{font-size:14px;color:#d6e8f1;}
-.nav a:hover h2{color:#fff;}
-.topright ul{padding-top:15px; float:right; padding-right:12px;}
-.topright ul li{float:left; padding-left:9px; padding-right:9px; background:url(../images/line.gif) no-repeat right;}
-.topright ul li:last-child{background:none;}
-.topright ul li a{font-size:13px; color:#e9f2f7;}
-.topright ul li a:hover{color:#fff;}
-.topright ul li span{margin-top:2px;float:left;padding-right:3px;}
-.user{height:30px;background:url(../images/ub1.png) repeat-x;clear:both;margin-top:10px;float:right; margin-right:12px;border-radius:30px; behavior:url(js/pie.htc); white-space:nowrap;position:relative;}
-.user span{display:inline-block;padding-right:10px; background:url(../images/user.png) no-repeat 15px 10px; line-height:30px; font-size:14px;color:#b8ceda; padding-left:20px; padding-left:35px;}
-.user b{display:inline-block;width:20px;height:18px; background:url(../images/msg.png);text-align:center; font-weight:normal; color:#fff;font-size:14px;margin-right:13px; margin-top:7px; line-height:18px;}
-.user i{display:inline-block;margin-right:5px;font-style:normal;line-height:30px; font-size:14px;color:#b8ceda;}
-
-/*left.html*/
-.lefttop{background:url(../images/lefttop.gif) repeat-x;height:40px;color:#fff;font-size:14px;line-height:40px;}
-.lefttop span{margin-left:8px; margin-top:10px;margin-right:8px; background:url(../images/leftico.png) no-repeat; width:20px; height:21px;float:left;}
-.leftmenu{width:187px;padding-bottom: 9999px;margin-bottom: -9999px; overflow:hidden; background:url(../images/leftline.gif) repeat-y right;}
-.leftmenu dd{background:url(../images/leftmenubg.gif) repeat-x;line-height:35px;font-weight:bold;font-size:14px;border-right:solid 1px #b7d5df;}
-.leftmenu dd span{float:left;margin:10px 8px 0 12px;}
-.leftmenu dd .menuson{display:none;}
-.leftmenu dd:first-child .menuson{display:block;}
-.menuson {line-height:30px; font-weight:normal; }
-.menuson li{cursor:pointer;}
-.menuson li.active{position:relative; background:url(../images/libg.png) repeat-x; line-height:30px; color:#fff;}
-.menuson li cite{display:block; float:left; margin-left:32px; background:url(../images/list.gif) no-repeat; width:16px; height:16px; margin-top:7px;}
-.menuson li.active cite{background:url(../images/list1.gif) no-repeat;}
-.menuson li.active i{display:block; background:url(../images/sj.png) no-repeat; width:6px; height:11px; position:absolute; right:0;z-index:10000; top:9px; right:-1px;}
-.menuson li a{ display:block; *display:inline; *padding-top:5px;}
-.menuson li.active a{color:#fff;}
-.title{cursor:pointer;}
-
-
-/*right.html*/
-.place{height:40px; background:url(../images/righttop.gif) repeat-x;}
-.place span{line-height:40px; font-weight:bold;float:left; margin-left:12px;}
-.placeul li{float:left; line-height:40px; padding-left:7px; padding-right:12px; background:url(../images/rlist.gif) no-repeat right;}
-.placeul li:last-child{background:none;}
-.rightinfo{padding:8px;}
-.tools{clear:both; height:35px; margin-bottom:8px;}
-.toolbar{float:left;}
-.toolbar li{background:url(../images/toolbg.gif) repeat-x; line-height:33px; height:33px; border:solid 1px #d3dbde; float:left; padding-right:10px; margin-right:5px;border-radius: 3px; behavior:url(js/pie.htc); cursor:pointer;}
-.toolbar li span{float:left; margin-left:10px; margin-right:5px; margin-top:5px;}
-.toolbar1{float:right;}
-.toolbar1 li{background:url(../images/toolbg.gif) repeat-x; line-height:33px; height:33px; border:solid 1px #d3dbde; float:left; padding-right:10px; margin-left:5px;border-radius: 3px; behavior:url(js/pie.htc);}
-.toolbar1 li span{float:left; margin-left:10px; margin-right:5px; margin-top:5px;}
-.tablelist{border:solid 1px #cbcbcb; width:100%; clear:both;white-space:nowrap;}
-.tablelist th{background:url(../images/th.gif) repeat-x; height:34px; line-height:34px; border-bottom:solid 1px #b6cad2; text-indent:11px; text-align:left;}
-.tablelist td{line-height:35px; text-indent:11px; border-right: dotted 1px #c7c7c7;}
-.tablelink{color:#056dae;}
-.tablelist tbody tr.odd{background:#f5f8fa;}
-.tablelist tbody tr:hover{background:#e5ebee;}
-.sort{padding-left:3px;}
-
-/*page*/
-.pagin{position:relative;margin-top:10px;padding:0 12px;height:35px;}
-.pagin .blue{color:#056dae;font-style:normal;}
-.pagin .paginList{position:absolute;right:12px;top:0;}
-.pagin .paginList .paginItem{float:left;}
-.pagin .paginList .paginItem a{float:left;width:31px;height:28px;border:1px solid #DDD; text-align:center;line-height:30px;border-left:none;color:#3399d5;}
-.pagin .paginList .paginItem:first-child a{border-left:1px solid #DDD;}
-.pagin .paginList .paginItem:first-child a{border-bottom-left-radius:5px;border-top-left-radius:5px;}
-.pagin .paginList .paginItem:last-child a{border-bottom-right-radius:5px;border-top-right-radius:5px;}
-.pagin .paginList .paginItem.current,.pagin .paginList .paginItem.current a{background:#f5f5f5; cursor:default;color:#737373;}
-.pagin .paginList .paginItem:hover{background:#f5f5f5;}
-.pagin .paginList .paginItem.more,.pagin .paginList .paginItem.more a:hover{ cursor:default;}
-.pagin .paginList .paginItem.more:hover{background:#FFF;}
-.pagin .paginList .paginItem.more a{color:#737373;}
-.pagepre{background:url(../images/pre.gif) no-repeat center center; width:31px; height:28px;}
-.pagenxt{background:url(../images/next.gif) no-repeat center center; width:31px; height:28px;}
-.pagepre_highlight{background:url(../images/pre_highlight.gif) no-repeat center center; width:31px; height:28px;}
-.pagenxt_highlight{background:url(../images/next_highlight.gif) no-repeat center center; width:31px; height:28px;}
-
-/*index*/
-.mainindex{padding:20px; overflow:hidden;}
-.welinfo{height:32px; line-height:32px; padding-bottom:8px;}
-.welinfo span{float:left;}
-.welinfo b{padding-left:8px;}
-.welinfo a{padding-left:15px;color:#3186c8;}
-.welinfo a:hover{color:#F60;}
-.welinfo i{font-style:normal; padding-left:8px;}
-.xline{border-bottom:solid 1px #dfe9ee; height:5px;}
-.iconlist{padding-left:40px; overflow:hidden;}
-.iconlist li{text-align:center; float:left; margin-right:25px; margin-top:25px;}
-.iconlist li p{line-height:25px;}
-.ibox{clear:both; padding-left:40px; padding-top:18px; overflow:hidden; padding-bottom:18px;}
-.ibtn{background:url(../images/ibtnbg.png) repeat-x;border:solid 1px #bfcfe1; height:23px; line-height:23px; display:block; float:left; padding:0 15px; cursor:pointer;}
-.ibtn img{margin-top:5px; float:left; padding-right:7px;}
-.box{height:15px;}
-.infolist{padding-left:40px; padding-bottom:15px;}
-.infolist li{ line-height:25px; height:25px; margin-bottom:8px;}
-.infolist li span{float:left; display:block; margin-right:10px;}
-.uimakerinfo{padding-left:40px; background:url(../images/search.png) no-repeat 10px 15px; padding-top:15px; padding-bottom:20px;}
-.umlist{padding-left:40px;}
-.umlist li{float:left; background:url(../images/ulist.png) no-repeat 0 3px; padding-left:10px; margin-right:15px;}
-
-
-/*default*/
-.mainbox{padding:8px;position:relative;}
-.mainleft{padding-right:298px;}
-.leftinfo{border:#d3dbde solid 1px; height:290px;}
-.mainright{width:298px;position:absolute; top:8px; right:8px;}
-.dflist{border:#d3dbde solid 1px; width:288px; height:290px; float:right;}
-.dflist1{border:#d3dbde solid 1px; width:288px; height:238px; float:right; margin-top:8px;}
-.listtitle{background:url(../images/tbg.png) repeat-x; height:36px; line-height:36px; border-bottom:solid 1px #d3dbde; text-indent:14px; font-weight:bold; font-size:14px;}
-.more1{float:right; font-weight:normal;color:#307fb1; padding-right:17px;}
-.maintj{text-align:center;}
-.newlist{padding-left:14px; padding-top:15px;}
-.newlist li{line-height:25px; background:url(../images/list2.png) no-repeat 0px 8px; text-indent:11px;}
-.newlist i{width:80px; display:block; float:left; font-style:normal;}
-.newlist b{font-weight:normal; color:#7b7b7b; padding-left:10px;}
-.leftinfos{height:238px;margin-top:8px;}
-.infoleft{border:#d3dbde solid 1px; float:left;height:238px;}
-.inforight{border:#d3dbde solid 1px; float:right;height:238px; }
-.tooli{padding:30px 20px;}
-.tooli li{float:left;padding-left:15px; padding-right:15px;margin-bottom:20px;}
-.tooli li span{text-align:center;}
-.tooli li p{line-height:35px; text-align:center;}
-
-
-/*form*/
-.formbody{padding:10px 18px;}
-.formtitle{border-bottom:solid 1px #d0dee5; line-height:35px; position:relative; height:35px; margin-bottom:28px;}
-.formtitle span{font-weight:bold;font-size:14px; border-bottom:solid 3px #66c9f3;float:left; position:absolute; z-index:100; bottom:-1px; padding:0 3px; height:30px; line-height:30px;}
-.forminfo{padding-left:23px;}
-.forminfo li{margin-bottom:13px; clear:both;}
-.forminfo li label{width:86px;line-height:34px; display:block; float:left;}
-.forminfo li i{color:#7f7f7f; padding-left:20px; font-style:normal;}
-.forminfo li cite{display:block; padding-top:10px;}
-.dfinput{width:345px; height:32px; line-height:32px; border-top:solid 1px #a7b5bc; border-left:solid 1px #a7b5bc; border-right:solid 1px #ced9df; border-bottom:solid 1px #ced9df; background:url(../images/inputbg.gif) repeat-x; text-indent:10px;}
-.dfinputmin{width:200px; height:20px; line-height:20px; border-top:solid 1px #a7b5bc; border-left:solid 1px #a7b5bc; border-right:solid 1px #ced9df; border-bottom:solid 1px #ced9df; background:url(../images/inputbg.gif) repeat-x; text-indent:10px;}
-.textinput{border-top:solid 1px #a7b5bc; border-left:solid 1px #a7b5bc; border-right:solid 1px #ced9df; border-bottom:solid 1px #ced9df; background:url(../images/inputbg.gif) repeat-x; padding:10px; width:504px; height:135px; line-height:20px; overflow:hidden;}
-.btn{width:137px;height:35px; background:url(../images/btnbg.png) no-repeat; font-size:14px;font-weight:bold;color:#fff; cursor:pointer;}
-
-
-/*tip*/
-.tip{width:485px; height:260px; position:absolute;top:10%; left:30%;background:#fcfdfd;box-shadow:1px 8px 10px 1px #9b9b9b;border-radius:1px;behavior:url(js/pie.htc); display:none; z-index:111111;}
-.tiptop{height:40px; line-height:40px; background:url(../images/tcbg.gif)  repeat-x; cursor:pointer;}
-.tiptop span{font-size:14px; font-weight:bold; color:#fff;float:left; text-indent:20px;}
-.tiptop a{display:block; background:url(../images/close.png) no-repeat; width:22px; height:22px;float:right;margin-right:7px; margin-top:10px; cursor:pointer;}
-.tiptop a:hover{background:url(../images/close1.png) no-repeat;}
-.tipinfo{padding-top:30px;margin-left:65px; height:95px;}
-.tipinfo span{width:95px; height:95px;float:left;}
-.tipright{float:left;padding-top:15px; padding-left:10px;}
-.tipright p{font-size:14px; font-weight:bold; line-height:35px;}
-.tipright cite{color:#858686;}
-.tipbtn{margin-top:25px; margin-left:125px;}
-.sure ,.cancel{width:96px; height:35px; line-height:35px; color:#fff; background:url(../images/btnbg1.png) repeat-x; font-size:14px; font-weight:bold;border-radius: 3px; cursor:pointer;}
-.cancel{background:url(../images/btnbg2.png) repeat-x;color:#000;font-weight:normal;}
-
-/*tools*/
-.toolsli{clear:both; overflow:hidden; margin-bottom:20px;}
-.toollist{margin-left:20px; overflow:hidden; float:left;}
-.toollist li{width:66px; text-align:center; float:left; margin-right:32px;}
-.toollist li a{width:65px; height:65px; background:#fafbfb; border-right:solid 1px #dbdbdb;border-bottom:solid 1px #dbdbdb; display:block;}
-.toollist li a:hover{background:#eef4f7;border-right:solid 1px #d0d5d7;border-bottom:solid 1px #d0d5d7;}
-.toollist li h2{line-height:35px;}
-.tooladd{margin-top:25px; width:20px; height:20px; float:left; display:block;}
-
-/*error 404*/
-.error{background:url(../images/error.png) no-repeat; width:490px; height:220px;margin-top:75px;}
-.error404{background:url(../images/404.png) no-repeat; width:490px; height:220px;margin-top:75px;padding-top:65px;}
-.error h2{font-size:22px; padding-left:154px;}
-.error p{padding-left:154px; line-height:35px;color:#717678;}
-.reindex{padding-left:154px;}
-.reindex a{width:115px; height:35px; font-size:14px; font-weight:bold; color:#fff; background:#3c95c8; display:block; line-height:35px; text-align:center;border-radius: 3px; behavior:url(js/pie.htc);margin-top:20px;}
-
-/*computer*/
-.comtitle{padding:20px; clear:both;}
-.comtitle span{width:10px;height:10px; background:url(../images/clist.png) no-repeat; float:left; background:#fff; padding-top:3px;}
-.comtitle h2{font-size:14px; display:block; float:left;color:#2a3e93; background:#fff; padding-left:5px; padding-right:8px;}
-.rline{border-bottom:solid 1px #e5ecf0; height:10px; margin-left:50px;}
-.disklist{padding-left:20px; padding-right:20px;}
-.disklist li{width:275px;_width:270px;float:left; margin-right:10px;px;height:70px; cursor:pointer; margin-bottom:5px;border:solid 1px #fff;}
-.disklist li a{color:#000;}
-.disklist li:hover{background:#fcfcfc; border:solid 1px #e5ecf0;}
-.dleft{background:url(../images/c02.png) no-repeat; height:50px; margin-left:12px; float:left; width:50px; margin-top:15px;}
-.dleft1{background:url(../images/c01.png) no-repeat; height:50px; margin-left:12px; float:left; width:50px; margin-top:15px;}
-.dleft2{background:url(../images/c03.png) no-repeat; height:50px; margin-left:12px; float:left; width:50px; margin-top:15px;}
-.dright{float:left; margin-left:10px; margin-top:5px;}
-.dright h3{font-weight:normal; padding-top:15px;}
-.dright p{color:#949494;}
-.dinfo{width:189px;height:15px; background:url(../images/diskbg.png) no-repeat; margin-top:5px; margin-bottom:5px;}
-.dinfo span{background:url(../images/cbg.png) repeat-x; height:15px;}
-.filetable{width:100%;}
-.filetable thead tr{background:#f5f9fb; line-height:35px;}
-.filetable thead tr th{text-align:left; text-indent:15px;font-weight:normal;color:#597190;}
-.filetable tbody tr td{text-indent:15px; line-height:23px;}
-.filetable tbody tr td img {margin-right:5px;}
-.tdlast{text-align:right;}
-.filetable tbody tr:hover{background:#f5f8fa; cursor:pointer;}
-
-/*imglist*/
-.imglist{clear:both; overflow:hidden; margin-bottom:20px; margin-left:5px;}
-.imglist li{width:188px; border:solid 1px #fff;height:199px;float:left; margin-right:8px; margin-bottom:10px; cursor:pointer;}
-.imglist li:hover{border:solid 1px #d7e4ea;}
-.imglist li span{width:168px; height:126px; margin:8px;}
-.imglist li h2{text-align:center; line-height:25px;}
-.imglist li p{text-align:center; line-height:17px; background:url(../images/line1.png) center center no-repeat;}
-.imglist li p a{color:#1f7cb6;}
-.imglist li p a:hover{color:#F60;}
-
-/*imgtable*/
-.imgtable{width:100%;border:solid 1px #cbcbcb; }
-.imgtable th{background:url(../images/th.gif) repeat-x; height:34px; line-height:34px; border-bottom:solid 1px #b6cad2; text-indent:21px; text-align:left;}
-.imgtable td{line-height:20px; text-indent:21px; border-right: dotted 1px #c7c7c7;}
-.imgtable td img{margin:10px 20px 10px 0;}
-.imgtable td p{color:#919191;}
-.imgtable td i{font-style:normal; color:#ea2020;}
-.imgtd{text-indent:0;}
-.imgtable tbody tr.odd{background:#f5f8fa;}
-.imgtable tbody tr:hover{background:#e5ebee;}
-
-/*tab*/
-.itab{height:36px; border-bottom:solid 1px #d0dee5; position:relative; border-left:solid 1px #d3dbde;}
-.itab ul li{float:left;height:37px; line-height:37px; background:url(../images/itabbg.png) repeat-x; border-right:solid 1px #d3dbde;}
-.itab ul li a{font-size:14px; color:#000; padding-left:25px; padding-right:25px;}
-.itab ul li a.selected{ height:37px; display:block; background:url(../images/itabbg1.png) repeat-x; font-weight:bold;}
-.tabson{margin:18px 0px;}
-.formtext{height:45px; padding-left:25px; line-height:20px; color:#848383;}
-.formtext b{color:#d70101;}
-.forminfo b{color:#ea2020; padding-left:3px;}
-
-/*class*/
-.classlist li{float:left;margin-right:10px;margin-bottom:10px;padding:12px;border:1px solid #ebebeb; background:#fcfcfc;}
-.classlist li:hover{border:1px solid #3eafe0; cursor:pointer;}
-.classlist li span{float:left;margin-right:18px;border:3px solid #fff;}
-.classlist li .lright{float:left;width:150px;}
-.classlist li .lright h2{font-size:12px; font-weight:bold;line-height:30px;}
-.classlist li .lright p{line-height:20px;}
-.enter{display:block;margin-top:5px;width:94px;height:30px;color:#fff;background:#3eafe0;font-weight:bold; border-radius:2px; text-align:center;line-height:30px; cursor:pointer;}
-.enter:hover{color:#fff; background:#d98c1d;}
-.clear{clear:both;}
-
-/*seachform*/
-.seachform{ height:42px;}
-.seachform li{float:left; margin-right:15px;}
-.seachform li label{padding-right:10px; float:left; line-height:32px;}
-.scinput{width:150px; height:32px; line-height:32px; border-top:solid 1px #a7b5bc; border-left:solid 1px #a7b5bc; border-right:solid 1px #ced9df; border-bottom:solid 1px #ced9df; background:url(../images/inputbg.gif) repeat-x; text-indent:10px;}
-.scbtn{width:85px;height:35px; background:url(../images/btnbg.png) no-repeat center; font-size:14px;font-weight:bold;color:#fff; cursor:pointer;border-radius:3px; behavior:url(js/pie.htc);}
-span.inner{display:inline;}
-
-.display_left{float:left;display:block;margin:5px 0px;}
-.forminfo li label.w160{width:160px;}
-
-.red{color:red;}
-.bold{font-weight:bold;}
-.input_error{border-color:red;}
+@charset "utf-8";
+/* CSS Document */
+/***
+ * uimaker
+ * http://www.uimaker.com
+ * e-mail: admin@uimaker.com
+ */
+*{font-size:9pt;border:0;margin:0;padding:0;}
+body{font-family:'微软雅黑'; margin:0 auto;min-width:980px;}
+ul{display:block;margin:0;padding:0;list-style:none;height:auto;overflow:hidden;}
+li{display:block;margin:0;padding:0;list-style: none;height:auto;overflow:hidden;}
+img{border:0;}
+dl,dt,dd,span{margin:0;padding:0;display:block;}
+a,a:focus{text-decoration:none;color:#000;outline:none;blr:expression(this.onFocus=this.blur());}
+a:hover{color:#00a4ac;text-decoration:none;}
+table{border-collapse:collapse;border-spacing: 0;}
+cite{font-style:normal;}
+h2{font-weight:normal;}
+
+/*cloud*/
+
+#mainBody {width:100%;height:100%;position:absolute;z-index:-1;}
+.cloud {position:absolute;top:0px;left:0px;width:100%;height:100%;background:url(../images/cloud.png) no-repeat;z-index:1;opacity:0.5;}
+#cloud2 {z-index:2;}
+
+
+/*login*/
+.logintop{height:47px; position:absolute; top:0; background:url(../images/loginbg1.png) repeat-x;z-index:100; width:100%;}
+.logintop span{color:#fff; line-height:47px; background:url(../images/loginsj.png) no-repeat 21px 18px; text-indent:44px; color:#afc5d2; float:left;}
+.logintop ul{float:right; padding-right:30px;}
+.logintop ul li{float:left; margin-left:20px; line-height:47px;}
+.logintop ul li a{color:#afc5d2;}
+.logintop ul li a:hover{color:#fff;}
+.loginbody{background:url(../images/loginbg3.png) no-repeat center center; width:100%; height:585px; overflow:hidden; position:absolute; top:47px;}
+.systemlogo{background:url(../images/loginlogo.png) no-repeat center;width:100%; height:71px; margin-top:75px;}
+.loginbox{width:692px; height:336px; background:url(../images/logininfo.png) no-repeat; margin-top:30px;}
+.loginbox ul{margin-top:88px; margin-left:285px;}
+.loginbox ul li{margin-bottom:25px;}
+.loginbox ul li label{color:#687f92; padding-left:25px;}
+.loginbox ul li label a{color:#687f92;}
+.loginbox ul li label a:hover{color:#3d96c9;}
+.loginbox ul li label input{margin-right:5px;}
+.loginuser{width:299px; height:48px; background:url(../images/loginuser.png) no-repeat; border:none; line-height:48px; padding-left:44px; font-size:14px; font-weight:bold;}
+.loginpwd{width:299px; height:48px; background:url(../images/loginpassword.png) no-repeat; border:none;line-height:48px; padding-left:44px; font-size:14px; color:#90a2bc;}
+.loginbtn{width:111px;height:35px; background:url(../images/buttonbg.png) repeat-x; font-size:14px; font-weight:bold; color:#fff;cursor:pointer; line-height:35px;}
+.loginbm{height:50px; line-height:50px; text-align:center; background:url(../images/loginbg2.png) repeat-x;position:absolute; bottom:0; width:100%; color:#0b3a58;}
+.loginbm a{font-weight:bold;color:#0b3a58;}
+.loginbm a:hover{color:#fff;}
+
+
+/*top.html*/
+.header{height:88px;}
+.topleft{height:88px;background:url(../images/topleft.jpg) no-repeat;float:left; width:300px;}
+.topleft img{margin-top:12px;margin-left:10px;}
+.topright{height:88px;background:url(../images/topright.jpg) no-repeat right;float:right;}
+.nav{float:left;}
+.nav li{float:left;width:87px;height:88px; text-align:center;}
+.nav li a{display:block;width:87px;height:88px;-moz-transition: none; transition: background-color 0.3s linear; -moz-transition: background-color 0.3s linear; -webkit-transition: background-color 0.3s linear; -o-transition: background-color 0.3s linear; }
+.nav li a.selected{background:url(../images/navbg.png) no-repeat;}
+.nav li a:hover{display:block;background:#000;color:#fff;background: none repeat scroll 0% 0% rgb(43, 127, 181);}
+.nav li img{margin-top:10px;}
+.nav li a{display:block;}
+.nav a h2{font-size:14px;color:#d6e8f1;}
+.nav a:hover h2{color:#fff;}
+.topright ul{padding-top:15px; float:right; padding-right:12px;}
+.topright ul li{float:left; padding-left:9px; padding-right:9px; background:url(../images/line.gif) no-repeat right;}
+.topright ul li:last-child{background:none;}
+.topright ul li a{font-size:13px; color:#e9f2f7;}
+.topright ul li a:hover{color:#fff;}
+.topright ul li span{margin-top:2px;float:left;padding-right:3px;}
+.user{height:30px;background:url(../images/ub1.png) repeat-x;clear:both;margin-top:10px;float:right; margin-right:12px;border-radius:30px; behavior:url(js/pie.htc); white-space:nowrap;position:relative;}
+.user span{display:inline-block;padding-right:10px; background:url(../images/user.png) no-repeat 15px 10px; line-height:30px; font-size:14px;color:#b8ceda; padding-left:20px; padding-left:35px;}
+.user b{display:inline-block;width:20px;height:18px; background:url(../images/msg.png);text-align:center; font-weight:normal; color:#fff;font-size:14px;margin-right:13px; margin-top:7px; line-height:18px;}
+.user i{display:inline-block;margin-right:5px;font-style:normal;line-height:30px; font-size:14px;color:#b8ceda;}
+
+/*left.html*/
+.lefttop{background:url(../images/lefttop.gif) repeat-x;height:40px;color:#fff;font-size:14px;line-height:40px;}
+.lefttop span{margin-left:8px; margin-top:10px;margin-right:8px; background:url(../images/leftico.png) no-repeat; width:20px; height:21px;float:left;}
+.leftmenu{width:187px;padding-bottom: 9999px;margin-bottom: -9999px; overflow:hidden; background:url(../images/leftline.gif) repeat-y right;}
+.leftmenu dd{background:url(../images/leftmenubg.gif) repeat-x;line-height:35px;font-weight:bold;font-size:14px;border-right:solid 1px #b7d5df;}
+.leftmenu dd span{float:left;margin:10px 8px 0 12px;}
+.leftmenu dd .menuson{display:none;}
+.leftmenu dd:first-child .menuson{display:block;}
+.menuson {line-height:30px; font-weight:normal; }
+.menuson li{cursor:pointer;}
+.menuson li.active{position:relative; background:url(../images/libg.png) repeat-x; line-height:30px; color:#fff;}
+.menuson li cite{display:block; float:left; margin-left:32px; background:url(../images/list.gif) no-repeat; width:16px; height:16px; margin-top:7px;}
+.menuson li.active cite{background:url(../images/list1.gif) no-repeat;}
+.menuson li.active i{display:block; background:url(../images/sj.png) no-repeat; width:6px; height:11px; position:absolute; right:0;z-index:10000; top:9px; right:-1px;}
+.menuson li a{ display:block; *display:inline; *padding-top:5px;}
+.menuson li.active a{color:#fff;}
+.title{cursor:pointer;}
+
+
+/*right.html*/
+.place{height:40px; background:url(../images/righttop.gif) repeat-x;}
+.place span{line-height:40px; font-weight:bold;float:left; margin-left:12px;}
+.placeul li{float:left; line-height:40px; padding-left:7px; padding-right:12px; background:url(../images/rlist.gif) no-repeat right;}
+.placeul li:last-child{background:none;}
+.rightinfo{padding:8px;}
+.tools{clear:both; height:35px; margin-bottom:8px;}
+.toolbar{float:left;}
+.toolbar li{background:url(../images/toolbg.gif) repeat-x; line-height:33px; height:33px; border:solid 1px #d3dbde; float:left; padding-right:10px; margin-right:5px;border-radius: 3px; behavior:url(js/pie.htc); cursor:pointer;}
+.toolbar li span{float:left; margin-left:10px; margin-right:5px; margin-top:5px;}
+.toolbar1{float:right;}
+.toolbar1 li{background:url(../images/toolbg.gif) repeat-x; line-height:33px; height:33px; border:solid 1px #d3dbde; float:left; padding-right:10px; margin-left:5px;border-radius: 3px; behavior:url(js/pie.htc);}
+.toolbar1 li span{float:left; margin-left:10px; margin-right:5px; margin-top:5px;}
+.tablelist{border:solid 1px #cbcbcb; width:100%; clear:both;white-space:nowrap;}
+.tablelist th{background:url(../images/th.gif) repeat-x; height:34px; line-height:34px; border-bottom:solid 1px #b6cad2; text-indent:11px; text-align:left;}
+.tablelist td{line-height:35px; text-indent:11px; border-right: dotted 1px #c7c7c7;}
+.tablelink{color:#056dae;}
+.tablelist tbody tr.odd{background:#f5f8fa;}
+.tablelist tbody tr:hover{background:#e5ebee;}
+.sort{padding-left:3px;}
+
+/*page*/
+.pagin{position:relative;margin-top:10px;padding:0 12px;height:35px;}
+.pagin .blue{color:#056dae;font-style:normal;}
+.pagin .paginList{position:absolute;right:12px;top:0;}
+.pagin .paginList .paginItem{float:left;}
+.pagin .paginList .paginItem a{float:left;width:31px;height:28px;border:1px solid #DDD; text-align:center;line-height:30px;border-left:none;color:#3399d5;}
+.pagin .paginList .paginItem:first-child a{border-left:1px solid #DDD;}
+.pagin .paginList .paginItem:first-child a{border-bottom-left-radius:5px;border-top-left-radius:5px;}
+.pagin .paginList .paginItem:last-child a{border-bottom-right-radius:5px;border-top-right-radius:5px;}
+.pagin .paginList .paginItem.current,.pagin .paginList .paginItem.current a{background:#f5f5f5; cursor:default;color:#737373;}
+.pagin .paginList .paginItem:hover{background:#f5f5f5;}
+.pagin .paginList .paginItem.more,.pagin .paginList .paginItem.more a:hover{ cursor:default;}
+.pagin .paginList .paginItem.more:hover{background:#FFF;}
+.pagin .paginList .paginItem.more a{color:#737373;}
+.pagepre{background:url(../images/pre.gif) no-repeat center center; width:31px; height:28px;}
+.pagenxt{background:url(../images/next.gif) no-repeat center center; width:31px; height:28px;}
+.pagepre_highlight{background:url(../images/pre_highlight.gif) no-repeat center center; width:31px; height:28px;}
+.pagenxt_highlight{background:url(../images/next_highlight.gif) no-repeat center center; width:31px; height:28px;}
+
+/*index*/
+.mainindex{padding:20px; overflow:hidden;}
+.welinfo{height:32px; line-height:32px; padding-bottom:8px;}
+.welinfo span{float:left;}
+.welinfo b{padding-left:8px;}
+.welinfo a{padding-left:15px;color:#3186c8;}
+.welinfo a:hover{color:#F60;}
+.welinfo i{font-style:normal; padding-left:8px;}
+.xline{border-bottom:solid 1px #dfe9ee; height:5px;}
+.iconlist{padding-left:40px; overflow:hidden;}
+.iconlist li{text-align:center; float:left; margin-right:25px; margin-top:25px;}
+.iconlist li p{line-height:25px;}
+.ibox{clear:both; padding-left:40px; padding-top:18px; overflow:hidden; padding-bottom:18px;}
+.ibtn{background:url(../images/ibtnbg.png) repeat-x;border:solid 1px #bfcfe1; height:23px; line-height:23px; display:block; float:left; padding:0 15px; cursor:pointer;}
+.ibtn img{margin-top:5px; float:left; padding-right:7px;}
+.box{height:15px;}
+.infolist{padding-left:40px; padding-bottom:15px;}
+.infolist li{ line-height:25px; height:25px; margin-bottom:8px;}
+.infolist li span{float:left; display:block; margin-right:10px;}
+.uimakerinfo{padding-left:40px; background:url(../images/search.png) no-repeat 10px 15px; padding-top:15px; padding-bottom:20px;}
+.umlist{padding-left:40px;}
+.umlist li{float:left; background:url(../images/ulist.png) no-repeat 0 3px; padding-left:10px; margin-right:15px;}
+
+
+/*default*/
+.mainbox{padding:8px;position:relative;}
+.mainleft{padding-right:298px;}
+.leftinfo{border:#d3dbde solid 1px; height:290px;}
+.mainright{width:298px;position:absolute; top:8px; right:8px;}
+.dflist{border:#d3dbde solid 1px; width:288px; height:290px; float:right;}
+.dflist1{border:#d3dbde solid 1px; width:288px; height:238px; float:right; margin-top:8px;}
+.listtitle{background:url(../images/tbg.png) repeat-x; height:36px; line-height:36px; border-bottom:solid 1px #d3dbde; text-indent:14px; font-weight:bold; font-size:14px;}
+.more1{float:right; font-weight:normal;color:#307fb1; padding-right:17px;}
+.maintj{text-align:center;}
+.newlist{padding-left:14px; padding-top:15px;}
+.newlist li{line-height:25px; background:url(../images/list2.png) no-repeat 0px 8px; text-indent:11px;}
+.newlist i{width:80px; display:block; float:left; font-style:normal;}
+.newlist b{font-weight:normal; color:#7b7b7b; padding-left:10px;}
+.leftinfos{height:238px;margin-top:8px;}
+.infoleft{border:#d3dbde solid 1px; float:left;height:238px;}
+.inforight{border:#d3dbde solid 1px; float:right;height:238px; }
+.tooli{padding:30px 20px;}
+.tooli li{float:left;padding-left:15px; padding-right:15px;margin-bottom:20px;}
+.tooli li span{text-align:center;}
+.tooli li p{line-height:35px; text-align:center;}
+
+
+/*form*/
+.formbody{padding:10px 18px;}
+.formtitle{border-bottom:solid 1px #d0dee5; line-height:35px; position:relative; height:35px; margin-bottom:28px;}
+.formtitle span{font-weight:bold;font-size:14px; border-bottom:solid 3px #66c9f3;float:left; position:absolute; z-index:100; bottom:-1px; padding:0 3px; height:30px; line-height:30px;}
+.forminfo{padding-left:23px;}
+.forminfo li{margin-bottom:13px; clear:both;}
+.forminfo li label{width:86px;line-height:34px; display:block; float:left;}
+.forminfo li i{color:#7f7f7f; padding-left:20px; font-style:normal;}
+.forminfo li cite{display:block; padding-top:10px;}
+.dfinput{width:345px; height:32px; line-height:32px; border-top:solid 1px #a7b5bc; border-left:solid 1px #a7b5bc; border-right:solid 1px #ced9df; border-bottom:solid 1px #ced9df; background:url(../images/inputbg.gif) repeat-x; text-indent:10px;}
+.dfinputmin{width:200px; height:20px; line-height:20px; border-top:solid 1px #a7b5bc; border-left:solid 1px #a7b5bc; border-right:solid 1px #ced9df; border-bottom:solid 1px #ced9df; background:url(../images/inputbg.gif) repeat-x; text-indent:10px;}
+.textinput{border-top:solid 1px #a7b5bc; border-left:solid 1px #a7b5bc; border-right:solid 1px #ced9df; border-bottom:solid 1px #ced9df; background:url(../images/inputbg.gif) repeat-x; padding:10px; width:504px; height:135px; line-height:20px; overflow:hidden;}
+.btn{width:137px;height:35px; background:url(../images/btnbg.png) no-repeat; font-size:14px;font-weight:bold;color:#fff; cursor:pointer;}
+
+
+/*tip*/
+.tip{width:485px; height:260px; position:absolute;top:10%; left:30%;background:#fcfdfd;box-shadow:1px 8px 10px 1px #9b9b9b;border-radius:1px;behavior:url(js/pie.htc); display:none; z-index:111111;}
+.tiptop{height:40px; line-height:40px; background:url(../images/tcbg.gif)  repeat-x; cursor:pointer;}
+.tiptop span{font-size:14px; font-weight:bold; color:#fff;float:left; text-indent:20px;}
+.tiptop a{display:block; background:url(../images/close.png) no-repeat; width:22px; height:22px;float:right;margin-right:7px; margin-top:10px; cursor:pointer;}
+.tiptop a:hover{background:url(../images/close1.png) no-repeat;}
+.tipinfo{padding-top:30px;margin-left:65px; height:95px;}
+.tipinfo span{width:95px; height:95px;float:left;}
+.tipright{float:left;padding-top:15px; padding-left:10px;}
+.tipright p{font-size:14px; font-weight:bold; line-height:35px;}
+.tipright cite{color:#858686;}
+.tipbtn{margin-top:25px; margin-left:125px;}
+.sure ,.cancel{width:96px; height:35px; line-height:35px; color:#fff; background:url(../images/btnbg1.png) repeat-x; font-size:14px; font-weight:bold;border-radius: 3px; cursor:pointer;}
+.cancel{background:url(../images/btnbg2.png) repeat-x;color:#000;font-weight:normal;}
+
+/*tools*/
+.toolsli{clear:both; overflow:hidden; margin-bottom:20px;}
+.toollist{margin-left:20px; overflow:hidden; float:left;}
+.toollist li{width:66px; text-align:center; float:left; margin-right:32px;}
+.toollist li a{width:65px; height:65px; background:#fafbfb; border-right:solid 1px #dbdbdb;border-bottom:solid 1px #dbdbdb; display:block;}
+.toollist li a:hover{background:#eef4f7;border-right:solid 1px #d0d5d7;border-bottom:solid 1px #d0d5d7;}
+.toollist li h2{line-height:35px;}
+.tooladd{margin-top:25px; width:20px; height:20px; float:left; display:block;}
+
+/*error 404*/
+.error{background:url(../images/error.png) no-repeat; width:490px; height:220px;margin-top:75px;}
+.error404{background:url(../images/404.png) no-repeat; width:490px; height:220px;margin-top:75px;padding-top:65px;}
+.error h2{font-size:22px; padding-left:154px;}
+.error p{padding-left:154px; line-height:35px;color:#717678;}
+.reindex{padding-left:154px;}
+.reindex a{width:115px; height:35px; font-size:14px; font-weight:bold; color:#fff; background:#3c95c8; display:block; line-height:35px; text-align:center;border-radius: 3px; behavior:url(js/pie.htc);margin-top:20px;}
+
+/*computer*/
+.comtitle{padding:20px; clear:both;}
+.comtitle span{width:10px;height:10px; background:url(../images/clist.png) no-repeat; float:left; background:#fff; padding-top:3px;}
+.comtitle h2{font-size:14px; display:block; float:left;color:#2a3e93; background:#fff; padding-left:5px; padding-right:8px;}
+.rline{border-bottom:solid 1px #e5ecf0; height:10px; margin-left:50px;}
+.disklist{padding-left:20px; padding-right:20px;}
+.disklist li{width:275px;_width:270px;float:left; margin-right:10px;px;height:70px; cursor:pointer; margin-bottom:5px;border:solid 1px #fff;}
+.disklist li a{color:#000;}
+.disklist li:hover{background:#fcfcfc; border:solid 1px #e5ecf0;}
+.dleft{background:url(../images/c02.png) no-repeat; height:50px; margin-left:12px; float:left; width:50px; margin-top:15px;}
+.dleft1{background:url(../images/c01.png) no-repeat; height:50px; margin-left:12px; float:left; width:50px; margin-top:15px;}
+.dleft2{background:url(../images/c03.png) no-repeat; height:50px; margin-left:12px; float:left; width:50px; margin-top:15px;}
+.dright{float:left; margin-left:10px; margin-top:5px;}
+.dright h3{font-weight:normal; padding-top:15px;}
+.dright p{color:#949494;}
+.dinfo{width:189px;height:15px; background:url(../images/diskbg.png) no-repeat; margin-top:5px; margin-bottom:5px;}
+.dinfo span{background:url(../images/cbg.png) repeat-x; height:15px;}
+.filetable{width:100%;}
+.filetable thead tr{background:#f5f9fb; line-height:35px;}
+.filetable thead tr th{text-align:left; text-indent:15px;font-weight:normal;color:#597190;}
+.filetable tbody tr td{text-indent:15px; line-height:23px;}
+.filetable tbody tr td img {margin-right:5px;}
+.tdlast{text-align:right;}
+.filetable tbody tr:hover{background:#f5f8fa; cursor:pointer;}
+
+/*imglist*/
+.imglist{clear:both; overflow:hidden; margin-bottom:20px; margin-left:5px;}
+.imglist li{width:188px; border:solid 1px #fff;height:199px;float:left; margin-right:8px; margin-bottom:10px; cursor:pointer;}
+.imglist li:hover{border:solid 1px #d7e4ea;}
+.imglist li span{width:168px; height:126px; margin:8px;}
+.imglist li h2{text-align:center; line-height:25px;}
+.imglist li p{text-align:center; line-height:17px; background:url(../images/line1.png) center center no-repeat;}
+.imglist li p a{color:#1f7cb6;}
+.imglist li p a:hover{color:#F60;}
+
+/*imgtable*/
+.imgtable{width:100%;border:solid 1px #cbcbcb; }
+.imgtable th{background:url(../images/th.gif) repeat-x; height:34px; line-height:34px; border-bottom:solid 1px #b6cad2; text-indent:21px; text-align:left;}
+.imgtable td{line-height:20px; text-indent:21px; border-right: dotted 1px #c7c7c7;}
+.imgtable td img{margin:10px 20px 10px 0;}
+.imgtable td p{color:#919191;}
+.imgtable td i{font-style:normal; color:#ea2020;}
+.imgtd{text-indent:0;}
+.imgtable tbody tr.odd{background:#f5f8fa;}
+.imgtable tbody tr:hover{background:#e5ebee;}
+
+/*tab*/
+.itab{height:36px; border-bottom:solid 1px #d0dee5; position:relative; border-left:solid 1px #d3dbde;}
+.itab ul li{float:left;height:37px; line-height:37px; background:url(../images/itabbg.png) repeat-x; border-right:solid 1px #d3dbde;}
+.itab ul li a{font-size:14px; color:#000; padding-left:25px; padding-right:25px;}
+.itab ul li a.selected{ height:37px; display:block; background:url(../images/itabbg1.png) repeat-x; font-weight:bold;}
+.tabson{margin:18px 0px;}
+.formtext{height:45px; padding-left:25px; line-height:20px; color:#848383;}
+.formtext b{color:#d70101;}
+.forminfo b{color:#ea2020; padding-left:3px;}
+
+/*class*/
+.classlist li{float:left;margin-right:10px;margin-bottom:10px;padding:12px;border:1px solid #ebebeb; background:#fcfcfc;}
+.classlist li:hover{border:1px solid #3eafe0; cursor:pointer;}
+.classlist li span{float:left;margin-right:18px;border:3px solid #fff;}
+.classlist li .lright{float:left;width:150px;}
+.classlist li .lright h2{font-size:12px; font-weight:bold;line-height:30px;}
+.classlist li .lright p{line-height:20px;}
+.enter{display:block;margin-top:5px;width:94px;height:30px;color:#fff;background:#3eafe0;font-weight:bold; border-radius:2px; text-align:center;line-height:30px; cursor:pointer;}
+.enter:hover{color:#fff; background:#d98c1d;}
+.clear{clear:both;}
+
+/*seachform*/
+.seachform{ height:42px;}
+.seachform li{float:left; margin-right:15px;}
+.seachform li label{padding-right:10px; float:left; line-height:32px;}
+.scinput{width:150px; height:32px; line-height:32px; border-top:solid 1px #a7b5bc; border-left:solid 1px #a7b5bc; border-right:solid 1px #ced9df; border-bottom:solid 1px #ced9df; background:url(../images/inputbg.gif) repeat-x; text-indent:10px;}
+.scbtn{width:85px;height:35px; background:url(../images/btnbg.png) no-repeat center; font-size:14px;font-weight:bold;color:#fff; cursor:pointer;border-radius:3px; behavior:url(js/pie.htc);}
+span.inner{display:inline;}
+
+.display_left{float:left;display:block;margin:5px 0px;}
+.forminfo li label.w160{width:160px;}
+
+.red{color:red;}
+.bold{font-weight:bold;}
+.input_error{border-color:red;}
 .overflow-auto{overflow:auto;}

+ 93 - 93
demo/public/static/css/sumoselect.css

@@ -1,93 +1,93 @@
-.SumoSelect p,div,ul,li{padding:0px; margin:0px;font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;color:#444;font-size:13px;}
-
-
-.SumoSelect p {margin: 0;}
-.SlectBox { width: 200px; padding: 5px 8px;}
-
-/*this is applied on that hidden select. DO NOT USE display:none; or visiblity:hidden; and Do not override any of these properties. */
-.SelectClass { position: absolute; top: 0px; left: 0px; right: 0px; height: 100%; width: 100%; border: none; z-index: 1; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter: alpha(opacity=0); -moz-opacity: 0; -khtml-opacity: 0; opacity: 0; }
-
-    .SumoSelect > .optWrapper > .options > li label, .SumoSelect > .CaptionCont { user-select: none; -o-user-select: none; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; }
-
-.SumoSelect { display: inline-block; position: relative;outline:none;}
-.SumoSelect:focus > .CaptionCont,.SumoSelect:hover > .CaptionCont {box-shadow: 0px 0px 2px #7799D0;border-color: #7799D0;}
-    .SumoSelect > .CaptionCont { position: relative; border: 1px solid #A4A4A4; min-height: 14px; background-color: #fff;border-radius:2px;margin:0px;}
-        .SumoSelect > .CaptionCont > span { display: block; padding-right: 30px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;cursor:default;}
-            /*placeholder style*/
-            .SumoSelect > .CaptionCont > span.placeholder { color: #ccc; font-style: italic; }
-
-        .SumoSelect > .CaptionCont > label { position: absolute; top: 0px; right: 0px; bottom: 0px; width: 30px;}
-            .SumoSelect > .CaptionCont > label > i { background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3wMdBhAJ/fwnjwAAAGFJREFUKM9jYBh+gBFKuzEwMKQwMDB8xaOWlYGB4T4DA0MrsuapDAwM//HgNwwMDDbYTJuGQ8MHBgYGJ1xOYGNgYJiBpuEpAwODHSF/siDZ+ISBgcGClEDqZ2Bg8B6CkQsAPRga0cpRtDEAAAAASUVORK5CYII=');
-                background-position: center center; width: 16px; height: 16px; display: block; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; margin: auto;background-repeat: no-repeat;opacity: 0.8;}
-
-    .SumoSelect > .optWrapper { top: 30px; width: 100%; position: absolute; left: 0; opacity: 0; visibility: hidden; transition: opacity 200ms ease-out, top 200ms ease-out, visibility 200ms ease-out; -webkit-transition: opacity 200ms ease-out, top 200ms ease-out, visibility 200ms ease-out; -moz-transition: opacity 200ms ease-out, top 200ms ease-out, visibility 200ms ease-out; -ms-transition: opacity 200ms ease-out, top 200ms ease-out, visibility 200ms ease-out; -o-transition: opacity 200ms ease-out, top 200ms ease-out, visibility 200ms ease-out; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; z-index: -100; background: #fff; border: 1px solid #ddd; box-shadow: 2px 3px 3px rgba(0, 0, 0, 0.11); border-radius: 3px;overflow: hidden;}
-        .SumoSelect > .optWrapper.open { top: 35px; visibility: visible; opacity: 1; z-index: 1000; }
-
-        .SumoSelect > .optWrapper > .options { list-style: none; display: block; padding: 0px; margin: 0px; overflow: auto; border-radius: 2px;
-         /*Set the height of pop up here (only for desktop mode)*/
-            max-height: 250px;
-             /*height*/ }
-        .SumoSelect > .optWrapper.isFloating > .options {max-height: 100%;box-shadow: 0px 0px 100px #595959;}
-        .SumoSelect > .optWrapper > .options > li { padding: 6px 6px; border-bottom: 1px solid #F3F3F3; position: relative; }
-            .SumoSelect > .optWrapper > .options > li:first-child { border-radius: 2px 2px 0px 0px; }
-            .SumoSelect > .optWrapper > .options > li:last-child { border-bottom: none; border-radius: 0px 0px 2px 2px; }
-            .SumoSelect > .optWrapper > .options > li:hover { background-color: #E4E4E4; }
-            .SumoSelect > .optWrapper > .options > li.sel{background-color: #a1c0e4;}
-
-            .SumoSelect > .optWrapper > .options > li label { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; display: block;cursor: pointer;}
-            .SumoSelect > .optWrapper > .options > li span { display: none; }
-
-        /*Floating styles*/
-        .SumoSelect > .optWrapper.isFloating { position: fixed; top: 0px; left: 0px; right: 0px; width: 90%; bottom: 0px; margin: auto; max-height: 90%; }
-
-    /*Hover*/
-    /*.SumoSelect:hover > .CaptionCont > label { background-color: #F1F1F1; }*/
-
-    /*disabled state*/
-    .SumoSelect > .optWrapper > .options > li.disabled { background-color: inherit;pointer-events: none;}
-        .SumoSelect > .optWrapper > .options > li.disabled * { -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; /* IE 5-7 */ filter: alpha(opacity=50); /* Netscape */ -moz-opacity: 0.5; /* Safari 1.x */ -khtml-opacity: 0.5; /* Good browsers */ opacity: 0.5; }
-
-
-    /*styling for multiple select*/
-    .SumoSelect > .optWrapper.multiple > .options > li { padding-left: 35px;cursor: pointer;}
-        .SumoSelect > .optWrapper.multiple > .options > li span,
-        .SumoSelect .select-all > span{position:absolute;display:block;width:30px;top:0px;bottom:0px;margin-left:-35px;}
-            .SumoSelect > .optWrapper.multiple > .options > li span i,
-            .SumoSelect .select-all > span i{position: absolute;margin: auto;left: 0px;right: 0px;top: 0px;bottom: 0px;width: 14px;height: 14px;border: 1px solid #AEAEAE;border-radius: 2px;box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15);background-color: #fff;}
-.SumoSelect > .optWrapper > .MultiControls { display: none; border-top: 1px solid #ddd; background-color: #fff; box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.13); border-radius: 0px 0px 3px 3px; }
-    .SumoSelect > .optWrapper.multiple.isFloating > .MultiControls { display: block; margin-top: 5px; position: absolute; bottom: 0px; width: 100%; }
-
-    .SumoSelect > .optWrapper.multiple.okCancelInMulti > .MultiControls { display: block; }
-        .SumoSelect > .optWrapper.multiple.okCancelInMulti > .MultiControls > p { padding: 6px; }
-
-    .SumoSelect > .optWrapper.multiple > .MultiControls > p { display: inline-block; cursor: pointer; padding: 12px; width: 50%; box-sizing: border-box; text-align: center; }
-        .SumoSelect > .optWrapper.multiple > .MultiControls > p:hover { background-color: #f1f1f1; }
-        .SumoSelect > .optWrapper.multiple > .MultiControls > p.btnOk { border-right: 1px solid #DBDBDB; border-radius: 0px 0px 0px 3px; }
-        .SumoSelect > .optWrapper.multiple > .MultiControls > p.btnCancel { border-radius: 0px 0px 3px 0px; }
-    /*styling for select on popup mode*/
-    .SumoSelect > .optWrapper.isFloating > .options > li { padding: 12px 6px; }
-
-    /*styling for only multiple select on popup mode*/
-    .SumoSelect > .optWrapper.multiple.isFloating > .options > li { padding-left: 35px; }
-    .SumoSelect > .optWrapper.multiple.isFloating { padding-bottom: 43px; }
-    /*selected state
-    .SumoSelect > .optWrapper.multiple > .options > li.selected span i:after,
-    .SumoSelect .select-all.selected > span i:after{content: '';position: absolute;width: 11px;height: 11px;top: 2px;left: 2px;background-color: rgb(17, 169, 17);border-radius: 2px;box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.15);}
-    */
-    .SumoSelect > .optWrapper.multiple > .options > li.selected span i,
-    .SumoSelect .select-all.selected > span i,
-    .SumoSelect .select-all.partial > span i{background-color: rgb(17, 169, 17);box-shadow: none;border-color: transparent;background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAGCAYAAAD+Bd/7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNXG14zYAAABMSURBVAiZfc0xDkAAFIPhd2Kr1WRjcAExuIgzGUTIZ/AkImjSofnbNBAfHvzAHjOKNzhiQ42IDFXCDivaaxAJd0xYshT3QqBxqnxeHvhunpu23xnmAAAAAElFTkSuQmCC');background-repeat: no-repeat;background-position: center center;}
-    /*disabled state*/
-    .SumoSelect.disabled { opacity: 0.7;cursor: not-allowed;}
-     .SumoSelect.disabled > .CaptionCont{border-color:#ccc;box-shadow:none;}
-
-    /**Select all button**/
-    .SumoSelect .select-all{border-radius: 3px 3px 0px 0px;position: relative;border-bottom: 1px solid #ddd;background-color: #fff;padding: 8px 0px 3px 35px;height: 20px;}
-    .SumoSelect .select-all > span i{cursor:pointer;}
-    .SumoSelect .select-all.partial > span i{background-color:#ccc;}
-
-
-
-     /*styling for optgroups*/
-    .SumoSelect > .optWrapper > .options > li.optGroup { padding-left: 5px; text-decoration: underline; }
-
+.SumoSelect p,div,ul,li{padding:0px; margin:0px;font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;color:#444;font-size:13px;}
+
+
+.SumoSelect p {margin: 0;}
+.SlectBox { width: 200px; padding: 5px 8px;}
+
+/*this is applied on that hidden select. DO NOT USE display:none; or visiblity:hidden; and Do not override any of these properties. */
+.SelectClass { position: absolute; top: 0px; left: 0px; right: 0px; height: 100%; width: 100%; border: none; z-index: 1; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter: alpha(opacity=0); -moz-opacity: 0; -khtml-opacity: 0; opacity: 0; }
+
+    .SumoSelect > .optWrapper > .options > li label, .SumoSelect > .CaptionCont { user-select: none; -o-user-select: none; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; }
+
+.SumoSelect { display: inline-block; position: relative;outline:none;}
+.SumoSelect:focus > .CaptionCont,.SumoSelect:hover > .CaptionCont {box-shadow: 0px 0px 2px #7799D0;border-color: #7799D0;}
+    .SumoSelect > .CaptionCont { position: relative; border: 1px solid #A4A4A4; min-height: 14px; background-color: #fff;border-radius:2px;margin:0px;}
+        .SumoSelect > .CaptionCont > span { display: block; padding-right: 30px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;cursor:default;}
+            /*placeholder style*/
+            .SumoSelect > .CaptionCont > span.placeholder { color: #ccc; font-style: italic; }
+
+        .SumoSelect > .CaptionCont > label { position: absolute; top: 0px; right: 0px; bottom: 0px; width: 30px;}
+            .SumoSelect > .CaptionCont > label > i { background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3wMdBhAJ/fwnjwAAAGFJREFUKM9jYBh+gBFKuzEwMKQwMDB8xaOWlYGB4T4DA0MrsuapDAwM//HgNwwMDDbYTJuGQ8MHBgYGJ1xOYGNgYJiBpuEpAwODHSF/siDZ+ISBgcGClEDqZ2Bg8B6CkQsAPRga0cpRtDEAAAAASUVORK5CYII=');
+                background-position: center center; width: 16px; height: 16px; display: block; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; margin: auto;background-repeat: no-repeat;opacity: 0.8;}
+
+    .SumoSelect > .optWrapper { top: 30px; width: 100%; position: absolute; left: 0; opacity: 0; visibility: hidden; transition: opacity 200ms ease-out, top 200ms ease-out, visibility 200ms ease-out; -webkit-transition: opacity 200ms ease-out, top 200ms ease-out, visibility 200ms ease-out; -moz-transition: opacity 200ms ease-out, top 200ms ease-out, visibility 200ms ease-out; -ms-transition: opacity 200ms ease-out, top 200ms ease-out, visibility 200ms ease-out; -o-transition: opacity 200ms ease-out, top 200ms ease-out, visibility 200ms ease-out; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; z-index: -100; background: #fff; border: 1px solid #ddd; box-shadow: 2px 3px 3px rgba(0, 0, 0, 0.11); border-radius: 3px;overflow: hidden;}
+        .SumoSelect > .optWrapper.open { top: 35px; visibility: visible; opacity: 1; z-index: 1000; }
+
+        .SumoSelect > .optWrapper > .options { list-style: none; display: block; padding: 0px; margin: 0px; overflow: auto; border-radius: 2px;
+         /*Set the height of pop up here (only for desktop mode)*/
+            max-height: 250px;
+             /*height*/ }
+        .SumoSelect > .optWrapper.isFloating > .options {max-height: 100%;box-shadow: 0px 0px 100px #595959;}
+        .SumoSelect > .optWrapper > .options > li { padding: 6px 6px; border-bottom: 1px solid #F3F3F3; position: relative; }
+            .SumoSelect > .optWrapper > .options > li:first-child { border-radius: 2px 2px 0px 0px; }
+            .SumoSelect > .optWrapper > .options > li:last-child { border-bottom: none; border-radius: 0px 0px 2px 2px; }
+            .SumoSelect > .optWrapper > .options > li:hover { background-color: #E4E4E4; }
+            .SumoSelect > .optWrapper > .options > li.sel{background-color: #a1c0e4;}
+
+            .SumoSelect > .optWrapper > .options > li label { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; display: block;cursor: pointer;}
+            .SumoSelect > .optWrapper > .options > li span { display: none; }
+
+        /*Floating styles*/
+        .SumoSelect > .optWrapper.isFloating { position: fixed; top: 0px; left: 0px; right: 0px; width: 90%; bottom: 0px; margin: auto; max-height: 90%; }
+
+    /*Hover*/
+    /*.SumoSelect:hover > .CaptionCont > label { background-color: #F1F1F1; }*/
+
+    /*disabled state*/
+    .SumoSelect > .optWrapper > .options > li.disabled { background-color: inherit;pointer-events: none;}
+        .SumoSelect > .optWrapper > .options > li.disabled * { -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; /* IE 5-7 */ filter: alpha(opacity=50); /* Netscape */ -moz-opacity: 0.5; /* Safari 1.x */ -khtml-opacity: 0.5; /* Good browsers */ opacity: 0.5; }
+
+
+    /*styling for multiple select*/
+    .SumoSelect > .optWrapper.multiple > .options > li { padding-left: 35px;cursor: pointer;}
+        .SumoSelect > .optWrapper.multiple > .options > li span,
+        .SumoSelect .select-all > span{position:absolute;display:block;width:30px;top:0px;bottom:0px;margin-left:-35px;}
+            .SumoSelect > .optWrapper.multiple > .options > li span i,
+            .SumoSelect .select-all > span i{position: absolute;margin: auto;left: 0px;right: 0px;top: 0px;bottom: 0px;width: 14px;height: 14px;border: 1px solid #AEAEAE;border-radius: 2px;box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15);background-color: #fff;}
+.SumoSelect > .optWrapper > .MultiControls { display: none; border-top: 1px solid #ddd; background-color: #fff; box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.13); border-radius: 0px 0px 3px 3px; }
+    .SumoSelect > .optWrapper.multiple.isFloating > .MultiControls { display: block; margin-top: 5px; position: absolute; bottom: 0px; width: 100%; }
+
+    .SumoSelect > .optWrapper.multiple.okCancelInMulti > .MultiControls { display: block; }
+        .SumoSelect > .optWrapper.multiple.okCancelInMulti > .MultiControls > p { padding: 6px; }
+
+    .SumoSelect > .optWrapper.multiple > .MultiControls > p { display: inline-block; cursor: pointer; padding: 12px; width: 50%; box-sizing: border-box; text-align: center; }
+        .SumoSelect > .optWrapper.multiple > .MultiControls > p:hover { background-color: #f1f1f1; }
+        .SumoSelect > .optWrapper.multiple > .MultiControls > p.btnOk { border-right: 1px solid #DBDBDB; border-radius: 0px 0px 0px 3px; }
+        .SumoSelect > .optWrapper.multiple > .MultiControls > p.btnCancel { border-radius: 0px 0px 3px 0px; }
+    /*styling for select on popup mode*/
+    .SumoSelect > .optWrapper.isFloating > .options > li { padding: 12px 6px; }
+
+    /*styling for only multiple select on popup mode*/
+    .SumoSelect > .optWrapper.multiple.isFloating > .options > li { padding-left: 35px; }
+    .SumoSelect > .optWrapper.multiple.isFloating { padding-bottom: 43px; }
+    /*selected state
+    .SumoSelect > .optWrapper.multiple > .options > li.selected span i:after,
+    .SumoSelect .select-all.selected > span i:after{content: '';position: absolute;width: 11px;height: 11px;top: 2px;left: 2px;background-color: rgb(17, 169, 17);border-radius: 2px;box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.15);}
+    */
+    .SumoSelect > .optWrapper.multiple > .options > li.selected span i,
+    .SumoSelect .select-all.selected > span i,
+    .SumoSelect .select-all.partial > span i{background-color: rgb(17, 169, 17);box-shadow: none;border-color: transparent;background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAGCAYAAAD+Bd/7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNXG14zYAAABMSURBVAiZfc0xDkAAFIPhd2Kr1WRjcAExuIgzGUTIZ/AkImjSofnbNBAfHvzAHjOKNzhiQ42IDFXCDivaaxAJd0xYshT3QqBxqnxeHvhunpu23xnmAAAAAElFTkSuQmCC');background-repeat: no-repeat;background-position: center center;}
+    /*disabled state*/
+    .SumoSelect.disabled { opacity: 0.7;cursor: not-allowed;}
+     .SumoSelect.disabled > .CaptionCont{border-color:#ccc;box-shadow:none;}
+
+    /**Select all button**/
+    .SumoSelect .select-all{border-radius: 3px 3px 0px 0px;position: relative;border-bottom: 1px solid #ddd;background-color: #fff;padding: 8px 0px 3px 35px;height: 20px;}
+    .SumoSelect .select-all > span i{cursor:pointer;}
+    .SumoSelect .select-all.partial > span i{background-color:#ccc;}
+
+
+
+     /*styling for optgroups*/
+    .SumoSelect > .optWrapper > .options > li.optGroup { padding-left: 5px; text-decoration: underline; }
+

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 5 - 5
demo/public/static/formbuilder/demo.css


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 220
demo/public/static/formbuilder/form-builder.css


+ 1353 - 1353
demo/public/static/formbuilder/form-builder.js

@@ -1,1354 +1,1354 @@
-/*
-formBuilder - git@github.com:kevinchappell/formBuilder.git
-Version: 1.6.2
-Author: Kevin Chappell <kevin.b.chappell@gmail.com>
-*/
-'use strict';
-
-(function($) {
-    'use strict';
-
-    var Toggle = function Toggle(element, options) {
-
-        var defaults = {
-            theme: 'fresh',
-            labels: {
-                off: 'Off',
-                on: 'On'
-            }
-        };
-
-        var opts = $.extend(defaults, options),
-        $kcToggle = $('<div class="kc-toggle"/>').insertAfter(element).append(element);
-
-        $kcToggle.toggleClass('on', element.is(':checked'));
-
-        var kctOn = '<div class="kct-on">' + opts.labels.on + '</div>',
-        kctOff = '<div class="kct-off">' + opts.labels.off + '</div>',
-        kctHandle = '<div class="kct-handle"></div>',
-        kctInner = '<div class="kct-inner">' + kctOn + kctHandle + kctOff + '</div>';
-
-        $kcToggle.append(kctInner);
-
-        $kcToggle.click(function() {
-            element.attr('checked', !element.attr('checked'));
-            $(this).toggleClass('on');
-        });
-    };
-
-    $.fn.kcToggle = function(options) {
-        var toggle = this;
-        return toggle.each(function() {
-            var element = $(this);
-            if (element.data('kcToggle')) {
-                return;
-            }
-            var kcToggle = new Toggle(element, options);
-            element.data('kcToggle', kcToggle);
-        });
-    };
-})(jQuery);
-'use strict';
-
-(function($) {
-    'use strict';
-    var FormBuilder = function FormBuilder(element, options) {
-
-        var defaults = {
-            // Uneditable fields or other content you would like to
-            // appear before and after regular fields.
-            disableFields: {
-                // before: '<h2>Header</h2>',
-                // after: '<h3>Footer</h3>'
-            },
-            // array of objects with fields values
-            // ex:
-            // defaultFields: [{
-            //   label: 'First Name',
-            //   name: 'first-name',
-            //   required: 'true',
-            //   description: 'Your first name',
-            //   type: 'text'
-            // }, {
-            //   label: 'Phone',
-            //   name: 'phone',
-            //   description: 'How can we reach you?',
-            //   type: 'text'
-            // }],
-            defaultFields: [],
-            roles: {
-                1 : 'Administrator'
-            },
-            showWarning: false,
-            serializePrefix: 'frmb',
-            messages: {
-                add: 'Add Item',
-                allowSelect: 'Allow Select',
-                autocomplete: 'Autocomplete',
-                cannotBeEmpty: 'This field cannot be empty',
-                checkboxGroup: 'Checkbox Group',
-                checkbox: 'Checkbox',
-                checkboxes: 'Checkboxes',
-                clearAllMessage: 'Are you sure you want to remove all items?',
-                clearAll: 'Clear All',
-                close: 'Close',
-                copy: 'Copy To Clipboard',
-                dateField: 'Date Field',
-                description: 'Help Text',
-                descriptionField: 'Description',
-                devMode: 'Developer Mode',
-                disableFields: 'These fields cannot be moved.',
-                editNames: 'Edit Names',
-                editorTitle: 'Form Elements',
-                editXML: 'Edit XML',
-                fieldVars: 'Field Variables',
-                fieldRemoveWarning: 'Are you sure you want to remove this field?',
-                getStarted: 'Drag a field from the right to this area',
-                hide: 'Edit',
-                hidden: 'Hidden Input',
-                label: 'Label',
-                labelEmpty: 'Field Label cannot be empty',
-                limitRole: 'Limit access to one or more of the following roles:',
-                mandatory: 'Mandatory',
-                maxLength: 'Max Length',
-                minOptionMessage: 'This field requires a minimum of 2 options',
-                name: 'Name',
-                no: 'No',
-                off: 'Off',
-                on: 'On',
-                optional: 'optional',
-                optionLabelPlaceholder: 'Label',
-                optionValuePlaceholder: 'Value',
-                optionEmpty: 'Option value required',
-                paragraph: 'Paragraph',
-                preview: 'Preview',
-                radioGroup: 'Radio Group',
-                radio: 'Radio',
-                removeMessage: 'Remove Element',
-                remove: '&#215;',
-                required: 'Required',
-                richText: 'Rich Text Editor',
-                roles: 'Access',
-                save: 'Save Template',
-                selectOptions: 'Select Items',
-                select: 'Select',
-                selectionsMessage: 'Allow Multiple Selections',
-                text: 'Text Field',
-                textLabel: 'Title',
-                textIntroduce: 'Description',
-                toggle: 'Toggle',
-                warning: 'Warning!',
-                viewXML: 'View XML',
-                yes: 'Yes',
-                defaultValue : 'Default Value',
-            }
-        };
-
-        var startIndex, doCancel, _helpers = {};
-
-        /**
-     * Callback for when a drag begins
-     * @param  {object} event
-     * @param  {object} ui
-     */
-        _helpers.startMoving = function(event, ui) {
-            event = event;
-            ui.item.addClass('moving');
-            startIndex = $('li', this).index(ui.item);
-        };
-
-        /**
-     * Callback for when a drag ends
-     * @param  {object} event
-     * @param  {object} ui
-     */
-        _helpers.stopMoving = function(event, ui) {
-            event = event;
-            ui.item.removeClass('moving');
-            if (doCancel) {
-                $(ui.sender).sortable('cancel');
-                $(this).sortable('cancel');
-            }
-        };
-
-     /**
-      * Make strings safe to be used as classes
-      * @param  {string} str string to be converted
-      * @return {string}     converter string
-     */
-        _helpers.safename = function(str) {
-            return str.replace(/\s/g, '-').replace(/[^a-zA-Z0-9\-\_]/g, '').toLowerCase();
-        };
-
-     /**
-      * Strips non-numbers from a number only input
-      * @param  {string} str string with possible number
-      * @return {string}     string without numbers
-     */
-        _helpers.forceNumber = function(str) {
-            return str.replace(/[^0-9]/g, '');
-        };
-
-        /**
-     * hide and show mouse tracking tooltips, only used for disabled
-     * fields in the editor.
-     * @todo   remove or refactor to make better use
-     * @param  {object} tt jQuery option with nexted tooltip
-     * @return {void}
-     */
-        _helpers.initTooltip = function(tt) {
-            var tooltip = tt.find('.tooltip');
-            tt.mouseenter(function() {
-                if (tooltip.outerWidth() > 200) {
-                    tooltip.addClass('max-width');
-                }
-                tooltip.css('left', tt.width() + 14);
-                tooltip.stop(true, true).fadeIn('fast');
-            }).mouseleave(function() {
-                tt.find('.tooltip').stop(true, true).fadeOut('fast');
-            });
-            tooltip.hide();
-        };
-
-        // saves the field data to our canvas (elem)
-        _helpers.save = function() {
-            $sortableFields.children('li').not('.disabled').each(function() {
-                _helpers.updatePreview($(this));
-            });
-            elem.val($sortableFields.toXML());
-        };
-
-        // updatePreview will generate the preview for radio and checkbox groups
-        _helpers.updatePreview = function(field) {
-            var fieldClass = field.attr('class'),
-            $prevHolder = $('.prev-holder', field);
-
-            if (fieldClass.indexOf('ui-sortable-handle') !== -1) {
-                return;
-            }
-
-            fieldClass = fieldClass.replace(' form-field', '');
-
-            var preview, previewData = {
-                type: fieldClass,
-                label: $('.fld-label', field).val()
-            };
-
-            if (fieldClass === 'checkbox') {
-                previewData.toggle = $('.checkbox-toggle', field).is(':checked');
-            }
-
-            if (fieldClass.match(/(select|checkbox-group|radio-group)/)) {
-                previewData.values = [];
-
-                $('.sortable-options li', field).each(function() {
-                    var option = {};
-                    option.selected = $('.select-option', $(this)).is(':checked');
-                    option.value = $('.option-value', $(this)).val();
-                    option.label = $('.option-label', $(this)).val();
-
-                    previewData.values.push(option);
-                });
-            }
-            preview = fieldPreview(previewData);
-
-            $prevHolder.html(preview);
-
-            $('input[toggle]', $prevHolder).kcToggle();
-        };
-
-        // update preview to label
-        _helpers.updateMultipleSelect = function() {
-            $sortableFields.delegate('input[name="multiple"]', 'change',
-            function() {
-                var options = $(this).parents('.fields:eq(0)').find('.sortable-options input.select-option');
-                if (this.checked) {
-                    options.each(function() {
-                        $(this).prop('type', 'checkbox');
-                    });
-                } else {
-                    options.each(function() {
-                        $(this).removeAttr('checked').prop('type', 'radio');
-                    });
-                }
-            });
-        };
-
-        _helpers.htmlEncode = function(value) {
-            return $('<div/>').text(value).html();
-        };
-
-        _helpers.htmlDecode = function(value) {
-            return $('<div/>').html(value).text();
-        };
-
-        _helpers.validateForm = function() {
-            var errors = [];
-            // check for empty field labels
-            $('input[name="label"], input[type="text"].option', $sortableFields).each(function() {
-                if ($(this).val() === '') {
-                    var field = $(this).parents('li.form-field'),
-                    fieldAttr = $(this);
-                    errors.push({
-                        field: field,
-                        error: opts.messages.labelEmpty,
-                        attribute: fieldAttr
-                    });
-                }
-            });
-
-            // @todo add error = { noVal: opts.messages.labelEmpty }
-            if (errors.length) {
-                alert('Error: ' + errors[0].error);
-                $('html, body').animate({
-                    scrollTop: errors[0].field.offset().top
-                },
-                1000,
-                function() {
-                    var targetID = $('.toggle-form', errors[0].field).attr('id');
-                    $('.toggle-form', errors[0].field).addClass('open').parent().next('.prev-holder').slideUp(250);
-                    $('#' + targetID + '-fld').slideDown(250,
-                    function() {
-                        errors[0].attribute.addClass('error');
-                    });
-                });
-            }
-        };
-
-        _helpers.disabledTT = function(field) {
-            var title = field.attr('data-tooltip');
-            if (title) {
-                field.removeAttr('title').data('tip_text', title);
-                var tt = $('<p/>', {
-                    'class': 'frmb-tt'
-                }).html(title);
-                field.append(tt);
-                tt.css({
-                    top: -tt.outerHeight(),
-                    left: -15
-                });
-                field.mouseleave(function() {
-                    $(this).attr('data-tooltip', field.data('tip_text'));
-                    $('.frmb-tt').remove();
-                });
-            }
-        };
-
-        var opts = $.extend(defaults, options),
-        elem = $(element),
-        frmbID = 'frmb-' + $('ul[id^=frmb-]').length++;
-
-        var field = '',
-        lastID = 1,
-        boxID = frmbID + '-control-box';
-
-        // create array of field objects to cycle through
-        var frmbFields = [{
-            label: opts.messages.text,
-            attrs: {
-                type: 'text',
-                className: 'text-input',
-                name: 'text-input'
-            }
-        },
-        {
-            label: opts.messages.select,
-            attrs: {
-                type: 'select',
-                className: 'select',
-                name: 'select'
-            }
-        },
-        {
-            label: opts.messages.richText,
-            attrs: {
-                type: 'rich-text',
-                className: 'rich-text',
-                name: 'rich-text'
-            }
-        },
-        {
-            label: opts.messages.radioGroup,
-            attrs: {
-                type: 'radio-group',
-                className: 'radio-group',
-                name: 'radio-group'
-            }
-        },
-        {
-            label: opts.messages.hidden,
-            attrs: {
-                type: 'hidden',
-                className: 'hidden-input',
-                name: 'hidden-input'
-            }
-        },
-        {
-            label: opts.messages.dateField,
-            attrs: {
-                type: 'date',
-                className: 'calendar',
-                name: 'date-input'
-            }
-        },
-        {
-            label: opts.messages.checkboxGroup,
-            attrs: {
-                type: 'checkbox-group',
-                className: 'checkbox-group',
-                name: 'checkbox-group'
-            }
-        },
-        {
-            label: opts.messages.checkbox,
-            attrs: {
-                type: 'checkbox',
-                className: 'checkbox',
-                name: 'checkbox'
-            }
-        },
-        {
-            label: opts.messages.autocomplete,
-            attrs: {
-                type: 'autocomplete',
-                className: 'autocomplete',
-                name: 'autocomplete'
-            }
-        },
-        {
-            label: opts.messages.textLabel,
-            attrs: {
-                type: 'text-label',
-                className: 'text-label',
-                name: 'text'
-            }
-        }];
-
-        // Create draggable fields for formBuilder
-        var cbUL = $('<ul/>', {
-            id: boxID,
-            'class': 'frmb-control'
-        });
-
-        // Loop through
-        for (var i = frmbFields.length - 1; i >= 0; i--) {
-            var $field = $('<li/>', {
-                'class': 'icon-' + frmbFields[i].attrs.className,
-                'type': frmbFields[i].type,
-                'name': frmbFields[i].className,
-                'label': frmbFields[i].label
-            });
-            for (var attr in frmbFields[i]) {
-                if (frmbFields[i].hasOwnProperty(attr)) {
-                    $field.data(attr, frmbFields[i][attr]);
-                }
-            }
-            $field.html(frmbFields[i].label).appendTo(cbUL);
-        }
-
-        // Build our headers and action links
-        var cbHeader = $('<h4/>').html(opts.messages.editorTitle),
-        viewXML = $('<a/>', {
-            id: frmbID + '-export-xml',
-            text: opts.messages.viewXML,
-            href: '#',
-            'class': 'view-xml'
-        }),
-        allowSelect = $('<a/>', {
-            id: frmbID + '-allow-select',
-            text: opts.messages.allowSelect,
-            href: '#',
-            'class': 'allow-select'
-        }).prop('checked', 'checked'),
-        editXML = $('<a/>', {
-            id: frmbID + '-edit-xml',
-            text: opts.messages.editXML,
-            href: '#',
-            'class': 'edit-xml'
-        }),
-        editNames = $('<a/>', {
-            id: frmbID + '-edit-names',
-            text: opts.messages.editNames,
-            href: '#',
-            'class': 'edit-names'
-        }),
-        clearAll = $('<a/>', {
-            id: frmbID + '-clear-all',
-            text: opts.messages.clearAll,
-            href: '#',
-            'class': 'clear-all'
-        }),
-        saveAll = $('<div/>', {
-            id: frmbID + '-save',
-            href: '#',
-            'class': 'save-btn-wrap',
-            title: opts.messages.save
-        }).html('<a class="save fb-button primary"><span>' + opts.messages.save + '</span></a>'),
-        actionLinksInner = $('<div/>', {
-            id: frmbID + '-action-links-inner',
-            'class': 'action-links-inner'
-        }).append(editXML, ' | ', editNames, ' | ', allowSelect, ' | ', clearAll, ' |&nbsp;'),
-        devMode = $('<span/>', {
-            'class': 'dev-mode-link'
-        }).html(opts.messages.devMode + ' ' + opts.messages.off),
-        actionLinks = $('<div/>', {
-            id: frmbID + '-action-links',
-            'class': 'action-links'
-        }).append(actionLinksInner, devMode);
-
-        // Sortable fields
-        var $sortableFields = $('<ul/>').attr('id', frmbID).addClass('frmb').sortable({
-            cursor: 'move',
-            opacity: 0.9,
-            beforeStop: function beforeStop(event, ui) {
-                var lastIndex = $('> li', $sortableFields).length - 1,
-                curIndex = ui.placeholder.index();
-                doCancel = curIndex <= 1 || curIndex === lastIndex;
-            },
-            start: _helpers.startMoving,
-            stop: _helpers.stopMoving,
-            cancel: 'input, .disabled, .sortable-options, .add, .btn, .no-drag',
-            // items: 'li:not(.no-fields)',
-            receive: function receive(event, ui) {
-                // if (doCancel) {
-                //   $('li:nth-child(' + curIndex + ')', $(this)).remove();
-                // }
-            },
-            placeholder: 'frmb-placeholder'
-        });
-
-        // ControlBox with different fields
-        cbUL.sortable({
-            helper: 'clone',
-            opacity: 0.9,
-            connectWith: $sortableFields,
-            cursor: 'move',
-            placeholder: 'ui-state-highlight',
-            start: _helpers.startMoving,
-            stop: _helpers.stopMoving,
-            revert: 150,
-            change: function change(event, ui) {
-                //fix the logic on this to only hide placeholder for disabledFields.before and after
-                // if (ui.placeholder.index() === 0 || ui.placeholder.index() === $('> li', $sortableFields).last().index()) {
-                //   $(ui.placeholder).hide();
-                // } else {
-                //   $(ui.placeholder).show();
-                // }
-            },
-            remove: function remove(event, ui) {
-                if (startIndex === 0) {
-                    cbUL.prepend(ui.item);
-                } else {
-                    $('li:nth-child(' + startIndex + ')', cbUL).after(ui.item);
-                }
-            },
-            beforeStop: function beforeStop(event, ui) {
-                var lastIndex = $('> li', $sortableFields).length - 1,
-                curIndex = ui.placeholder.index();
-                doCancel = curIndex <= 1 || curIndex === lastIndex ? true: false;
-                if (ui.placeholder.parent().hasClass('frmb-control')) {
-                    doCancel = true;
-                }
-            },
-            update: function update(event, ui) {
-                // _helpers.stopMoving;
-                elem.stopIndex = $('li', $sortableFields).index(ui.item) === 0 ? '0': $('li', $sortableFields).index(ui.item);
-                if ($('li', $sortableFields).index(ui.item) < 0) {
-                    $(this).sortable('cancel');
-                } else {
-                    prepFieldVars($(ui.item[0]), true);
-                }
-            },
-            receive: function receive(event, ui) {
-                if (ui.sender.hasClass('frmb') || ui.sender.hasClass('frmb-control')) {
-                    $(ui.sender).sortable('cancel');
-                }
-            }
-        });
-
-        var $stageWrap = $('<div/>', {
-            id: frmbID + '-stage-wrap',
-            'class': 'stage-wrap'
-        });
-
-        var $formWrap = $('<div/>', {
-            id: frmbID + '-form-wrap',
-            'class': 'form-wrap'
-        });
-
-        elem.before($stageWrap).appendTo($stageWrap);
-
-        // Replace the textarea with sortable list.
-        //elem.before($sortableFields).parent().prepend(frmbHeader).addClass('frmb-wrap').append(actionLinks, viewXML, saveAll);
-        var cbWrap = $('<div/>', {
-            id: frmbID + '-cb-wrap',
-            'class': 'cb-wrap'
-        }).append(cbHeader, cbUL);
-
-        $stageWrap.append($sortableFields, cbWrap, actionLinks, viewXML, saveAll);
-        $stageWrap.before($formWrap);
-        $formWrap.append($stageWrap, cbWrap);
-
-        var doSave = function doSave() {
-            if ($(this).parents('li.disabled').length === 0) {
-                if ($(this).name === 'label' && $(this).val() === '') {
-                    return alert('Error: ' + opts.messages.labelEmpty);
-                }
-                _helpers.save();
-            }
-        };
-
-        // Not pretty but we need to save a lot so users don't have to keep clicking a save button
-        $('input, select', $sortableFields).on('change', doSave);
-        $('input, select', $sortableFields).on('blur', doSave);
-
-        // Parse saved XML template data
-        elem.getTemplate = function() {
-            var xml = elem.val() !== '' ? $.parseXML(elem.val()) : false,
-            fields = $(xml).find('field');
-
-            if (fields.length > 0) {
-                fields.each(function() {
-                    prepFieldVars($(this));
-                });
-            } else if (!xml) {
-                // Load default fields if none are set
-                if (opts.defaultFields.length) {
-                    for (var i = opts.defaultFields.length - 1; i >= 0; i--) {
-                        appendNewField(opts.defaultFields[i]);
-                    }
-                } else {
-                    $stageWrap.addClass('empty').attr('data-content', opts.messages.getStarted);
-                }
-                disabledBeforeAfter();
-            }
-        };
-
-        var disabledBeforeAfter = function disabledBeforeAfter() {
-            var li = '<li class="disabled __POSITION__">__CONTENT__</li>';
-            if (opts.disableFields.before && !$('.disabled.before', $sortableFields).length) {
-                $sortableFields.prepend(li.replace('__POSITION__', 'before').replace('__CONTENT__', opts.disableFields.before));
-            }
-            if (opts.disableFields.after && !$('.disabled.after', $sortableFields).length) {
-                $sortableFields.append(li.replace('__POSITION__', 'after').replace('__CONTENT__', opts.disableFields.after));
-            }
-        };
-
-        var nameAttr = function nameAttr(field) {
-            var epoch = new Date().getTime();
-            return field.data('attrs').name + '-' + epoch;
-        };
-
-        var prepFieldVars = function prepFieldVars($field, isNew) {
-            isNew = isNew || false;
-            var fieldAttrs = $field.data('attrs') || {},
-            fType = fieldAttrs.type || $field.attr('type'),
-            isMultiple = fType.match(/(select|checkbox-group|radio-group)/),
-            values = {};
-
-            values.label = _helpers.htmlEncode($field.attr('label'));
-            values.name = isNew ? nameAttr($field) : fieldAttrs.name || $field.attr('name');
-            values.name = typeof values.name == 'undefined' ? '' : values.name;
-            values.defaultVal = $field.attr('defaultVal') !== undefined ? _helpers.htmlEncode($field.attr('defaultVal')) : '';
-            values.role = $field.attr('role');
-            values.required = $field.attr('required');
-            values.maxLength = $field.attr('max-length');
-            values.toggle = $field.attr('toggle');
-            values.type = fType;
-            values.description = $field.attr('description') !== undefined ? _helpers.htmlEncode($field.attr('description')) : '';
-            values.introduce = $field.attr('introduce') !== undefined ? _helpers.htmlEncode($field.attr('introduce')) : '';
-            if (isMultiple) {
-                values.multiple = true;
-                values.values = [];
-                $field.children().each(function(i) {
-                    var value = {
-                        label: $(this).text(),
-                        value: $(this).attr('value'),
-                        selected: $field.attr('default') === i ? true: false
-                    };
-                    values.values.push(value);
-                });
-            }
-
-            appendNewField(values);
-            $stageWrap.removeClass('empty');
-            disabledBeforeAfter();
-        };
-
-        // multi-line textarea
-        var appendTextarea = function appendTextarea(values) {
-            appendFieldLi(opts.messages.richText, advFields(values), values);
-        };
-
-        var appendInput = function appendInput(values) {
-            var type = values.type || 'text';
-            appendFieldLi(opts.messages[type], advFields(values), values);
-        };
-        var textLabel = function textLabel(values) {
-            var type = values.type || 'text';
-            values.introduce = values.introduce || opts.messages.textIntroduce;
-            appendFieldLi(opts.messages[type], advFields(values), values);
-        }
-        // add select dropdown
-        var appendSelectList = function appendSelectList(values) {
-
-            if (!values.values || !values.values.length) {
-                values.values = [{
-                    selected: 'false',
-                    label: 'Option 1',
-                    value: 'option-1'
-                },
-                {
-                    selected: 'false',
-                    label: 'Option 2',
-                    value: 'option-2'
-                }];
-            }
-
-            var field = '',
-            name = _helpers.safename(values.name),
-            multiDisplay = values.type === 'checkbox-group' ? 'none': 'none';
-
-            field += advFields(values);
-            field += '<div class="false-label">' + opts.messages.selectOptions + '</div>';
-            field += '<div class="fields">';
-
-            field += '<div class="allow-multi" style="display:' + multiDisplay + '">';
-            field += '<input type="checkbox" id="multiple_' + lastID + '" name="multiple"' + (values.multiple ? 'checked="checked"': '') + '>';
-            field += '<label class="multiple" for="multiple_' + lastID + '">' + opts.messages.selectionsMessage + '</label>';
-            field += '</div>';
-            field += '<ol class="sortable-options">';
-            for (i = 0; i < values.values.length; i++) {
-                field += selectFieldOptions(values.values[i], name, values.values[i].selected, values.multiple);
-            }
-            field += '</ol>';
-            field += '<div class="field_actions"><a href="#" class="add add_opt"><strong>' + opts.messages.add + '</strong></a> | <a href="#" class="close_field">' + opts.messages.close + '</a></div>';
-            field += '</div>';
-            appendFieldLi(opts.messages.select, field, values);
-
-            $('.sortable-options').sortable(); // making the dynamically added option fields sortable.
-        };
-
-        var appendNewField = function appendNewField(values) {
-            if (values === undefined) {
-                values = '';
-            }
-
-            // TODO: refactor to move functions into this object
-            var appendFieldType = {
-                // 'text': appendTextInput(values),
-                // 'checkbox': appendCheckbox(values),
-                // 'select': appendSelectList(values),
-                // 'textarea': appendTextarea(values),
-                'text-label': textLabel,
-                '2': appendInput,
-                'date': appendInput,
-                'autocomplete': appendInput,
-                'checkbox': appendInput,
-                'select': appendSelectList,
-                'rich-text': appendTextarea,
-                'textarea': appendTextarea,
-                'radio-group': appendSelectList,
-                'checkbox-group': appendSelectList,
-                'text': appendInput,
-                'hidden': appendInput
-            };
-
-            if (typeof appendFieldType[values.type] === 'function') {
-                appendFieldType[values.type](values);
-            }
-        };
-
-        /**
-     * Build the editable properties for the field
-     * @param  {object} values configuration object for advanced fields
-     * @return {string}        markup for advanced fields
-     */
-        var advFields = function advFields(values) {
-            var advFields = '',
-            key, roles = values.role !== undefined ? values.role.split(',') : [];
-            var fieldLabel = $('<div>', {
-                'class': 'frm-fld label-wrap'
-            });
-            $('<label/>').html(opts.messages.label + ' *').appendTo(fieldLabel);
-            $('<input>', {
-                type: 'text',
-                name: 'label',
-                value: values.label,
-                'class': 'fld-label'
-            }).appendTo(fieldLabel);
-            advFields += fieldLabel[0].outerHTML;
-
-            var fieldDesc = $('<div>', {
-                'class': 'frm-fld description-wrap'
-            });
-            $('<label/>').html(opts.messages.description + ' *').appendTo(fieldDesc);
-
-            if (values.type == 'text-label') { //text-label
-                advFields += '<div class="frm-fld description-wrap"><label>' + opts.messages.textIntroduce + '</label>';
-                advFields += '<input type="text" name="introduce" value="' + values.introduce + '" class="fld-introduce" id="introduce-' + lastID + '" /></div>';
-            }
-            if (values.type != 'text-label') {
-                advFields += '<div class="frm-fld description-wrap"><label>' + opts.messages.description + '</label>';
-                advFields += '<input type="text" name="description" value="' + values.description + '" class="fld-description" id="description-' + lastID + '" /></div>';
-                advFields += '<div class="frm-fld name-wrap"><label>' + opts.messages.name + ' <span class="required">*</span></label>';
-                advFields += '<input type="text" name="name" value="' + values.name + '" class="fld-name" id="title-' + lastID + '" /></div>';
-            }
-
-            advFields += '<div class="frm-fld access-wrap"><label>' + opts.messages.roles + '</label>';
-
-            advFields += '<input type="checkbox" name="enable_roles" value="" ' + (values.role !== undefined ? 'checked': '') + ' id="enable_roles-' + lastID + '"/> <label for="enable_roles-' + lastID + '" class="roles_label">' + opts.messages.limitRole + '</label>';
-            advFields += '<div class="frm-fld available-roles" ' + (values.role !== undefined ? 'style="display:block"': '') + '>';
-            for (key in opts.roles) {
-                if ($.inArray(key, ['date', '4']) === -1) {
-                    advFields += '<input type="checkbox" name="roles[]" value="' + key + '" id="fld-' + lastID + '-roles-' + key + '" ' + ($.inArray(key, roles) !== -1 ? 'checked': '') + ' class="roles-field" /><label for="fld-' + lastID + '-roles-' + key + '">' + opts.roles[key] + '</label><br/>';
-                }
-            }
-            advFields += '</div></div>';
-
-            // if field type is not checkbox, checkbox/radio group or select list, add max length
-            if ($.inArray(values.type, ['checkbox', 'select', 'checkbox-group', 'date', 'autocomplete', 'radio-group', 'text-label']) < 0) {
-                advFields += '<div class="frm-fld"><label class="max-length-label">' + opts.messages.maxLength + '</label>';
-                advFields += '<input type="text" name="max-length" max-length="4" value="' + (values.maxLength !== undefined ? values.maxLength: '') + '" class="fld-max-length" id="max-length-' + lastID + '" /></div>';
-            }
-
-            return advFields;
-        };
-
-        // Append the new field to the editor
-        var appendFieldLi = function appendFieldLi(title, field, values) {
-            var label = $(field).find('input[name="label"]').val() !== '' ? $(field).find('input[name="label"]').val() : title;
-            var defaultVal = typeof values.defaultVal != 'undefined' ? values.defaultVal : '';
-            var introduce = $(field).find('input[name="introduce"]').val() !== '' ? $(field).find('input[name="introduce"]').val() : '';
-            var li = '',
-            delBtn = '<a id="del_' + lastID + '" class="del-button btn delete-confirm" href="#" title="' + opts.messages.removeMessage + '">' + opts.messages.remove + '</a>',
-            toggleBtn = '<a id="frm-' + lastID + '" class="toggle-form btn icon-pencil" href="#" title="' + opts.messages.hide + '"></a> ',
-            required = values.required,
-            toggle = values.toggle || undefined,
-            tooltip = values.description !== '' ? '<span class="tooltip-element" tooltip="' + values.description + '">?</span>': '';
-
-            li += '<li id="frm-' + lastID + '-item" class="' + values.type + ' form-field">';
-            li += '<div class="legend">';
-            li += delBtn;
-            li += '<span id="txt-title-' + lastID + '" class="field-label">' + label + '</span>' + tooltip + '<span class="required-asterisk" ' + (required === 'true' ? 'style="display:inline"': '') + '> *</span>' + toggleBtn;
-            li += '</div>';
-            if (values.type == 'text-label') {
-                li += '<div class="frm-fld">';
-                li += '<label class="field-introduce">' + introduce + '</label>';
-                li += '</div>';
-            }
-            li += '<div class="prev-holder">' + fieldPreview(values) + '</div>';
-            li += '<div id="frm-' + lastID + '-fld" class="frm-holder">';
-            li += '<div class="form-elements">';
-
-            if (values.type != 'text-label') {
-                li += '<div class="frm-fld">';
-                li += '<label>&nbsp;</label>';
-                li += '<input class="required" type="checkbox" value="1" name="required-' + lastID + '" id="required-' + lastID + '"' + (required === 'true' ? ' checked="checked"': '') + ' /><label class="required_label" for="required-' + lastID + '">' + opts.messages.required + '</label>';
-
-                if (values.type === 'checkbox') {
-                    li += '<div class="frm-fld">';
-                    li += '<label>&nbsp;</label>';
-                    li += '<input class="checkbox-toggle" type="checkbox" value="1" name="toggle-' + lastID + '" id="toggle-' + lastID + '"' + (toggle === 'true' ? ' checked="checked"': '') + ' /><label class="toggle-label" for="toggle-' + lastID + '">' + opts.messages.toggle + '</label>';
-                    li += '</div>';
-                }
-                li += '</div>';
-            }
-
-            if (values.type == 'hidden') {
-                li += '<div class="frm-fld">';
-                li += '<label class="field-defaultVal">'+opts.messages.defaultValue+'</label>';
-                li += '<input type="text" class="fld-defaultVal" name="defaultVal" id="defaultVal-'+lastID+'" value="'+ defaultVal +'" />';
-                li += '</div>';
-            }
-            li += field;
-            li += '</div>';
-            li += '</div>';
-            li += '</li>';
-
-            if (elem.stopIndex) {
-                $('li', $sortableFields).eq(elem.stopIndex).after(li);
-            } else {
-                $sortableFields.append(li);
-            }
-
-            $(document.getElementById('frm-' + lastID + '-item')).hide().slideDown(250);
-
-            lastID++;
-            _helpers.save();
-        };
-
-        /**
-     * Generate preview markup
-     * @param  {object} attrs
-     * @return {string}       preview markup for field
-     */
-        var fieldPreview = function fieldPreview(attrs) {
-            var i, preview = '',
-            epoch = new Date().getTime();
-            switch (attrs.type) {
-            case 'textarea':
-                preview = '<' + attrs.type + '></' + attrs.type + '>';
-                break;
-            case 'select':
-                var options;
-                attrs.values.reverse();
-                for (i = attrs.values.length - 1; i >= 0; i--) {
-                    options += '<option value="' + attrs.values[i].value + '">' + attrs.values[i].label + '</option>';
-                }
-                preview = '<' + attrs.type + ' class="no-drag">' + options + '</' + attrs.type + '>';
-                break;
-            case 'checkbox-group':
-            case 'radio-group':
-                var type = attrs.type.replace('-group', '');
-                attrs.values.reverse();
-                for (i = attrs.values.length - 1; i >= 0; i--) {
-                    preview += '<div class="inner-checkbox"><input type="' + type + '" id="' + type + '-' + epoch + '-' + i + '" value="' + attrs.values[i].value + '" /><label for="' + type + '-' + epoch + '-' + i + '">' + attrs.values[i].label + '</label></div>';
-                }
-                break;
-            case 'text':
-            case 'password':
-            case 'hidden':
-            case 'email':
-            case 'date':
-            case 'checkbox':
-                var toggle = attrs.toggle ? 'toggle': '';
-                preview = '<input type="' + attrs.type + '" ' + toggle + ' placeholder="">';
-                break;
-            case 'autocomplete':
-                preview = '<input class="ui-autocomplete-input" autocomplete="on" placeholder="">';
-                break;
-            default:
-                preview = '<' + attrs.type + '></' + attrs.type + '>';
-            }
-
-            return preview;
-        };
-
-        // Select field html, since there may be multiple
-        var selectFieldOptions = function selectFieldOptions(values, name, selected, multipleSelect) {
-            var selectedType = multipleSelect ? 'checkbox': 'radio';
-
-            if (typeof values !== 'object') {
-                values = {
-                    label: '',
-                    value: ''
-                };
-            } else {
-                values.label = values.label || '';
-                values.value = values.value || '';
-            }
-
-            field = '<li>';
-            field += '<input type="' + selectedType + '" ' + selected + ' class="select-option" name="' + name + '" />';
-            field += '<input type="text" class="option-label" placeholder="' + opts.messages.optionLabelPlaceholder + '" value="' + values.label + '" />';
-            field += '<input type="text" class="option-value" placeholder="' + opts.messages.optionValuePlaceholder + '" value="' + values.value + '" />';
-            field += '<a href="#" class="remove btn" title="' + opts.messages.removeMessage + '">' + opts.messages.remove + '</a>';
-            field += '</li>';
-
-            return field;
-        };
-
-        // ---------------------- UTILITIES ---------------------- //
-        // delete options
-        $sortableFields.delegate('.remove', 'click',
-        function(e) {
-            e.preventDefault();
-            var optionsCount = $(this).parents('.sortable-options:eq(0)').children('li').length;
-            if (optionsCount <= 2) {
-                alert('Error: ' + opts.messages.minOptionMessage);
-            } else {
-                $(this).parent('li').slideUp('250',
-                function() {
-                    $(this).remove();
-                });
-            }
-        });
-
-        // toggle fields
-        $sortableFields.on('click', '.toggle-form',
-        function(e) {
-            e.preventDefault();
-            var targetID = $(this).attr('id');
-            $(this).toggleClass('open').parent().next('.prev-holder').slideToggle(250);
-            $(document.getElementById(targetID + '-fld')).slideToggle(250,
-            function() {
-                _helpers.save();
-            });
-        });
-
-        // update preview to label
-        $sortableFields.delegate('input[name="label"]', 'keyup',
-        function() {
-            $('.field-label', $(this).closest('li')).text($(this).val());
-        });
-
-        $sortableFields.delegate('input[name="introduce"]', 'keyup',
-        function() {
-            $('.field-introduce', $(this).closest('li')).text($(this).val());
-        });
-        $sortableFields.delegate('input[name="defaultVal"]', 'keyup',
-        function() {
-            _helpers.save();
-        });
-        // remove error styling when users tries to correct mistake
-        $sortableFields.delegate('input.error', 'keyup',
-        function() {
-            $(this).removeClass('error');
-        });
-
-        // update preview for description
-        $sortableFields.delegate('input[name="description"]', 'keyup',
-        function() {
-            var closestToolTip = $('.tooltip-element', $(this).closest('li'));
-            if ($(this).val() !== '') {
-                if (!closestToolTip.length) {
-                    var tt = '<span class="tooltip-element" tooltip="' + $(this).val() + '">?</span>';
-                    $('.toggle-form', $(this).closest('li')).before(tt);
-                    // _helpers.initTooltip(tt);
-                } else {
-                    closestToolTip.attr('tooltip', $(this).val()).css('display', 'inline-block');
-                }
-            } else {
-                if (closestToolTip.length) {
-                    closestToolTip.css('display', 'none');
-                }
-            }
-        });
-
-        _helpers.updateMultipleSelect();
-
-        // format name attribute
-        $sortableFields.delegate('input[name="name"]', 'keyup',
-        function() {
-            $(this).val(_helpers.safename($(this).val()));
-            if ($(this).val() === '') {
-                $(this).addClass('field_error').attr('placeholder', opts.messages.cannotBeEmpty);
-            } else {
-                $(this).removeClass('field_error');
-            }
-        });
-
-        $sortableFields.delegate('input.fld-max-length', 'keyup',
-        function() {
-            $(this).val(_helpers.forceNumber($(this).val()));
-        });
-
-        // Delete field
-        $sortableFields.delegate('.delete-confirm', 'click',
-        function(e) {
-            e.preventDefault();
-
-            // lets see if the user really wants to remove this field... FOREVER
-            var fieldWarnH3 = $('<h3/>').html('<span></span>' + opts.messages.warning),
-            deleteID = $(this).attr('id').replace(/del_/, ''),
-            delBtn = $(this),
-            $field = $(document.getElementById('frm-' + deleteID + '-item')),
-            toolTipPageX = delBtn.offset().left - $(window).scrollLeft(),
-            toolTipPageY = delBtn.offset().top - $(window).scrollTop();
-
-            if (opts.showWarning) {
-                jQuery('<div />').append(fieldWarnH3, opts.messages.fieldRemoveWarning).dialog({
-                    modal: true,
-                    resizable: false,
-                    width: 300,
-                    dialogClass: 'ite-warning',
-                    open: function open() {
-                        $('.ui-widget-overlay').css({
-                            'opacity': 0.0
-                        });
-                    },
-                    position: [toolTipPageX - 282, toolTipPageY - 178],
-                    buttons: [{
-                        text: opts.messages.yes,
-                        click: function click() {
-                            $field.slideUp(250,
-                            function() {
-                                $(this).remove();
-                                _helpers.save();
-                            });
-                            $(this).dialog('close');
-                        }
-                    },
-                    {
-                        text: opts.messages.no,
-                        'class': 'cancel',
-                        click: function click() {
-                            $(this).dialog('close');
-                        }
-                    }]
-                });
-            } else {
-                $field.slideUp(250,
-                function() {
-                    $(this).remove();
-                    _helpers.save();
-                });
-            }
-
-            if ($('.form-field', $sortableFields).length === 1) {
-                $stageWrap.addClass('empty');
-            }
-        });
-
-        // Attach a callback to toggle required asterisk
-        $sortableFields.delegate('input.required', 'click',
-        function() {
-            var requiredAsterisk = $(this).parents('li.form-field').find('.required-asterisk');
-            requiredAsterisk.toggle();
-        });
-
-        // Attach a callback to toggle roles visibility
-        $sortableFields.delegate('input[name="enable_roles"]', 'click',
-        function() {
-            var roles = $(this).siblings('div.available-roles'),
-            enableRolesCB = $(this);
-            roles.slideToggle(250,
-            function() {
-                if (!enableRolesCB.is(':checked')) {
-                    $('input[type="checkbox"]', roles).removeAttr('checked');
-                }
-            });
-        });
-
-        // Attach a callback to add new checkboxes
-        $sortableFields.delegate('.add_ck', 'click',
-        function() {
-            $(this).parent().before(selectFieldOptions());
-            return false;
-        });
-
-        $sortableFields.delegate('li.disabled .form-element', 'mouseenter',
-        function() {
-            _helpers.disabledTT($(this));
-        });
-
-        // Attach a callback to add new options
-        $sortableFields.delegate('.add_opt', 'click',
-        function(e) {
-            e.preventDefault();
-            var isMultiple = $(this).parents('.fields').first().find('input[name="multiple"]')[0].checked,
-            name = $(this).parents('.fields').find('.select-option:eq(0)').attr('name');
-            $(this).parents('.fields').first().find('.sortable-options').append(selectFieldOptions(false, name, false, isMultiple));
-            _helpers.updateMultipleSelect();
-        });
-
-        // Attach a callback to close link
-        $sortableFields.delegate('.close_field', 'click',
-        function(e) {
-            e.preventDefault();
-            $(this).parents('li.form-field').find('.toggle-form').trigger('click');
-        });
-
-        // Attach a callback to add new radio fields
-        $sortableFields.delegate('.add_rd', 'click',
-        function(e) {
-            e.preventDefault();
-            $(this).parent().before(selectFieldOptions(false, $(this).parents('.frm-holder').attr('id')));
-        });
-
-        $('.form-elements .fields .remove, .frmb .del-button').on('hover',
-        function() {
-            $(this).parents('li.form-field').toggleClass('delete');
-        });
-
-        // View XML
-        $(document.getElementById(frmbID + '-export-xml')).click(function(e) {
-            e.preventDefault();
-            var xml = elem.val(),
-            $pre = $('<pre />').text(xml);
-            $pre.dialog({
-                resizable: false,
-                modal: true,
-                width: 720,
-                dialogClass: 'frmb-xml',
-                overlay: {
-                    color: '#333333'
-                }
-            });
-        });
-
-        // Clear all fields in form editor
-        $(document.getElementById(frmbID + '-clear-all')).click(function(e) {
-            e.preventDefault();
-            if (window.confirm(opts.messages.clearAllMessage)) {
-                $sortableFields.empty();
-                elem.val('');
-                _helpers.save();
-                var values = {
-                    label: [opts.messages.descriptionField],
-                    name: ['content'],
-                    required: 'true',
-                    description: opts.messages.mandatory
-                };
-
-                appendNewField(values);
-                $sortableFields.prepend(opts.disableFields.before);
-                $sortableFields.append(opts.disableFields.after);
-            }
-        });
-
-        // Save Idea Template
-        $(document.getElementById(frmbID + '-save')).click(function(e) {
-            if ($(this).find('.ldkInlineEdit').length === 0) {
-                e.preventDefault();
-                if (!$stageWrap.hasClass('edit-xml')) {
-                    _helpers.save();
-                }
-                _helpers.validateForm(e);
-            }
-        });
-
-        var triggerDevMode = false,
-        keys = [],
-        devCode = '68,69,86';
-        // Super secret Developer Tools
-        $('.save.fb-button').mouseover(function() {
-            triggerDevMode = true;
-        }).mouseout(function() {
-            triggerDevMode = false;
-        });
-        $(document.documentElement).keydown(function(e) {
-            keys.push(e.keyCode);
-            if (keys.toString().indexOf(devCode) >= 0) {
-                $('.action-links').toggle();
-                $('.view-xml').toggle();
-                keys = [];
-            }
-        });
-        // Toggle Developer Mode
-        $('.dev-mode-link').click(function(e) {
-            e.preventDefault();
-            var dml = $(this);
-            $stageWrap.toggleClass('dev-mode');
-            dml.parent().css('opacity', 1);
-            if ($stageWrap.hasClass('dev-mode')) {
-                dml.siblings('.action-links-inner').css('width', '100%');
-                dml.html(opts.messages.devMode + ' ' + opts.messages.on).css('color', '#8CC63F');
-            } else {
-                dml.siblings('.action-links-inner').css('width', 0);
-                dml.html(opts.messages.devMode + ' ' + opts.messages.off).css('color', '#666666');
-                triggerDevMode = false;
-                $('.action-links').toggle();
-                $('.view-xml').toggle();
-            }
-        });
-
-        // Toggle Edit Names
-        $(document.getElementById(frmbID + '-edit-names')).click(function(e) {
-            e.preventDefault();
-            $(this).toggleClass('active');
-            $('.name-wrap', $sortableFields).slideToggle(250,
-            function() {
-                $stageWrap.toggleClass('edit-names');
-            });
-        });
-
-        // Toggle Allow Select
-        $(document.getElementById(frmbID + '-allow-select')).click(function(e) {
-            e.preventDefault();
-            $(this).toggleClass('active');
-            $('.allow-multi, .select-option', $sortableFields).slideToggle(250,
-            function() {
-                $stageWrap.toggleClass('allow-select');
-            });
-        });
-
-        // Toggle Edit XML
-        $(document.getElementById(frmbID + '-edit-xml')).click(function(e) {
-            e.preventDefault();
-            $(this).toggleClass('active');
-            $('textarea.idea-template').show();
-            $('.template-textarea-wrap').slideToggle(250);
-            $stageWrap.toggleClass('edit-xml');
-        });
-
-        elem.parent().find('p[id*="ideaTemplate"]').remove();
-        elem.wrap('<div class="template-textarea-wrap"/>');
-        elem.getTemplate();
-    };
-
-    $.fn.formBuilder = function(options) {
-        var form = this;
-        return form.each(function() {
-            var element = $(this);
-            if (element.data('formBuilder')) {
-                return;
-            }
-            var formBuilder = new FormBuilder(this, options);
-            element.data('formBuilder', formBuilder);
-        });
-    };
-})(jQuery);
-
-// toXML is a jQuery plugin that turns our form editor into XML
-(function($) {
-    'use strict';
-    $.fn.toXML = function(options) {
-        var defaults = {
-            prepend: '',
-            attributes: ['class']
-        };
-        var opts = $.extend(defaults, options);
-
-        var serialStr = '';
-
-        // Begin the core plugin
-        this.each(function() {
-            var liCount = 0;
-            var c = 1;
-
-            if ($(this).children().length >= 1) {
-                serialStr += '<form-template>\n\t<fields>';
-
-                // build new xml
-                $(this).children().each(function() {
-                    var $field = $(this);
-                    if (! ($field.hasClass('moving') || $field.hasClass('disabled'))) {
-                        for (var att = 0; att < opts.attributes.length; att++) {
-                            var required = $('input.required', $field).is(':checked') ? 'required="true" ': 'required="false" ',
-                            multipleChecked = $('input[name="multiple"]', $field).is(':checked'),
-                            multiple = multipleChecked ? 'style="multiple" ': '',
-                            t = $field.attr(opts.attributes[att]).replace(' form-field', ''),
-                            // field type
-                            multipleField = t.match(/(select|checkbox-group|radio-group)/),
-                            type = 'type="' + t + '" ',
-                            fName = $('input.fld-name', $field).length > 0 ? ('name="' + $('input.fld-name', $field).val() + '" ') : '',
-                            fLabel = 'label="' + $('input.fld-label', $field).val() + '" ',
-                            roleVals = $.map($('input.roles-field:checked', $field),
-                            function(n) {
-                                return n.value;
-                            }).join(','),
-                            roles = roleVals !== '' ? 'role="' + roleVals + '" ': '',
-
-                            desc = $('input.fld-description', $field).length > 0 ? ('description="' + $('input.fld-description', $field).val() + '" ') : '',
-                            introduce = $('input.fld-introduce', $field).length > 0 ? ('introduce="' + $('input.fld-introduce', $field).val() + '" ') : '',
-							defaultVal = $('input.fld-defaultVal', $field).length > 0 ? ('defaultVal="' + $('input.fld-defaultVal', $field).val() + '" ') : '',
-                            maxLengthVal = $('input.fld-max-length', $field).val(),
-                            maxLength = 'max-length="' + (maxLengthVal !== undefined ? maxLengthVal: '') + '" ',
-                            fSlash = !multipleField ? '/': '';
-                            var fToggle = $('.checkbox-toggle', $field).is(':checked') ? 'toggle="true" ': '';
-
-                            serialStr += '\n\t\t<field ' + fName + fLabel + defaultVal + fToggle + multiple + roles + desc + introduce + (maxLengthVal !== '' ? maxLengthVal !== undefined ? maxLength: '': '') + required + type + fSlash +'>';
-                            if (multipleField) {
-                                c = 1;
-                                $('.sortable-options li', $field).each(function() {
-                                    var $option = $(this),
-                                    optionValue = 'value="' + $('.option-value', $option).val() + '"',
-                                    optionLabel = $('.option-label', $option).val(),
-                                    selected = $('.select-option', $option).is(':checked') ? ' selected="true"': '';
-                                    serialStr += '\n\t\t\t<option' + selected + ' ' + optionValue + '>' + optionLabel + '</option>';
-                                    c++;
-                                });
-                                serialStr += '\n\t\t</field>';
-                            }
-                        }
-                    }
-                    liCount++;
-                });
-                serialStr += '\n\t</fields>\n</form-template>';
-            } // if "$(this).children().length >= 1"
-        });
-        return serialStr;
-    };
+/*
+formBuilder - git@github.com:kevinchappell/formBuilder.git
+Version: 1.6.2
+Author: Kevin Chappell <kevin.b.chappell@gmail.com>
+*/
+'use strict';
+
+(function($) {
+    'use strict';
+
+    var Toggle = function Toggle(element, options) {
+
+        var defaults = {
+            theme: 'fresh',
+            labels: {
+                off: 'Off',
+                on: 'On'
+            }
+        };
+
+        var opts = $.extend(defaults, options),
+        $kcToggle = $('<div class="kc-toggle"/>').insertAfter(element).append(element);
+
+        $kcToggle.toggleClass('on', element.is(':checked'));
+
+        var kctOn = '<div class="kct-on">' + opts.labels.on + '</div>',
+        kctOff = '<div class="kct-off">' + opts.labels.off + '</div>',
+        kctHandle = '<div class="kct-handle"></div>',
+        kctInner = '<div class="kct-inner">' + kctOn + kctHandle + kctOff + '</div>';
+
+        $kcToggle.append(kctInner);
+
+        $kcToggle.click(function() {
+            element.attr('checked', !element.attr('checked'));
+            $(this).toggleClass('on');
+        });
+    };
+
+    $.fn.kcToggle = function(options) {
+        var toggle = this;
+        return toggle.each(function() {
+            var element = $(this);
+            if (element.data('kcToggle')) {
+                return;
+            }
+            var kcToggle = new Toggle(element, options);
+            element.data('kcToggle', kcToggle);
+        });
+    };
+})(jQuery);
+'use strict';
+
+(function($) {
+    'use strict';
+    var FormBuilder = function FormBuilder(element, options) {
+
+        var defaults = {
+            // Uneditable fields or other content you would like to
+            // appear before and after regular fields.
+            disableFields: {
+                // before: '<h2>Header</h2>',
+                // after: '<h3>Footer</h3>'
+            },
+            // array of objects with fields values
+            // ex:
+            // defaultFields: [{
+            //   label: 'First Name',
+            //   name: 'first-name',
+            //   required: 'true',
+            //   description: 'Your first name',
+            //   type: 'text'
+            // }, {
+            //   label: 'Phone',
+            //   name: 'phone',
+            //   description: 'How can we reach you?',
+            //   type: 'text'
+            // }],
+            defaultFields: [],
+            roles: {
+                1 : 'Administrator'
+            },
+            showWarning: false,
+            serializePrefix: 'frmb',
+            messages: {
+                add: 'Add Item',
+                allowSelect: 'Allow Select',
+                autocomplete: 'Autocomplete',
+                cannotBeEmpty: 'This field cannot be empty',
+                checkboxGroup: 'Checkbox Group',
+                checkbox: 'Checkbox',
+                checkboxes: 'Checkboxes',
+                clearAllMessage: 'Are you sure you want to remove all items?',
+                clearAll: 'Clear All',
+                close: 'Close',
+                copy: 'Copy To Clipboard',
+                dateField: 'Date Field',
+                description: 'Help Text',
+                descriptionField: 'Description',
+                devMode: 'Developer Mode',
+                disableFields: 'These fields cannot be moved.',
+                editNames: 'Edit Names',
+                editorTitle: 'Form Elements',
+                editXML: 'Edit XML',
+                fieldVars: 'Field Variables',
+                fieldRemoveWarning: 'Are you sure you want to remove this field?',
+                getStarted: 'Drag a field from the right to this area',
+                hide: 'Edit',
+                hidden: 'Hidden Input',
+                label: 'Label',
+                labelEmpty: 'Field Label cannot be empty',
+                limitRole: 'Limit access to one or more of the following roles:',
+                mandatory: 'Mandatory',
+                maxLength: 'Max Length',
+                minOptionMessage: 'This field requires a minimum of 2 options',
+                name: 'Name',
+                no: 'No',
+                off: 'Off',
+                on: 'On',
+                optional: 'optional',
+                optionLabelPlaceholder: 'Label',
+                optionValuePlaceholder: 'Value',
+                optionEmpty: 'Option value required',
+                paragraph: 'Paragraph',
+                preview: 'Preview',
+                radioGroup: 'Radio Group',
+                radio: 'Radio',
+                removeMessage: 'Remove Element',
+                remove: '&#215;',
+                required: 'Required',
+                richText: 'Rich Text Editor',
+                roles: 'Access',
+                save: 'Save Template',
+                selectOptions: 'Select Items',
+                select: 'Select',
+                selectionsMessage: 'Allow Multiple Selections',
+                text: 'Text Field',
+                textLabel: 'Title',
+                textIntroduce: 'Description',
+                toggle: 'Toggle',
+                warning: 'Warning!',
+                viewXML: 'View XML',
+                yes: 'Yes',
+                defaultValue : 'Default Value',
+            }
+        };
+
+        var startIndex, doCancel, _helpers = {};
+
+        /**
+     * Callback for when a drag begins
+     * @param  {object} event
+     * @param  {object} ui
+     */
+        _helpers.startMoving = function(event, ui) {
+            event = event;
+            ui.item.addClass('moving');
+            startIndex = $('li', this).index(ui.item);
+        };
+
+        /**
+     * Callback for when a drag ends
+     * @param  {object} event
+     * @param  {object} ui
+     */
+        _helpers.stopMoving = function(event, ui) {
+            event = event;
+            ui.item.removeClass('moving');
+            if (doCancel) {
+                $(ui.sender).sortable('cancel');
+                $(this).sortable('cancel');
+            }
+        };
+
+     /**
+      * Make strings safe to be used as classes
+      * @param  {string} str string to be converted
+      * @return {string}     converter string
+     */
+        _helpers.safename = function(str) {
+            return str.replace(/\s/g, '-').replace(/[^a-zA-Z0-9\-\_]/g, '').toLowerCase();
+        };
+
+     /**
+      * Strips non-numbers from a number only input
+      * @param  {string} str string with possible number
+      * @return {string}     string without numbers
+     */
+        _helpers.forceNumber = function(str) {
+            return str.replace(/[^0-9]/g, '');
+        };
+
+        /**
+     * hide and show mouse tracking tooltips, only used for disabled
+     * fields in the editor.
+     * @todo   remove or refactor to make better use
+     * @param  {object} tt jQuery option with nexted tooltip
+     * @return {void}
+     */
+        _helpers.initTooltip = function(tt) {
+            var tooltip = tt.find('.tooltip');
+            tt.mouseenter(function() {
+                if (tooltip.outerWidth() > 200) {
+                    tooltip.addClass('max-width');
+                }
+                tooltip.css('left', tt.width() + 14);
+                tooltip.stop(true, true).fadeIn('fast');
+            }).mouseleave(function() {
+                tt.find('.tooltip').stop(true, true).fadeOut('fast');
+            });
+            tooltip.hide();
+        };
+
+        // saves the field data to our canvas (elem)
+        _helpers.save = function() {
+            $sortableFields.children('li').not('.disabled').each(function() {
+                _helpers.updatePreview($(this));
+            });
+            elem.val($sortableFields.toXML());
+        };
+
+        // updatePreview will generate the preview for radio and checkbox groups
+        _helpers.updatePreview = function(field) {
+            var fieldClass = field.attr('class'),
+            $prevHolder = $('.prev-holder', field);
+
+            if (fieldClass.indexOf('ui-sortable-handle') !== -1) {
+                return;
+            }
+
+            fieldClass = fieldClass.replace(' form-field', '');
+
+            var preview, previewData = {
+                type: fieldClass,
+                label: $('.fld-label', field).val()
+            };
+
+            if (fieldClass === 'checkbox') {
+                previewData.toggle = $('.checkbox-toggle', field).is(':checked');
+            }
+
+            if (fieldClass.match(/(select|checkbox-group|radio-group)/)) {
+                previewData.values = [];
+
+                $('.sortable-options li', field).each(function() {
+                    var option = {};
+                    option.selected = $('.select-option', $(this)).is(':checked');
+                    option.value = $('.option-value', $(this)).val();
+                    option.label = $('.option-label', $(this)).val();
+
+                    previewData.values.push(option);
+                });
+            }
+            preview = fieldPreview(previewData);
+
+            $prevHolder.html(preview);
+
+            $('input[toggle]', $prevHolder).kcToggle();
+        };
+
+        // update preview to label
+        _helpers.updateMultipleSelect = function() {
+            $sortableFields.delegate('input[name="multiple"]', 'change',
+            function() {
+                var options = $(this).parents('.fields:eq(0)').find('.sortable-options input.select-option');
+                if (this.checked) {
+                    options.each(function() {
+                        $(this).prop('type', 'checkbox');
+                    });
+                } else {
+                    options.each(function() {
+                        $(this).removeAttr('checked').prop('type', 'radio');
+                    });
+                }
+            });
+        };
+
+        _helpers.htmlEncode = function(value) {
+            return $('<div/>').text(value).html();
+        };
+
+        _helpers.htmlDecode = function(value) {
+            return $('<div/>').html(value).text();
+        };
+
+        _helpers.validateForm = function() {
+            var errors = [];
+            // check for empty field labels
+            $('input[name="label"], input[type="text"].option', $sortableFields).each(function() {
+                if ($(this).val() === '') {
+                    var field = $(this).parents('li.form-field'),
+                    fieldAttr = $(this);
+                    errors.push({
+                        field: field,
+                        error: opts.messages.labelEmpty,
+                        attribute: fieldAttr
+                    });
+                }
+            });
+
+            // @todo add error = { noVal: opts.messages.labelEmpty }
+            if (errors.length) {
+                alert('Error: ' + errors[0].error);
+                $('html, body').animate({
+                    scrollTop: errors[0].field.offset().top
+                },
+                1000,
+                function() {
+                    var targetID = $('.toggle-form', errors[0].field).attr('id');
+                    $('.toggle-form', errors[0].field).addClass('open').parent().next('.prev-holder').slideUp(250);
+                    $('#' + targetID + '-fld').slideDown(250,
+                    function() {
+                        errors[0].attribute.addClass('error');
+                    });
+                });
+            }
+        };
+
+        _helpers.disabledTT = function(field) {
+            var title = field.attr('data-tooltip');
+            if (title) {
+                field.removeAttr('title').data('tip_text', title);
+                var tt = $('<p/>', {
+                    'class': 'frmb-tt'
+                }).html(title);
+                field.append(tt);
+                tt.css({
+                    top: -tt.outerHeight(),
+                    left: -15
+                });
+                field.mouseleave(function() {
+                    $(this).attr('data-tooltip', field.data('tip_text'));
+                    $('.frmb-tt').remove();
+                });
+            }
+        };
+
+        var opts = $.extend(defaults, options),
+        elem = $(element),
+        frmbID = 'frmb-' + $('ul[id^=frmb-]').length++;
+
+        var field = '',
+        lastID = 1,
+        boxID = frmbID + '-control-box';
+
+        // create array of field objects to cycle through
+        var frmbFields = [{
+            label: opts.messages.text,
+            attrs: {
+                type: 'text',
+                className: 'text-input',
+                name: 'text-input'
+            }
+        },
+        {
+            label: opts.messages.select,
+            attrs: {
+                type: 'select',
+                className: 'select',
+                name: 'select'
+            }
+        },
+        {
+            label: opts.messages.richText,
+            attrs: {
+                type: 'rich-text',
+                className: 'rich-text',
+                name: 'rich-text'
+            }
+        },
+        {
+            label: opts.messages.radioGroup,
+            attrs: {
+                type: 'radio-group',
+                className: 'radio-group',
+                name: 'radio-group'
+            }
+        },
+        {
+            label: opts.messages.hidden,
+            attrs: {
+                type: 'hidden',
+                className: 'hidden-input',
+                name: 'hidden-input'
+            }
+        },
+        {
+            label: opts.messages.dateField,
+            attrs: {
+                type: 'date',
+                className: 'calendar',
+                name: 'date-input'
+            }
+        },
+        {
+            label: opts.messages.checkboxGroup,
+            attrs: {
+                type: 'checkbox-group',
+                className: 'checkbox-group',
+                name: 'checkbox-group'
+            }
+        },
+        {
+            label: opts.messages.checkbox,
+            attrs: {
+                type: 'checkbox',
+                className: 'checkbox',
+                name: 'checkbox'
+            }
+        },
+        {
+            label: opts.messages.autocomplete,
+            attrs: {
+                type: 'autocomplete',
+                className: 'autocomplete',
+                name: 'autocomplete'
+            }
+        },
+        {
+            label: opts.messages.textLabel,
+            attrs: {
+                type: 'text-label',
+                className: 'text-label',
+                name: 'text'
+            }
+        }];
+
+        // Create draggable fields for formBuilder
+        var cbUL = $('<ul/>', {
+            id: boxID,
+            'class': 'frmb-control'
+        });
+
+        // Loop through
+        for (var i = frmbFields.length - 1; i >= 0; i--) {
+            var $field = $('<li/>', {
+                'class': 'icon-' + frmbFields[i].attrs.className,
+                'type': frmbFields[i].type,
+                'name': frmbFields[i].className,
+                'label': frmbFields[i].label
+            });
+            for (var attr in frmbFields[i]) {
+                if (frmbFields[i].hasOwnProperty(attr)) {
+                    $field.data(attr, frmbFields[i][attr]);
+                }
+            }
+            $field.html(frmbFields[i].label).appendTo(cbUL);
+        }
+
+        // Build our headers and action links
+        var cbHeader = $('<h4/>').html(opts.messages.editorTitle),
+        viewXML = $('<a/>', {
+            id: frmbID + '-export-xml',
+            text: opts.messages.viewXML,
+            href: '#',
+            'class': 'view-xml'
+        }),
+        allowSelect = $('<a/>', {
+            id: frmbID + '-allow-select',
+            text: opts.messages.allowSelect,
+            href: '#',
+            'class': 'allow-select'
+        }).prop('checked', 'checked'),
+        editXML = $('<a/>', {
+            id: frmbID + '-edit-xml',
+            text: opts.messages.editXML,
+            href: '#',
+            'class': 'edit-xml'
+        }),
+        editNames = $('<a/>', {
+            id: frmbID + '-edit-names',
+            text: opts.messages.editNames,
+            href: '#',
+            'class': 'edit-names'
+        }),
+        clearAll = $('<a/>', {
+            id: frmbID + '-clear-all',
+            text: opts.messages.clearAll,
+            href: '#',
+            'class': 'clear-all'
+        }),
+        saveAll = $('<div/>', {
+            id: frmbID + '-save',
+            href: '#',
+            'class': 'save-btn-wrap',
+            title: opts.messages.save
+        }).html('<a class="save fb-button primary"><span>' + opts.messages.save + '</span></a>'),
+        actionLinksInner = $('<div/>', {
+            id: frmbID + '-action-links-inner',
+            'class': 'action-links-inner'
+        }).append(editXML, ' | ', editNames, ' | ', allowSelect, ' | ', clearAll, ' |&nbsp;'),
+        devMode = $('<span/>', {
+            'class': 'dev-mode-link'
+        }).html(opts.messages.devMode + ' ' + opts.messages.off),
+        actionLinks = $('<div/>', {
+            id: frmbID + '-action-links',
+            'class': 'action-links'
+        }).append(actionLinksInner, devMode);
+
+        // Sortable fields
+        var $sortableFields = $('<ul/>').attr('id', frmbID).addClass('frmb').sortable({
+            cursor: 'move',
+            opacity: 0.9,
+            beforeStop: function beforeStop(event, ui) {
+                var lastIndex = $('> li', $sortableFields).length - 1,
+                curIndex = ui.placeholder.index();
+                doCancel = curIndex <= 1 || curIndex === lastIndex;
+            },
+            start: _helpers.startMoving,
+            stop: _helpers.stopMoving,
+            cancel: 'input, .disabled, .sortable-options, .add, .btn, .no-drag',
+            // items: 'li:not(.no-fields)',
+            receive: function receive(event, ui) {
+                // if (doCancel) {
+                //   $('li:nth-child(' + curIndex + ')', $(this)).remove();
+                // }
+            },
+            placeholder: 'frmb-placeholder'
+        });
+
+        // ControlBox with different fields
+        cbUL.sortable({
+            helper: 'clone',
+            opacity: 0.9,
+            connectWith: $sortableFields,
+            cursor: 'move',
+            placeholder: 'ui-state-highlight',
+            start: _helpers.startMoving,
+            stop: _helpers.stopMoving,
+            revert: 150,
+            change: function change(event, ui) {
+                //fix the logic on this to only hide placeholder for disabledFields.before and after
+                // if (ui.placeholder.index() === 0 || ui.placeholder.index() === $('> li', $sortableFields).last().index()) {
+                //   $(ui.placeholder).hide();
+                // } else {
+                //   $(ui.placeholder).show();
+                // }
+            },
+            remove: function remove(event, ui) {
+                if (startIndex === 0) {
+                    cbUL.prepend(ui.item);
+                } else {
+                    $('li:nth-child(' + startIndex + ')', cbUL).after(ui.item);
+                }
+            },
+            beforeStop: function beforeStop(event, ui) {
+                var lastIndex = $('> li', $sortableFields).length - 1,
+                curIndex = ui.placeholder.index();
+                doCancel = curIndex <= 1 || curIndex === lastIndex ? true: false;
+                if (ui.placeholder.parent().hasClass('frmb-control')) {
+                    doCancel = true;
+                }
+            },
+            update: function update(event, ui) {
+                // _helpers.stopMoving;
+                elem.stopIndex = $('li', $sortableFields).index(ui.item) === 0 ? '0': $('li', $sortableFields).index(ui.item);
+                if ($('li', $sortableFields).index(ui.item) < 0) {
+                    $(this).sortable('cancel');
+                } else {
+                    prepFieldVars($(ui.item[0]), true);
+                }
+            },
+            receive: function receive(event, ui) {
+                if (ui.sender.hasClass('frmb') || ui.sender.hasClass('frmb-control')) {
+                    $(ui.sender).sortable('cancel');
+                }
+            }
+        });
+
+        var $stageWrap = $('<div/>', {
+            id: frmbID + '-stage-wrap',
+            'class': 'stage-wrap'
+        });
+
+        var $formWrap = $('<div/>', {
+            id: frmbID + '-form-wrap',
+            'class': 'form-wrap'
+        });
+
+        elem.before($stageWrap).appendTo($stageWrap);
+
+        // Replace the textarea with sortable list.
+        //elem.before($sortableFields).parent().prepend(frmbHeader).addClass('frmb-wrap').append(actionLinks, viewXML, saveAll);
+        var cbWrap = $('<div/>', {
+            id: frmbID + '-cb-wrap',
+            'class': 'cb-wrap'
+        }).append(cbHeader, cbUL);
+
+        $stageWrap.append($sortableFields, cbWrap, actionLinks, viewXML, saveAll);
+        $stageWrap.before($formWrap);
+        $formWrap.append($stageWrap, cbWrap);
+
+        var doSave = function doSave() {
+            if ($(this).parents('li.disabled').length === 0) {
+                if ($(this).name === 'label' && $(this).val() === '') {
+                    return alert('Error: ' + opts.messages.labelEmpty);
+                }
+                _helpers.save();
+            }
+        };
+
+        // Not pretty but we need to save a lot so users don't have to keep clicking a save button
+        $('input, select', $sortableFields).on('change', doSave);
+        $('input, select', $sortableFields).on('blur', doSave);
+
+        // Parse saved XML template data
+        elem.getTemplate = function() {
+            var xml = elem.val() !== '' ? $.parseXML(elem.val()) : false,
+            fields = $(xml).find('field');
+
+            if (fields.length > 0) {
+                fields.each(function() {
+                    prepFieldVars($(this));
+                });
+            } else if (!xml) {
+                // Load default fields if none are set
+                if (opts.defaultFields.length) {
+                    for (var i = opts.defaultFields.length - 1; i >= 0; i--) {
+                        appendNewField(opts.defaultFields[i]);
+                    }
+                } else {
+                    $stageWrap.addClass('empty').attr('data-content', opts.messages.getStarted);
+                }
+                disabledBeforeAfter();
+            }
+        };
+
+        var disabledBeforeAfter = function disabledBeforeAfter() {
+            var li = '<li class="disabled __POSITION__">__CONTENT__</li>';
+            if (opts.disableFields.before && !$('.disabled.before', $sortableFields).length) {
+                $sortableFields.prepend(li.replace('__POSITION__', 'before').replace('__CONTENT__', opts.disableFields.before));
+            }
+            if (opts.disableFields.after && !$('.disabled.after', $sortableFields).length) {
+                $sortableFields.append(li.replace('__POSITION__', 'after').replace('__CONTENT__', opts.disableFields.after));
+            }
+        };
+
+        var nameAttr = function nameAttr(field) {
+            var epoch = new Date().getTime();
+            return field.data('attrs').name + '-' + epoch;
+        };
+
+        var prepFieldVars = function prepFieldVars($field, isNew) {
+            isNew = isNew || false;
+            var fieldAttrs = $field.data('attrs') || {},
+            fType = fieldAttrs.type || $field.attr('type'),
+            isMultiple = fType.match(/(select|checkbox-group|radio-group)/),
+            values = {};
+
+            values.label = _helpers.htmlEncode($field.attr('label'));
+            values.name = isNew ? nameAttr($field) : fieldAttrs.name || $field.attr('name');
+            values.name = typeof values.name == 'undefined' ? '' : values.name;
+            values.defaultVal = $field.attr('defaultVal') !== undefined ? _helpers.htmlEncode($field.attr('defaultVal')) : '';
+            values.role = $field.attr('role');
+            values.required = $field.attr('required');
+            values.maxLength = $field.attr('max-length');
+            values.toggle = $field.attr('toggle');
+            values.type = fType;
+            values.description = $field.attr('description') !== undefined ? _helpers.htmlEncode($field.attr('description')) : '';
+            values.introduce = $field.attr('introduce') !== undefined ? _helpers.htmlEncode($field.attr('introduce')) : '';
+            if (isMultiple) {
+                values.multiple = true;
+                values.values = [];
+                $field.children().each(function(i) {
+                    var value = {
+                        label: $(this).text(),
+                        value: $(this).attr('value'),
+                        selected: $field.attr('default') === i ? true: false
+                    };
+                    values.values.push(value);
+                });
+            }
+
+            appendNewField(values);
+            $stageWrap.removeClass('empty');
+            disabledBeforeAfter();
+        };
+
+        // multi-line textarea
+        var appendTextarea = function appendTextarea(values) {
+            appendFieldLi(opts.messages.richText, advFields(values), values);
+        };
+
+        var appendInput = function appendInput(values) {
+            var type = values.type || 'text';
+            appendFieldLi(opts.messages[type], advFields(values), values);
+        };
+        var textLabel = function textLabel(values) {
+            var type = values.type || 'text';
+            values.introduce = values.introduce || opts.messages.textIntroduce;
+            appendFieldLi(opts.messages[type], advFields(values), values);
+        }
+        // add select dropdown
+        var appendSelectList = function appendSelectList(values) {
+
+            if (!values.values || !values.values.length) {
+                values.values = [{
+                    selected: 'false',
+                    label: 'Option 1',
+                    value: 'option-1'
+                },
+                {
+                    selected: 'false',
+                    label: 'Option 2',
+                    value: 'option-2'
+                }];
+            }
+
+            var field = '',
+            name = _helpers.safename(values.name),
+            multiDisplay = values.type === 'checkbox-group' ? 'none': 'none';
+
+            field += advFields(values);
+            field += '<div class="false-label">' + opts.messages.selectOptions + '</div>';
+            field += '<div class="fields">';
+
+            field += '<div class="allow-multi" style="display:' + multiDisplay + '">';
+            field += '<input type="checkbox" id="multiple_' + lastID + '" name="multiple"' + (values.multiple ? 'checked="checked"': '') + '>';
+            field += '<label class="multiple" for="multiple_' + lastID + '">' + opts.messages.selectionsMessage + '</label>';
+            field += '</div>';
+            field += '<ol class="sortable-options">';
+            for (i = 0; i < values.values.length; i++) {
+                field += selectFieldOptions(values.values[i], name, values.values[i].selected, values.multiple);
+            }
+            field += '</ol>';
+            field += '<div class="field_actions"><a href="#" class="add add_opt"><strong>' + opts.messages.add + '</strong></a> | <a href="#" class="close_field">' + opts.messages.close + '</a></div>';
+            field += '</div>';
+            appendFieldLi(opts.messages.select, field, values);
+
+            $('.sortable-options').sortable(); // making the dynamically added option fields sortable.
+        };
+
+        var appendNewField = function appendNewField(values) {
+            if (values === undefined) {
+                values = '';
+            }
+
+            // TODO: refactor to move functions into this object
+            var appendFieldType = {
+                // 'text': appendTextInput(values),
+                // 'checkbox': appendCheckbox(values),
+                // 'select': appendSelectList(values),
+                // 'textarea': appendTextarea(values),
+                'text-label': textLabel,
+                '2': appendInput,
+                'date': appendInput,
+                'autocomplete': appendInput,
+                'checkbox': appendInput,
+                'select': appendSelectList,
+                'rich-text': appendTextarea,
+                'textarea': appendTextarea,
+                'radio-group': appendSelectList,
+                'checkbox-group': appendSelectList,
+                'text': appendInput,
+                'hidden': appendInput
+            };
+
+            if (typeof appendFieldType[values.type] === 'function') {
+                appendFieldType[values.type](values);
+            }
+        };
+
+        /**
+     * Build the editable properties for the field
+     * @param  {object} values configuration object for advanced fields
+     * @return {string}        markup for advanced fields
+     */
+        var advFields = function advFields(values) {
+            var advFields = '',
+            key, roles = values.role !== undefined ? values.role.split(',') : [];
+            var fieldLabel = $('<div>', {
+                'class': 'frm-fld label-wrap'
+            });
+            $('<label/>').html(opts.messages.label + ' *').appendTo(fieldLabel);
+            $('<input>', {
+                type: 'text',
+                name: 'label',
+                value: values.label,
+                'class': 'fld-label'
+            }).appendTo(fieldLabel);
+            advFields += fieldLabel[0].outerHTML;
+
+            var fieldDesc = $('<div>', {
+                'class': 'frm-fld description-wrap'
+            });
+            $('<label/>').html(opts.messages.description + ' *').appendTo(fieldDesc);
+
+            if (values.type == 'text-label') { //text-label
+                advFields += '<div class="frm-fld description-wrap"><label>' + opts.messages.textIntroduce + '</label>';
+                advFields += '<input type="text" name="introduce" value="' + values.introduce + '" class="fld-introduce" id="introduce-' + lastID + '" /></div>';
+            }
+            if (values.type != 'text-label') {
+                advFields += '<div class="frm-fld description-wrap"><label>' + opts.messages.description + '</label>';
+                advFields += '<input type="text" name="description" value="' + values.description + '" class="fld-description" id="description-' + lastID + '" /></div>';
+                advFields += '<div class="frm-fld name-wrap"><label>' + opts.messages.name + ' <span class="required">*</span></label>';
+                advFields += '<input type="text" name="name" value="' + values.name + '" class="fld-name" id="title-' + lastID + '" /></div>';
+            }
+
+            advFields += '<div class="frm-fld access-wrap"><label>' + opts.messages.roles + '</label>';
+
+            advFields += '<input type="checkbox" name="enable_roles" value="" ' + (values.role !== undefined ? 'checked': '') + ' id="enable_roles-' + lastID + '"/> <label for="enable_roles-' + lastID + '" class="roles_label">' + opts.messages.limitRole + '</label>';
+            advFields += '<div class="frm-fld available-roles" ' + (values.role !== undefined ? 'style="display:block"': '') + '>';
+            for (key in opts.roles) {
+                if ($.inArray(key, ['date', '4']) === -1) {
+                    advFields += '<input type="checkbox" name="roles[]" value="' + key + '" id="fld-' + lastID + '-roles-' + key + '" ' + ($.inArray(key, roles) !== -1 ? 'checked': '') + ' class="roles-field" /><label for="fld-' + lastID + '-roles-' + key + '">' + opts.roles[key] + '</label><br/>';
+                }
+            }
+            advFields += '</div></div>';
+
+            // if field type is not checkbox, checkbox/radio group or select list, add max length
+            if ($.inArray(values.type, ['checkbox', 'select', 'checkbox-group', 'date', 'autocomplete', 'radio-group', 'text-label']) < 0) {
+                advFields += '<div class="frm-fld"><label class="max-length-label">' + opts.messages.maxLength + '</label>';
+                advFields += '<input type="text" name="max-length" max-length="4" value="' + (values.maxLength !== undefined ? values.maxLength: '') + '" class="fld-max-length" id="max-length-' + lastID + '" /></div>';
+            }
+
+            return advFields;
+        };
+
+        // Append the new field to the editor
+        var appendFieldLi = function appendFieldLi(title, field, values) {
+            var label = $(field).find('input[name="label"]').val() !== '' ? $(field).find('input[name="label"]').val() : title;
+            var defaultVal = typeof values.defaultVal != 'undefined' ? values.defaultVal : '';
+            var introduce = $(field).find('input[name="introduce"]').val() !== '' ? $(field).find('input[name="introduce"]').val() : '';
+            var li = '',
+            delBtn = '<a id="del_' + lastID + '" class="del-button btn delete-confirm" href="#" title="' + opts.messages.removeMessage + '">' + opts.messages.remove + '</a>',
+            toggleBtn = '<a id="frm-' + lastID + '" class="toggle-form btn icon-pencil" href="#" title="' + opts.messages.hide + '"></a> ',
+            required = values.required,
+            toggle = values.toggle || undefined,
+            tooltip = values.description !== '' ? '<span class="tooltip-element" tooltip="' + values.description + '">?</span>': '';
+
+            li += '<li id="frm-' + lastID + '-item" class="' + values.type + ' form-field">';
+            li += '<div class="legend">';
+            li += delBtn;
+            li += '<span id="txt-title-' + lastID + '" class="field-label">' + label + '</span>' + tooltip + '<span class="required-asterisk" ' + (required === 'true' ? 'style="display:inline"': '') + '> *</span>' + toggleBtn;
+            li += '</div>';
+            if (values.type == 'text-label') {
+                li += '<div class="frm-fld">';
+                li += '<label class="field-introduce">' + introduce + '</label>';
+                li += '</div>';
+            }
+            li += '<div class="prev-holder">' + fieldPreview(values) + '</div>';
+            li += '<div id="frm-' + lastID + '-fld" class="frm-holder">';
+            li += '<div class="form-elements">';
+
+            if (values.type != 'text-label') {
+                li += '<div class="frm-fld">';
+                li += '<label>&nbsp;</label>';
+                li += '<input class="required" type="checkbox" value="1" name="required-' + lastID + '" id="required-' + lastID + '"' + (required === 'true' ? ' checked="checked"': '') + ' /><label class="required_label" for="required-' + lastID + '">' + opts.messages.required + '</label>';
+
+                if (values.type === 'checkbox') {
+                    li += '<div class="frm-fld">';
+                    li += '<label>&nbsp;</label>';
+                    li += '<input class="checkbox-toggle" type="checkbox" value="1" name="toggle-' + lastID + '" id="toggle-' + lastID + '"' + (toggle === 'true' ? ' checked="checked"': '') + ' /><label class="toggle-label" for="toggle-' + lastID + '">' + opts.messages.toggle + '</label>';
+                    li += '</div>';
+                }
+                li += '</div>';
+            }
+
+            if (values.type == 'hidden') {
+                li += '<div class="frm-fld">';
+                li += '<label class="field-defaultVal">'+opts.messages.defaultValue+'</label>';
+                li += '<input type="text" class="fld-defaultVal" name="defaultVal" id="defaultVal-'+lastID+'" value="'+ defaultVal +'" />';
+                li += '</div>';
+            }
+            li += field;
+            li += '</div>';
+            li += '</div>';
+            li += '</li>';
+
+            if (elem.stopIndex) {
+                $('li', $sortableFields).eq(elem.stopIndex).after(li);
+            } else {
+                $sortableFields.append(li);
+            }
+
+            $(document.getElementById('frm-' + lastID + '-item')).hide().slideDown(250);
+
+            lastID++;
+            _helpers.save();
+        };
+
+        /**
+     * Generate preview markup
+     * @param  {object} attrs
+     * @return {string}       preview markup for field
+     */
+        var fieldPreview = function fieldPreview(attrs) {
+            var i, preview = '',
+            epoch = new Date().getTime();
+            switch (attrs.type) {
+            case 'textarea':
+                preview = '<' + attrs.type + '></' + attrs.type + '>';
+                break;
+            case 'select':
+                var options;
+                attrs.values.reverse();
+                for (i = attrs.values.length - 1; i >= 0; i--) {
+                    options += '<option value="' + attrs.values[i].value + '">' + attrs.values[i].label + '</option>';
+                }
+                preview = '<' + attrs.type + ' class="no-drag">' + options + '</' + attrs.type + '>';
+                break;
+            case 'checkbox-group':
+            case 'radio-group':
+                var type = attrs.type.replace('-group', '');
+                attrs.values.reverse();
+                for (i = attrs.values.length - 1; i >= 0; i--) {
+                    preview += '<div class="inner-checkbox"><input type="' + type + '" id="' + type + '-' + epoch + '-' + i + '" value="' + attrs.values[i].value + '" /><label for="' + type + '-' + epoch + '-' + i + '">' + attrs.values[i].label + '</label></div>';
+                }
+                break;
+            case 'text':
+            case 'password':
+            case 'hidden':
+            case 'email':
+            case 'date':
+            case 'checkbox':
+                var toggle = attrs.toggle ? 'toggle': '';
+                preview = '<input type="' + attrs.type + '" ' + toggle + ' placeholder="">';
+                break;
+            case 'autocomplete':
+                preview = '<input class="ui-autocomplete-input" autocomplete="on" placeholder="">';
+                break;
+            default:
+                preview = '<' + attrs.type + '></' + attrs.type + '>';
+            }
+
+            return preview;
+        };
+
+        // Select field html, since there may be multiple
+        var selectFieldOptions = function selectFieldOptions(values, name, selected, multipleSelect) {
+            var selectedType = multipleSelect ? 'checkbox': 'radio';
+
+            if (typeof values !== 'object') {
+                values = {
+                    label: '',
+                    value: ''
+                };
+            } else {
+                values.label = values.label || '';
+                values.value = values.value || '';
+            }
+
+            field = '<li>';
+            field += '<input type="' + selectedType + '" ' + selected + ' class="select-option" name="' + name + '" />';
+            field += '<input type="text" class="option-label" placeholder="' + opts.messages.optionLabelPlaceholder + '" value="' + values.label + '" />';
+            field += '<input type="text" class="option-value" placeholder="' + opts.messages.optionValuePlaceholder + '" value="' + values.value + '" />';
+            field += '<a href="#" class="remove btn" title="' + opts.messages.removeMessage + '">' + opts.messages.remove + '</a>';
+            field += '</li>';
+
+            return field;
+        };
+
+        // ---------------------- UTILITIES ---------------------- //
+        // delete options
+        $sortableFields.delegate('.remove', 'click',
+        function(e) {
+            e.preventDefault();
+            var optionsCount = $(this).parents('.sortable-options:eq(0)').children('li').length;
+            if (optionsCount <= 2) {
+                alert('Error: ' + opts.messages.minOptionMessage);
+            } else {
+                $(this).parent('li').slideUp('250',
+                function() {
+                    $(this).remove();
+                });
+            }
+        });
+
+        // toggle fields
+        $sortableFields.on('click', '.toggle-form',
+        function(e) {
+            e.preventDefault();
+            var targetID = $(this).attr('id');
+            $(this).toggleClass('open').parent().next('.prev-holder').slideToggle(250);
+            $(document.getElementById(targetID + '-fld')).slideToggle(250,
+            function() {
+                _helpers.save();
+            });
+        });
+
+        // update preview to label
+        $sortableFields.delegate('input[name="label"]', 'keyup',
+        function() {
+            $('.field-label', $(this).closest('li')).text($(this).val());
+        });
+
+        $sortableFields.delegate('input[name="introduce"]', 'keyup',
+        function() {
+            $('.field-introduce', $(this).closest('li')).text($(this).val());
+        });
+        $sortableFields.delegate('input[name="defaultVal"]', 'keyup',
+        function() {
+            _helpers.save();
+        });
+        // remove error styling when users tries to correct mistake
+        $sortableFields.delegate('input.error', 'keyup',
+        function() {
+            $(this).removeClass('error');
+        });
+
+        // update preview for description
+        $sortableFields.delegate('input[name="description"]', 'keyup',
+        function() {
+            var closestToolTip = $('.tooltip-element', $(this).closest('li'));
+            if ($(this).val() !== '') {
+                if (!closestToolTip.length) {
+                    var tt = '<span class="tooltip-element" tooltip="' + $(this).val() + '">?</span>';
+                    $('.toggle-form', $(this).closest('li')).before(tt);
+                    // _helpers.initTooltip(tt);
+                } else {
+                    closestToolTip.attr('tooltip', $(this).val()).css('display', 'inline-block');
+                }
+            } else {
+                if (closestToolTip.length) {
+                    closestToolTip.css('display', 'none');
+                }
+            }
+        });
+
+        _helpers.updateMultipleSelect();
+
+        // format name attribute
+        $sortableFields.delegate('input[name="name"]', 'keyup',
+        function() {
+            $(this).val(_helpers.safename($(this).val()));
+            if ($(this).val() === '') {
+                $(this).addClass('field_error').attr('placeholder', opts.messages.cannotBeEmpty);
+            } else {
+                $(this).removeClass('field_error');
+            }
+        });
+
+        $sortableFields.delegate('input.fld-max-length', 'keyup',
+        function() {
+            $(this).val(_helpers.forceNumber($(this).val()));
+        });
+
+        // Delete field
+        $sortableFields.delegate('.delete-confirm', 'click',
+        function(e) {
+            e.preventDefault();
+
+            // lets see if the user really wants to remove this field... FOREVER
+            var fieldWarnH3 = $('<h3/>').html('<span></span>' + opts.messages.warning),
+            deleteID = $(this).attr('id').replace(/del_/, ''),
+            delBtn = $(this),
+            $field = $(document.getElementById('frm-' + deleteID + '-item')),
+            toolTipPageX = delBtn.offset().left - $(window).scrollLeft(),
+            toolTipPageY = delBtn.offset().top - $(window).scrollTop();
+
+            if (opts.showWarning) {
+                jQuery('<div />').append(fieldWarnH3, opts.messages.fieldRemoveWarning).dialog({
+                    modal: true,
+                    resizable: false,
+                    width: 300,
+                    dialogClass: 'ite-warning',
+                    open: function open() {
+                        $('.ui-widget-overlay').css({
+                            'opacity': 0.0
+                        });
+                    },
+                    position: [toolTipPageX - 282, toolTipPageY - 178],
+                    buttons: [{
+                        text: opts.messages.yes,
+                        click: function click() {
+                            $field.slideUp(250,
+                            function() {
+                                $(this).remove();
+                                _helpers.save();
+                            });
+                            $(this).dialog('close');
+                        }
+                    },
+                    {
+                        text: opts.messages.no,
+                        'class': 'cancel',
+                        click: function click() {
+                            $(this).dialog('close');
+                        }
+                    }]
+                });
+            } else {
+                $field.slideUp(250,
+                function() {
+                    $(this).remove();
+                    _helpers.save();
+                });
+            }
+
+            if ($('.form-field', $sortableFields).length === 1) {
+                $stageWrap.addClass('empty');
+            }
+        });
+
+        // Attach a callback to toggle required asterisk
+        $sortableFields.delegate('input.required', 'click',
+        function() {
+            var requiredAsterisk = $(this).parents('li.form-field').find('.required-asterisk');
+            requiredAsterisk.toggle();
+        });
+
+        // Attach a callback to toggle roles visibility
+        $sortableFields.delegate('input[name="enable_roles"]', 'click',
+        function() {
+            var roles = $(this).siblings('div.available-roles'),
+            enableRolesCB = $(this);
+            roles.slideToggle(250,
+            function() {
+                if (!enableRolesCB.is(':checked')) {
+                    $('input[type="checkbox"]', roles).removeAttr('checked');
+                }
+            });
+        });
+
+        // Attach a callback to add new checkboxes
+        $sortableFields.delegate('.add_ck', 'click',
+        function() {
+            $(this).parent().before(selectFieldOptions());
+            return false;
+        });
+
+        $sortableFields.delegate('li.disabled .form-element', 'mouseenter',
+        function() {
+            _helpers.disabledTT($(this));
+        });
+
+        // Attach a callback to add new options
+        $sortableFields.delegate('.add_opt', 'click',
+        function(e) {
+            e.preventDefault();
+            var isMultiple = $(this).parents('.fields').first().find('input[name="multiple"]')[0].checked,
+            name = $(this).parents('.fields').find('.select-option:eq(0)').attr('name');
+            $(this).parents('.fields').first().find('.sortable-options').append(selectFieldOptions(false, name, false, isMultiple));
+            _helpers.updateMultipleSelect();
+        });
+
+        // Attach a callback to close link
+        $sortableFields.delegate('.close_field', 'click',
+        function(e) {
+            e.preventDefault();
+            $(this).parents('li.form-field').find('.toggle-form').trigger('click');
+        });
+
+        // Attach a callback to add new radio fields
+        $sortableFields.delegate('.add_rd', 'click',
+        function(e) {
+            e.preventDefault();
+            $(this).parent().before(selectFieldOptions(false, $(this).parents('.frm-holder').attr('id')));
+        });
+
+        $('.form-elements .fields .remove, .frmb .del-button').on('hover',
+        function() {
+            $(this).parents('li.form-field').toggleClass('delete');
+        });
+
+        // View XML
+        $(document.getElementById(frmbID + '-export-xml')).click(function(e) {
+            e.preventDefault();
+            var xml = elem.val(),
+            $pre = $('<pre />').text(xml);
+            $pre.dialog({
+                resizable: false,
+                modal: true,
+                width: 720,
+                dialogClass: 'frmb-xml',
+                overlay: {
+                    color: '#333333'
+                }
+            });
+        });
+
+        // Clear all fields in form editor
+        $(document.getElementById(frmbID + '-clear-all')).click(function(e) {
+            e.preventDefault();
+            if (window.confirm(opts.messages.clearAllMessage)) {
+                $sortableFields.empty();
+                elem.val('');
+                _helpers.save();
+                var values = {
+                    label: [opts.messages.descriptionField],
+                    name: ['content'],
+                    required: 'true',
+                    description: opts.messages.mandatory
+                };
+
+                appendNewField(values);
+                $sortableFields.prepend(opts.disableFields.before);
+                $sortableFields.append(opts.disableFields.after);
+            }
+        });
+
+        // Save Idea Template
+        $(document.getElementById(frmbID + '-save')).click(function(e) {
+            if ($(this).find('.ldkInlineEdit').length === 0) {
+                e.preventDefault();
+                if (!$stageWrap.hasClass('edit-xml')) {
+                    _helpers.save();
+                }
+                _helpers.validateForm(e);
+            }
+        });
+
+        var triggerDevMode = false,
+        keys = [],
+        devCode = '68,69,86';
+        // Super secret Developer Tools
+        $('.save.fb-button').mouseover(function() {
+            triggerDevMode = true;
+        }).mouseout(function() {
+            triggerDevMode = false;
+        });
+        $(document.documentElement).keydown(function(e) {
+            keys.push(e.keyCode);
+            if (keys.toString().indexOf(devCode) >= 0) {
+                $('.action-links').toggle();
+                $('.view-xml').toggle();
+                keys = [];
+            }
+        });
+        // Toggle Developer Mode
+        $('.dev-mode-link').click(function(e) {
+            e.preventDefault();
+            var dml = $(this);
+            $stageWrap.toggleClass('dev-mode');
+            dml.parent().css('opacity', 1);
+            if ($stageWrap.hasClass('dev-mode')) {
+                dml.siblings('.action-links-inner').css('width', '100%');
+                dml.html(opts.messages.devMode + ' ' + opts.messages.on).css('color', '#8CC63F');
+            } else {
+                dml.siblings('.action-links-inner').css('width', 0);
+                dml.html(opts.messages.devMode + ' ' + opts.messages.off).css('color', '#666666');
+                triggerDevMode = false;
+                $('.action-links').toggle();
+                $('.view-xml').toggle();
+            }
+        });
+
+        // Toggle Edit Names
+        $(document.getElementById(frmbID + '-edit-names')).click(function(e) {
+            e.preventDefault();
+            $(this).toggleClass('active');
+            $('.name-wrap', $sortableFields).slideToggle(250,
+            function() {
+                $stageWrap.toggleClass('edit-names');
+            });
+        });
+
+        // Toggle Allow Select
+        $(document.getElementById(frmbID + '-allow-select')).click(function(e) {
+            e.preventDefault();
+            $(this).toggleClass('active');
+            $('.allow-multi, .select-option', $sortableFields).slideToggle(250,
+            function() {
+                $stageWrap.toggleClass('allow-select');
+            });
+        });
+
+        // Toggle Edit XML
+        $(document.getElementById(frmbID + '-edit-xml')).click(function(e) {
+            e.preventDefault();
+            $(this).toggleClass('active');
+            $('textarea.idea-template').show();
+            $('.template-textarea-wrap').slideToggle(250);
+            $stageWrap.toggleClass('edit-xml');
+        });
+
+        elem.parent().find('p[id*="ideaTemplate"]').remove();
+        elem.wrap('<div class="template-textarea-wrap"/>');
+        elem.getTemplate();
+    };
+
+    $.fn.formBuilder = function(options) {
+        var form = this;
+        return form.each(function() {
+            var element = $(this);
+            if (element.data('formBuilder')) {
+                return;
+            }
+            var formBuilder = new FormBuilder(this, options);
+            element.data('formBuilder', formBuilder);
+        });
+    };
+})(jQuery);
+
+// toXML is a jQuery plugin that turns our form editor into XML
+(function($) {
+    'use strict';
+    $.fn.toXML = function(options) {
+        var defaults = {
+            prepend: '',
+            attributes: ['class']
+        };
+        var opts = $.extend(defaults, options);
+
+        var serialStr = '';
+
+        // Begin the core plugin
+        this.each(function() {
+            var liCount = 0;
+            var c = 1;
+
+            if ($(this).children().length >= 1) {
+                serialStr += '<form-template>\n\t<fields>';
+
+                // build new xml
+                $(this).children().each(function() {
+                    var $field = $(this);
+                    if (! ($field.hasClass('moving') || $field.hasClass('disabled'))) {
+                        for (var att = 0; att < opts.attributes.length; att++) {
+                            var required = $('input.required', $field).is(':checked') ? 'required="true" ': 'required="false" ',
+                            multipleChecked = $('input[name="multiple"]', $field).is(':checked'),
+                            multiple = multipleChecked ? 'style="multiple" ': '',
+                            t = $field.attr(opts.attributes[att]).replace(' form-field', ''),
+                            // field type
+                            multipleField = t.match(/(select|checkbox-group|radio-group)/),
+                            type = 'type="' + t + '" ',
+                            fName = $('input.fld-name', $field).length > 0 ? ('name="' + $('input.fld-name', $field).val() + '" ') : '',
+                            fLabel = 'label="' + $('input.fld-label', $field).val() + '" ',
+                            roleVals = $.map($('input.roles-field:checked', $field),
+                            function(n) {
+                                return n.value;
+                            }).join(','),
+                            roles = roleVals !== '' ? 'role="' + roleVals + '" ': '',
+
+                            desc = $('input.fld-description', $field).length > 0 ? ('description="' + $('input.fld-description', $field).val() + '" ') : '',
+                            introduce = $('input.fld-introduce', $field).length > 0 ? ('introduce="' + $('input.fld-introduce', $field).val() + '" ') : '',
+							defaultVal = $('input.fld-defaultVal', $field).length > 0 ? ('defaultVal="' + $('input.fld-defaultVal', $field).val() + '" ') : '',
+                            maxLengthVal = $('input.fld-max-length', $field).val(),
+                            maxLength = 'max-length="' + (maxLengthVal !== undefined ? maxLengthVal: '') + '" ',
+                            fSlash = !multipleField ? '/': '';
+                            var fToggle = $('.checkbox-toggle', $field).is(':checked') ? 'toggle="true" ': '';
+
+                            serialStr += '\n\t\t<field ' + fName + fLabel + defaultVal + fToggle + multiple + roles + desc + introduce + (maxLengthVal !== '' ? maxLengthVal !== undefined ? maxLength: '': '') + required + type + fSlash +'>';
+                            if (multipleField) {
+                                c = 1;
+                                $('.sortable-options li', $field).each(function() {
+                                    var $option = $(this),
+                                    optionValue = 'value="' + $('.option-value', $option).val() + '"',
+                                    optionLabel = $('.option-label', $option).val(),
+                                    selected = $('.select-option', $option).is(':checked') ? ' selected="true"': '';
+                                    serialStr += '\n\t\t\t<option' + selected + ' ' + optionValue + '>' + optionLabel + '</option>';
+                                    c++;
+                                });
+                                serialStr += '\n\t\t</field>';
+                            }
+                        }
+                    }
+                    liCount++;
+                });
+                serialStr += '\n\t</fields>\n</form-template>';
+            } // if "$(this).children().length >= 1"
+        });
+        return serialStr;
+    };
 })(jQuery);

+ 312 - 312
demo/public/static/formbuilder/form-render.css

@@ -1,312 +1,312 @@
-/*
-formBuilder - git@github.com:kevinchappell/formBuilder.git
-Version: 1.6.2
-Author: Kevin Chappell <kevin.b.chappell@gmail.com>
-*/
-* {
-	box-sizing: border-box;
-}
-
-button,
-input,
-select,
-textarea {
-	font-family: inherit;
-	font-size: inherit;
-	line-height: inherit;
-}
-
-input {
-	line-height: normal;
-}
-
-button,
-input,
-optgroup,
-select,
-textarea {
-	margin: 0;
-	font: inherit;
-	color: inherit;
-}
-
-textarea {
-	overflow: auto;
-}
-
-button,
-input,
-select,
-textarea {
-	font-family: inherit;
-	font-size: inherit;
-	line-height: inherit;
-}
-
-.btn-group {
-	position: relative;
-	display: inline-block;
-	vertical-align: middle;
-}
-
-.btn-group > .btn {
-	position: relative;
-	float: left;
-}
-
-.btn {
-	display: inline-block;
-	padding: 6px 12px;
-	margin-bottom: 0;
-	font-size: 14px;
-	font-weight: 400;
-	line-height: 1.42857143;
-	text-align: center;
-	white-space: nowrap;
-	vertical-align: middle;
-	-ms-touch-action: manipulation;
-	touch-action: manipulation;
-	cursor: pointer;
-	-webkit-user-select: none;
-	-moz-user-select: none;
-	-ms-user-select: none;
-	user-select: none;
-	background-image: none;
-	border: 1px solid transparent;
-	border-radius: 4px;
-}
-
-.btn.btn-default {
-	color: #333;
-	background-color: #fff;
-	border-color: #ccc;
-}
-
-.btn-group .btn + .btn,
-.btn-group .btn + .btn-group,
-.btn-group .btn-group + .btn,
-.btn-group .btn-group + .btn-group {
-	margin-left: -1px;
-}
-
-.btn-group > .btn:last-child:not(:first-child),
-.btn-group > .dropdown-toggle:not(:first-child) {
-	border-top-left-radius: 0;
-	border-bottom-left-radius: 0;
-}
-
-.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {
-	border-top-right-radius: 0;
-	border-bottom-right-radius: 0;
-}
-
-.btn-group-vertical > .btn.active,
-.btn-group-vertical > .btn:active,
-.btn-group-vertical > .btn:focus,
-.btn-group-vertical > .btn:hover,
-.btn-group > .btn.active,
-.btn-group > .btn:active,
-.btn-group > .btn:focus,
-.btn-group > .btn:hover {
-	z-index: 2;
-}
-
-.btn-primary {
-	color: #fff;
-	background-color: #337ab7;
-	border-color: #2e6da4;
-}
-
-.btn-danger {
-	color: #fff;
-	background-color: #d9534f;
-	border-color: #d43f3a;
-}
-
-.btn-default {
-	color: #333;
-	background-color: #fff;
-	border-color: #ccc;
-}
-
-.btn-primary:hover {
-	color: #fff;
-	background-color: #286090;
-	border-color: #204d74;
-}
-
-.input-group .form-control:last-child,
-.input-group-addon:last-child,
-.input-group-btn:first-child > .btn-group:not(:first-child) > .btn,
-.input-group-btn:first-child > .btn:not(:first-child),
-.input-group-btn:last-child > .btn,
-.input-group-btn:last-child > .btn-group > .btn,
-.input-group-btn:last-child > .dropdown-toggle {
-	border-top-left-radius: 0;
-	border-bottom-left-radius: 0;
-}
-
-.input-group .form-control,
-.input-group-addon,
-.input-group-btn {
-	display: table-cell;
-}
-
-.input-group-lg > .form-control,
-.input-group-lg > .input-group-addon,
-.input-group-lg > .input-group-btn > .btn {
-	height: 46px;
-	padding: 10px 16px;
-	font-size: 18px;
-	line-height: 1.3333333;
-	border-radius: 6px;
-}
-
-.input-group .form-control {
-	position: relative;
-	z-index: 2;
-	float: left;
-	width: 100%;
-	margin-bottom: 0;
-}
-
-.input-group {
-	position: relative;
-	display: table;
-	border-collapse: separate;
-}
-
-.form-control,
-output {
-	font-size: 14px;
-	line-height: 1.42857143;
-	color: #555;
-	display: block;
-}
-
-textarea.form-control {
-	height: auto;
-}
-
-.form-control {
-	height: 34px;
-	display: block;
-	width: 100%;
-	padding: 6px 12px;
-	font-size: 14px;
-	line-height: 1.42857143;
-	color: #555;
-	background-color: #fff;
-	background-image: none;
-	border: 1px solid #ccc;
-	border-radius: 4px;
-	box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-	-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
-	transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
-}
-
-.form-group {
-	margin-bottom: 15px;
-	height: auto;
-	overflow: hidden;
-}
-
-.btn,
-.form-control {
-	background-image: none;
-}
-
-.kc-toggle {
-	position: relative;
-	margin: 4px 0 0 2px;
-	width: 60px;
-	height: 21px;
-	border-radius: 3px;
-	cursor: pointer;
-	overflow: hidden;
-	display: inline-block;
-	background: #e9e9e9;
-	border: 1px solid #cbcbcb;
-	vertical-align: bottom;
-	-webkit-touch-callout: none;
-	-webkit-user-select: none;
-	-khtml-user-select: none;
-	-moz-user-select: none;
-	-ms-user-select: none;
-	user-select: none;
-}
-
-.kc-toggle .kct-inner {
-	position: absolute;
-	top: 0;
-	left: -28px;
-	width: 115px;
-	height: 100%;
-	-webkit-transition: left 150ms ease;
-	transition: left 150ms ease;
-}
-
-.kc-toggle.on .kct-inner {
-	background: #e2e2e2;
-	background: -webkit-linear-gradient(top, #e2e2e2 0%, #ffffff 100%);
-	background: linear-gradient(to bottom, #e2e2e2 0%, #ffffff 100%);
-	left: 0;
-}
-
-.kc-toggle input {
-	display: none;
-	position: absolute;
-	z-index: -1;
-	opacity: 0;
-	margin: 0;
-	padding: 0;
-	width: 100%;
-	height: 100%;
-}
-
-.kc-toggle
-.kct-on {
-	color: #12a912;
-}
-
-.kct-off {
-	color: #666;
-}
-
-.kct-on, .kct-off, .kct-handle {
-	width: 28px;
-	height: 100%;
-	font-family: Arial, Tahoma, sans-serif;
-	font-size: 12px;
-	text-align: center;
-	line-height: 22px;
-	font-weight: bold;
-	float: left;
-}
-
-.kct-on, .kct-off {
-	position: relative;
-}
-
-.kct-handle {
-	position: relative;
-	height: 17px;
-	background: #ffffff;
-	background: -webkit-linear-gradient(top, #ffffff 0%, #cecece 100%);
-	background: linear-gradient(to bottom, #ffffff 0%, #cecece 100%);
-	border: 1px solid #999;
-	font-weight: 100;
-	color: #4b4b4b;
-	text-shadow: none;
-	border-radius: 3px;
-	margin: 1px;
-}
-
-.inner-checkbox {
-	float: left;
-	display: block;
-	height: auto;
-	overflow: hidden;
-	padding-right: 5px;
-	line-height: 25px;
-}
+/*
+formBuilder - git@github.com:kevinchappell/formBuilder.git
+Version: 1.6.2
+Author: Kevin Chappell <kevin.b.chappell@gmail.com>
+*/
+* {
+	box-sizing: border-box;
+}
+
+button,
+input,
+select,
+textarea {
+	font-family: inherit;
+	font-size: inherit;
+	line-height: inherit;
+}
+
+input {
+	line-height: normal;
+}
+
+button,
+input,
+optgroup,
+select,
+textarea {
+	margin: 0;
+	font: inherit;
+	color: inherit;
+}
+
+textarea {
+	overflow: auto;
+}
+
+button,
+input,
+select,
+textarea {
+	font-family: inherit;
+	font-size: inherit;
+	line-height: inherit;
+}
+
+.btn-group {
+	position: relative;
+	display: inline-block;
+	vertical-align: middle;
+}
+
+.btn-group > .btn {
+	position: relative;
+	float: left;
+}
+
+.btn {
+	display: inline-block;
+	padding: 6px 12px;
+	margin-bottom: 0;
+	font-size: 14px;
+	font-weight: 400;
+	line-height: 1.42857143;
+	text-align: center;
+	white-space: nowrap;
+	vertical-align: middle;
+	-ms-touch-action: manipulation;
+	touch-action: manipulation;
+	cursor: pointer;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+	background-image: none;
+	border: 1px solid transparent;
+	border-radius: 4px;
+}
+
+.btn.btn-default {
+	color: #333;
+	background-color: #fff;
+	border-color: #ccc;
+}
+
+.btn-group .btn + .btn,
+.btn-group .btn + .btn-group,
+.btn-group .btn-group + .btn,
+.btn-group .btn-group + .btn-group {
+	margin-left: -1px;
+}
+
+.btn-group > .btn:last-child:not(:first-child),
+.btn-group > .dropdown-toggle:not(:first-child) {
+	border-top-left-radius: 0;
+	border-bottom-left-radius: 0;
+}
+
+.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {
+	border-top-right-radius: 0;
+	border-bottom-right-radius: 0;
+}
+
+.btn-group-vertical > .btn.active,
+.btn-group-vertical > .btn:active,
+.btn-group-vertical > .btn:focus,
+.btn-group-vertical > .btn:hover,
+.btn-group > .btn.active,
+.btn-group > .btn:active,
+.btn-group > .btn:focus,
+.btn-group > .btn:hover {
+	z-index: 2;
+}
+
+.btn-primary {
+	color: #fff;
+	background-color: #337ab7;
+	border-color: #2e6da4;
+}
+
+.btn-danger {
+	color: #fff;
+	background-color: #d9534f;
+	border-color: #d43f3a;
+}
+
+.btn-default {
+	color: #333;
+	background-color: #fff;
+	border-color: #ccc;
+}
+
+.btn-primary:hover {
+	color: #fff;
+	background-color: #286090;
+	border-color: #204d74;
+}
+
+.input-group .form-control:last-child,
+.input-group-addon:last-child,
+.input-group-btn:first-child > .btn-group:not(:first-child) > .btn,
+.input-group-btn:first-child > .btn:not(:first-child),
+.input-group-btn:last-child > .btn,
+.input-group-btn:last-child > .btn-group > .btn,
+.input-group-btn:last-child > .dropdown-toggle {
+	border-top-left-radius: 0;
+	border-bottom-left-radius: 0;
+}
+
+.input-group .form-control,
+.input-group-addon,
+.input-group-btn {
+	display: table-cell;
+}
+
+.input-group-lg > .form-control,
+.input-group-lg > .input-group-addon,
+.input-group-lg > .input-group-btn > .btn {
+	height: 46px;
+	padding: 10px 16px;
+	font-size: 18px;
+	line-height: 1.3333333;
+	border-radius: 6px;
+}
+
+.input-group .form-control {
+	position: relative;
+	z-index: 2;
+	float: left;
+	width: 100%;
+	margin-bottom: 0;
+}
+
+.input-group {
+	position: relative;
+	display: table;
+	border-collapse: separate;
+}
+
+.form-control,
+output {
+	font-size: 14px;
+	line-height: 1.42857143;
+	color: #555;
+	display: block;
+}
+
+textarea.form-control {
+	height: auto;
+}
+
+.form-control {
+	height: 34px;
+	display: block;
+	width: 100%;
+	padding: 6px 12px;
+	font-size: 14px;
+	line-height: 1.42857143;
+	color: #555;
+	background-color: #fff;
+	background-image: none;
+	border: 1px solid #ccc;
+	border-radius: 4px;
+	box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+	-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
+	transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
+}
+
+.form-group {
+	margin-bottom: 15px;
+	height: auto;
+	overflow: hidden;
+}
+
+.btn,
+.form-control {
+	background-image: none;
+}
+
+.kc-toggle {
+	position: relative;
+	margin: 4px 0 0 2px;
+	width: 60px;
+	height: 21px;
+	border-radius: 3px;
+	cursor: pointer;
+	overflow: hidden;
+	display: inline-block;
+	background: #e9e9e9;
+	border: 1px solid #cbcbcb;
+	vertical-align: bottom;
+	-webkit-touch-callout: none;
+	-webkit-user-select: none;
+	-khtml-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+.kc-toggle .kct-inner {
+	position: absolute;
+	top: 0;
+	left: -28px;
+	width: 115px;
+	height: 100%;
+	-webkit-transition: left 150ms ease;
+	transition: left 150ms ease;
+}
+
+.kc-toggle.on .kct-inner {
+	background: #e2e2e2;
+	background: -webkit-linear-gradient(top, #e2e2e2 0%, #ffffff 100%);
+	background: linear-gradient(to bottom, #e2e2e2 0%, #ffffff 100%);
+	left: 0;
+}
+
+.kc-toggle input {
+	display: none;
+	position: absolute;
+	z-index: -1;
+	opacity: 0;
+	margin: 0;
+	padding: 0;
+	width: 100%;
+	height: 100%;
+}
+
+.kc-toggle
+.kct-on {
+	color: #12a912;
+}
+
+.kct-off {
+	color: #666;
+}
+
+.kct-on, .kct-off, .kct-handle {
+	width: 28px;
+	height: 100%;
+	font-family: Arial, Tahoma, sans-serif;
+	font-size: 12px;
+	text-align: center;
+	line-height: 22px;
+	font-weight: bold;
+	float: left;
+}
+
+.kct-on, .kct-off {
+	position: relative;
+}
+
+.kct-handle {
+	position: relative;
+	height: 17px;
+	background: #ffffff;
+	background: -webkit-linear-gradient(top, #ffffff 0%, #cecece 100%);
+	background: linear-gradient(to bottom, #ffffff 0%, #cecece 100%);
+	border: 1px solid #999;
+	font-weight: 100;
+	color: #4b4b4b;
+	text-shadow: none;
+	border-radius: 3px;
+	margin: 1px;
+}
+
+.inner-checkbox {
+	float: left;
+	display: block;
+	height: auto;
+	overflow: hidden;
+	padding-right: 5px;
+	line-height: 25px;
+}

+ 247 - 247
demo/public/static/formbuilder/form-render.js

@@ -1,248 +1,248 @@
-/*
-formBuilder - git@github.com:kevinchappell/formBuilder.git
-Version: 1.6.2
-Author: Kevin Chappell <kevin.b.chappell@gmail.com>
-*/
-'use strict';
-
-(function($) {
-    'use strict';
-
-    var Toggle = function Toggle(element, options) {
-
-        var defaults = {
-            theme: 'fresh',
-            labels: {
-                off: 'Off',
-                on: 'On'
-            }
-        };
-
-        var opts = $.extend(defaults, options),
-        $kcToggle = $('<div class="kc-toggle"/>').insertAfter(element).append(element);
-
-        $kcToggle.toggleClass('on', element.is(':checked'));
-
-        var kctOn = '<div class="kct-on">' + opts.labels.on + '</div>',
-        kctOff = '<div class="kct-off">' + opts.labels.off + '</div>',
-        kctHandle = '<div class="kct-handle"></div>',
-        kctInner = '<div class="kct-inner">' + kctOn + kctHandle + kctOff + '</div>';
-
-        $kcToggle.append(kctInner);
-
-        $kcToggle.click(function() {
-            element.attr('checked', !element.attr('checked'));
-            $(this).toggleClass('on');
-        });
-    };
-
-    $.fn.kcToggle = function(options) {
-        var toggle = this;
-        return toggle.each(function() {
-            var element = $(this);
-            if (element.data('kcToggle')) {
-                return;
-            }
-            var kcToggle = new Toggle(element, options);
-            element.data('kcToggle', kcToggle);
-        });
-    };
-})(jQuery);
-// render the formBuilder XML into html
-'use strict';
-
-(function($) {
-    'use strict';
-    $.fn.formRender = function(options) {
-        var $template = $(this),
-        defaults = {
-            destroyTemplate: true,
-            // @todo
-            container: false
-        },
-        _helpers = {};
-
-        var opts = $.extend(defaults, options);
-
-     /**
-     * Generate markup wrapper where needed
-     * @param  {string} type
-     * @param  {object} attrs
-     * @param  {string} content we wrap this
-     * @return {string}
-     */
-        _helpers.markup = function(type) {
-            var attrs = arguments.length <= 1 || arguments[1] === undefined ? {}: arguments[1];
-            var content = arguments.length <= 2 || arguments[2] === undefined ? '': arguments[2];
-
-            attrs = _helpers.attrString(attrs);
-            content = Array.isArray(content) ? content.join('') : content;
-            var inlineElems = ['input'],
-            template = inlineElems.indexOf(type) === -1 ? '<' + type + ' ' + attrs + '>' + content + '</' + type + '>': '<' + type + ' ' + attrs + '/>';
-            return template;
-        };
-
-     /**
-     * Generate preview markup
-     * @param  {object} field
-     * @return {string}       preview markup for field
-     * @todo
-     */
-        _helpers.fieldRender = function(field) {
-            var fieldMarkup = '',
-            fieldLabel = '',
-            optionsMarkup = '';
-            var fieldAttrs = _helpers.parseAttrs(field.attributes),
-            fieldDesc = fieldAttrs.description,
-            // @todo
-            fieldOptions = $('option', field);
-            fieldAttrs.id = fieldAttrs.name;
-        	console.log(fieldAttrs);
-        	var defaultVal = typeof fieldAttrs.defaultVal != 'undefined' ? fieldAttrs.defaultVal : '';
-            if (fieldAttrs.type !== 'checkbox') {
-                fieldAttrs['class'] = 'form-control';
-            }
-
-            if (fieldAttrs.type !== 'hidden') {
-                fieldLabel = '<label for="' + fieldAttrs.id + '">' + fieldAttrs.label + '</label>';
-            }
-
-            if (fieldAttrs.required === 'false') {
-                delete fieldAttrs.required;
-            } else {
-                fieldAttrs.required = null;
-                fieldAttrs['aria-required'] = 'true';
-            }
-
-            delete fieldAttrs.label;
-            delete fieldAttrs.description;
-
-            var fieldAttrsString = _helpers.attrString(fieldAttrs);
-
-            switch (fieldAttrs.type) {
-            case 'textarea':
-            case 'rich-text':
-                delete fieldAttrs.type;
-                delete fieldAttrs.value;
-                fieldMarkup = fieldLabel + '<textarea ' + fieldAttrsString + '></textarea>';
-                break;
-            case 'select':
-                fieldAttrs.type = fieldAttrs.type.replace('-group', '');
-
-                if (fieldOptions.length) {
-                    fieldOptions.each(function(index, el) {
-                        var optionAttrs = _helpers.parseAttrs(el.attributes),
-                        optionAttrsString = _helpers.attrString(optionAttrs),
-                        optionText = el.innerHTML || el.innerContent || el.innerText || el.childNodes[0].nodeValue || el.value;
-
-                        optionsMarkup += '<option ' + optionAttrsString + '>' + optionText + '</option>';
-                    });
-                }
-                fieldMarkup = fieldLabel + '<select ' + fieldAttrsString + '>' + optionsMarkup + '</select>';
-                break;
-            case 'checkbox-group':
-            case 'radio-group':
-                fieldAttrs.type = fieldAttrs.type.replace('-group', '');
-                delete fieldAttrs['class'];
-
-                if (fieldOptions.length) { (function() {
-                        var optionName = fieldAttrs.name + '[]';
-                        fieldOptions.each(function(index, el) {
-                            var optionAttrs = $.extend(fieldAttrs, _helpers.parseAttrs(el.attributes));
-                            optionAttrs.name = optionName;
-                            optionAttrs.id = fieldAttrs.id + '-' + index;
-                            var optionAttrsString = _helpers.attrString(optionAttrs),
-                            optionText = el.innerHTML || el.innerContent || el.innerText || el.childNodes[0].nodeValue || el.value;
-
-                            optionsMarkup += '<div class="inner-checkbox"><input ' + optionAttrsString + ' /> <label for="' + optionAttrs.id + '">' + optionText + '</label></div>';
-                        });
-                    })();
-                }
-                fieldMarkup = fieldLabel + '<div class="' + fieldAttrs.type + '-group">' + optionsMarkup + '</div>';
-                break;
-            case 'text':
-            case 'password':
-            case 'email':
-            case 'hidden':
-            case 'date':
-            case 'autocomplete':
-                fieldMarkup = fieldLabel + ' <input ' + fieldAttrsString + ' value="'+defaultVal+'">';
-                break;
-            case 'checkbox':
-                fieldMarkup = '<input ' + fieldAttrsString + '> ' + fieldLabel;
-
-                if (fieldAttrs.toggle) {
-                    setTimeout(function() {
-                        $(document.getElementById(fieldAttrs.id)).kcToggle();
-                    },
-                    100);
-                }
-                break;
-            case 'text-label':
-                fieldMarkup = fieldLabel + '<div class="frm-fld"><label class="field-introduce">' + fieldAttrs.introduce + '</label></div>';
-                break;
-            default:
-                fieldMarkup = '<' + fieldAttrs.type + '></' + fieldAttrs.type + '>';
-            }
-
-            if (fieldAttrs.type !== 'hidden') {
-                fieldMarkup = _helpers.markup('div', {
-                    'class': 'form-group'
-                },
-                fieldMarkup);
-            }
-
-            return fieldMarkup;
-        };
-
-        _helpers.attrString = function(attrs) {
-            var attributes = [];
-            for (var attr in attrs) {
-                if (attrs.hasOwnProperty(attr)) {
-                    var attrVal = attrs[attr] ? '="' + attrs[attr] + '"': '';
-                    attributes.push(attr + attrVal);
-                }
-            }
-            return attributes.join(' ');
-        };
-
-        _helpers.parseAttrs = function(attrNodes) {
-            var fieldAttrs = {};
-            for (var attr in attrNodes) {
-                if (attrNodes.hasOwnProperty(attr)) {
-                    fieldAttrs[attrNodes[attr]['nodeName']] = attrNodes[attr]['nodeValue'];
-                }
-            }
-            return fieldAttrs;
-        };
-
-        // Begin the core plugin
-        this.each(function() {
-            var rendered = [];
-
-            var formData = $.parseXML($template.val()),
-            fields = $('field', formData),
-            settings = $('settings', formData); // @todo
-            if (!formData) {
-                alert('No formData. Add some fields and try again');
-                return false;
-            }
-
-            // generate field markup if we have fields
-            if (fields.length) {
-                fields.each(function(index, field) {
-                    index = index;
-                    rendered.push(_helpers.fieldRender(field));
-                });
-            }
-
-            var output = rendered.join('');
-
-            if (opts.container && opts.container.length) {
-                opts.container.html(output);
-            } else {
-                $template.replaceWith(output);
-            }
-        });
-    };
+/*
+formBuilder - git@github.com:kevinchappell/formBuilder.git
+Version: 1.6.2
+Author: Kevin Chappell <kevin.b.chappell@gmail.com>
+*/
+'use strict';
+
+(function($) {
+    'use strict';
+
+    var Toggle = function Toggle(element, options) {
+
+        var defaults = {
+            theme: 'fresh',
+            labels: {
+                off: 'Off',
+                on: 'On'
+            }
+        };
+
+        var opts = $.extend(defaults, options),
+        $kcToggle = $('<div class="kc-toggle"/>').insertAfter(element).append(element);
+
+        $kcToggle.toggleClass('on', element.is(':checked'));
+
+        var kctOn = '<div class="kct-on">' + opts.labels.on + '</div>',
+        kctOff = '<div class="kct-off">' + opts.labels.off + '</div>',
+        kctHandle = '<div class="kct-handle"></div>',
+        kctInner = '<div class="kct-inner">' + kctOn + kctHandle + kctOff + '</div>';
+
+        $kcToggle.append(kctInner);
+
+        $kcToggle.click(function() {
+            element.attr('checked', !element.attr('checked'));
+            $(this).toggleClass('on');
+        });
+    };
+
+    $.fn.kcToggle = function(options) {
+        var toggle = this;
+        return toggle.each(function() {
+            var element = $(this);
+            if (element.data('kcToggle')) {
+                return;
+            }
+            var kcToggle = new Toggle(element, options);
+            element.data('kcToggle', kcToggle);
+        });
+    };
+})(jQuery);
+// render the formBuilder XML into html
+'use strict';
+
+(function($) {
+    'use strict';
+    $.fn.formRender = function(options) {
+        var $template = $(this),
+        defaults = {
+            destroyTemplate: true,
+            // @todo
+            container: false
+        },
+        _helpers = {};
+
+        var opts = $.extend(defaults, options);
+
+     /**
+     * Generate markup wrapper where needed
+     * @param  {string} type
+     * @param  {object} attrs
+     * @param  {string} content we wrap this
+     * @return {string}
+     */
+        _helpers.markup = function(type) {
+            var attrs = arguments.length <= 1 || arguments[1] === undefined ? {}: arguments[1];
+            var content = arguments.length <= 2 || arguments[2] === undefined ? '': arguments[2];
+
+            attrs = _helpers.attrString(attrs);
+            content = Array.isArray(content) ? content.join('') : content;
+            var inlineElems = ['input'],
+            template = inlineElems.indexOf(type) === -1 ? '<' + type + ' ' + attrs + '>' + content + '</' + type + '>': '<' + type + ' ' + attrs + '/>';
+            return template;
+        };
+
+     /**
+     * Generate preview markup
+     * @param  {object} field
+     * @return {string}       preview markup for field
+     * @todo
+     */
+        _helpers.fieldRender = function(field) {
+            var fieldMarkup = '',
+            fieldLabel = '',
+            optionsMarkup = '';
+            var fieldAttrs = _helpers.parseAttrs(field.attributes),
+            fieldDesc = fieldAttrs.description,
+            // @todo
+            fieldOptions = $('option', field);
+            fieldAttrs.id = fieldAttrs.name;
+        	console.log(fieldAttrs);
+        	var defaultVal = typeof fieldAttrs.defaultVal != 'undefined' ? fieldAttrs.defaultVal : '';
+            if (fieldAttrs.type !== 'checkbox') {
+                fieldAttrs['class'] = 'form-control';
+            }
+
+            if (fieldAttrs.type !== 'hidden') {
+                fieldLabel = '<label for="' + fieldAttrs.id + '">' + fieldAttrs.label + '</label>';
+            }
+
+            if (fieldAttrs.required === 'false') {
+                delete fieldAttrs.required;
+            } else {
+                fieldAttrs.required = null;
+                fieldAttrs['aria-required'] = 'true';
+            }
+
+            delete fieldAttrs.label;
+            delete fieldAttrs.description;
+
+            var fieldAttrsString = _helpers.attrString(fieldAttrs);
+
+            switch (fieldAttrs.type) {
+            case 'textarea':
+            case 'rich-text':
+                delete fieldAttrs.type;
+                delete fieldAttrs.value;
+                fieldMarkup = fieldLabel + '<textarea ' + fieldAttrsString + '></textarea>';
+                break;
+            case 'select':
+                fieldAttrs.type = fieldAttrs.type.replace('-group', '');
+
+                if (fieldOptions.length) {
+                    fieldOptions.each(function(index, el) {
+                        var optionAttrs = _helpers.parseAttrs(el.attributes),
+                        optionAttrsString = _helpers.attrString(optionAttrs),
+                        optionText = el.innerHTML || el.innerContent || el.innerText || el.childNodes[0].nodeValue || el.value;
+
+                        optionsMarkup += '<option ' + optionAttrsString + '>' + optionText + '</option>';
+                    });
+                }
+                fieldMarkup = fieldLabel + '<select ' + fieldAttrsString + '>' + optionsMarkup + '</select>';
+                break;
+            case 'checkbox-group':
+            case 'radio-group':
+                fieldAttrs.type = fieldAttrs.type.replace('-group', '');
+                delete fieldAttrs['class'];
+
+                if (fieldOptions.length) { (function() {
+                        var optionName = fieldAttrs.name + '[]';
+                        fieldOptions.each(function(index, el) {
+                            var optionAttrs = $.extend(fieldAttrs, _helpers.parseAttrs(el.attributes));
+                            optionAttrs.name = optionName;
+                            optionAttrs.id = fieldAttrs.id + '-' + index;
+                            var optionAttrsString = _helpers.attrString(optionAttrs),
+                            optionText = el.innerHTML || el.innerContent || el.innerText || el.childNodes[0].nodeValue || el.value;
+
+                            optionsMarkup += '<div class="inner-checkbox"><input ' + optionAttrsString + ' /> <label for="' + optionAttrs.id + '">' + optionText + '</label></div>';
+                        });
+                    })();
+                }
+                fieldMarkup = fieldLabel + '<div class="' + fieldAttrs.type + '-group">' + optionsMarkup + '</div>';
+                break;
+            case 'text':
+            case 'password':
+            case 'email':
+            case 'hidden':
+            case 'date':
+            case 'autocomplete':
+                fieldMarkup = fieldLabel + ' <input ' + fieldAttrsString + ' value="'+defaultVal+'">';
+                break;
+            case 'checkbox':
+                fieldMarkup = '<input ' + fieldAttrsString + '> ' + fieldLabel;
+
+                if (fieldAttrs.toggle) {
+                    setTimeout(function() {
+                        $(document.getElementById(fieldAttrs.id)).kcToggle();
+                    },
+                    100);
+                }
+                break;
+            case 'text-label':
+                fieldMarkup = fieldLabel + '<div class="frm-fld"><label class="field-introduce">' + fieldAttrs.introduce + '</label></div>';
+                break;
+            default:
+                fieldMarkup = '<' + fieldAttrs.type + '></' + fieldAttrs.type + '>';
+            }
+
+            if (fieldAttrs.type !== 'hidden') {
+                fieldMarkup = _helpers.markup('div', {
+                    'class': 'form-group'
+                },
+                fieldMarkup);
+            }
+
+            return fieldMarkup;
+        };
+
+        _helpers.attrString = function(attrs) {
+            var attributes = [];
+            for (var attr in attrs) {
+                if (attrs.hasOwnProperty(attr)) {
+                    var attrVal = attrs[attr] ? '="' + attrs[attr] + '"': '';
+                    attributes.push(attr + attrVal);
+                }
+            }
+            return attributes.join(' ');
+        };
+
+        _helpers.parseAttrs = function(attrNodes) {
+            var fieldAttrs = {};
+            for (var attr in attrNodes) {
+                if (attrNodes.hasOwnProperty(attr)) {
+                    fieldAttrs[attrNodes[attr]['nodeName']] = attrNodes[attr]['nodeValue'];
+                }
+            }
+            return fieldAttrs;
+        };
+
+        // Begin the core plugin
+        this.each(function() {
+            var rendered = [];
+
+            var formData = $.parseXML($template.val()),
+            fields = $('field', formData),
+            settings = $('settings', formData); // @todo
+            if (!formData) {
+                alert('No formData. Add some fields and try again');
+                return false;
+            }
+
+            // generate field markup if we have fields
+            if (fields.length) {
+                fields.each(function(index, field) {
+                    index = index;
+                    rendered.push(_helpers.fieldRender(field));
+                });
+            }
+
+            var output = rendered.join('');
+
+            if (opts.container && opts.container.length) {
+                opts.container.html(output);
+            } else {
+                $template.replaceWith(output);
+            }
+        });
+    };
 })(jQuery);

+ 64 - 64
demo/public/static/formbuilder/language/cn.js

@@ -1,65 +1,65 @@
-var formbuilder = {};
-formbuilder.language = {};
-formbuilder.language.cn = {
-  				messages:{
-			        add: '添加',
-			        allowSelect: '允许选择',
-			        autocomplete: '自动完成',
-			        cannotBeEmpty: '此表单域不能为空',
-			        checkboxGroup: '多选列表',
-			        checkbox: '选项框',
-			        checkboxes: '多选框',
-			        clearAllMessage: '确定要移除所有项?',
-			        clearAll: '清除所有',
-			        close: '关闭',
-			        copy: '拷贝到粘贴板',
-			        dateField: '日期表单',
-			        description: '帮助',
-			        descriptionField: '描述',
-			        devMode: '开发模式',
-			        disableFields: '表单不能移除.',
-			        editNames: '编辑名字',
-			        editorTitle: '表单元素Form Elements',
-			        editXML: '编辑XML',
-			        fieldVars: '表单值',
-			        fieldRemoveWarning: '去顶要移除此表单元素?',
-			        getStarted: '拖动右侧表单元素到此区域',
-			        hide: '编辑',
-			        hidden: '隐藏输入框',
-			        label: '标签',
-			        labelEmpty: '标签元素不能为空',
-			        limitRole: '权限:',
-			        mandatory: 'Mandatory',
-			        maxLength: '最大长度',
-			        minOptionMessage: '此表单需要最少两个选项',
-			        name: '名字',
-			        no: 'No',
-			        off: 'Off',
-			        on: 'On',
-			        optional: 'optional',
-			        optionLabelPlaceholder: '标签',
-			        optionValuePlaceholder: '值',
-			        optionEmpty: '选项值不能为空',
-			        paragraph: 'Paragraph',
-			        preview: '预览',
-			        radioGroup: '单选',
-			        radio: '单选',
-			        removeMessage: '移除元素',
-			        remove: '&#215;',
-			        required: '必选',
-			        richText: '编辑框',
-			        roles: '权限',
-			        save: '预览模板',
-			        selectOptions: '选项',
-			        select: '选项',
-			        selectionsMessage: '允许多选',
-			        text: '文本域',
-			        textLabel: '标题',
-			        textIntroduce : '描述',
-			        toggle: '切换',
-			        warning: '警告!',
-			        viewXML: '查看 XML',
-			        yes: 'Yes',
-			        defaultValue : '默认值',
-  				}
+var formbuilder = {};
+formbuilder.language = {};
+formbuilder.language.cn = {
+  				messages:{
+			        add: '添加',
+			        allowSelect: '允许选择',
+			        autocomplete: '自动完成',
+			        cannotBeEmpty: '此表单域不能为空',
+			        checkboxGroup: '多选列表',
+			        checkbox: '选项框',
+			        checkboxes: '多选框',
+			        clearAllMessage: '确定要移除所有项?',
+			        clearAll: '清除所有',
+			        close: '关闭',
+			        copy: '拷贝到粘贴板',
+			        dateField: '日期表单',
+			        description: '帮助',
+			        descriptionField: '描述',
+			        devMode: '开发模式',
+			        disableFields: '表单不能移除.',
+			        editNames: '编辑名字',
+			        editorTitle: '表单元素Form Elements',
+			        editXML: '编辑XML',
+			        fieldVars: '表单值',
+			        fieldRemoveWarning: '去顶要移除此表单元素?',
+			        getStarted: '拖动右侧表单元素到此区域',
+			        hide: '编辑',
+			        hidden: '隐藏输入框',
+			        label: '标签',
+			        labelEmpty: '标签元素不能为空',
+			        limitRole: '权限:',
+			        mandatory: 'Mandatory',
+			        maxLength: '最大长度',
+			        minOptionMessage: '此表单需要最少两个选项',
+			        name: '名字',
+			        no: 'No',
+			        off: 'Off',
+			        on: 'On',
+			        optional: 'optional',
+			        optionLabelPlaceholder: '标签',
+			        optionValuePlaceholder: '值',
+			        optionEmpty: '选项值不能为空',
+			        paragraph: 'Paragraph',
+			        preview: '预览',
+			        radioGroup: '单选',
+			        radio: '单选',
+			        removeMessage: '移除元素',
+			        remove: '&#215;',
+			        required: '必选',
+			        richText: '编辑框',
+			        roles: '权限',
+			        save: '预览模板',
+			        selectOptions: '选项',
+			        select: '选项',
+			        selectionsMessage: '允许多选',
+			        text: '文本域',
+			        textLabel: '标题',
+			        textIntroduce : '描述',
+			        toggle: '切换',
+			        warning: '警告!',
+			        viewXML: '查看 XML',
+			        yes: 'Yes',
+			        defaultValue : '默认值',
+  				}
   };

+ 116 - 116
demo/public/static/formbuilder/sass/_reset.scss

@@ -1,116 +1,116 @@
-/*******************************************************************************
-MeyerWeb Reset
-*******************************************************************************/
-
-html,
-body,
-div,
-span,
-applet,
-object,
-iframe,
-h1,
-h2,
-h3,
-h4,
-h5,
-h6,
-p,
-blockquote,
-pre,
-a,
-abbr,
-acronym,
-address,
-big,
-cite,
-code,
-del,
-dfn,
-em,
-img,
-ins,
-kbd,
-q,
-s,
-samp,
-small,
-strike,
-strong,
-sub,
-sup,
-tt,
-var,
-b,
-u,
-i,
-center,
-dl,
-dt,
-dd,
-ol,
-ul,
-li,
-fieldset,
-form,
-label,
-legend,
-table,
-caption,
-tbody,
-tfoot,
-thead,
-tr,
-th,
-td,
-article,
-aside,
-canvas,
-details,
-embed,
-figure,
-figcaption,
-footer,
-header,
-hgroup,
-menu,
-nav,
-output,
-ruby,
-section,
-summary,
-time,
-mark,
-audio,
-video {
-	margin: 0;
-	padding: 0;
-	border: 0;
-	font: inherit;
-	vertical-align: baseline;
-}
-/* HTML5 display-role reset for older browsers */
-
-article,
-aside,
-details,
-figcaption,
-figure,
-footer,
-header,
-hgroup,
-menu,
-nav,
-section {
-	display: block;
-}
-
-ol,
-ul {
-	list-style: none;
-}
-
-table {
-	border-collapse: collapse;
-	border-spacing: 0;
-}
+/*******************************************************************************
+MeyerWeb Reset
+*******************************************************************************/
+
+html,
+body,
+div,
+span,
+applet,
+object,
+iframe,
+h1,
+h2,
+h3,
+h4,
+h5,
+h6,
+p,
+blockquote,
+pre,
+a,
+abbr,
+acronym,
+address,
+big,
+cite,
+code,
+del,
+dfn,
+em,
+img,
+ins,
+kbd,
+q,
+s,
+samp,
+small,
+strike,
+strong,
+sub,
+sup,
+tt,
+var,
+b,
+u,
+i,
+center,
+dl,
+dt,
+dd,
+ol,
+ul,
+li,
+fieldset,
+form,
+label,
+legend,
+table,
+caption,
+tbody,
+tfoot,
+thead,
+tr,
+th,
+td,
+article,
+aside,
+canvas,
+details,
+embed,
+figure,
+figcaption,
+footer,
+header,
+hgroup,
+menu,
+nav,
+output,
+ruby,
+section,
+summary,
+time,
+mark,
+audio,
+video {
+	margin: 0;
+	padding: 0;
+	border: 0;
+	font: inherit;
+	vertical-align: baseline;
+}
+/* HTML5 display-role reset for older browsers */
+
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+hgroup,
+menu,
+nav,
+section {
+	display: block;
+}
+
+ol,
+ul {
+	list-style: none;
+}
+
+table {
+	border-collapse: collapse;
+	border-spacing: 0;
+}

+ 351 - 351
demo/public/static/formbuilder/sass/_theme.scss

@@ -1,351 +1,351 @@
-/*******************************************************************************
-Slate Theme for GitHub Pages
-by Jason Costello, @jsncostello
-*******************************************************************************/
-
-/*******************************************************************************
-Theme Styles
-*******************************************************************************/
-
-body {
-	box-sizing: border-box;
-	color: #373737;
-	background: #212121;
-	font-size: 14px;
-	font-family: 'Myriad Pro', Calibri, Helvetica, Arial, sans-serif;
-	line-height: 1.42857143;
-	-webkit-font-smoothing: antialiased;
-}
-
-h1,
-h2,
-h3,
-h4,
-h5,
-h6 {
-	margin: 10px 0;
-	font-weight: 700;
-	color: #222222;
-	font-family: 'Lucida Grande', 'Calibri', Helvetica, Arial, sans-serif;
-	letter-spacing: -1px;
-}
-
-h1 {
-	font-size: 36px;
-	font-weight: 700;
-}
-
-h2 {
-	padding-bottom: 10px;
-	font-size: 32px;
-	background: url("images/bg_hr.png") repeat-x bottom;
-}
-
-h3 {
-	font-size: 24px;
-}
-
-h4 {
-	font-size: 21px;
-}
-
-h5 {
-	font-size: 18px;
-}
-
-h6 {
-	font-size: 16px;
-}
-
-p {
-	margin: 10px 0 15px 0;
-}
-
-footer p {
-	color: #f2f2f2;
-}
-
-a {
-	text-decoration: none;
-	color: $highlight-color;
-	text-shadow: none;
-	transition: color 0.5s ease;
-	transition: text-shadow 0.5s ease;
-}
-
-a:hover,
-a:focus {
-	text-decoration: underline;
-}
-
-em {
-	font-style: italic;
-}
-
-strong {
-	font-weight: bold;
-}
-
-p img {
-	display: inline;
-	margin: 0;
-	padding: 0;
-	vertical-align: middle;
-	text-align: center;
-	border: none;
-}
-
-pre,
-code {
-	width: 100%;
-	color: #222;
-	background-color: $white;
-	font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
-	font-size: 14px;
-	border-radius: 2px;
-}
-
-pre {
-	width: 98%;
-	padding: 1%;
-	box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
-	overflow: auto;
-	white-space: pre-wrap;
-}
-
-code {
-	padding: 1%;
-	width: 98%;
-	margin: 0 3px;
-	box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
-}
-
-pre code {
-	display: block;
-	box-shadow: none;
-}
-
-blockquote {
-	color: #666;
-	margin-bottom: 20px;
-	padding: 0 0 0 20px;
-	border-left: 3px solid #bbb;
-}
-
-ul,
-ol,
-dl {
-	margin-bottom: 15px;
-}
-
-ul {
-	list-style-position: inside;
-	list-style: disc;
-	padding-left: 20px;
-}
-
-ol {
-	list-style-position: inside;
-	list-style: decimal;
-	padding-left: 20px;
-}
-
-dl dt {
-	font-weight: bold;
-}
-
-dl dd {
-	padding-left: 20px;
-	font-style: italic;
-}
-
-dl p {
-	padding-left: 20px;
-	font-style: italic;
-}
-
-hr {
-	height: 1px;
-	margin-bottom: 5px;
-	border: none;
-	background: url("images/bg_hr.png") repeat-x center;
-}
-
-table {
-	border: 1px solid #373737;
-	margin-bottom: 20px;
-	text-align: left;
-}
-
-th {
-	font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
-	padding: 10px;
-	background: #373737;
-	color: $white;
-}
-
-td {
-	padding: 10px;
-	border: 1px solid #373737;
-}
-
-form {}
-
-/*******************************************************************************
-Full-Width Styles
-*******************************************************************************/
-
-.outer {
-	width: 100%;
-}
-
-.inner {
-	position: relative;
-	max-width: 1080px;
-	padding: 20px 10px;
-	margin: 0 auto;
-}
-
-#forkme_banner {
-	display: block;
-	position: absolute;
-	top: 0;
-	right: 10px;
-	z-index: 10;
-	padding: 10px 50px 10px 10px;
-	color: #fff;
-	background: url("images/blacktocat.png") $highlight-color no-repeat 95% 50%;
-	font-weight: 700;
-	box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
-	border-bottom-left-radius: 2px;
-	border-bottom-right-radius: 2px;
-}
-
-#header_wrap {
-	background: linear-gradient(to bottom, #373737, #212121);
-}
-
-#header_wrap .inner {
-	padding: 50px 10px 30px 10px;
-}
-
-#project_title {
-	margin: 0;
-	color: #fff;
-	font-size: 42px;
-	font-weight: 700;
-	text-shadow: #111 0px 0px 10px;
-}
-
-#project_tagline {
-	color: #fff;
-	font-size: 24px;
-	font-weight: 300;
-	background: none;
-	text-shadow: #111 0px 0px 10px;
-}
-
-#downloads {
-	position: absolute;
-	width: 210px;
-	z-index: 10;
-	bottom: -40px;
-	right: 0;
-	height: 70px;
-	background: url("images/icon_download.png") no-repeat 0% 90%;
-}
-
-.zip_download_link {
-	display: block;
-	float: right;
-	width: 90px;
-	height: 70px;
-	text-indent: -5000px;
-	overflow: hidden;
-	background: url(images/sprite_download.png) no-repeat bottom left;
-}
-
-.tar_download_link {
-	display: block;
-	float: right;
-	width: 90px;
-	height: 70px;
-	text-indent: -5000px;
-	overflow: hidden;
-	background: url(images/sprite_download.png) no-repeat bottom right;
-	margin-left: 10px;
-}
-
-.zip_download_link:hover {
-	background: url(images/sprite_download.png) no-repeat top left;
-}
-
-.tar_download_link:hover {
-	background: url(images/sprite_download.png) no-repeat top right;
-}
-
-#main_content_wrap {
-	background: #f2f2f2;
-	border-top: 1px solid #111;
-	border-bottom: 1px solid #111;
-}
-
-#footer_wrap {
-	background: #212121;
-}
-
-/*******************************************************************************
-Small Device Styles
-*******************************************************************************/
-
-@media screen and (max-width: 480px) {
-	body {
-		font-size: 14px;
-	}
-
-	#downloads {
-		display: none;
-	}
-
-	.inner {
-		min-width: 320px;
-		max-width: 480px;
-	}
-
-	#project_title {
-		font-size: 32px;
-	}
-
-	h1 {
-		font-size: 28px;
-	}
-
-	h2 {
-		font-size: 24px;
-	}
-
-	h3 {
-		font-size: 21px;
-	}
-
-	h4 {
-		font-size: 18px;
-	}
-
-	h5 {
-		font-size: 14px;
-	}
-
-	h6 {
-		font-size: 12px;
-	}
-
-	code,
-	pre {
-		min-width: 320px;
-		max-width: 480px;
-		font-size: 11px;
-		width: 98%;
-		padding: 1%;
-	}
-}
+/*******************************************************************************
+Slate Theme for GitHub Pages
+by Jason Costello, @jsncostello
+*******************************************************************************/
+
+/*******************************************************************************
+Theme Styles
+*******************************************************************************/
+
+body {
+	box-sizing: border-box;
+	color: #373737;
+	background: #212121;
+	font-size: 14px;
+	font-family: 'Myriad Pro', Calibri, Helvetica, Arial, sans-serif;
+	line-height: 1.42857143;
+	-webkit-font-smoothing: antialiased;
+}
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+	margin: 10px 0;
+	font-weight: 700;
+	color: #222222;
+	font-family: 'Lucida Grande', 'Calibri', Helvetica, Arial, sans-serif;
+	letter-spacing: -1px;
+}
+
+h1 {
+	font-size: 36px;
+	font-weight: 700;
+}
+
+h2 {
+	padding-bottom: 10px;
+	font-size: 32px;
+	background: url("images/bg_hr.png") repeat-x bottom;
+}
+
+h3 {
+	font-size: 24px;
+}
+
+h4 {
+	font-size: 21px;
+}
+
+h5 {
+	font-size: 18px;
+}
+
+h6 {
+	font-size: 16px;
+}
+
+p {
+	margin: 10px 0 15px 0;
+}
+
+footer p {
+	color: #f2f2f2;
+}
+
+a {
+	text-decoration: none;
+	color: $highlight-color;
+	text-shadow: none;
+	transition: color 0.5s ease;
+	transition: text-shadow 0.5s ease;
+}
+
+a:hover,
+a:focus {
+	text-decoration: underline;
+}
+
+em {
+	font-style: italic;
+}
+
+strong {
+	font-weight: bold;
+}
+
+p img {
+	display: inline;
+	margin: 0;
+	padding: 0;
+	vertical-align: middle;
+	text-align: center;
+	border: none;
+}
+
+pre,
+code {
+	width: 100%;
+	color: #222;
+	background-color: $white;
+	font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
+	font-size: 14px;
+	border-radius: 2px;
+}
+
+pre {
+	width: 98%;
+	padding: 1%;
+	box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
+	overflow: auto;
+	white-space: pre-wrap;
+}
+
+code {
+	padding: 1%;
+	width: 98%;
+	margin: 0 3px;
+	box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
+}
+
+pre code {
+	display: block;
+	box-shadow: none;
+}
+
+blockquote {
+	color: #666;
+	margin-bottom: 20px;
+	padding: 0 0 0 20px;
+	border-left: 3px solid #bbb;
+}
+
+ul,
+ol,
+dl {
+	margin-bottom: 15px;
+}
+
+ul {
+	list-style-position: inside;
+	list-style: disc;
+	padding-left: 20px;
+}
+
+ol {
+	list-style-position: inside;
+	list-style: decimal;
+	padding-left: 20px;
+}
+
+dl dt {
+	font-weight: bold;
+}
+
+dl dd {
+	padding-left: 20px;
+	font-style: italic;
+}
+
+dl p {
+	padding-left: 20px;
+	font-style: italic;
+}
+
+hr {
+	height: 1px;
+	margin-bottom: 5px;
+	border: none;
+	background: url("images/bg_hr.png") repeat-x center;
+}
+
+table {
+	border: 1px solid #373737;
+	margin-bottom: 20px;
+	text-align: left;
+}
+
+th {
+	font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
+	padding: 10px;
+	background: #373737;
+	color: $white;
+}
+
+td {
+	padding: 10px;
+	border: 1px solid #373737;
+}
+
+form {}
+
+/*******************************************************************************
+Full-Width Styles
+*******************************************************************************/
+
+.outer {
+	width: 100%;
+}
+
+.inner {
+	position: relative;
+	max-width: 1080px;
+	padding: 20px 10px;
+	margin: 0 auto;
+}
+
+#forkme_banner {
+	display: block;
+	position: absolute;
+	top: 0;
+	right: 10px;
+	z-index: 10;
+	padding: 10px 50px 10px 10px;
+	color: #fff;
+	background: url("images/blacktocat.png") $highlight-color no-repeat 95% 50%;
+	font-weight: 700;
+	box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
+	border-bottom-left-radius: 2px;
+	border-bottom-right-radius: 2px;
+}
+
+#header_wrap {
+	background: linear-gradient(to bottom, #373737, #212121);
+}
+
+#header_wrap .inner {
+	padding: 50px 10px 30px 10px;
+}
+
+#project_title {
+	margin: 0;
+	color: #fff;
+	font-size: 42px;
+	font-weight: 700;
+	text-shadow: #111 0px 0px 10px;
+}
+
+#project_tagline {
+	color: #fff;
+	font-size: 24px;
+	font-weight: 300;
+	background: none;
+	text-shadow: #111 0px 0px 10px;
+}
+
+#downloads {
+	position: absolute;
+	width: 210px;
+	z-index: 10;
+	bottom: -40px;
+	right: 0;
+	height: 70px;
+	background: url("images/icon_download.png") no-repeat 0% 90%;
+}
+
+.zip_download_link {
+	display: block;
+	float: right;
+	width: 90px;
+	height: 70px;
+	text-indent: -5000px;
+	overflow: hidden;
+	background: url(images/sprite_download.png) no-repeat bottom left;
+}
+
+.tar_download_link {
+	display: block;
+	float: right;
+	width: 90px;
+	height: 70px;
+	text-indent: -5000px;
+	overflow: hidden;
+	background: url(images/sprite_download.png) no-repeat bottom right;
+	margin-left: 10px;
+}
+
+.zip_download_link:hover {
+	background: url(images/sprite_download.png) no-repeat top left;
+}
+
+.tar_download_link:hover {
+	background: url(images/sprite_download.png) no-repeat top right;
+}
+
+#main_content_wrap {
+	background: #f2f2f2;
+	border-top: 1px solid #111;
+	border-bottom: 1px solid #111;
+}
+
+#footer_wrap {
+	background: #212121;
+}
+
+/*******************************************************************************
+Small Device Styles
+*******************************************************************************/
+
+@media screen and (max-width: 480px) {
+	body {
+		font-size: 14px;
+	}
+
+	#downloads {
+		display: none;
+	}
+
+	.inner {
+		min-width: 320px;
+		max-width: 480px;
+	}
+
+	#project_title {
+		font-size: 32px;
+	}
+
+	h1 {
+		font-size: 28px;
+	}
+
+	h2 {
+		font-size: 24px;
+	}
+
+	h3 {
+		font-size: 21px;
+	}
+
+	h4 {
+		font-size: 18px;
+	}
+
+	h5 {
+		font-size: 14px;
+	}
+
+	h6 {
+		font-size: 12px;
+	}
+
+	code,
+	pre {
+		min-width: 320px;
+		max-width: 480px;
+		font-size: 11px;
+		width: 98%;
+		padding: 1%;
+	}
+}

+ 7 - 7
demo/public/static/formbuilder/sass/_variables.scss

@@ -1,7 +1,7 @@
-$highlight-color: #0090ff;
-$color: darken($highlight-color, 20%);
-$border-color: #999;
-$off-white: #fefefe;
-$white: #fff;
-$black: #000;
-$green: #00BC63;
+$highlight-color: #0090ff;
+$color: darken($highlight-color, 20%);
+$border-color: #999;
+$off-white: #fefefe;
+$white: #fff;
+$black: #000;
+$green: #00BC63;

+ 80 - 80
demo/public/static/formbuilder/sass/demo.scss

@@ -1,80 +1,80 @@
-@import "variables";
-@import "reset";
-@import "theme";
-
-.donate-plea {
-  width: 50%;
-  float: left;
-  text-align: left;
-
-  form {
-    float: left;
-    margin-bottom: 10px;
-  }
-}
-
-.copyright {
-  float: right;
-  text-align: right;
-}
-
-header {}
-
-.badges {
-  margin-top: -30px;
-}
-
-.social {
-  margin-top: -40px;
-
-  .chicklets {
-    text-indent: -9999px;
-  }
-}
-
-em {
-  color: $border-color;
-  display: block;
-}
-
-fieldset {
-  border: 1px solid $border-color;
-  background: $off-white;
-  padding: 20px;
-  margin: 20px 0;
-}
-
-legend {
-  border: 1px solid $border-color;
-  background: $off-white;
-  padding: 5px 10px;
-}
-
-#rendered-form {
-  clear: both;
-  float: left;
-  width: 62%;
-  margin-right: 2%;
-
-  .form-group {
-    > label {
-      font-weight: 700;
-      font-size: 1.1em;
-    }
-  }
-}
-
-.render-description {
-  width: 36%;
-  float: right;
-}
-
-#main_content {
-  hr {
-    clear: both;
-  }
-}
-
-.build-form {
-  margin-bottom: 30px;
-}
+@import "variables";
+@import "reset";
+@import "theme";
+
+.donate-plea {
+  width: 50%;
+  float: left;
+  text-align: left;
+
+  form {
+    float: left;
+    margin-bottom: 10px;
+  }
+}
+
+.copyright {
+  float: right;
+  text-align: right;
+}
+
+header {}
+
+.badges {
+  margin-top: -30px;
+}
+
+.social {
+  margin-top: -40px;
+
+  .chicklets {
+    text-indent: -9999px;
+  }
+}
+
+em {
+  color: $border-color;
+  display: block;
+}
+
+fieldset {
+  border: 1px solid $border-color;
+  background: $off-white;
+  padding: 20px;
+  margin: 20px 0;
+}
+
+legend {
+  border: 1px solid $border-color;
+  background: $off-white;
+  padding: 5px 10px;
+}
+
+#rendered-form {
+  clear: both;
+  float: left;
+  width: 62%;
+  margin-right: 2%;
+
+  .form-group {
+    > label {
+      font-weight: 700;
+      font-size: 1.1em;
+    }
+  }
+}
+
+.render-description {
+  width: 36%;
+  float: right;
+}
+
+#main_content {
+  hr {
+    clear: both;
+  }
+}
+
+.build-form {
+  margin-bottom: 30px;
+}

+ 96 - 96
demo/public/static/js/PIE.htc

@@ -1,96 +1,96 @@
-<!--
-PIE: CSS3 rendering for IE
-Version 1.0.0
-http://css3pie.com
-Dual-licensed for use under the Apache License Version 2.0 or the General Public License (GPL) Version 2.
--->
-<PUBLIC:COMPONENT lightWeight="true">
-<!-- saved from url=(0014)about:internet -->
-<PUBLIC:ATTACH EVENT="oncontentready" FOR="element" ONEVENT="init()" />
-<PUBLIC:ATTACH EVENT="ondocumentready" FOR="element" ONEVENT="init()" />
-<PUBLIC:ATTACH EVENT="ondetach" FOR="element" ONEVENT="cleanup()" />
-
-<script type="text/javascript">
-var doc = element.document;var f=window.PIE;
-if(!f){f=window.PIE={F:"-pie-",nb:"Pie",La:"pie_",Ac:{TD:1,TH:1},cc:{TABLE:1,THEAD:1,TBODY:1,TFOOT:1,TR:1,INPUT:1,TEXTAREA:1,SELECT:1,OPTION:1,IMG:1,HR:1},fc:{A:1,INPUT:1,TEXTAREA:1,SELECT:1,BUTTON:1},Gd:{submit:1,button:1,reset:1},aa:function(){}};try{doc.execCommand("BackgroundImageCache",false,true)}catch(aa){}for(var ba=4,Z=doc.createElement("div"),ca=Z.getElementsByTagName("i"),ga;Z.innerHTML="<!--[if gt IE "+ ++ba+"]><i></i><![endif]--\>",ca[0];);f.O=ba;if(ba===6)f.F=f.F.replace(/^-/,"");f.ja=
-doc.documentMode||f.O;Z.innerHTML='<v:shape adj="1"/>';ga=Z.firstChild;ga.style.behavior="url(#default#VML)";f.zc=typeof ga.adj==="object";(function(){var a,b=0,c={};f.p={Za:function(d){if(!a){a=doc.createDocumentFragment();a.namespaces.add("css3vml","urn:schemas-microsoft-com:vml")}return a.createElement("css3vml:"+d)},Ba:function(d){return d&&d._pieId||(d._pieId="_"+ ++b)},Eb:function(d){var e,g,j,i,h=arguments;e=1;for(g=h.length;e<g;e++){i=h[e];for(j in i)if(i.hasOwnProperty(j))d[j]=i[j]}return d},
-Rb:function(d,e,g){var j=c[d],i,h;if(j)Object.prototype.toString.call(j)==="[object Array]"?j.push([e,g]):e.call(g,j);else{h=c[d]=[[e,g]];i=new Image;i.onload=function(){j=c[d]={h:i.width,f:i.height};for(var k=0,n=h.length;k<n;k++)h[k][0].call(h[k][1],j);i.onload=null};i.src=d}}}})();f.Na={gc:function(a,b,c,d){function e(){k=j>=90&&j<270?b:0;n=j<180?c:0;m=b-k;p=c-n}function g(){for(;j<0;)j+=360;j%=360}var j=d.sa;d=d.zb;var i,h,k,n,m,p,r,t;if(d){d=d.coords(a,b,c);i=d.x;h=d.y}if(j){j=j.jd();g();e();
-if(!d){i=k;h=n}d=f.Na.tc(i,h,j,m,p);a=d[0];d=d[1]}else if(d){a=b-i;d=c-h}else{i=h=a=0;d=c}r=a-i;t=d-h;if(j===void 0){j=!r?t<0?90:270:!t?r<0?180:0:-Math.atan2(t,r)/Math.PI*180;g();e()}return{sa:j,xc:i,yc:h,td:a,ud:d,Wd:k,Xd:n,rd:m,sd:p,kd:r,ld:t,rc:f.Na.dc(i,h,a,d)}},tc:function(a,b,c,d,e){if(c===0||c===180)return[d,b];else if(c===90||c===270)return[a,e];else{c=Math.tan(-c*Math.PI/180);a=c*a-b;b=-1/c;d=b*d-e;e=b-c;return[(d-a)/e,(c*d-b*a)/e]}},dc:function(a,b,c,d){a=c-a;b=d-b;return Math.abs(a===0?
-b:b===0?a:Math.sqrt(a*a+b*b))}};f.ea=function(){this.Gb=[];this.oc={}};f.ea.prototype={ba:function(a){var b=f.p.Ba(a),c=this.oc,d=this.Gb;if(!(b in c)){c[b]=d.length;d.push(a)}},Ha:function(a){a=f.p.Ba(a);var b=this.oc;if(a&&a in b){delete this.Gb[b[a]];delete b[a]}},xa:function(){for(var a=this.Gb,b=a.length;b--;)a[b]&&a[b]()}};f.Oa=new f.ea;f.Oa.Rd=function(){var a=this,b;if(!a.Sd){b=doc.documentElement.currentStyle.getAttribute(f.F+"poll-interval")||250;(function c(){a.xa();setTimeout(c,b)})();
-a.Sd=1}};(function(){function a(){f.L.xa();window.detachEvent("onunload",a);window.PIE=null}f.L=new f.ea;window.attachEvent("onunload",a);f.L.ta=function(b,c,d){b.attachEvent(c,d);this.ba(function(){b.detachEvent(c,d)})}})();f.Qa=new f.ea;f.L.ta(window,"onresize",function(){f.Qa.xa()});(function(){function a(){f.mb.xa()}f.mb=new f.ea;f.L.ta(window,"onscroll",a);f.Qa.ba(a)})();(function(){function a(){c=f.kb.md()}function b(){if(c){for(var d=0,e=c.length;d<e;d++)f.attach(c[d]);c=0}}var c;if(f.ja<9){f.L.ta(window,
-"onbeforeprint",a);f.L.ta(window,"onafterprint",b)}})();f.lb=new f.ea;f.L.ta(doc,"onmouseup",function(){f.lb.xa()});f.he=function(){function a(h){this.Y=h}var b=doc.createElement("length-calc"),c=doc.body||doc.documentElement,d=b.style,e={},g=["mm","cm","in","pt","pc"],j=g.length,i={};d.position="absolute";d.top=d.left="-9999px";for(c.appendChild(b);j--;){d.width="100"+g[j];e[g[j]]=b.offsetWidth/100}c.removeChild(b);d.width="1em";a.prototype={Kb:/(px|em|ex|mm|cm|in|pt|pc|%)$/,ic:function(){var h=
-this.Jd;if(h===void 0)h=this.Jd=parseFloat(this.Y);return h},yb:function(){var h=this.ae;if(!h)h=this.ae=(h=this.Y.match(this.Kb))&&h[0]||"px";return h},a:function(h,k){var n=this.ic(),m=this.yb();switch(m){case "px":return n;case "%":return n*(typeof k==="function"?k():k)/100;case "em":return n*this.xb(h);case "ex":return n*this.xb(h)/2;default:return n*e[m]}},xb:function(h){var k=h.currentStyle.fontSize,n,m;if(k.indexOf("px")>0)return parseFloat(k);else if(h.tagName in f.cc){m=this;n=h.parentNode;
-return f.n(k).a(n,function(){return m.xb(n)})}else{h.appendChild(b);k=b.offsetWidth;b.parentNode===h&&h.removeChild(b);return k}}};f.n=function(h){return i[h]||(i[h]=new a(h))};return a}();f.Ja=function(){function a(e){this.X=e}var b=f.n("50%"),c={top:1,center:1,bottom:1},d={left:1,center:1,right:1};a.prototype={zd:function(){if(!this.ac){var e=this.X,g=e.length,j=f.v,i=j.qa,h=f.n("0");i=i.na;h=["left",h,"top",h];if(g===1){e.push(new j.ob(i,"center"));g++}if(g===2){i&(e[0].k|e[1].k)&&e[0].d in c&&
-e[1].d in d&&e.push(e.shift());if(e[0].k&i)if(e[0].d==="center")h[1]=b;else h[0]=e[0].d;else if(e[0].W())h[1]=f.n(e[0].d);if(e[1].k&i)if(e[1].d==="center")h[3]=b;else h[2]=e[1].d;else if(e[1].W())h[3]=f.n(e[1].d)}this.ac=h}return this.ac},coords:function(e,g,j){var i=this.zd(),h=i[1].a(e,g);e=i[3].a(e,j);return{x:i[0]==="right"?g-h:h,y:i[2]==="bottom"?j-e:e}}};return a}();f.Ka=function(){function a(b,c){this.h=b;this.f=c}a.prototype={a:function(b,c,d,e,g){var j=this.h,i=this.f,h=c/d;e=e/g;if(j===
-"contain"){j=e>h?c:d*e;i=e>h?c/e:d}else if(j==="cover"){j=e<h?c:d*e;i=e<h?c/e:d}else if(j==="auto"){i=i==="auto"?g:i.a(b,d);j=i*e}else{j=j.a(b,c);i=i==="auto"?j/e:i.a(b,d)}return{h:j,f:i}}};a.Kc=new a("auto","auto");return a}();f.Ec=function(){function a(b){this.Y=b}a.prototype={Kb:/[a-z]+$/i,yb:function(){return this.ad||(this.ad=this.Y.match(this.Kb)[0].toLowerCase())},jd:function(){var b=this.Vc,c;if(b===undefined){b=this.yb();c=parseFloat(this.Y,10);b=this.Vc=b==="deg"?c:b==="rad"?c/Math.PI*180:
-b==="grad"?c/400*360:b==="turn"?c*360:0}return b}};return a}();f.Jc=function(){function a(c){this.Y=c}var b={};a.Qd=/\s*rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d+|\d*\.\d+)\s*\)\s*/;a.Fb={aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"000",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",
-cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9A9A9",darkgreen:"006400",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"696969",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",
-forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DCDCDC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"808080",green:"008000",greenyellow:"ADFF2F",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgreen:"90EE90",lightgrey:"D3D3D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",
-lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"0F0",limegreen:"32CD32",linen:"FAF0E6",magenta:"F0F",maroon:"800000",mediumauqamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370D8",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",
-navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"688E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0C0C0",skyblue:"87CEEB",
-slateblue:"6A5ACD",slategray:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"FFF",whitesmoke:"F5F5F5",yellow:"FF0",yellowgreen:"9ACD32"};a.prototype={parse:function(){if(!this.Ua){var c=this.Y,d;if(d=c.match(a.Qd)){this.Ua="rgb("+d[1]+","+d[2]+","+d[3]+")";this.Yb=parseFloat(d[4])}else{if((d=c.toLowerCase())in a.Fb)c="#"+a.Fb[d];this.Ua=c;this.Yb=c==="transparent"?0:
-1}}},U:function(c){this.parse();return this.Ua==="currentColor"?c.currentStyle.color:this.Ua},fa:function(){this.parse();return this.Yb}};f.ha=function(c){return b[c]||(b[c]=new a(c))};return a}();f.v=function(){function a(c){this.$a=c;this.ch=0;this.X=[];this.Ga=0}var b=a.qa={Ia:1,Wb:2,z:4,Lc:8,Xb:16,na:32,K:64,oa:128,pa:256,Ra:512,Tc:1024,URL:2048};a.ob=function(c,d){this.k=c;this.d=d};a.ob.prototype={Ca:function(){return this.k&b.K||this.k&b.oa&&this.d==="0"},W:function(){return this.Ca()||this.k&
-b.Ra}};a.prototype={de:/\s/,Kd:/^[\+\-]?(\d*\.)?\d+/,url:/^url\(\s*("([^"]*)"|'([^']*)'|([!#$%&*-~]*))\s*\)/i,nc:/^\-?[_a-z][\w-]*/i,Yd:/^("([^"]*)"|'([^']*)')/,Bd:/^#([\da-f]{6}|[\da-f]{3})/i,be:{px:b.K,em:b.K,ex:b.K,mm:b.K,cm:b.K,"in":b.K,pt:b.K,pc:b.K,deg:b.Ia,rad:b.Ia,grad:b.Ia},fd:{rgb:1,rgba:1,hsl:1,hsla:1},next:function(c){function d(p,r){p=new a.ob(p,r);if(!c){k.X.push(p);k.Ga++}return p}function e(){k.Ga++;return null}var g,j,i,h,k=this;if(this.Ga<this.X.length)return this.X[this.Ga++];for(;this.de.test(this.$a.charAt(this.ch));)this.ch++;
-if(this.ch>=this.$a.length)return e();j=this.ch;g=this.$a.substring(this.ch);i=g.charAt(0);switch(i){case "#":if(h=g.match(this.Bd)){this.ch+=h[0].length;return d(b.z,h[0])}break;case '"':case "'":if(h=g.match(this.Yd)){this.ch+=h[0].length;return d(b.Tc,h[2]||h[3]||"")}break;case "/":case ",":this.ch++;return d(b.pa,i);case "u":if(h=g.match(this.url)){this.ch+=h[0].length;return d(b.URL,h[2]||h[3]||h[4]||"")}}if(h=g.match(this.Kd)){i=h[0];this.ch+=i.length;if(g.charAt(i.length)==="%"){this.ch++;
-return d(b.Ra,i+"%")}if(h=g.substring(i.length).match(this.nc)){i+=h[0];this.ch+=h[0].length;return d(this.be[h[0].toLowerCase()]||b.Lc,i)}return d(b.oa,i)}if(h=g.match(this.nc)){i=h[0];this.ch+=i.length;if(i.toLowerCase()in f.Jc.Fb||i==="currentColor"||i==="transparent")return d(b.z,i);if(g.charAt(i.length)==="("){this.ch++;if(i.toLowerCase()in this.fd){g=function(p){return p&&p.k&b.oa};h=function(p){return p&&p.k&(b.oa|b.Ra)};var n=function(p,r){return p&&p.d===r},m=function(){return k.next(1)};
-if((i.charAt(0)==="r"?h(m()):g(m()))&&n(m(),",")&&h(m())&&n(m(),",")&&h(m())&&(i==="rgb"||i==="hsa"||n(m(),",")&&g(m()))&&n(m(),")"))return d(b.z,this.$a.substring(j,this.ch));return e()}return d(b.Xb,i)}return d(b.na,i)}this.ch++;return d(b.Wb,i)},D:function(){return this.X[this.Ga-- -2]},all:function(){for(;this.next(););return this.X},ma:function(c,d){for(var e=[],g,j;g=this.next();){if(c(g)){j=true;this.D();break}e.push(g)}return d&&!j?null:e}};return a}();var ha=function(a){this.e=a};ha.prototype=
-{Z:0,Od:function(){var a=this.qb,b;return!a||(b=this.o())&&(a.x!==b.x||a.y!==b.y)},Td:function(){var a=this.qb,b;return!a||(b=this.o())&&(a.h!==b.h||a.f!==b.f)},hc:function(){var a=this.e,b=a.getBoundingClientRect(),c=f.ja===9,d=f.O===7,e=b.right-b.left;return{x:b.left,y:b.top,h:c||d?a.offsetWidth:e,f:c||d?a.offsetHeight:b.bottom-b.top,Hd:d&&e?a.offsetWidth/e:1}},o:function(){return this.Z?this.Va||(this.Va=this.hc()):this.hc()},Ad:function(){return!!this.qb},cb:function(){++this.Z},hb:function(){if(!--this.Z){if(this.Va)this.qb=
-this.Va;this.Va=null}}};(function(){function a(b){var c=f.p.Ba(b);return function(){if(this.Z){var d=this.$b||(this.$b={});return c in d?d[c]:(d[c]=b.call(this))}else return b.call(this)}}f.B={Z:0,ka:function(b){function c(d){this.e=d;this.Zb=this.ia()}f.p.Eb(c.prototype,f.B,b);c.$c={};return c},j:function(){var b=this.ia(),c=this.constructor.$c;return b?b in c?c[b]:(c[b]=this.la(b)):null},ia:a(function(){var b=this.e,c=this.constructor,d=b.style;b=b.currentStyle;var e=this.wa,g=this.Fa,j=c.Yc||(c.Yc=
-f.F+e);c=c.Zc||(c.Zc=f.nb+g.charAt(0).toUpperCase()+g.substring(1));return d[c]||b.getAttribute(j)||d[g]||b.getAttribute(e)}),i:a(function(){return!!this.j()}),H:a(function(){var b=this.ia(),c=b!==this.Zb;this.Zb=b;return c}),va:a,cb:function(){++this.Z},hb:function(){--this.Z||delete this.$b}}})();f.Sb=f.B.ka({wa:f.F+"background",Fa:f.nb+"Background",cd:{scroll:1,fixed:1,local:1},fb:{"repeat-x":1,"repeat-y":1,repeat:1,"no-repeat":1},sc:{"padding-box":1,"border-box":1,"content-box":1},Pd:{top:1,right:1,
-bottom:1,left:1,center:1},Ud:{contain:1,cover:1},eb:{Ma:"backgroundClip",z:"backgroundColor",da:"backgroundImage",Pa:"backgroundOrigin",S:"backgroundPosition",T:"backgroundRepeat",Sa:"backgroundSize"},la:function(a){function b(s){return s&&s.W()||s.k&k&&s.d in t}function c(s){return s&&(s.W()&&f.n(s.d)||s.d==="auto"&&"auto")}var d=this.e.currentStyle,e,g,j,i=f.v.qa,h=i.pa,k=i.na,n=i.z,m,p,r=0,t=this.Pd,v,l,q={M:[]};if(this.wb()){e=new f.v(a);for(j={};g=e.next();){m=g.k;p=g.d;if(!j.P&&m&i.Xb&&p===
-"linear-gradient"){v={ca:[],P:p};for(l={};g=e.next();){m=g.k;p=g.d;if(m&i.Wb&&p===")"){l.color&&v.ca.push(l);v.ca.length>1&&f.p.Eb(j,v);break}if(m&n){if(v.sa||v.zb){g=e.D();if(g.k!==h)break;e.next()}l={color:f.ha(p)};g=e.next();if(g.W())l.db=f.n(g.d);else e.D()}else if(m&i.Ia&&!v.sa&&!l.color&&!v.ca.length)v.sa=new f.Ec(g.d);else if(b(g)&&!v.zb&&!l.color&&!v.ca.length){e.D();v.zb=new f.Ja(e.ma(function(s){return!b(s)},false))}else if(m&h&&p===","){if(l.color){v.ca.push(l);l={}}}else break}}else if(!j.P&&
-m&i.URL){j.Ab=p;j.P="image"}else if(b(g)&&!j.$){e.D();j.$=new f.Ja(e.ma(function(s){return!b(s)},false))}else if(m&k)if(p in this.fb&&!j.bb)j.bb=p;else if(p in this.sc&&!j.Wa){j.Wa=p;if((g=e.next())&&g.k&k&&g.d in this.sc)j.ub=g.d;else{j.ub=p;e.D()}}else if(p in this.cd&&!j.bc)j.bc=p;else return null;else if(m&n&&!q.color)q.color=f.ha(p);else if(m&h&&p==="/"&&!j.Xa&&j.$){g=e.next();if(g.k&k&&g.d in this.Ud)j.Xa=new f.Ka(g.d);else if(g=c(g)){m=c(e.next());if(!m){m=g;e.D()}j.Xa=new f.Ka(g,m)}else return null}else if(m&
-h&&p===","&&j.P){j.Hb=a.substring(r,e.ch-1);r=e.ch;q.M.push(j);j={}}else return null}if(j.P){j.Hb=a.substring(r);q.M.push(j)}}else this.Bc(f.ja<9?function(){var s=this.eb,o=d[s.S+"X"],u=d[s.S+"Y"],x=d[s.da],y=d[s.z];if(y!=="transparent")q.color=f.ha(y);if(x!=="none")q.M=[{P:"image",Ab:(new f.v(x)).next().d,bb:d[s.T],$:new f.Ja((new f.v(o+" "+u)).all())}]}:function(){var s=this.eb,o=/\s*,\s*/,u=d[s.da].split(o),x=d[s.z],y,z,B,E,D,C;if(x!=="transparent")q.color=f.ha(x);if((E=u.length)&&u[0]!=="none"){x=
-d[s.T].split(o);y=d[s.S].split(o);z=d[s.Pa].split(o);B=d[s.Ma].split(o);s=d[s.Sa].split(o);q.M=[];for(o=0;o<E;o++)if((D=u[o])&&D!=="none"){C=s[o].split(" ");q.M.push({Hb:D+" "+x[o]+" "+y[o]+" / "+s[o]+" "+z[o]+" "+B[o],P:"image",Ab:(new f.v(D)).next().d,bb:x[o],$:new f.Ja((new f.v(y[o])).all()),Wa:z[o],ub:B[o],Xa:new f.Ka(C[0],C[1])})}}});return q.color||q.M[0]?q:null},Bc:function(a){var b=f.ja>8,c=this.eb,d=this.e.runtimeStyle,e=d[c.da],g=d[c.z],j=d[c.T],i,h,k,n;if(e)d[c.da]="";if(g)d[c.z]="";if(j)d[c.T]=
-"";if(b){i=d[c.Ma];h=d[c.Pa];n=d[c.S];k=d[c.Sa];if(i)d[c.Ma]="";if(h)d[c.Pa]="";if(n)d[c.S]="";if(k)d[c.Sa]=""}a=a.call(this);if(e)d[c.da]=e;if(g)d[c.z]=g;if(j)d[c.T]=j;if(b){if(i)d[c.Ma]=i;if(h)d[c.Pa]=h;if(n)d[c.S]=n;if(k)d[c.Sa]=k}return a},ia:f.B.va(function(){return this.wb()||this.Bc(function(){var a=this.e.currentStyle,b=this.eb;return a[b.z]+" "+a[b.da]+" "+a[b.T]+" "+a[b.S+"X"]+" "+a[b.S+"Y"]})}),wb:f.B.va(function(){var a=this.e;return a.style[this.Fa]||a.currentStyle.getAttribute(this.wa)}),
-qc:function(){var a=0;if(f.O<7){a=this.e;a=""+(a.style[f.nb+"PngFix"]||a.currentStyle.getAttribute(f.F+"png-fix"))==="true"}return a},i:f.B.va(function(){return(this.wb()||this.qc())&&!!this.j()})});f.Vb=f.B.ka({wc:["Top","Right","Bottom","Left"],Id:{thin:"1px",medium:"3px",thick:"5px"},la:function(){var a={},b={},c={},d=false,e=true,g=true,j=true;this.Cc(function(){for(var i=this.e.currentStyle,h=0,k,n,m,p,r,t,v;h<4;h++){m=this.wc[h];v=m.charAt(0).toLowerCase();k=b[v]=i["border"+m+"Style"];n=i["border"+
-m+"Color"];m=i["border"+m+"Width"];if(h>0){if(k!==p)g=false;if(n!==r)e=false;if(m!==t)j=false}p=k;r=n;t=m;c[v]=f.ha(n);m=a[v]=f.n(b[v]==="none"?"0":this.Id[m]||m);if(m.a(this.e)>0)d=true}});return d?{J:a,Zd:b,gd:c,ee:j,hd:e,$d:g}:null},ia:f.B.va(function(){var a=this.e,b=a.currentStyle,c;a.tagName in f.Ac&&a.offsetParent.currentStyle.borderCollapse==="collapse"||this.Cc(function(){c=b.borderWidth+"|"+b.borderStyle+"|"+b.borderColor});return c}),Cc:function(a){var b=this.e.runtimeStyle,c=b.borderWidth,
-d=b.borderColor;if(c)b.borderWidth="";if(d)b.borderColor="";a=a.call(this);if(c)b.borderWidth=c;if(d)b.borderColor=d;return a}});(function(){f.jb=f.B.ka({wa:"border-radius",Fa:"borderRadius",la:function(b){var c=null,d,e,g,j,i=false;if(b){e=new f.v(b);var h=function(){for(var k=[],n;(g=e.next())&&g.W();){j=f.n(g.d);n=j.ic();if(n<0)return null;if(n>0)i=true;k.push(j)}return k.length>0&&k.length<5?{tl:k[0],tr:k[1]||k[0],br:k[2]||k[0],bl:k[3]||k[1]||k[0]}:null};if(b=h()){if(g){if(g.k&f.v.qa.pa&&g.d===
-"/")d=h()}else d=b;if(i&&b&&d)c={x:b,y:d}}}return c}});var a=f.n("0");a={tl:a,tr:a,br:a,bl:a};f.jb.Dc={x:a,y:a}})();f.Ub=f.B.ka({wa:"border-image",Fa:"borderImage",fb:{stretch:1,round:1,repeat:1,space:1},la:function(a){var b=null,c,d,e,g,j,i,h=0,k=f.v.qa,n=k.na,m=k.oa,p=k.Ra;if(a){c=new f.v(a);b={};for(var r=function(l){return l&&l.k&k.pa&&l.d==="/"},t=function(l){return l&&l.k&n&&l.d==="fill"},v=function(){g=c.ma(function(l){return!(l.k&(m|p))});if(t(c.next())&&!b.fill)b.fill=true;else c.D();if(r(c.next())){h++;
-j=c.ma(function(l){return!l.W()&&!(l.k&n&&l.d==="auto")});if(r(c.next())){h++;i=c.ma(function(l){return!l.Ca()})}}else c.D()};a=c.next();){d=a.k;e=a.d;if(d&(m|p)&&!g){c.D();v()}else if(t(a)&&!b.fill){b.fill=true;v()}else if(d&n&&this.fb[e]&&!b.repeat){b.repeat={f:e};if(a=c.next())if(a.k&n&&this.fb[a.d])b.repeat.Ob=a.d;else c.D()}else if(d&k.URL&&!b.src)b.src=e;else return null}if(!b.src||!g||g.length<1||g.length>4||j&&j.length>4||h===1&&j.length<1||i&&i.length>4||h===2&&i.length<1)return null;if(!b.repeat)b.repeat=
-{f:"stretch"};if(!b.repeat.Ob)b.repeat.Ob=b.repeat.f;a=function(l,q){return{t:q(l[0]),r:q(l[1]||l[0]),b:q(l[2]||l[0]),l:q(l[3]||l[1]||l[0])}};b.slice=a(g,function(l){return f.n(l.k&m?l.d+"px":l.d)});if(j&&j[0])b.J=a(j,function(l){return l.W()?f.n(l.d):l.d});if(i&&i[0])b.Da=a(i,function(l){return l.Ca()?f.n(l.d):l.d})}return b}});f.Ic=f.B.ka({wa:"box-shadow",Fa:"boxShadow",la:function(a){var b,c=f.n,d=f.v.qa,e;if(a){e=new f.v(a);b={Da:[],Bb:[]};for(a=function(){for(var g,j,i,h,k,n;g=e.next();){i=g.d;
-j=g.k;if(j&d.pa&&i===",")break;else if(g.Ca()&&!k){e.D();k=e.ma(function(m){return!m.Ca()})}else if(j&d.z&&!h)h=i;else if(j&d.na&&i==="inset"&&!n)n=true;else return false}g=k&&k.length;if(g>1&&g<5){(n?b.Bb:b.Da).push({fe:c(k[0].d),ge:c(k[1].d),blur:c(k[2]?k[2].d:"0"),Vd:c(k[3]?k[3].d:"0"),color:f.ha(h||"currentColor")});return true}return false};a(););}return b&&(b.Bb.length||b.Da.length)?b:null}});f.Uc=f.B.ka({ia:f.B.va(function(){var a=this.e.currentStyle;return a.visibility+"|"+a.display}),la:function(){var a=
-this.e,b=a.runtimeStyle;a=a.currentStyle;var c=b.visibility,d;b.visibility="";d=a.visibility;b.visibility=c;return{ce:d!=="hidden",nd:a.display!=="none"}},i:function(){return false}});f.u={R:function(a){function b(c,d,e,g){this.e=c;this.s=d;this.g=e;this.parent=g}f.p.Eb(b.prototype,f.u,a);return b},Cb:false,Q:function(){return false},Ea:f.aa,Lb:function(){this.m();this.i()&&this.V()},ib:function(){this.Cb=true},Mb:function(){this.i()?this.V():this.m()},sb:function(a,b){this.vc(a);for(var c=this.ra||
-(this.ra=[]),d=a+1,e=c.length,g;d<e;d++)if(g=c[d])break;c[a]=b;this.I().insertBefore(b,g||null)},za:function(a){var b=this.ra;return b&&b[a]||null},vc:function(a){var b=this.za(a),c=this.Ta;if(b&&c){c.removeChild(b);this.ra[a]=null}},Aa:function(a,b,c,d){var e=this.rb||(this.rb={}),g=e[a];if(!g){g=e[a]=f.p.Za("shape");if(b)g.appendChild(g[b]=f.p.Za(b));if(d){c=this.za(d);if(!c){this.sb(d,doc.createElement("group"+d));c=this.za(d)}}c.appendChild(g);a=g.style;a.position="absolute";a.left=a.top=0;a.behavior=
-"url(#default#VML)"}return g},vb:function(a){var b=this.rb,c=b&&b[a];if(c){c.parentNode.removeChild(c);delete b[a]}return!!c},kc:function(a){var b=this.e,c=this.s.o(),d=c.h,e=c.f,g,j,i,h,k,n;c=a.x.tl.a(b,d);g=a.y.tl.a(b,e);j=a.x.tr.a(b,d);i=a.y.tr.a(b,e);h=a.x.br.a(b,d);k=a.y.br.a(b,e);n=a.x.bl.a(b,d);a=a.y.bl.a(b,e);d=Math.min(d/(c+j),e/(i+k),d/(n+h),e/(g+a));if(d<1){c*=d;g*=d;j*=d;i*=d;h*=d;k*=d;n*=d;a*=d}return{x:{tl:c,tr:j,br:h,bl:n},y:{tl:g,tr:i,br:k,bl:a}}},ya:function(a,b,c){b=b||1;var d,e,
-g=this.s.o();e=g.h*b;g=g.f*b;var j=this.g.G,i=Math.floor,h=Math.ceil,k=a?a.Jb*b:0,n=a?a.Ib*b:0,m=a?a.tb*b:0;a=a?a.Db*b:0;var p,r,t,v,l;if(c||j.i()){d=this.kc(c||j.j());c=d.x.tl*b;j=d.y.tl*b;p=d.x.tr*b;r=d.y.tr*b;t=d.x.br*b;v=d.y.br*b;l=d.x.bl*b;b=d.y.bl*b;e="m"+i(a)+","+i(j)+"qy"+i(c)+","+i(k)+"l"+h(e-p)+","+i(k)+"qx"+h(e-n)+","+i(r)+"l"+h(e-n)+","+h(g-v)+"qy"+h(e-t)+","+h(g-m)+"l"+i(l)+","+h(g-m)+"qx"+i(a)+","+h(g-b)+" x e"}else e="m"+i(a)+","+i(k)+"l"+h(e-n)+","+i(k)+"l"+h(e-n)+","+h(g-m)+"l"+i(a)+
-","+h(g-m)+"xe";return e},I:function(){var a=this.parent.za(this.N),b;if(!a){a=doc.createElement(this.Ya);b=a.style;b.position="absolute";b.top=b.left=0;this.parent.sb(this.N,a)}return a},mc:function(){var a=this.e,b=a.currentStyle,c=a.runtimeStyle,d=a.tagName,e=f.O===6,g;if(e&&(d in f.cc||d==="FIELDSET")||d==="BUTTON"||d==="INPUT"&&a.type in f.Gd){c.borderWidth="";d=this.g.w.wc;for(g=d.length;g--;){e=d[g];c["padding"+e]="";c["padding"+e]=f.n(b["padding"+e]).a(a)+f.n(b["border"+e+"Width"]).a(a)+(f.O!==
-8&&g%2?1:0)}c.borderWidth=0}else if(e){if(a.childNodes.length!==1||a.firstChild.tagName!=="ie6-mask"){b=doc.createElement("ie6-mask");d=b.style;d.visibility="visible";for(d.zoom=1;d=a.firstChild;)b.appendChild(d);a.appendChild(b);c.visibility="hidden"}}else c.borderColor="transparent"},ie:function(){},m:function(){this.parent.vc(this.N);delete this.rb;delete this.ra}};f.Rc=f.u.R({i:function(){var a=this.ed;for(var b in a)if(a.hasOwnProperty(b)&&a[b].i())return true;return false},Q:function(){return this.g.Pb.H()},
-ib:function(){if(this.i()){var a=this.jc(),b=a,c;a=a.currentStyle;var d=a.position,e=this.I().style,g=0,j=0;j=this.s.o();var i=j.Hd;if(d==="fixed"&&f.O>6){g=j.x*i;j=j.y*i;b=d}else{do b=b.offsetParent;while(b&&b.currentStyle.position==="static");if(b){c=b.getBoundingClientRect();b=b.currentStyle;g=(j.x-c.left)*i-(parseFloat(b.borderLeftWidth)||0);j=(j.y-c.top)*i-(parseFloat(b.borderTopWidth)||0)}else{b=doc.documentElement;g=(j.x+b.scrollLeft-b.clientLeft)*i;j=(j.y+b.scrollTop-b.clientTop)*i}b="absolute"}e.position=
-b;e.left=g;e.top=j;e.zIndex=d==="static"?-1:a.zIndex;this.Cb=true}},Mb:f.aa,Nb:function(){var a=this.g.Pb.j();this.I().style.display=a.ce&&a.nd?"":"none"},Lb:function(){this.i()?this.Nb():this.m()},jc:function(){var a=this.e;return a.tagName in f.Ac?a.offsetParent:a},I:function(){var a=this.Ta,b;if(!a){b=this.jc();a=this.Ta=doc.createElement("css3-container");a.style.direction="ltr";this.Nb();b.parentNode.insertBefore(a,b)}return a},ab:f.aa,m:function(){var a=this.Ta,b;if(a&&(b=a.parentNode))b.removeChild(a);
-delete this.Ta;delete this.ra}});f.Fc=f.u.R({N:2,Ya:"background",Q:function(){var a=this.g;return a.C.H()||a.G.H()},i:function(){var a=this.g;return a.q.i()||a.G.i()||a.C.i()||a.ga.i()&&a.ga.j().Bb},V:function(){var a=this.s.o();if(a.h&&a.f){this.od();this.pd()}},od:function(){var a=this.g.C.j(),b=this.s.o(),c=this.e,d=a&&a.color,e,g;if(d&&d.fa()>0){this.lc();a=this.Aa("bgColor","fill",this.I(),1);e=b.h;b=b.f;a.stroked=false;a.coordsize=e*2+","+b*2;a.coordorigin="1,1";a.path=this.ya(null,2);g=a.style;
-g.width=e;g.height=b;a.fill.color=d.U(c);c=d.fa();if(c<1)a.fill.opacity=c}else this.vb("bgColor")},pd:function(){var a=this.g.C.j(),b=this.s.o();a=a&&a.M;var c,d,e,g,j;if(a){this.lc();d=b.h;e=b.f;for(j=a.length;j--;){b=a[j];c=this.Aa("bgImage"+j,"fill",this.I(),2);c.stroked=false;c.fill.type="tile";c.fillcolor="none";c.coordsize=d*2+","+e*2;c.coordorigin="1,1";c.path=this.ya(0,2);g=c.style;g.width=d;g.height=e;if(b.P==="linear-gradient")this.bd(c,b);else{c.fill.src=b.Ab;this.Nd(c,j)}}}for(j=a?a.length:
-0;this.vb("bgImage"+j++););},Nd:function(a,b){var c=this;f.p.Rb(a.fill.src,function(d){var e=c.e,g=c.s.o(),j=g.h;g=g.f;if(j&&g){var i=a.fill,h=c.g,k=h.w.j(),n=k&&k.J;k=n?n.t.a(e):0;var m=n?n.r.a(e):0,p=n?n.b.a(e):0;n=n?n.l.a(e):0;h=h.C.j().M[b];e=h.$?h.$.coords(e,j-d.h-n-m,g-d.f-k-p):{x:0,y:0};h=h.bb;p=m=0;var r=j+1,t=g+1,v=f.O===8?0:1;n=Math.round(e.x)+n+0.5;k=Math.round(e.y)+k+0.5;i.position=n/j+","+k/g;i.size.x=1;i.size=d.h+"px,"+d.f+"px";if(h&&h!=="repeat"){if(h==="repeat-x"||h==="no-repeat"){m=
-k+1;t=k+d.f+v}if(h==="repeat-y"||h==="no-repeat"){p=n+1;r=n+d.h+v}a.style.clip="rect("+m+"px,"+r+"px,"+t+"px,"+p+"px)"}}})},bd:function(a,b){var c=this.e,d=this.s.o(),e=d.h,g=d.f;a=a.fill;d=b.ca;var j=d.length,i=Math.PI,h=f.Na,k=h.tc,n=h.dc;b=h.gc(c,e,g,b);h=b.sa;var m=b.xc,p=b.yc,r=b.Wd,t=b.Xd,v=b.rd,l=b.sd,q=b.kd,s=b.ld;b=b.rc;e=h%90?Math.atan2(q*e/g,s)/i*180:h+90;e+=180;e%=360;v=k(r,t,h,v,l);g=n(r,t,v[0],v[1]);i=[];v=k(m,p,h,r,t);n=n(m,p,v[0],v[1])/g*100;k=[];for(h=0;h<j;h++)k.push(d[h].db?d[h].db.a(c,
-b):h===0?0:h===j-1?b:null);for(h=1;h<j;h++){if(k[h]===null){m=k[h-1];b=h;do p=k[++b];while(p===null);k[h]=m+(p-m)/(b-h+1)}k[h]=Math.max(k[h],k[h-1])}for(h=0;h<j;h++)i.push(n+k[h]/g*100+"% "+d[h].color.U(c));a.angle=e;a.type="gradient";a.method="sigma";a.color=d[0].color.U(c);a.color2=d[j-1].color.U(c);if(a.colors)a.colors.value=i.join(",");else a.colors=i.join(",")},lc:function(){var a=this.e.runtimeStyle;a.backgroundImage="url(about:blank)";a.backgroundColor="transparent"},m:function(){f.u.m.call(this);
-var a=this.e.runtimeStyle;a.backgroundImage=a.backgroundColor=""}});f.Gc=f.u.R({N:4,Ya:"border",Q:function(){var a=this.g;return a.w.H()||a.G.H()},i:function(){var a=this.g;return a.G.i()&&!a.q.i()&&a.w.i()},V:function(){var a=this.e,b=this.g.w.j(),c=this.s.o(),d=c.h;c=c.f;var e,g,j,i,h;if(b){this.mc();b=this.wd(2);i=0;for(h=b.length;i<h;i++){j=b[i];e=this.Aa("borderPiece"+i,j.stroke?"stroke":"fill",this.I());e.coordsize=d*2+","+c*2;e.coordorigin="1,1";e.path=j.path;g=e.style;g.width=d;g.height=c;
-e.filled=!!j.fill;e.stroked=!!j.stroke;if(j.stroke){e=e.stroke;e.weight=j.Qb+"px";e.color=j.color.U(a);e.dashstyle=j.stroke==="dashed"?"2 2":j.stroke==="dotted"?"1 1":"solid";e.linestyle=j.stroke==="double"&&j.Qb>2?"ThinThin":"Single"}else e.fill.color=j.fill.U(a)}for(;this.vb("borderPiece"+i++););}},wd:function(a){var b=this.e,c,d,e,g=this.g.w,j=[],i,h,k,n,m=Math.round,p,r,t;if(g.i()){c=g.j();g=c.J;r=c.Zd;t=c.gd;if(c.ee&&c.$d&&c.hd){if(t.t.fa()>0){c=g.t.a(b);k=c/2;j.push({path:this.ya({Jb:k,Ib:k,
-tb:k,Db:k},a),stroke:r.t,color:t.t,Qb:c})}}else{a=a||1;c=this.s.o();d=c.h;e=c.f;c=m(g.t.a(b));k=m(g.r.a(b));n=m(g.b.a(b));b=m(g.l.a(b));var v={t:c,r:k,b:n,l:b};b=this.g.G;if(b.i())p=this.kc(b.j());i=Math.floor;h=Math.ceil;var l=function(o,u){return p?p[o][u]:0},q=function(o,u,x,y,z,B){var E=l("x",o),D=l("y",o),C=o.charAt(1)==="r";o=o.charAt(0)==="b";return E>0&&D>0?(B?"al":"ae")+(C?h(d-E):i(E))*a+","+(o?h(e-D):i(D))*a+","+(i(E)-u)*a+","+(i(D)-x)*a+","+y*65535+","+2949075*(z?1:-1):(B?"m":"l")+(C?d-
-u:u)*a+","+(o?e-x:x)*a},s=function(o,u,x,y){var z=o==="t"?i(l("x","tl"))*a+","+h(u)*a:o==="r"?h(d-u)*a+","+i(l("y","tr"))*a:o==="b"?h(d-l("x","br"))*a+","+i(e-u)*a:i(u)*a+","+h(e-l("y","bl"))*a;o=o==="t"?h(d-l("x","tr"))*a+","+h(u)*a:o==="r"?h(d-u)*a+","+h(e-l("y","br"))*a:o==="b"?i(l("x","bl"))*a+","+i(e-u)*a:i(u)*a+","+i(l("y","tl"))*a;return x?(y?"m"+o:"")+"l"+z:(y?"m"+z:"")+"l"+o};b=function(o,u,x,y,z,B){var E=o==="l"||o==="r",D=v[o],C,F;if(D>0&&r[o]!=="none"&&t[o].fa()>0){C=v[E?o:u];u=v[E?u:
-o];F=v[E?o:x];x=v[E?x:o];if(r[o]==="dashed"||r[o]==="dotted"){j.push({path:q(y,C,u,B+45,0,1)+q(y,0,0,B,1,0),fill:t[o]});j.push({path:s(o,D/2,0,1),stroke:r[o],Qb:D,color:t[o]});j.push({path:q(z,F,x,B,0,1)+q(z,0,0,B-45,1,0),fill:t[o]})}else j.push({path:q(y,C,u,B+45,0,1)+s(o,D,0,0)+q(z,F,x,B,0,0)+(r[o]==="double"&&D>2?q(z,F-i(F/3),x-i(x/3),B-45,1,0)+s(o,h(D/3*2),1,0)+q(y,C-i(C/3),u-i(u/3),B,1,0)+"x "+q(y,i(C/3),i(u/3),B+45,0,1)+s(o,i(D/3),1,0)+q(z,i(F/3),i(x/3),B,0,0):"")+q(z,0,0,B-45,1,0)+s(o,0,1,
-0)+q(y,0,0,B,1,0),fill:t[o]})}};b("t","l","r","tl","tr",90);b("r","t","b","tr","br",0);b("b","r","l","br","bl",-90);b("l","b","t","bl","tl",-180)}}return j},m:function(){if(this.ec||!this.g.q.i())this.e.runtimeStyle.borderColor="";f.u.m.call(this)}});f.Tb=f.u.R({N:5,Md:["t","tr","r","br","b","bl","l","tl","c"],Q:function(){return this.g.q.H()},i:function(){return this.g.q.i()},V:function(){this.I();var a=this.g.q.j(),b=this.g.w.j(),c=this.s.o(),d=this.e,e=this.uc;f.p.Rb(a.src,function(g){function j(s,
-o,u,x,y){s=e[s].style;var z=Math.max;s.width=z(o,0);s.height=z(u,0);s.left=x;s.top=y}function i(s,o,u){for(var x=0,y=s.length;x<y;x++)e[s[x]].imagedata[o]=u}var h=c.h,k=c.f,n=f.n("0"),m=a.J||(b?b.J:{t:n,r:n,b:n,l:n});n=m.t.a(d);var p=m.r.a(d),r=m.b.a(d);m=m.l.a(d);var t=a.slice,v=t.t.a(d),l=t.r.a(d),q=t.b.a(d);t=t.l.a(d);j("tl",m,n,0,0);j("t",h-m-p,n,m,0);j("tr",p,n,h-p,0);j("r",p,k-n-r,h-p,n);j("br",p,r,h-p,k-r);j("b",h-m-p,r,m,k-r);j("bl",m,r,0,k-r);j("l",m,k-n-r,0,n);j("c",h-m-p,k-n-r,m,n);i(["tl",
-"t","tr"],"cropBottom",(g.f-v)/g.f);i(["tl","l","bl"],"cropRight",(g.h-t)/g.h);i(["bl","b","br"],"cropTop",(g.f-q)/g.f);i(["tr","r","br"],"cropLeft",(g.h-l)/g.h);i(["l","r","c"],"cropTop",v/g.f);i(["l","r","c"],"cropBottom",q/g.f);i(["t","b","c"],"cropLeft",t/g.h);i(["t","b","c"],"cropRight",l/g.h);e.c.style.display=a.fill?"":"none"},this)},I:function(){var a=this.parent.za(this.N),b,c,d,e=this.Md,g=e.length;if(!a){a=doc.createElement("border-image");b=a.style;b.position="absolute";this.uc={};for(d=
-0;d<g;d++){c=this.uc[e[d]]=f.p.Za("rect");c.appendChild(f.p.Za("imagedata"));b=c.style;b.behavior="url(#default#VML)";b.position="absolute";b.top=b.left=0;c.imagedata.src=this.g.q.j().src;c.stroked=false;c.filled=false;a.appendChild(c)}this.parent.sb(this.N,a)}return a},Ea:function(){if(this.i()){var a=this.e,b=a.runtimeStyle,c=this.g.q.j().J;b.borderStyle="solid";if(c){b.borderTopWidth=c.t.a(a)+"px";b.borderRightWidth=c.r.a(a)+"px";b.borderBottomWidth=c.b.a(a)+"px";b.borderLeftWidth=c.l.a(a)+"px"}this.mc()}},
-m:function(){var a=this.e.runtimeStyle;a.borderStyle="";if(this.ec||!this.g.w.i())a.borderColor=a.borderWidth="";f.u.m.call(this)}});f.Hc=f.u.R({N:1,Ya:"outset-box-shadow",Q:function(){var a=this.g;return a.ga.H()||a.G.H()},i:function(){var a=this.g.ga;return a.i()&&a.j().Da[0]},V:function(){function a(C,F,O,H,M,P,I){C=b.Aa("shadow"+C+F,"fill",d,j-C);F=C.fill;C.coordsize=n*2+","+m*2;C.coordorigin="1,1";C.stroked=false;C.filled=true;F.color=M.U(c);if(P){F.type="gradienttitle";F.color2=F.color;F.opacity=
-0}C.path=I;l=C.style;l.left=O;l.top=H;l.width=n;l.height=m;return C}var b=this,c=this.e,d=this.I(),e=this.g,g=e.ga.j().Da;e=e.G.j();var j=g.length,i=j,h,k=this.s.o(),n=k.h,m=k.f;k=f.O===8?1:0;for(var p=["tl","tr","br","bl"],r,t,v,l,q,s,o,u,x,y,z,B,E,D;i--;){t=g[i];q=t.fe.a(c);s=t.ge.a(c);h=t.Vd.a(c);o=t.blur.a(c);t=t.color;u=-h-o;if(!e&&o)e=f.jb.Dc;u=this.ya({Jb:u,Ib:u,tb:u,Db:u},2,e);if(o){x=(h+o)*2+n;y=(h+o)*2+m;z=x?o*2/x:0;B=y?o*2/y:0;if(o-h>n/2||o-h>m/2)for(h=4;h--;){r=p[h];E=r.charAt(0)==="b";
-D=r.charAt(1)==="r";r=a(i,r,q,s,t,o,u);v=r.fill;v.focusposition=(D?1-z:z)+","+(E?1-B:B);v.focussize="0,0";r.style.clip="rect("+((E?y/2:0)+k)+"px,"+(D?x:x/2)+"px,"+(E?y:y/2)+"px,"+((D?x/2:0)+k)+"px)"}else{r=a(i,"",q,s,t,o,u);v=r.fill;v.focusposition=z+","+B;v.focussize=1-z*2+","+(1-B*2)}}else{r=a(i,"",q,s,t,o,u);q=t.fa();if(q<1)r.fill.opacity=q}}}});f.Pc=f.u.R({N:6,Ya:"imgEl",Q:function(){var a=this.g;return this.e.src!==this.Xc||a.G.H()},i:function(){var a=this.g;return a.G.i()||a.C.qc()},V:function(){this.Xc=
-j;this.Cd();var a=this.Aa("img","fill",this.I()),b=a.fill,c=this.s.o(),d=c.h;c=c.f;var e=this.g.w.j(),g=e&&e.J;e=this.e;var j=e.src,i=Math.round,h=e.currentStyle,k=f.n;if(!g||f.O<7){g=f.n("0");g={t:g,r:g,b:g,l:g}}a.stroked=false;b.type="frame";b.src=j;b.position=(d?0.5/d:0)+","+(c?0.5/c:0);a.coordsize=d*2+","+c*2;a.coordorigin="1,1";a.path=this.ya({Jb:i(g.t.a(e)+k(h.paddingTop).a(e)),Ib:i(g.r.a(e)+k(h.paddingRight).a(e)),tb:i(g.b.a(e)+k(h.paddingBottom).a(e)),Db:i(g.l.a(e)+k(h.paddingLeft).a(e))},
-2);a=a.style;a.width=d;a.height=c},Cd:function(){this.e.runtimeStyle.filter="alpha(opacity=0)"},m:function(){f.u.m.call(this);this.e.runtimeStyle.filter=""}});f.Oc=f.u.R({ib:f.aa,Mb:f.aa,Nb:f.aa,Lb:f.aa,Ld:/^,+|,+$/g,Fd:/,+/g,gb:function(a,b){(this.pb||(this.pb=[]))[a]=b||void 0},ab:function(){var a=this.pb,b;if(a&&(b=a.join(",").replace(this.Ld,"").replace(this.Fd,","))!==this.Wc)this.Wc=this.e.runtimeStyle.background=b},m:function(){this.e.runtimeStyle.background="";delete this.pb}});f.Mc=f.u.R({ua:1,
-Q:function(){return this.g.C.H()},i:function(){var a=this.g;return a.C.i()||a.q.i()},V:function(){var a=this.g.C.j(),b,c,d=0,e,g;if(a){b=[];if(c=a.M)for(;e=c[d++];)if(e.P==="linear-gradient"){g=this.vd(e.Wa);g=(e.Xa||f.Ka.Kc).a(this.e,g.h,g.f,g.h,g.f);b.push("url(data:image/svg+xml,"+escape(this.xd(e,g.h,g.f))+") "+this.dd(e.$)+" / "+g.h+"px "+g.f+"px "+(e.bc||"")+" "+(e.Wa||"")+" "+(e.ub||""))}else b.push(e.Hb);a.color&&b.push(a.color.Y);this.parent.gb(this.ua,b.join(","))}},dd:function(a){return a?
-a.X.map(function(b){return b.d}).join(" "):"0 0"},vd:function(a){var b=this.e,c=this.s.o(),d=c.h;c=c.f;var e;if(a!=="border-box")if((e=this.g.w.j())&&(e=e.J)){d-=e.l.a(b)+e.l.a(b);c-=e.t.a(b)+e.b.a(b)}if(a==="content-box"){a=f.n;e=b.currentStyle;d-=a(e.paddingLeft).a(b)+a(e.paddingRight).a(b);c-=a(e.paddingTop).a(b)+a(e.paddingBottom).a(b)}return{h:d,f:c}},xd:function(a,b,c){var d=this.e,e=a.ca,g=e.length,j=f.Na.gc(d,b,c,a);a=j.xc;var i=j.yc,h=j.td,k=j.ud;j=j.rc;var n,m,p,r,t;n=[];for(m=0;m<g;m++)n.push(e[m].db?
-e[m].db.a(d,j):m===0?0:m===g-1?j:null);for(m=1;m<g;m++)if(n[m]===null){r=n[m-1];p=m;do t=n[++p];while(t===null);n[m]=r+(t-r)/(p-m+1)}b=['<svg width="'+b+'" height="'+c+'" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="g" gradientUnits="userSpaceOnUse" x1="'+a/b*100+'%" y1="'+i/c*100+'%" x2="'+h/b*100+'%" y2="'+k/c*100+'%">'];for(m=0;m<g;m++)b.push('<stop offset="'+n[m]/j+'" stop-color="'+e[m].color.U(d)+'" stop-opacity="'+e[m].color.fa()+'"/>');b.push('</linearGradient></defs><rect width="100%" height="100%" fill="url(#g)"/></svg>');
-return b.join("")},m:function(){this.parent.gb(this.ua)}});f.Nc=f.u.R({T:"repeat",Sc:"stretch",Qc:"round",ua:0,Q:function(){return this.g.q.H()},i:function(){return this.g.q.i()},V:function(){var a=this,b=a.g.q.j(),c=a.g.w.j(),d=a.s.o(),e=b.repeat,g=e.f,j=e.Ob,i=a.e,h=0;f.p.Rb(b.src,function(k){function n(Q,R,U,V,W,Y,X,S,w,A){K.push('<pattern patternUnits="userSpaceOnUse" id="pattern'+G+'" x="'+(g===l?Q+U/2-w/2:Q)+'" y="'+(j===l?R+V/2-A/2:R)+'" width="'+w+'" height="'+A+'"><svg width="'+w+'" height="'+
-A+'" viewBox="'+W+" "+Y+" "+X+" "+S+'" preserveAspectRatio="none"><image xlink:href="'+v+'" x="0" y="0" width="'+r+'" height="'+t+'" /></svg></pattern>');J.push('<rect x="'+Q+'" y="'+R+'" width="'+U+'" height="'+V+'" fill="url(#pattern'+G+')" />');G++}var m=d.h,p=d.f,r=k.h,t=k.f,v=a.Dd(b.src,r,t),l=a.T,q=a.Sc;k=a.Qc;var s=Math.ceil,o=f.n("0"),u=b.J||(c?c.J:{t:o,r:o,b:o,l:o});o=u.t.a(i);var x=u.r.a(i),y=u.b.a(i);u=u.l.a(i);var z=b.slice,B=z.t.a(i),E=z.r.a(i),D=z.b.a(i);z=z.l.a(i);var C=m-u-x,F=p-o-
-y,O=r-z-E,H=t-B-D,M=g===q?C:O*o/B,P=j===q?F:H*x/E,I=g===q?C:O*y/D;q=j===q?F:H*u/z;var K=[],J=[],G=0;if(g===k){M-=(M-(C%M||M))/s(C/M);I-=(I-(C%I||I))/s(C/I)}if(j===k){P-=(P-(F%P||P))/s(F/P);q-=(q-(F%q||q))/s(F/q)}k=['<svg width="'+m+'" height="'+p+'" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">'];n(0,0,u,o,0,0,z,B,u,o);n(u,0,C,o,z,0,O,B,M,o);n(m-x,0,x,o,r-E,0,E,B,x,o);n(0,o,u,F,0,B,z,H,u,q);if(b.fill)n(u,o,C,F,z,B,O,H,M||I||O,q||P||H);n(m-x,o,x,F,r-E,B,E,H,x,P);n(0,
-p-y,u,y,0,t-D,z,D,u,y);n(u,p-y,C,y,z,t-D,O,D,I,y);n(m-x,p-y,x,y,r-E,t-D,E,D,x,y);k.push("<defs>"+K.join("\n")+"</defs>"+J.join("\n")+"</svg>");a.parent.gb(a.ua,"url(data:image/svg+xml,"+escape(k.join(""))+") no-repeat border-box border-box");h&&a.parent.ab()},a);h=1},Dd:function(){var a={};return function(b,c,d){var e=a[b],g;if(!e){e=new Image;g=doc.createElement("canvas");e.src=b;g.width=c;g.height=d;g.getContext("2d").drawImage(e,0,0);e=a[b]=g.toDataURL()}return e}}(),Ea:f.Tb.prototype.Ea,m:function(){var a=
-this.e.runtimeStyle;this.parent.gb(this.ua);a.borderColor=a.borderStyle=a.borderWidth=""}});f.kb=function(){function a(l,q){l.className+=" "+q}function b(l){var q=v.slice.call(arguments,1),s=q.length;setTimeout(function(){if(l)for(;s--;)a(l,q[s])},0)}function c(l){var q=v.slice.call(arguments,1),s=q.length;setTimeout(function(){if(l)for(;s--;){var o=q[s];o=t[o]||(t[o]=new RegExp("\\b"+o+"\\b","g"));l.className=l.className.replace(o,"")}},0)}function d(l){function q(){if(!U){var w,A,L=f.ja,T=l.currentStyle,
-N=T.getAttribute(g)==="true",da=T.getAttribute(i)!=="false",ea=T.getAttribute(h)!=="false";S=T.getAttribute(j);S=L>7?S!=="false":S==="true";if(!R){R=1;l.runtimeStyle.zoom=1;T=l;for(var fa=1;T=T.previousSibling;)if(T.nodeType===1){fa=0;break}fa&&a(l,p)}J.cb();if(N&&(A=J.o())&&(w=doc.documentElement||doc.body)&&(A.y>w.clientHeight||A.x>w.clientWidth||A.y+A.f<0||A.x+A.h<0)){if(!Y){Y=1;f.mb.ba(q)}}else{U=1;Y=R=0;f.mb.Ha(q);if(L===9){G={C:new f.Sb(l),q:new f.Ub(l),w:new f.Vb(l)};Q=[G.C,G.q];K=new f.Oc(l,
-J,G);w=[new f.Mc(l,J,G,K),new f.Nc(l,J,G,K)]}else{G={C:new f.Sb(l),w:new f.Vb(l),q:new f.Ub(l),G:new f.jb(l),ga:new f.Ic(l),Pb:new f.Uc(l)};Q=[G.C,G.w,G.q,G.G,G.ga,G.Pb];K=new f.Rc(l,J,G);w=[new f.Hc(l,J,G,K),new f.Fc(l,J,G,K),new f.Gc(l,J,G,K),new f.Tb(l,J,G,K)];l.tagName==="IMG"&&w.push(new f.Pc(l,J,G,K));K.ed=w}I=[K].concat(w);if(w=l.currentStyle.getAttribute(f.F+"watch-ancestors")){w=parseInt(w,10);A=0;for(N=l.parentNode;N&&(w==="NaN"||A++<w);){H(N,"onpropertychange",C);H(N,"onmouseenter",x);
-H(N,"onmouseleave",y);H(N,"onmousedown",z);if(N.tagName in f.fc){H(N,"onfocus",E);H(N,"onblur",D)}N=N.parentNode}}if(S){f.Oa.ba(o);f.Oa.Rd()}o(1)}if(!V){V=1;L<9&&H(l,"onmove",s);H(l,"onresize",s);H(l,"onpropertychange",u);ea&&H(l,"onmouseenter",x);if(ea||da)H(l,"onmouseleave",y);da&&H(l,"onmousedown",z);if(l.tagName in f.fc){H(l,"onfocus",E);H(l,"onblur",D)}f.Qa.ba(s);f.L.ba(M)}J.hb()}}function s(){J&&J.Ad()&&o()}function o(w){if(!X)if(U){var A,L=I.length;F();for(A=0;A<L;A++)I[A].Ea();if(w||J.Od())for(A=
-0;A<L;A++)I[A].ib();if(w||J.Td())for(A=0;A<L;A++)I[A].Mb();K.ab();O()}else R||q()}function u(){var w,A=I.length,L;w=event;if(!X&&!(w&&w.propertyName in r))if(U){F();for(w=0;w<A;w++)I[w].Ea();for(w=0;w<A;w++){L=I[w];L.Cb||L.ib();L.Q()&&L.Lb()}K.ab();O()}else R||q()}function x(){b(l,k)}function y(){c(l,k,n)}function z(){b(l,n);f.lb.ba(B)}function B(){c(l,n);f.lb.Ha(B)}function E(){b(l,m)}function D(){c(l,m)}function C(){var w=event.propertyName;if(w==="className"||w==="id")u()}function F(){J.cb();for(var w=
-Q.length;w--;)Q[w].cb()}function O(){for(var w=Q.length;w--;)Q[w].hb();J.hb()}function H(w,A,L){w.attachEvent(A,L);W.push([w,A,L])}function M(){if(V){for(var w=W.length,A;w--;){A=W[w];A[0].detachEvent(A[1],A[2])}f.L.Ha(M);V=0;W=[]}}function P(){if(!X){var w,A;M();X=1;if(I){w=0;for(A=I.length;w<A;w++){I[w].ec=1;I[w].m()}}S&&f.Oa.Ha(o);f.Qa.Ha(o);I=J=G=Q=l=null}}var I,K,J=new ha(l),G,Q,R,U,V,W=[],Y,X,S;this.Ed=q;this.update=o;this.m=P;this.qd=l}var e={},g=f.F+"lazy-init",j=f.F+"poll",i=f.F+"track-active",
-h=f.F+"track-hover",k=f.La+"hover",n=f.La+"active",m=f.La+"focus",p=f.La+"first-child",r={background:1,bgColor:1,display:1},t={},v=[];d.yd=function(l){var q=f.p.Ba(l);return e[q]||(e[q]=new d(l))};d.m=function(l){l=f.p.Ba(l);var q=e[l];if(q){q.m();delete e[l]}};d.md=function(){var l=[],q;if(e){for(var s in e)if(e.hasOwnProperty(s)){q=e[s];l.push(q.qd);q.m()}e={}}return l};return d}();f.supportsVML=f.zc;f.attach=function(a){f.ja<10&&f.zc&&f.kb.yd(a).Ed()};f.detach=function(a){f.kb.m(a)}};
-var $=element;function init(){if(doc.media!=="print"){var a=window.PIE;a&&a.attach($)}}function cleanup(){if(doc.media!=="print"){var a=window.PIE;if(a){a.detach($);$=0}}}$.readyState==="complete"&&init();
-</script>
-</PUBLIC:COMPONENT>
+<!--
+PIE: CSS3 rendering for IE
+Version 1.0.0
+http://css3pie.com
+Dual-licensed for use under the Apache License Version 2.0 or the General Public License (GPL) Version 2.
+-->
+<PUBLIC:COMPONENT lightWeight="true">
+<!-- saved from url=(0014)about:internet -->
+<PUBLIC:ATTACH EVENT="oncontentready" FOR="element" ONEVENT="init()" />
+<PUBLIC:ATTACH EVENT="ondocumentready" FOR="element" ONEVENT="init()" />
+<PUBLIC:ATTACH EVENT="ondetach" FOR="element" ONEVENT="cleanup()" />
+
+<script type="text/javascript">
+var doc = element.document;var f=window.PIE;
+if(!f){f=window.PIE={F:"-pie-",nb:"Pie",La:"pie_",Ac:{TD:1,TH:1},cc:{TABLE:1,THEAD:1,TBODY:1,TFOOT:1,TR:1,INPUT:1,TEXTAREA:1,SELECT:1,OPTION:1,IMG:1,HR:1},fc:{A:1,INPUT:1,TEXTAREA:1,SELECT:1,BUTTON:1},Gd:{submit:1,button:1,reset:1},aa:function(){}};try{doc.execCommand("BackgroundImageCache",false,true)}catch(aa){}for(var ba=4,Z=doc.createElement("div"),ca=Z.getElementsByTagName("i"),ga;Z.innerHTML="<!--[if gt IE "+ ++ba+"]><i></i><![endif]--\>",ca[0];);f.O=ba;if(ba===6)f.F=f.F.replace(/^-/,"");f.ja=
+doc.documentMode||f.O;Z.innerHTML='<v:shape adj="1"/>';ga=Z.firstChild;ga.style.behavior="url(#default#VML)";f.zc=typeof ga.adj==="object";(function(){var a,b=0,c={};f.p={Za:function(d){if(!a){a=doc.createDocumentFragment();a.namespaces.add("css3vml","urn:schemas-microsoft-com:vml")}return a.createElement("css3vml:"+d)},Ba:function(d){return d&&d._pieId||(d._pieId="_"+ ++b)},Eb:function(d){var e,g,j,i,h=arguments;e=1;for(g=h.length;e<g;e++){i=h[e];for(j in i)if(i.hasOwnProperty(j))d[j]=i[j]}return d},
+Rb:function(d,e,g){var j=c[d],i,h;if(j)Object.prototype.toString.call(j)==="[object Array]"?j.push([e,g]):e.call(g,j);else{h=c[d]=[[e,g]];i=new Image;i.onload=function(){j=c[d]={h:i.width,f:i.height};for(var k=0,n=h.length;k<n;k++)h[k][0].call(h[k][1],j);i.onload=null};i.src=d}}}})();f.Na={gc:function(a,b,c,d){function e(){k=j>=90&&j<270?b:0;n=j<180?c:0;m=b-k;p=c-n}function g(){for(;j<0;)j+=360;j%=360}var j=d.sa;d=d.zb;var i,h,k,n,m,p,r,t;if(d){d=d.coords(a,b,c);i=d.x;h=d.y}if(j){j=j.jd();g();e();
+if(!d){i=k;h=n}d=f.Na.tc(i,h,j,m,p);a=d[0];d=d[1]}else if(d){a=b-i;d=c-h}else{i=h=a=0;d=c}r=a-i;t=d-h;if(j===void 0){j=!r?t<0?90:270:!t?r<0?180:0:-Math.atan2(t,r)/Math.PI*180;g();e()}return{sa:j,xc:i,yc:h,td:a,ud:d,Wd:k,Xd:n,rd:m,sd:p,kd:r,ld:t,rc:f.Na.dc(i,h,a,d)}},tc:function(a,b,c,d,e){if(c===0||c===180)return[d,b];else if(c===90||c===270)return[a,e];else{c=Math.tan(-c*Math.PI/180);a=c*a-b;b=-1/c;d=b*d-e;e=b-c;return[(d-a)/e,(c*d-b*a)/e]}},dc:function(a,b,c,d){a=c-a;b=d-b;return Math.abs(a===0?
+b:b===0?a:Math.sqrt(a*a+b*b))}};f.ea=function(){this.Gb=[];this.oc={}};f.ea.prototype={ba:function(a){var b=f.p.Ba(a),c=this.oc,d=this.Gb;if(!(b in c)){c[b]=d.length;d.push(a)}},Ha:function(a){a=f.p.Ba(a);var b=this.oc;if(a&&a in b){delete this.Gb[b[a]];delete b[a]}},xa:function(){for(var a=this.Gb,b=a.length;b--;)a[b]&&a[b]()}};f.Oa=new f.ea;f.Oa.Rd=function(){var a=this,b;if(!a.Sd){b=doc.documentElement.currentStyle.getAttribute(f.F+"poll-interval")||250;(function c(){a.xa();setTimeout(c,b)})();
+a.Sd=1}};(function(){function a(){f.L.xa();window.detachEvent("onunload",a);window.PIE=null}f.L=new f.ea;window.attachEvent("onunload",a);f.L.ta=function(b,c,d){b.attachEvent(c,d);this.ba(function(){b.detachEvent(c,d)})}})();f.Qa=new f.ea;f.L.ta(window,"onresize",function(){f.Qa.xa()});(function(){function a(){f.mb.xa()}f.mb=new f.ea;f.L.ta(window,"onscroll",a);f.Qa.ba(a)})();(function(){function a(){c=f.kb.md()}function b(){if(c){for(var d=0,e=c.length;d<e;d++)f.attach(c[d]);c=0}}var c;if(f.ja<9){f.L.ta(window,
+"onbeforeprint",a);f.L.ta(window,"onafterprint",b)}})();f.lb=new f.ea;f.L.ta(doc,"onmouseup",function(){f.lb.xa()});f.he=function(){function a(h){this.Y=h}var b=doc.createElement("length-calc"),c=doc.body||doc.documentElement,d=b.style,e={},g=["mm","cm","in","pt","pc"],j=g.length,i={};d.position="absolute";d.top=d.left="-9999px";for(c.appendChild(b);j--;){d.width="100"+g[j];e[g[j]]=b.offsetWidth/100}c.removeChild(b);d.width="1em";a.prototype={Kb:/(px|em|ex|mm|cm|in|pt|pc|%)$/,ic:function(){var h=
+this.Jd;if(h===void 0)h=this.Jd=parseFloat(this.Y);return h},yb:function(){var h=this.ae;if(!h)h=this.ae=(h=this.Y.match(this.Kb))&&h[0]||"px";return h},a:function(h,k){var n=this.ic(),m=this.yb();switch(m){case "px":return n;case "%":return n*(typeof k==="function"?k():k)/100;case "em":return n*this.xb(h);case "ex":return n*this.xb(h)/2;default:return n*e[m]}},xb:function(h){var k=h.currentStyle.fontSize,n,m;if(k.indexOf("px")>0)return parseFloat(k);else if(h.tagName in f.cc){m=this;n=h.parentNode;
+return f.n(k).a(n,function(){return m.xb(n)})}else{h.appendChild(b);k=b.offsetWidth;b.parentNode===h&&h.removeChild(b);return k}}};f.n=function(h){return i[h]||(i[h]=new a(h))};return a}();f.Ja=function(){function a(e){this.X=e}var b=f.n("50%"),c={top:1,center:1,bottom:1},d={left:1,center:1,right:1};a.prototype={zd:function(){if(!this.ac){var e=this.X,g=e.length,j=f.v,i=j.qa,h=f.n("0");i=i.na;h=["left",h,"top",h];if(g===1){e.push(new j.ob(i,"center"));g++}if(g===2){i&(e[0].k|e[1].k)&&e[0].d in c&&
+e[1].d in d&&e.push(e.shift());if(e[0].k&i)if(e[0].d==="center")h[1]=b;else h[0]=e[0].d;else if(e[0].W())h[1]=f.n(e[0].d);if(e[1].k&i)if(e[1].d==="center")h[3]=b;else h[2]=e[1].d;else if(e[1].W())h[3]=f.n(e[1].d)}this.ac=h}return this.ac},coords:function(e,g,j){var i=this.zd(),h=i[1].a(e,g);e=i[3].a(e,j);return{x:i[0]==="right"?g-h:h,y:i[2]==="bottom"?j-e:e}}};return a}();f.Ka=function(){function a(b,c){this.h=b;this.f=c}a.prototype={a:function(b,c,d,e,g){var j=this.h,i=this.f,h=c/d;e=e/g;if(j===
+"contain"){j=e>h?c:d*e;i=e>h?c/e:d}else if(j==="cover"){j=e<h?c:d*e;i=e<h?c/e:d}else if(j==="auto"){i=i==="auto"?g:i.a(b,d);j=i*e}else{j=j.a(b,c);i=i==="auto"?j/e:i.a(b,d)}return{h:j,f:i}}};a.Kc=new a("auto","auto");return a}();f.Ec=function(){function a(b){this.Y=b}a.prototype={Kb:/[a-z]+$/i,yb:function(){return this.ad||(this.ad=this.Y.match(this.Kb)[0].toLowerCase())},jd:function(){var b=this.Vc,c;if(b===undefined){b=this.yb();c=parseFloat(this.Y,10);b=this.Vc=b==="deg"?c:b==="rad"?c/Math.PI*180:
+b==="grad"?c/400*360:b==="turn"?c*360:0}return b}};return a}();f.Jc=function(){function a(c){this.Y=c}var b={};a.Qd=/\s*rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d+|\d*\.\d+)\s*\)\s*/;a.Fb={aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"000",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",
+cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9A9A9",darkgreen:"006400",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"696969",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",
+forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DCDCDC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"808080",green:"008000",greenyellow:"ADFF2F",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgreen:"90EE90",lightgrey:"D3D3D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",
+lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"0F0",limegreen:"32CD32",linen:"FAF0E6",magenta:"F0F",maroon:"800000",mediumauqamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370D8",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",
+navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"688E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0C0C0",skyblue:"87CEEB",
+slateblue:"6A5ACD",slategray:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"FFF",whitesmoke:"F5F5F5",yellow:"FF0",yellowgreen:"9ACD32"};a.prototype={parse:function(){if(!this.Ua){var c=this.Y,d;if(d=c.match(a.Qd)){this.Ua="rgb("+d[1]+","+d[2]+","+d[3]+")";this.Yb=parseFloat(d[4])}else{if((d=c.toLowerCase())in a.Fb)c="#"+a.Fb[d];this.Ua=c;this.Yb=c==="transparent"?0:
+1}}},U:function(c){this.parse();return this.Ua==="currentColor"?c.currentStyle.color:this.Ua},fa:function(){this.parse();return this.Yb}};f.ha=function(c){return b[c]||(b[c]=new a(c))};return a}();f.v=function(){function a(c){this.$a=c;this.ch=0;this.X=[];this.Ga=0}var b=a.qa={Ia:1,Wb:2,z:4,Lc:8,Xb:16,na:32,K:64,oa:128,pa:256,Ra:512,Tc:1024,URL:2048};a.ob=function(c,d){this.k=c;this.d=d};a.ob.prototype={Ca:function(){return this.k&b.K||this.k&b.oa&&this.d==="0"},W:function(){return this.Ca()||this.k&
+b.Ra}};a.prototype={de:/\s/,Kd:/^[\+\-]?(\d*\.)?\d+/,url:/^url\(\s*("([^"]*)"|'([^']*)'|([!#$%&*-~]*))\s*\)/i,nc:/^\-?[_a-z][\w-]*/i,Yd:/^("([^"]*)"|'([^']*)')/,Bd:/^#([\da-f]{6}|[\da-f]{3})/i,be:{px:b.K,em:b.K,ex:b.K,mm:b.K,cm:b.K,"in":b.K,pt:b.K,pc:b.K,deg:b.Ia,rad:b.Ia,grad:b.Ia},fd:{rgb:1,rgba:1,hsl:1,hsla:1},next:function(c){function d(p,r){p=new a.ob(p,r);if(!c){k.X.push(p);k.Ga++}return p}function e(){k.Ga++;return null}var g,j,i,h,k=this;if(this.Ga<this.X.length)return this.X[this.Ga++];for(;this.de.test(this.$a.charAt(this.ch));)this.ch++;
+if(this.ch>=this.$a.length)return e();j=this.ch;g=this.$a.substring(this.ch);i=g.charAt(0);switch(i){case "#":if(h=g.match(this.Bd)){this.ch+=h[0].length;return d(b.z,h[0])}break;case '"':case "'":if(h=g.match(this.Yd)){this.ch+=h[0].length;return d(b.Tc,h[2]||h[3]||"")}break;case "/":case ",":this.ch++;return d(b.pa,i);case "u":if(h=g.match(this.url)){this.ch+=h[0].length;return d(b.URL,h[2]||h[3]||h[4]||"")}}if(h=g.match(this.Kd)){i=h[0];this.ch+=i.length;if(g.charAt(i.length)==="%"){this.ch++;
+return d(b.Ra,i+"%")}if(h=g.substring(i.length).match(this.nc)){i+=h[0];this.ch+=h[0].length;return d(this.be[h[0].toLowerCase()]||b.Lc,i)}return d(b.oa,i)}if(h=g.match(this.nc)){i=h[0];this.ch+=i.length;if(i.toLowerCase()in f.Jc.Fb||i==="currentColor"||i==="transparent")return d(b.z,i);if(g.charAt(i.length)==="("){this.ch++;if(i.toLowerCase()in this.fd){g=function(p){return p&&p.k&b.oa};h=function(p){return p&&p.k&(b.oa|b.Ra)};var n=function(p,r){return p&&p.d===r},m=function(){return k.next(1)};
+if((i.charAt(0)==="r"?h(m()):g(m()))&&n(m(),",")&&h(m())&&n(m(),",")&&h(m())&&(i==="rgb"||i==="hsa"||n(m(),",")&&g(m()))&&n(m(),")"))return d(b.z,this.$a.substring(j,this.ch));return e()}return d(b.Xb,i)}return d(b.na,i)}this.ch++;return d(b.Wb,i)},D:function(){return this.X[this.Ga-- -2]},all:function(){for(;this.next(););return this.X},ma:function(c,d){for(var e=[],g,j;g=this.next();){if(c(g)){j=true;this.D();break}e.push(g)}return d&&!j?null:e}};return a}();var ha=function(a){this.e=a};ha.prototype=
+{Z:0,Od:function(){var a=this.qb,b;return!a||(b=this.o())&&(a.x!==b.x||a.y!==b.y)},Td:function(){var a=this.qb,b;return!a||(b=this.o())&&(a.h!==b.h||a.f!==b.f)},hc:function(){var a=this.e,b=a.getBoundingClientRect(),c=f.ja===9,d=f.O===7,e=b.right-b.left;return{x:b.left,y:b.top,h:c||d?a.offsetWidth:e,f:c||d?a.offsetHeight:b.bottom-b.top,Hd:d&&e?a.offsetWidth/e:1}},o:function(){return this.Z?this.Va||(this.Va=this.hc()):this.hc()},Ad:function(){return!!this.qb},cb:function(){++this.Z},hb:function(){if(!--this.Z){if(this.Va)this.qb=
+this.Va;this.Va=null}}};(function(){function a(b){var c=f.p.Ba(b);return function(){if(this.Z){var d=this.$b||(this.$b={});return c in d?d[c]:(d[c]=b.call(this))}else return b.call(this)}}f.B={Z:0,ka:function(b){function c(d){this.e=d;this.Zb=this.ia()}f.p.Eb(c.prototype,f.B,b);c.$c={};return c},j:function(){var b=this.ia(),c=this.constructor.$c;return b?b in c?c[b]:(c[b]=this.la(b)):null},ia:a(function(){var b=this.e,c=this.constructor,d=b.style;b=b.currentStyle;var e=this.wa,g=this.Fa,j=c.Yc||(c.Yc=
+f.F+e);c=c.Zc||(c.Zc=f.nb+g.charAt(0).toUpperCase()+g.substring(1));return d[c]||b.getAttribute(j)||d[g]||b.getAttribute(e)}),i:a(function(){return!!this.j()}),H:a(function(){var b=this.ia(),c=b!==this.Zb;this.Zb=b;return c}),va:a,cb:function(){++this.Z},hb:function(){--this.Z||delete this.$b}}})();f.Sb=f.B.ka({wa:f.F+"background",Fa:f.nb+"Background",cd:{scroll:1,fixed:1,local:1},fb:{"repeat-x":1,"repeat-y":1,repeat:1,"no-repeat":1},sc:{"padding-box":1,"border-box":1,"content-box":1},Pd:{top:1,right:1,
+bottom:1,left:1,center:1},Ud:{contain:1,cover:1},eb:{Ma:"backgroundClip",z:"backgroundColor",da:"backgroundImage",Pa:"backgroundOrigin",S:"backgroundPosition",T:"backgroundRepeat",Sa:"backgroundSize"},la:function(a){function b(s){return s&&s.W()||s.k&k&&s.d in t}function c(s){return s&&(s.W()&&f.n(s.d)||s.d==="auto"&&"auto")}var d=this.e.currentStyle,e,g,j,i=f.v.qa,h=i.pa,k=i.na,n=i.z,m,p,r=0,t=this.Pd,v,l,q={M:[]};if(this.wb()){e=new f.v(a);for(j={};g=e.next();){m=g.k;p=g.d;if(!j.P&&m&i.Xb&&p===
+"linear-gradient"){v={ca:[],P:p};for(l={};g=e.next();){m=g.k;p=g.d;if(m&i.Wb&&p===")"){l.color&&v.ca.push(l);v.ca.length>1&&f.p.Eb(j,v);break}if(m&n){if(v.sa||v.zb){g=e.D();if(g.k!==h)break;e.next()}l={color:f.ha(p)};g=e.next();if(g.W())l.db=f.n(g.d);else e.D()}else if(m&i.Ia&&!v.sa&&!l.color&&!v.ca.length)v.sa=new f.Ec(g.d);else if(b(g)&&!v.zb&&!l.color&&!v.ca.length){e.D();v.zb=new f.Ja(e.ma(function(s){return!b(s)},false))}else if(m&h&&p===","){if(l.color){v.ca.push(l);l={}}}else break}}else if(!j.P&&
+m&i.URL){j.Ab=p;j.P="image"}else if(b(g)&&!j.$){e.D();j.$=new f.Ja(e.ma(function(s){return!b(s)},false))}else if(m&k)if(p in this.fb&&!j.bb)j.bb=p;else if(p in this.sc&&!j.Wa){j.Wa=p;if((g=e.next())&&g.k&k&&g.d in this.sc)j.ub=g.d;else{j.ub=p;e.D()}}else if(p in this.cd&&!j.bc)j.bc=p;else return null;else if(m&n&&!q.color)q.color=f.ha(p);else if(m&h&&p==="/"&&!j.Xa&&j.$){g=e.next();if(g.k&k&&g.d in this.Ud)j.Xa=new f.Ka(g.d);else if(g=c(g)){m=c(e.next());if(!m){m=g;e.D()}j.Xa=new f.Ka(g,m)}else return null}else if(m&
+h&&p===","&&j.P){j.Hb=a.substring(r,e.ch-1);r=e.ch;q.M.push(j);j={}}else return null}if(j.P){j.Hb=a.substring(r);q.M.push(j)}}else this.Bc(f.ja<9?function(){var s=this.eb,o=d[s.S+"X"],u=d[s.S+"Y"],x=d[s.da],y=d[s.z];if(y!=="transparent")q.color=f.ha(y);if(x!=="none")q.M=[{P:"image",Ab:(new f.v(x)).next().d,bb:d[s.T],$:new f.Ja((new f.v(o+" "+u)).all())}]}:function(){var s=this.eb,o=/\s*,\s*/,u=d[s.da].split(o),x=d[s.z],y,z,B,E,D,C;if(x!=="transparent")q.color=f.ha(x);if((E=u.length)&&u[0]!=="none"){x=
+d[s.T].split(o);y=d[s.S].split(o);z=d[s.Pa].split(o);B=d[s.Ma].split(o);s=d[s.Sa].split(o);q.M=[];for(o=0;o<E;o++)if((D=u[o])&&D!=="none"){C=s[o].split(" ");q.M.push({Hb:D+" "+x[o]+" "+y[o]+" / "+s[o]+" "+z[o]+" "+B[o],P:"image",Ab:(new f.v(D)).next().d,bb:x[o],$:new f.Ja((new f.v(y[o])).all()),Wa:z[o],ub:B[o],Xa:new f.Ka(C[0],C[1])})}}});return q.color||q.M[0]?q:null},Bc:function(a){var b=f.ja>8,c=this.eb,d=this.e.runtimeStyle,e=d[c.da],g=d[c.z],j=d[c.T],i,h,k,n;if(e)d[c.da]="";if(g)d[c.z]="";if(j)d[c.T]=
+"";if(b){i=d[c.Ma];h=d[c.Pa];n=d[c.S];k=d[c.Sa];if(i)d[c.Ma]="";if(h)d[c.Pa]="";if(n)d[c.S]="";if(k)d[c.Sa]=""}a=a.call(this);if(e)d[c.da]=e;if(g)d[c.z]=g;if(j)d[c.T]=j;if(b){if(i)d[c.Ma]=i;if(h)d[c.Pa]=h;if(n)d[c.S]=n;if(k)d[c.Sa]=k}return a},ia:f.B.va(function(){return this.wb()||this.Bc(function(){var a=this.e.currentStyle,b=this.eb;return a[b.z]+" "+a[b.da]+" "+a[b.T]+" "+a[b.S+"X"]+" "+a[b.S+"Y"]})}),wb:f.B.va(function(){var a=this.e;return a.style[this.Fa]||a.currentStyle.getAttribute(this.wa)}),
+qc:function(){var a=0;if(f.O<7){a=this.e;a=""+(a.style[f.nb+"PngFix"]||a.currentStyle.getAttribute(f.F+"png-fix"))==="true"}return a},i:f.B.va(function(){return(this.wb()||this.qc())&&!!this.j()})});f.Vb=f.B.ka({wc:["Top","Right","Bottom","Left"],Id:{thin:"1px",medium:"3px",thick:"5px"},la:function(){var a={},b={},c={},d=false,e=true,g=true,j=true;this.Cc(function(){for(var i=this.e.currentStyle,h=0,k,n,m,p,r,t,v;h<4;h++){m=this.wc[h];v=m.charAt(0).toLowerCase();k=b[v]=i["border"+m+"Style"];n=i["border"+
+m+"Color"];m=i["border"+m+"Width"];if(h>0){if(k!==p)g=false;if(n!==r)e=false;if(m!==t)j=false}p=k;r=n;t=m;c[v]=f.ha(n);m=a[v]=f.n(b[v]==="none"?"0":this.Id[m]||m);if(m.a(this.e)>0)d=true}});return d?{J:a,Zd:b,gd:c,ee:j,hd:e,$d:g}:null},ia:f.B.va(function(){var a=this.e,b=a.currentStyle,c;a.tagName in f.Ac&&a.offsetParent.currentStyle.borderCollapse==="collapse"||this.Cc(function(){c=b.borderWidth+"|"+b.borderStyle+"|"+b.borderColor});return c}),Cc:function(a){var b=this.e.runtimeStyle,c=b.borderWidth,
+d=b.borderColor;if(c)b.borderWidth="";if(d)b.borderColor="";a=a.call(this);if(c)b.borderWidth=c;if(d)b.borderColor=d;return a}});(function(){f.jb=f.B.ka({wa:"border-radius",Fa:"borderRadius",la:function(b){var c=null,d,e,g,j,i=false;if(b){e=new f.v(b);var h=function(){for(var k=[],n;(g=e.next())&&g.W();){j=f.n(g.d);n=j.ic();if(n<0)return null;if(n>0)i=true;k.push(j)}return k.length>0&&k.length<5?{tl:k[0],tr:k[1]||k[0],br:k[2]||k[0],bl:k[3]||k[1]||k[0]}:null};if(b=h()){if(g){if(g.k&f.v.qa.pa&&g.d===
+"/")d=h()}else d=b;if(i&&b&&d)c={x:b,y:d}}}return c}});var a=f.n("0");a={tl:a,tr:a,br:a,bl:a};f.jb.Dc={x:a,y:a}})();f.Ub=f.B.ka({wa:"border-image",Fa:"borderImage",fb:{stretch:1,round:1,repeat:1,space:1},la:function(a){var b=null,c,d,e,g,j,i,h=0,k=f.v.qa,n=k.na,m=k.oa,p=k.Ra;if(a){c=new f.v(a);b={};for(var r=function(l){return l&&l.k&k.pa&&l.d==="/"},t=function(l){return l&&l.k&n&&l.d==="fill"},v=function(){g=c.ma(function(l){return!(l.k&(m|p))});if(t(c.next())&&!b.fill)b.fill=true;else c.D();if(r(c.next())){h++;
+j=c.ma(function(l){return!l.W()&&!(l.k&n&&l.d==="auto")});if(r(c.next())){h++;i=c.ma(function(l){return!l.Ca()})}}else c.D()};a=c.next();){d=a.k;e=a.d;if(d&(m|p)&&!g){c.D();v()}else if(t(a)&&!b.fill){b.fill=true;v()}else if(d&n&&this.fb[e]&&!b.repeat){b.repeat={f:e};if(a=c.next())if(a.k&n&&this.fb[a.d])b.repeat.Ob=a.d;else c.D()}else if(d&k.URL&&!b.src)b.src=e;else return null}if(!b.src||!g||g.length<1||g.length>4||j&&j.length>4||h===1&&j.length<1||i&&i.length>4||h===2&&i.length<1)return null;if(!b.repeat)b.repeat=
+{f:"stretch"};if(!b.repeat.Ob)b.repeat.Ob=b.repeat.f;a=function(l,q){return{t:q(l[0]),r:q(l[1]||l[0]),b:q(l[2]||l[0]),l:q(l[3]||l[1]||l[0])}};b.slice=a(g,function(l){return f.n(l.k&m?l.d+"px":l.d)});if(j&&j[0])b.J=a(j,function(l){return l.W()?f.n(l.d):l.d});if(i&&i[0])b.Da=a(i,function(l){return l.Ca()?f.n(l.d):l.d})}return b}});f.Ic=f.B.ka({wa:"box-shadow",Fa:"boxShadow",la:function(a){var b,c=f.n,d=f.v.qa,e;if(a){e=new f.v(a);b={Da:[],Bb:[]};for(a=function(){for(var g,j,i,h,k,n;g=e.next();){i=g.d;
+j=g.k;if(j&d.pa&&i===",")break;else if(g.Ca()&&!k){e.D();k=e.ma(function(m){return!m.Ca()})}else if(j&d.z&&!h)h=i;else if(j&d.na&&i==="inset"&&!n)n=true;else return false}g=k&&k.length;if(g>1&&g<5){(n?b.Bb:b.Da).push({fe:c(k[0].d),ge:c(k[1].d),blur:c(k[2]?k[2].d:"0"),Vd:c(k[3]?k[3].d:"0"),color:f.ha(h||"currentColor")});return true}return false};a(););}return b&&(b.Bb.length||b.Da.length)?b:null}});f.Uc=f.B.ka({ia:f.B.va(function(){var a=this.e.currentStyle;return a.visibility+"|"+a.display}),la:function(){var a=
+this.e,b=a.runtimeStyle;a=a.currentStyle;var c=b.visibility,d;b.visibility="";d=a.visibility;b.visibility=c;return{ce:d!=="hidden",nd:a.display!=="none"}},i:function(){return false}});f.u={R:function(a){function b(c,d,e,g){this.e=c;this.s=d;this.g=e;this.parent=g}f.p.Eb(b.prototype,f.u,a);return b},Cb:false,Q:function(){return false},Ea:f.aa,Lb:function(){this.m();this.i()&&this.V()},ib:function(){this.Cb=true},Mb:function(){this.i()?this.V():this.m()},sb:function(a,b){this.vc(a);for(var c=this.ra||
+(this.ra=[]),d=a+1,e=c.length,g;d<e;d++)if(g=c[d])break;c[a]=b;this.I().insertBefore(b,g||null)},za:function(a){var b=this.ra;return b&&b[a]||null},vc:function(a){var b=this.za(a),c=this.Ta;if(b&&c){c.removeChild(b);this.ra[a]=null}},Aa:function(a,b,c,d){var e=this.rb||(this.rb={}),g=e[a];if(!g){g=e[a]=f.p.Za("shape");if(b)g.appendChild(g[b]=f.p.Za(b));if(d){c=this.za(d);if(!c){this.sb(d,doc.createElement("group"+d));c=this.za(d)}}c.appendChild(g);a=g.style;a.position="absolute";a.left=a.top=0;a.behavior=
+"url(#default#VML)"}return g},vb:function(a){var b=this.rb,c=b&&b[a];if(c){c.parentNode.removeChild(c);delete b[a]}return!!c},kc:function(a){var b=this.e,c=this.s.o(),d=c.h,e=c.f,g,j,i,h,k,n;c=a.x.tl.a(b,d);g=a.y.tl.a(b,e);j=a.x.tr.a(b,d);i=a.y.tr.a(b,e);h=a.x.br.a(b,d);k=a.y.br.a(b,e);n=a.x.bl.a(b,d);a=a.y.bl.a(b,e);d=Math.min(d/(c+j),e/(i+k),d/(n+h),e/(g+a));if(d<1){c*=d;g*=d;j*=d;i*=d;h*=d;k*=d;n*=d;a*=d}return{x:{tl:c,tr:j,br:h,bl:n},y:{tl:g,tr:i,br:k,bl:a}}},ya:function(a,b,c){b=b||1;var d,e,
+g=this.s.o();e=g.h*b;g=g.f*b;var j=this.g.G,i=Math.floor,h=Math.ceil,k=a?a.Jb*b:0,n=a?a.Ib*b:0,m=a?a.tb*b:0;a=a?a.Db*b:0;var p,r,t,v,l;if(c||j.i()){d=this.kc(c||j.j());c=d.x.tl*b;j=d.y.tl*b;p=d.x.tr*b;r=d.y.tr*b;t=d.x.br*b;v=d.y.br*b;l=d.x.bl*b;b=d.y.bl*b;e="m"+i(a)+","+i(j)+"qy"+i(c)+","+i(k)+"l"+h(e-p)+","+i(k)+"qx"+h(e-n)+","+i(r)+"l"+h(e-n)+","+h(g-v)+"qy"+h(e-t)+","+h(g-m)+"l"+i(l)+","+h(g-m)+"qx"+i(a)+","+h(g-b)+" x e"}else e="m"+i(a)+","+i(k)+"l"+h(e-n)+","+i(k)+"l"+h(e-n)+","+h(g-m)+"l"+i(a)+
+","+h(g-m)+"xe";return e},I:function(){var a=this.parent.za(this.N),b;if(!a){a=doc.createElement(this.Ya);b=a.style;b.position="absolute";b.top=b.left=0;this.parent.sb(this.N,a)}return a},mc:function(){var a=this.e,b=a.currentStyle,c=a.runtimeStyle,d=a.tagName,e=f.O===6,g;if(e&&(d in f.cc||d==="FIELDSET")||d==="BUTTON"||d==="INPUT"&&a.type in f.Gd){c.borderWidth="";d=this.g.w.wc;for(g=d.length;g--;){e=d[g];c["padding"+e]="";c["padding"+e]=f.n(b["padding"+e]).a(a)+f.n(b["border"+e+"Width"]).a(a)+(f.O!==
+8&&g%2?1:0)}c.borderWidth=0}else if(e){if(a.childNodes.length!==1||a.firstChild.tagName!=="ie6-mask"){b=doc.createElement("ie6-mask");d=b.style;d.visibility="visible";for(d.zoom=1;d=a.firstChild;)b.appendChild(d);a.appendChild(b);c.visibility="hidden"}}else c.borderColor="transparent"},ie:function(){},m:function(){this.parent.vc(this.N);delete this.rb;delete this.ra}};f.Rc=f.u.R({i:function(){var a=this.ed;for(var b in a)if(a.hasOwnProperty(b)&&a[b].i())return true;return false},Q:function(){return this.g.Pb.H()},
+ib:function(){if(this.i()){var a=this.jc(),b=a,c;a=a.currentStyle;var d=a.position,e=this.I().style,g=0,j=0;j=this.s.o();var i=j.Hd;if(d==="fixed"&&f.O>6){g=j.x*i;j=j.y*i;b=d}else{do b=b.offsetParent;while(b&&b.currentStyle.position==="static");if(b){c=b.getBoundingClientRect();b=b.currentStyle;g=(j.x-c.left)*i-(parseFloat(b.borderLeftWidth)||0);j=(j.y-c.top)*i-(parseFloat(b.borderTopWidth)||0)}else{b=doc.documentElement;g=(j.x+b.scrollLeft-b.clientLeft)*i;j=(j.y+b.scrollTop-b.clientTop)*i}b="absolute"}e.position=
+b;e.left=g;e.top=j;e.zIndex=d==="static"?-1:a.zIndex;this.Cb=true}},Mb:f.aa,Nb:function(){var a=this.g.Pb.j();this.I().style.display=a.ce&&a.nd?"":"none"},Lb:function(){this.i()?this.Nb():this.m()},jc:function(){var a=this.e;return a.tagName in f.Ac?a.offsetParent:a},I:function(){var a=this.Ta,b;if(!a){b=this.jc();a=this.Ta=doc.createElement("css3-container");a.style.direction="ltr";this.Nb();b.parentNode.insertBefore(a,b)}return a},ab:f.aa,m:function(){var a=this.Ta,b;if(a&&(b=a.parentNode))b.removeChild(a);
+delete this.Ta;delete this.ra}});f.Fc=f.u.R({N:2,Ya:"background",Q:function(){var a=this.g;return a.C.H()||a.G.H()},i:function(){var a=this.g;return a.q.i()||a.G.i()||a.C.i()||a.ga.i()&&a.ga.j().Bb},V:function(){var a=this.s.o();if(a.h&&a.f){this.od();this.pd()}},od:function(){var a=this.g.C.j(),b=this.s.o(),c=this.e,d=a&&a.color,e,g;if(d&&d.fa()>0){this.lc();a=this.Aa("bgColor","fill",this.I(),1);e=b.h;b=b.f;a.stroked=false;a.coordsize=e*2+","+b*2;a.coordorigin="1,1";a.path=this.ya(null,2);g=a.style;
+g.width=e;g.height=b;a.fill.color=d.U(c);c=d.fa();if(c<1)a.fill.opacity=c}else this.vb("bgColor")},pd:function(){var a=this.g.C.j(),b=this.s.o();a=a&&a.M;var c,d,e,g,j;if(a){this.lc();d=b.h;e=b.f;for(j=a.length;j--;){b=a[j];c=this.Aa("bgImage"+j,"fill",this.I(),2);c.stroked=false;c.fill.type="tile";c.fillcolor="none";c.coordsize=d*2+","+e*2;c.coordorigin="1,1";c.path=this.ya(0,2);g=c.style;g.width=d;g.height=e;if(b.P==="linear-gradient")this.bd(c,b);else{c.fill.src=b.Ab;this.Nd(c,j)}}}for(j=a?a.length:
+0;this.vb("bgImage"+j++););},Nd:function(a,b){var c=this;f.p.Rb(a.fill.src,function(d){var e=c.e,g=c.s.o(),j=g.h;g=g.f;if(j&&g){var i=a.fill,h=c.g,k=h.w.j(),n=k&&k.J;k=n?n.t.a(e):0;var m=n?n.r.a(e):0,p=n?n.b.a(e):0;n=n?n.l.a(e):0;h=h.C.j().M[b];e=h.$?h.$.coords(e,j-d.h-n-m,g-d.f-k-p):{x:0,y:0};h=h.bb;p=m=0;var r=j+1,t=g+1,v=f.O===8?0:1;n=Math.round(e.x)+n+0.5;k=Math.round(e.y)+k+0.5;i.position=n/j+","+k/g;i.size.x=1;i.size=d.h+"px,"+d.f+"px";if(h&&h!=="repeat"){if(h==="repeat-x"||h==="no-repeat"){m=
+k+1;t=k+d.f+v}if(h==="repeat-y"||h==="no-repeat"){p=n+1;r=n+d.h+v}a.style.clip="rect("+m+"px,"+r+"px,"+t+"px,"+p+"px)"}}})},bd:function(a,b){var c=this.e,d=this.s.o(),e=d.h,g=d.f;a=a.fill;d=b.ca;var j=d.length,i=Math.PI,h=f.Na,k=h.tc,n=h.dc;b=h.gc(c,e,g,b);h=b.sa;var m=b.xc,p=b.yc,r=b.Wd,t=b.Xd,v=b.rd,l=b.sd,q=b.kd,s=b.ld;b=b.rc;e=h%90?Math.atan2(q*e/g,s)/i*180:h+90;e+=180;e%=360;v=k(r,t,h,v,l);g=n(r,t,v[0],v[1]);i=[];v=k(m,p,h,r,t);n=n(m,p,v[0],v[1])/g*100;k=[];for(h=0;h<j;h++)k.push(d[h].db?d[h].db.a(c,
+b):h===0?0:h===j-1?b:null);for(h=1;h<j;h++){if(k[h]===null){m=k[h-1];b=h;do p=k[++b];while(p===null);k[h]=m+(p-m)/(b-h+1)}k[h]=Math.max(k[h],k[h-1])}for(h=0;h<j;h++)i.push(n+k[h]/g*100+"% "+d[h].color.U(c));a.angle=e;a.type="gradient";a.method="sigma";a.color=d[0].color.U(c);a.color2=d[j-1].color.U(c);if(a.colors)a.colors.value=i.join(",");else a.colors=i.join(",")},lc:function(){var a=this.e.runtimeStyle;a.backgroundImage="url(about:blank)";a.backgroundColor="transparent"},m:function(){f.u.m.call(this);
+var a=this.e.runtimeStyle;a.backgroundImage=a.backgroundColor=""}});f.Gc=f.u.R({N:4,Ya:"border",Q:function(){var a=this.g;return a.w.H()||a.G.H()},i:function(){var a=this.g;return a.G.i()&&!a.q.i()&&a.w.i()},V:function(){var a=this.e,b=this.g.w.j(),c=this.s.o(),d=c.h;c=c.f;var e,g,j,i,h;if(b){this.mc();b=this.wd(2);i=0;for(h=b.length;i<h;i++){j=b[i];e=this.Aa("borderPiece"+i,j.stroke?"stroke":"fill",this.I());e.coordsize=d*2+","+c*2;e.coordorigin="1,1";e.path=j.path;g=e.style;g.width=d;g.height=c;
+e.filled=!!j.fill;e.stroked=!!j.stroke;if(j.stroke){e=e.stroke;e.weight=j.Qb+"px";e.color=j.color.U(a);e.dashstyle=j.stroke==="dashed"?"2 2":j.stroke==="dotted"?"1 1":"solid";e.linestyle=j.stroke==="double"&&j.Qb>2?"ThinThin":"Single"}else e.fill.color=j.fill.U(a)}for(;this.vb("borderPiece"+i++););}},wd:function(a){var b=this.e,c,d,e,g=this.g.w,j=[],i,h,k,n,m=Math.round,p,r,t;if(g.i()){c=g.j();g=c.J;r=c.Zd;t=c.gd;if(c.ee&&c.$d&&c.hd){if(t.t.fa()>0){c=g.t.a(b);k=c/2;j.push({path:this.ya({Jb:k,Ib:k,
+tb:k,Db:k},a),stroke:r.t,color:t.t,Qb:c})}}else{a=a||1;c=this.s.o();d=c.h;e=c.f;c=m(g.t.a(b));k=m(g.r.a(b));n=m(g.b.a(b));b=m(g.l.a(b));var v={t:c,r:k,b:n,l:b};b=this.g.G;if(b.i())p=this.kc(b.j());i=Math.floor;h=Math.ceil;var l=function(o,u){return p?p[o][u]:0},q=function(o,u,x,y,z,B){var E=l("x",o),D=l("y",o),C=o.charAt(1)==="r";o=o.charAt(0)==="b";return E>0&&D>0?(B?"al":"ae")+(C?h(d-E):i(E))*a+","+(o?h(e-D):i(D))*a+","+(i(E)-u)*a+","+(i(D)-x)*a+","+y*65535+","+2949075*(z?1:-1):(B?"m":"l")+(C?d-
+u:u)*a+","+(o?e-x:x)*a},s=function(o,u,x,y){var z=o==="t"?i(l("x","tl"))*a+","+h(u)*a:o==="r"?h(d-u)*a+","+i(l("y","tr"))*a:o==="b"?h(d-l("x","br"))*a+","+i(e-u)*a:i(u)*a+","+h(e-l("y","bl"))*a;o=o==="t"?h(d-l("x","tr"))*a+","+h(u)*a:o==="r"?h(d-u)*a+","+h(e-l("y","br"))*a:o==="b"?i(l("x","bl"))*a+","+i(e-u)*a:i(u)*a+","+i(l("y","tl"))*a;return x?(y?"m"+o:"")+"l"+z:(y?"m"+z:"")+"l"+o};b=function(o,u,x,y,z,B){var E=o==="l"||o==="r",D=v[o],C,F;if(D>0&&r[o]!=="none"&&t[o].fa()>0){C=v[E?o:u];u=v[E?u:
+o];F=v[E?o:x];x=v[E?x:o];if(r[o]==="dashed"||r[o]==="dotted"){j.push({path:q(y,C,u,B+45,0,1)+q(y,0,0,B,1,0),fill:t[o]});j.push({path:s(o,D/2,0,1),stroke:r[o],Qb:D,color:t[o]});j.push({path:q(z,F,x,B,0,1)+q(z,0,0,B-45,1,0),fill:t[o]})}else j.push({path:q(y,C,u,B+45,0,1)+s(o,D,0,0)+q(z,F,x,B,0,0)+(r[o]==="double"&&D>2?q(z,F-i(F/3),x-i(x/3),B-45,1,0)+s(o,h(D/3*2),1,0)+q(y,C-i(C/3),u-i(u/3),B,1,0)+"x "+q(y,i(C/3),i(u/3),B+45,0,1)+s(o,i(D/3),1,0)+q(z,i(F/3),i(x/3),B,0,0):"")+q(z,0,0,B-45,1,0)+s(o,0,1,
+0)+q(y,0,0,B,1,0),fill:t[o]})}};b("t","l","r","tl","tr",90);b("r","t","b","tr","br",0);b("b","r","l","br","bl",-90);b("l","b","t","bl","tl",-180)}}return j},m:function(){if(this.ec||!this.g.q.i())this.e.runtimeStyle.borderColor="";f.u.m.call(this)}});f.Tb=f.u.R({N:5,Md:["t","tr","r","br","b","bl","l","tl","c"],Q:function(){return this.g.q.H()},i:function(){return this.g.q.i()},V:function(){this.I();var a=this.g.q.j(),b=this.g.w.j(),c=this.s.o(),d=this.e,e=this.uc;f.p.Rb(a.src,function(g){function j(s,
+o,u,x,y){s=e[s].style;var z=Math.max;s.width=z(o,0);s.height=z(u,0);s.left=x;s.top=y}function i(s,o,u){for(var x=0,y=s.length;x<y;x++)e[s[x]].imagedata[o]=u}var h=c.h,k=c.f,n=f.n("0"),m=a.J||(b?b.J:{t:n,r:n,b:n,l:n});n=m.t.a(d);var p=m.r.a(d),r=m.b.a(d);m=m.l.a(d);var t=a.slice,v=t.t.a(d),l=t.r.a(d),q=t.b.a(d);t=t.l.a(d);j("tl",m,n,0,0);j("t",h-m-p,n,m,0);j("tr",p,n,h-p,0);j("r",p,k-n-r,h-p,n);j("br",p,r,h-p,k-r);j("b",h-m-p,r,m,k-r);j("bl",m,r,0,k-r);j("l",m,k-n-r,0,n);j("c",h-m-p,k-n-r,m,n);i(["tl",
+"t","tr"],"cropBottom",(g.f-v)/g.f);i(["tl","l","bl"],"cropRight",(g.h-t)/g.h);i(["bl","b","br"],"cropTop",(g.f-q)/g.f);i(["tr","r","br"],"cropLeft",(g.h-l)/g.h);i(["l","r","c"],"cropTop",v/g.f);i(["l","r","c"],"cropBottom",q/g.f);i(["t","b","c"],"cropLeft",t/g.h);i(["t","b","c"],"cropRight",l/g.h);e.c.style.display=a.fill?"":"none"},this)},I:function(){var a=this.parent.za(this.N),b,c,d,e=this.Md,g=e.length;if(!a){a=doc.createElement("border-image");b=a.style;b.position="absolute";this.uc={};for(d=
+0;d<g;d++){c=this.uc[e[d]]=f.p.Za("rect");c.appendChild(f.p.Za("imagedata"));b=c.style;b.behavior="url(#default#VML)";b.position="absolute";b.top=b.left=0;c.imagedata.src=this.g.q.j().src;c.stroked=false;c.filled=false;a.appendChild(c)}this.parent.sb(this.N,a)}return a},Ea:function(){if(this.i()){var a=this.e,b=a.runtimeStyle,c=this.g.q.j().J;b.borderStyle="solid";if(c){b.borderTopWidth=c.t.a(a)+"px";b.borderRightWidth=c.r.a(a)+"px";b.borderBottomWidth=c.b.a(a)+"px";b.borderLeftWidth=c.l.a(a)+"px"}this.mc()}},
+m:function(){var a=this.e.runtimeStyle;a.borderStyle="";if(this.ec||!this.g.w.i())a.borderColor=a.borderWidth="";f.u.m.call(this)}});f.Hc=f.u.R({N:1,Ya:"outset-box-shadow",Q:function(){var a=this.g;return a.ga.H()||a.G.H()},i:function(){var a=this.g.ga;return a.i()&&a.j().Da[0]},V:function(){function a(C,F,O,H,M,P,I){C=b.Aa("shadow"+C+F,"fill",d,j-C);F=C.fill;C.coordsize=n*2+","+m*2;C.coordorigin="1,1";C.stroked=false;C.filled=true;F.color=M.U(c);if(P){F.type="gradienttitle";F.color2=F.color;F.opacity=
+0}C.path=I;l=C.style;l.left=O;l.top=H;l.width=n;l.height=m;return C}var b=this,c=this.e,d=this.I(),e=this.g,g=e.ga.j().Da;e=e.G.j();var j=g.length,i=j,h,k=this.s.o(),n=k.h,m=k.f;k=f.O===8?1:0;for(var p=["tl","tr","br","bl"],r,t,v,l,q,s,o,u,x,y,z,B,E,D;i--;){t=g[i];q=t.fe.a(c);s=t.ge.a(c);h=t.Vd.a(c);o=t.blur.a(c);t=t.color;u=-h-o;if(!e&&o)e=f.jb.Dc;u=this.ya({Jb:u,Ib:u,tb:u,Db:u},2,e);if(o){x=(h+o)*2+n;y=(h+o)*2+m;z=x?o*2/x:0;B=y?o*2/y:0;if(o-h>n/2||o-h>m/2)for(h=4;h--;){r=p[h];E=r.charAt(0)==="b";
+D=r.charAt(1)==="r";r=a(i,r,q,s,t,o,u);v=r.fill;v.focusposition=(D?1-z:z)+","+(E?1-B:B);v.focussize="0,0";r.style.clip="rect("+((E?y/2:0)+k)+"px,"+(D?x:x/2)+"px,"+(E?y:y/2)+"px,"+((D?x/2:0)+k)+"px)"}else{r=a(i,"",q,s,t,o,u);v=r.fill;v.focusposition=z+","+B;v.focussize=1-z*2+","+(1-B*2)}}else{r=a(i,"",q,s,t,o,u);q=t.fa();if(q<1)r.fill.opacity=q}}}});f.Pc=f.u.R({N:6,Ya:"imgEl",Q:function(){var a=this.g;return this.e.src!==this.Xc||a.G.H()},i:function(){var a=this.g;return a.G.i()||a.C.qc()},V:function(){this.Xc=
+j;this.Cd();var a=this.Aa("img","fill",this.I()),b=a.fill,c=this.s.o(),d=c.h;c=c.f;var e=this.g.w.j(),g=e&&e.J;e=this.e;var j=e.src,i=Math.round,h=e.currentStyle,k=f.n;if(!g||f.O<7){g=f.n("0");g={t:g,r:g,b:g,l:g}}a.stroked=false;b.type="frame";b.src=j;b.position=(d?0.5/d:0)+","+(c?0.5/c:0);a.coordsize=d*2+","+c*2;a.coordorigin="1,1";a.path=this.ya({Jb:i(g.t.a(e)+k(h.paddingTop).a(e)),Ib:i(g.r.a(e)+k(h.paddingRight).a(e)),tb:i(g.b.a(e)+k(h.paddingBottom).a(e)),Db:i(g.l.a(e)+k(h.paddingLeft).a(e))},
+2);a=a.style;a.width=d;a.height=c},Cd:function(){this.e.runtimeStyle.filter="alpha(opacity=0)"},m:function(){f.u.m.call(this);this.e.runtimeStyle.filter=""}});f.Oc=f.u.R({ib:f.aa,Mb:f.aa,Nb:f.aa,Lb:f.aa,Ld:/^,+|,+$/g,Fd:/,+/g,gb:function(a,b){(this.pb||(this.pb=[]))[a]=b||void 0},ab:function(){var a=this.pb,b;if(a&&(b=a.join(",").replace(this.Ld,"").replace(this.Fd,","))!==this.Wc)this.Wc=this.e.runtimeStyle.background=b},m:function(){this.e.runtimeStyle.background="";delete this.pb}});f.Mc=f.u.R({ua:1,
+Q:function(){return this.g.C.H()},i:function(){var a=this.g;return a.C.i()||a.q.i()},V:function(){var a=this.g.C.j(),b,c,d=0,e,g;if(a){b=[];if(c=a.M)for(;e=c[d++];)if(e.P==="linear-gradient"){g=this.vd(e.Wa);g=(e.Xa||f.Ka.Kc).a(this.e,g.h,g.f,g.h,g.f);b.push("url(data:image/svg+xml,"+escape(this.xd(e,g.h,g.f))+") "+this.dd(e.$)+" / "+g.h+"px "+g.f+"px "+(e.bc||"")+" "+(e.Wa||"")+" "+(e.ub||""))}else b.push(e.Hb);a.color&&b.push(a.color.Y);this.parent.gb(this.ua,b.join(","))}},dd:function(a){return a?
+a.X.map(function(b){return b.d}).join(" "):"0 0"},vd:function(a){var b=this.e,c=this.s.o(),d=c.h;c=c.f;var e;if(a!=="border-box")if((e=this.g.w.j())&&(e=e.J)){d-=e.l.a(b)+e.l.a(b);c-=e.t.a(b)+e.b.a(b)}if(a==="content-box"){a=f.n;e=b.currentStyle;d-=a(e.paddingLeft).a(b)+a(e.paddingRight).a(b);c-=a(e.paddingTop).a(b)+a(e.paddingBottom).a(b)}return{h:d,f:c}},xd:function(a,b,c){var d=this.e,e=a.ca,g=e.length,j=f.Na.gc(d,b,c,a);a=j.xc;var i=j.yc,h=j.td,k=j.ud;j=j.rc;var n,m,p,r,t;n=[];for(m=0;m<g;m++)n.push(e[m].db?
+e[m].db.a(d,j):m===0?0:m===g-1?j:null);for(m=1;m<g;m++)if(n[m]===null){r=n[m-1];p=m;do t=n[++p];while(t===null);n[m]=r+(t-r)/(p-m+1)}b=['<svg width="'+b+'" height="'+c+'" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="g" gradientUnits="userSpaceOnUse" x1="'+a/b*100+'%" y1="'+i/c*100+'%" x2="'+h/b*100+'%" y2="'+k/c*100+'%">'];for(m=0;m<g;m++)b.push('<stop offset="'+n[m]/j+'" stop-color="'+e[m].color.U(d)+'" stop-opacity="'+e[m].color.fa()+'"/>');b.push('</linearGradient></defs><rect width="100%" height="100%" fill="url(#g)"/></svg>');
+return b.join("")},m:function(){this.parent.gb(this.ua)}});f.Nc=f.u.R({T:"repeat",Sc:"stretch",Qc:"round",ua:0,Q:function(){return this.g.q.H()},i:function(){return this.g.q.i()},V:function(){var a=this,b=a.g.q.j(),c=a.g.w.j(),d=a.s.o(),e=b.repeat,g=e.f,j=e.Ob,i=a.e,h=0;f.p.Rb(b.src,function(k){function n(Q,R,U,V,W,Y,X,S,w,A){K.push('<pattern patternUnits="userSpaceOnUse" id="pattern'+G+'" x="'+(g===l?Q+U/2-w/2:Q)+'" y="'+(j===l?R+V/2-A/2:R)+'" width="'+w+'" height="'+A+'"><svg width="'+w+'" height="'+
+A+'" viewBox="'+W+" "+Y+" "+X+" "+S+'" preserveAspectRatio="none"><image xlink:href="'+v+'" x="0" y="0" width="'+r+'" height="'+t+'" /></svg></pattern>');J.push('<rect x="'+Q+'" y="'+R+'" width="'+U+'" height="'+V+'" fill="url(#pattern'+G+')" />');G++}var m=d.h,p=d.f,r=k.h,t=k.f,v=a.Dd(b.src,r,t),l=a.T,q=a.Sc;k=a.Qc;var s=Math.ceil,o=f.n("0"),u=b.J||(c?c.J:{t:o,r:o,b:o,l:o});o=u.t.a(i);var x=u.r.a(i),y=u.b.a(i);u=u.l.a(i);var z=b.slice,B=z.t.a(i),E=z.r.a(i),D=z.b.a(i);z=z.l.a(i);var C=m-u-x,F=p-o-
+y,O=r-z-E,H=t-B-D,M=g===q?C:O*o/B,P=j===q?F:H*x/E,I=g===q?C:O*y/D;q=j===q?F:H*u/z;var K=[],J=[],G=0;if(g===k){M-=(M-(C%M||M))/s(C/M);I-=(I-(C%I||I))/s(C/I)}if(j===k){P-=(P-(F%P||P))/s(F/P);q-=(q-(F%q||q))/s(F/q)}k=['<svg width="'+m+'" height="'+p+'" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">'];n(0,0,u,o,0,0,z,B,u,o);n(u,0,C,o,z,0,O,B,M,o);n(m-x,0,x,o,r-E,0,E,B,x,o);n(0,o,u,F,0,B,z,H,u,q);if(b.fill)n(u,o,C,F,z,B,O,H,M||I||O,q||P||H);n(m-x,o,x,F,r-E,B,E,H,x,P);n(0,
+p-y,u,y,0,t-D,z,D,u,y);n(u,p-y,C,y,z,t-D,O,D,I,y);n(m-x,p-y,x,y,r-E,t-D,E,D,x,y);k.push("<defs>"+K.join("\n")+"</defs>"+J.join("\n")+"</svg>");a.parent.gb(a.ua,"url(data:image/svg+xml,"+escape(k.join(""))+") no-repeat border-box border-box");h&&a.parent.ab()},a);h=1},Dd:function(){var a={};return function(b,c,d){var e=a[b],g;if(!e){e=new Image;g=doc.createElement("canvas");e.src=b;g.width=c;g.height=d;g.getContext("2d").drawImage(e,0,0);e=a[b]=g.toDataURL()}return e}}(),Ea:f.Tb.prototype.Ea,m:function(){var a=
+this.e.runtimeStyle;this.parent.gb(this.ua);a.borderColor=a.borderStyle=a.borderWidth=""}});f.kb=function(){function a(l,q){l.className+=" "+q}function b(l){var q=v.slice.call(arguments,1),s=q.length;setTimeout(function(){if(l)for(;s--;)a(l,q[s])},0)}function c(l){var q=v.slice.call(arguments,1),s=q.length;setTimeout(function(){if(l)for(;s--;){var o=q[s];o=t[o]||(t[o]=new RegExp("\\b"+o+"\\b","g"));l.className=l.className.replace(o,"")}},0)}function d(l){function q(){if(!U){var w,A,L=f.ja,T=l.currentStyle,
+N=T.getAttribute(g)==="true",da=T.getAttribute(i)!=="false",ea=T.getAttribute(h)!=="false";S=T.getAttribute(j);S=L>7?S!=="false":S==="true";if(!R){R=1;l.runtimeStyle.zoom=1;T=l;for(var fa=1;T=T.previousSibling;)if(T.nodeType===1){fa=0;break}fa&&a(l,p)}J.cb();if(N&&(A=J.o())&&(w=doc.documentElement||doc.body)&&(A.y>w.clientHeight||A.x>w.clientWidth||A.y+A.f<0||A.x+A.h<0)){if(!Y){Y=1;f.mb.ba(q)}}else{U=1;Y=R=0;f.mb.Ha(q);if(L===9){G={C:new f.Sb(l),q:new f.Ub(l),w:new f.Vb(l)};Q=[G.C,G.q];K=new f.Oc(l,
+J,G);w=[new f.Mc(l,J,G,K),new f.Nc(l,J,G,K)]}else{G={C:new f.Sb(l),w:new f.Vb(l),q:new f.Ub(l),G:new f.jb(l),ga:new f.Ic(l),Pb:new f.Uc(l)};Q=[G.C,G.w,G.q,G.G,G.ga,G.Pb];K=new f.Rc(l,J,G);w=[new f.Hc(l,J,G,K),new f.Fc(l,J,G,K),new f.Gc(l,J,G,K),new f.Tb(l,J,G,K)];l.tagName==="IMG"&&w.push(new f.Pc(l,J,G,K));K.ed=w}I=[K].concat(w);if(w=l.currentStyle.getAttribute(f.F+"watch-ancestors")){w=parseInt(w,10);A=0;for(N=l.parentNode;N&&(w==="NaN"||A++<w);){H(N,"onpropertychange",C);H(N,"onmouseenter",x);
+H(N,"onmouseleave",y);H(N,"onmousedown",z);if(N.tagName in f.fc){H(N,"onfocus",E);H(N,"onblur",D)}N=N.parentNode}}if(S){f.Oa.ba(o);f.Oa.Rd()}o(1)}if(!V){V=1;L<9&&H(l,"onmove",s);H(l,"onresize",s);H(l,"onpropertychange",u);ea&&H(l,"onmouseenter",x);if(ea||da)H(l,"onmouseleave",y);da&&H(l,"onmousedown",z);if(l.tagName in f.fc){H(l,"onfocus",E);H(l,"onblur",D)}f.Qa.ba(s);f.L.ba(M)}J.hb()}}function s(){J&&J.Ad()&&o()}function o(w){if(!X)if(U){var A,L=I.length;F();for(A=0;A<L;A++)I[A].Ea();if(w||J.Od())for(A=
+0;A<L;A++)I[A].ib();if(w||J.Td())for(A=0;A<L;A++)I[A].Mb();K.ab();O()}else R||q()}function u(){var w,A=I.length,L;w=event;if(!X&&!(w&&w.propertyName in r))if(U){F();for(w=0;w<A;w++)I[w].Ea();for(w=0;w<A;w++){L=I[w];L.Cb||L.ib();L.Q()&&L.Lb()}K.ab();O()}else R||q()}function x(){b(l,k)}function y(){c(l,k,n)}function z(){b(l,n);f.lb.ba(B)}function B(){c(l,n);f.lb.Ha(B)}function E(){b(l,m)}function D(){c(l,m)}function C(){var w=event.propertyName;if(w==="className"||w==="id")u()}function F(){J.cb();for(var w=
+Q.length;w--;)Q[w].cb()}function O(){for(var w=Q.length;w--;)Q[w].hb();J.hb()}function H(w,A,L){w.attachEvent(A,L);W.push([w,A,L])}function M(){if(V){for(var w=W.length,A;w--;){A=W[w];A[0].detachEvent(A[1],A[2])}f.L.Ha(M);V=0;W=[]}}function P(){if(!X){var w,A;M();X=1;if(I){w=0;for(A=I.length;w<A;w++){I[w].ec=1;I[w].m()}}S&&f.Oa.Ha(o);f.Qa.Ha(o);I=J=G=Q=l=null}}var I,K,J=new ha(l),G,Q,R,U,V,W=[],Y,X,S;this.Ed=q;this.update=o;this.m=P;this.qd=l}var e={},g=f.F+"lazy-init",j=f.F+"poll",i=f.F+"track-active",
+h=f.F+"track-hover",k=f.La+"hover",n=f.La+"active",m=f.La+"focus",p=f.La+"first-child",r={background:1,bgColor:1,display:1},t={},v=[];d.yd=function(l){var q=f.p.Ba(l);return e[q]||(e[q]=new d(l))};d.m=function(l){l=f.p.Ba(l);var q=e[l];if(q){q.m();delete e[l]}};d.md=function(){var l=[],q;if(e){for(var s in e)if(e.hasOwnProperty(s)){q=e[s];l.push(q.qd);q.m()}e={}}return l};return d}();f.supportsVML=f.zc;f.attach=function(a){f.ja<10&&f.zc&&f.kb.yd(a).Ed()};f.detach=function(a){f.kb.m(a)}};
+var $=element;function init(){if(doc.media!=="print"){var a=window.PIE;a&&a.attach($)}}function cleanup(){if(doc.media!=="print"){var a=window.PIE;if(a){a.detach($);$=0}}}$.readyState==="complete"&&init();
+</script>
+</PUBLIC:COMPONENT>

+ 211 - 211
demo/public/static/js/ajaxfileupload.js

@@ -1,211 +1,211 @@
-
-jQuery.extend({
-	
-
-    createUploadIframe: function(id, uri)
-	{
-			//create frame
-            var frameId = 'jUploadFrame' + id;
-            var iframeHtml = '<iframe id="' + frameId + '" name="' + frameId + '" style="position:absolute; top:-9999px; left:-9999px"';
-			if(window.ActiveXObject)
-			{
-                if(typeof uri== 'boolean'){
-					iframeHtml += ' src="' + 'javascript:false' + '"';
-
-                }
-                else if(typeof uri== 'string'){
-					iframeHtml += ' src="' + uri + '"';
-
-                }	
-			}
-			iframeHtml += ' />';
-			jQuery(iframeHtml).appendTo(document.body);
-
-            return jQuery('#' + frameId).get(0);			
-    },
-    createUploadForm: function(id, fileElementId, data)
-	{
-		//create form	
-		var formId = 'jUploadForm' + id;
-		var fileId = 'jUploadFile' + id;
-		var form = jQuery('<form  action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"></form>');	
-		if(data)
-		{
-			for(var i in data)
-			{
-				jQuery('<input type="hidden" name="' + i + '" value="' + data[i] + '" />').appendTo(form);
-			}			
-		}		
-		var oldElement = jQuery('#' + fileElementId);
-		var newElement = jQuery(oldElement).clone();
-		jQuery(oldElement).attr('id', fileId);
-		jQuery(oldElement).before(newElement);
-		jQuery(oldElement).appendTo(form);
-
-
-		
-		//set attributes
-		jQuery(form).css('position', 'absolute');
-		jQuery(form).css('top', '-1200px');
-		jQuery(form).css('left', '-1200px');
-		jQuery(form).appendTo('body');		
-		return form;
-    },
-
-    ajaxFileUpload: function(s) {
-        // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout		
-        s = jQuery.extend({}, jQuery.ajaxSettings, s);
-        var id = new Date().getTime()        
-		var form = jQuery.createUploadForm(id, s.fileElementId, (typeof(s.data)=='undefined'?false:s.data));
-		var io = jQuery.createUploadIframe(id, s.secureuri);
-		var frameId = 'jUploadFrame' + id;
-		var formId = 'jUploadForm' + id;		
-        // Watch for a new set of requests
-        if ( s.global && ! jQuery.active++ )
-		{
-			jQuery.event.trigger( "ajaxStart" );
-		}            
-        var requestDone = false;
-        // Create the request object
-        var xml = {}   
-        if ( s.global )
-            jQuery.event.trigger("ajaxSend", [xml, s]);
-        // Wait for a response to come back
-        var uploadCallback = function(isTimeout)
-		{			
-			var io = document.getElementById(frameId);
-            try 
-			{				
-				if(io.contentWindow)
-				{
-					 xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
-                	 xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
-					 
-				}else if(io.contentDocument)
-				{
-					 xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
-                	xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
-				}						
-            }catch(e)
-			{
-				jQuery.handleError(s, xml, null, e);
-			}
-            if ( xml || isTimeout == "timeout") 
-			{				
-                requestDone = true;
-                var status;
-                try {
-                    status = isTimeout != "timeout" ? "success" : "error";
-                    // Make sure that the request was successful or notmodified
-                    if ( status != "error" )
-					{
-                        // process the data (runs the xml through httpData regardless of callback)
-                        var data = jQuery.uploadHttpData( xml, s.dataType );    
-                        // If a local callback was specified, fire it and pass it the data
-                        if ( s.success )
-                            s.success( data, status );
-    
-                        // Fire the global callback
-                        if( s.global )
-                            jQuery.event.trigger( "ajaxSuccess", [xml, s] );
-                    } else
-                        jQuery.handleError(s, xml, status);
-                } catch(e) 
-				{
-                    status = "error";
-                    jQuery.handleError(s, xml, status, e);
-                }
-
-                // The request was completed
-                if( s.global )
-                    jQuery.event.trigger( "ajaxComplete", [xml, s] );
-
-                // Handle the global AJAX counter
-                if ( s.global && ! --jQuery.active )
-                    jQuery.event.trigger( "ajaxStop" );
-
-                // Process result
-                if ( s.complete )
-                    s.complete(xml, status);
-
-                jQuery(io).unbind()
-
-                setTimeout(function()
-									{	try 
-										{
-											jQuery(io).remove();
-											jQuery(form).remove();	
-											
-										} catch(e) 
-										{
-											jQuery.handleError(s, xml, null, e);
-										}									
-
-									}, 100)
-
-                xml = null
-
-            }
-        }
-        // Timeout checker
-        if ( s.timeout > 0 ) 
-		{
-            setTimeout(function(){
-                // Check to see if the request is still happening
-                if( !requestDone ) uploadCallback( "timeout" );
-            }, s.timeout);
-        }
-        try 
-		{
-
-			var form = jQuery('#' + formId);
-			jQuery(form).attr('action', s.url);
-			jQuery(form).attr('method', 'POST');
-			jQuery(form).attr('target', frameId);
-            if(form.encoding)
-			{
-				jQuery(form).attr('encoding', 'multipart/form-data');      			
-            }
-            else
-			{	
-				jQuery(form).attr('enctype', 'multipart/form-data');			
-            }			
-            jQuery(form).submit();
-
-        } catch(e) 
-		{			
-            jQuery.handleError(s, xml, null, e);
-        }
-		
-		jQuery('#' + frameId).load(uploadCallback	);
-        return {abort: function () {}};	
-
-    },
-
-    uploadHttpData: function( r, type ) {
-        var data = !type;
-        data = type == "xml" || data ? r.responseXML : r.responseText;
-        // If the type is "script", eval it in global context
-        if ( type == "script" )
-            jQuery.globalEval( data );
-        // Get the JavaScript object, if JSON is used.
-        if ( type == "json" )
-            eval( "data = " + data );
-        // evaluate scripts within html
-        if ( type == "html" )
-            jQuery("<div>").html(data).evalScripts();
-
-        return data;
-    },
-    handleError: function( s, xhr, status, e )      {  
-        // If a local callback was specified, fire it  
-                if ( s.error ) {  
-                    s.error.call( s.context || s, xhr, status, e );  
-                }
-                // Fire the global callback  
-                if ( s.global ) {  
-                    (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] );  
-                }  
-    }  
-})
-
+
+jQuery.extend({
+	
+
+    createUploadIframe: function(id, uri)
+	{
+			//create frame
+            var frameId = 'jUploadFrame' + id;
+            var iframeHtml = '<iframe id="' + frameId + '" name="' + frameId + '" style="position:absolute; top:-9999px; left:-9999px"';
+			if(window.ActiveXObject)
+			{
+                if(typeof uri== 'boolean'){
+					iframeHtml += ' src="' + 'javascript:false' + '"';
+
+                }
+                else if(typeof uri== 'string'){
+					iframeHtml += ' src="' + uri + '"';
+
+                }	
+			}
+			iframeHtml += ' />';
+			jQuery(iframeHtml).appendTo(document.body);
+
+            return jQuery('#' + frameId).get(0);			
+    },
+    createUploadForm: function(id, fileElementId, data)
+	{
+		//create form	
+		var formId = 'jUploadForm' + id;
+		var fileId = 'jUploadFile' + id;
+		var form = jQuery('<form  action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"></form>');	
+		if(data)
+		{
+			for(var i in data)
+			{
+				jQuery('<input type="hidden" name="' + i + '" value="' + data[i] + '" />').appendTo(form);
+			}			
+		}		
+		var oldElement = jQuery('#' + fileElementId);
+		var newElement = jQuery(oldElement).clone();
+		jQuery(oldElement).attr('id', fileId);
+		jQuery(oldElement).before(newElement);
+		jQuery(oldElement).appendTo(form);
+
+
+		
+		//set attributes
+		jQuery(form).css('position', 'absolute');
+		jQuery(form).css('top', '-1200px');
+		jQuery(form).css('left', '-1200px');
+		jQuery(form).appendTo('body');		
+		return form;
+    },
+
+    ajaxFileUpload: function(s) {
+        // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout		
+        s = jQuery.extend({}, jQuery.ajaxSettings, s);
+        var id = new Date().getTime()        
+		var form = jQuery.createUploadForm(id, s.fileElementId, (typeof(s.data)=='undefined'?false:s.data));
+		var io = jQuery.createUploadIframe(id, s.secureuri);
+		var frameId = 'jUploadFrame' + id;
+		var formId = 'jUploadForm' + id;		
+        // Watch for a new set of requests
+        if ( s.global && ! jQuery.active++ )
+		{
+			jQuery.event.trigger( "ajaxStart" );
+		}            
+        var requestDone = false;
+        // Create the request object
+        var xml = {}   
+        if ( s.global )
+            jQuery.event.trigger("ajaxSend", [xml, s]);
+        // Wait for a response to come back
+        var uploadCallback = function(isTimeout)
+		{			
+			var io = document.getElementById(frameId);
+            try 
+			{				
+				if(io.contentWindow)
+				{
+					 xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
+                	 xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
+					 
+				}else if(io.contentDocument)
+				{
+					 xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
+                	xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
+				}						
+            }catch(e)
+			{
+				jQuery.handleError(s, xml, null, e);
+			}
+            if ( xml || isTimeout == "timeout") 
+			{				
+                requestDone = true;
+                var status;
+                try {
+                    status = isTimeout != "timeout" ? "success" : "error";
+                    // Make sure that the request was successful or notmodified
+                    if ( status != "error" )
+					{
+                        // process the data (runs the xml through httpData regardless of callback)
+                        var data = jQuery.uploadHttpData( xml, s.dataType );    
+                        // If a local callback was specified, fire it and pass it the data
+                        if ( s.success )
+                            s.success( data, status );
+    
+                        // Fire the global callback
+                        if( s.global )
+                            jQuery.event.trigger( "ajaxSuccess", [xml, s] );
+                    } else
+                        jQuery.handleError(s, xml, status);
+                } catch(e) 
+				{
+                    status = "error";
+                    jQuery.handleError(s, xml, status, e);
+                }
+
+                // The request was completed
+                if( s.global )
+                    jQuery.event.trigger( "ajaxComplete", [xml, s] );
+
+                // Handle the global AJAX counter
+                if ( s.global && ! --jQuery.active )
+                    jQuery.event.trigger( "ajaxStop" );
+
+                // Process result
+                if ( s.complete )
+                    s.complete(xml, status);
+
+                jQuery(io).unbind()
+
+                setTimeout(function()
+									{	try 
+										{
+											jQuery(io).remove();
+											jQuery(form).remove();	
+											
+										} catch(e) 
+										{
+											jQuery.handleError(s, xml, null, e);
+										}									
+
+									}, 100)
+
+                xml = null
+
+            }
+        }
+        // Timeout checker
+        if ( s.timeout > 0 ) 
+		{
+            setTimeout(function(){
+                // Check to see if the request is still happening
+                if( !requestDone ) uploadCallback( "timeout" );
+            }, s.timeout);
+        }
+        try 
+		{
+
+			var form = jQuery('#' + formId);
+			jQuery(form).attr('action', s.url);
+			jQuery(form).attr('method', 'POST');
+			jQuery(form).attr('target', frameId);
+            if(form.encoding)
+			{
+				jQuery(form).attr('encoding', 'multipart/form-data');      			
+            }
+            else
+			{	
+				jQuery(form).attr('enctype', 'multipart/form-data');			
+            }			
+            jQuery(form).submit();
+
+        } catch(e) 
+		{			
+            jQuery.handleError(s, xml, null, e);
+        }
+		
+		jQuery('#' + frameId).load(uploadCallback	);
+        return {abort: function () {}};	
+
+    },
+
+    uploadHttpData: function( r, type ) {
+        var data = !type;
+        data = type == "xml" || data ? r.responseXML : r.responseText;
+        // If the type is "script", eval it in global context
+        if ( type == "script" )
+            jQuery.globalEval( data );
+        // Get the JavaScript object, if JSON is used.
+        if ( type == "json" )
+            eval( "data = " + data );
+        // evaluate scripts within html
+        if ( type == "html" )
+            jQuery("<div>").html(data).evalScripts();
+
+        return data;
+    },
+    handleError: function( s, xhr, status, e )      {  
+        // If a local callback was specified, fire it  
+                if ( s.error ) {  
+                    s.error.call( s.context || s, xhr, status, e );  
+                }
+                // Fire the global callback  
+                if ( s.global ) {  
+                    (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] );  
+                }  
+    }  
+})
+

+ 46 - 46
demo/public/static/js/cloud.js

@@ -1,47 +1,47 @@
-
-// Cloud Float...
-    var $main = $cloud = mainwidth = null;
-    var offset1 = 450;
-	var offset2 = 0;
-	
-	var offsetbg = 0;
-    
-    $(document).ready(
-        function () {
-            $main = $("#mainBody");
-			$body = $("body");
-            $cloud1 = $("#cloud1");
-			$cloud2 = $("#cloud2");
-			
-            mainwidth = $main.outerWidth();
-         
-        }
-    );
-
-    /// 飘动
-    setInterval(function flutter() {
-        if (offset1 >= mainwidth) {
-            offset1 =  -580;
-        }
-
-        if (offset2 >= mainwidth) {
-			 offset2 =  -580;
-        }
-		
-        offset1 += 1.1;
-		offset2 += 1;
-        $cloud1.css("background-position", offset1 + "px 100px")
-		
-		$cloud2.css("background-position", offset2 + "px 460px")
-    }, 70);
-	
-	
-	setInterval(function bg() {
-        if (offsetbg >= mainwidth) {
-            offsetbg =  -580;
-        }
-
-        offsetbg += 0.9;
-        $body.css("background-position", -offsetbg + "px 0")
-    }, 90 );
+
+// Cloud Float...
+    var $main = $cloud = mainwidth = null;
+    var offset1 = 450;
+	var offset2 = 0;
+	
+	var offsetbg = 0;
+    
+    $(document).ready(
+        function () {
+            $main = $("#mainBody");
+			$body = $("body");
+            $cloud1 = $("#cloud1");
+			$cloud2 = $("#cloud2");
+			
+            mainwidth = $main.outerWidth();
+         
+        }
+    );
+
+    /// 飘动
+    setInterval(function flutter() {
+        if (offset1 >= mainwidth) {
+            offset1 =  -580;
+        }
+
+        if (offset2 >= mainwidth) {
+			 offset2 =  -580;
+        }
+		
+        offset1 += 1.1;
+		offset2 += 1;
+        $cloud1.css("background-position", offset1 + "px 100px")
+		
+		$cloud2.css("background-position", offset2 + "px 460px")
+    }, 70);
+	
+	
+	setInterval(function bg() {
+        if (offsetbg >= mainwidth) {
+            offsetbg =  -580;
+        }
+
+        offsetbg += 0.9;
+        $body.css("background-position", -offsetbg + "px 0")
+    }, 90 );
 	

+ 2566 - 2566
demo/public/static/js/editor/kindeditor.js

@@ -1,2566 +1,2566 @@
-/*******************************************************************************
-* KindEditor - WYSIWYG HTML Editor for Internet
-*
-* @author Roddy <luolonghao@gmail.com>
-* @site http://www.kindsoft.net/
-* @licence LGPL(http://www.opensource.org/licenses/lgpl-license.php)
-* @version 3.2.1
-*******************************************************************************/
-
-var KE = {};
-
-KE.version = '3.2.1';
-
-KE.lang = {
-    source : '切换模式',
-    preview : '预览',
-    undo : '后退(Ctrl+Z)',
-    redo : '前进(Ctrl+Y)',
-    cut : '剪切(Ctrl+X)',
-    copy : '复制(Ctrl+C)',
-    paste : '粘贴(Ctrl+V)',
-    plainpaste : '粘贴为无格式文本',
-    wordpaste : '从Word粘贴',
-    selectall : '全选',
-    justifyleft : '左对齐',
-    justifycenter : '居中',
-    justifyright : '右对齐',
-    justifyfull : '两端对齐',
-    insertorderedlist : '编号',
-    insertunorderedlist : '项目符号',
-    indent : '增加缩进',
-    outdent : '减少缩进',
-    subscript : '下标',
-    superscript : '上标',
-    date : '插入当前日期',
-    time : '插入当前时间',
-    title : '标题',
-    fontname : '字体',
-    fontsize : '文字大小',
-    textcolor : '文字颜色',
-    bgcolor : '文字背景',
-    bold : '粗体',
-    italic : '斜体',
-    underline : '下划线',
-    strikethrough : '删除线',
-    removeformat : '删除格式',
-    image : '插入图片',
-    flash : '插入Flash',
-    media : '插入多媒体',
-    layer : '插入层',
-    table : '插入表格',
-    specialchar : '插入特殊字符',
-    hr : '插入横线',
-    emoticons : '插入笑脸',
-    link : '超级连接',
-    unlink : '取消超级连接',
-    fullscreen : '全屏显示',
-    about : '关于',
-    print : '打印',
-    yes : '确定',
-    no : '取消',
-    close : '关闭',
-    invalidImg : "请输入有效的URL地址。\n只允许jpg,gif,bmp,png格式。",
-    invalidMedia : "请输入有效的URL地址。\n只允许mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb格式。",
-    invalidWidth : "宽度必须为数字。",
-    invalidHeight : "高度必须为数字。",
-    invalidBorder : "边框必须为数字。",
-    invalidUrl : "URL不正确。",
-    pleaseInput : "请输入内容"
-};
-
-KE.scriptPath = (function() {
-    var elements = document.getElementsByTagName('script');
-    for (var i = 0, len = elements.length; i < len; i++) {
-        if (elements[i].src && elements[i].src.match(/kindeditor[\w\-\.]*\.js/)) {
-            return elements[i].src.substring(0, elements[i].src.lastIndexOf('/') + 1);
-        }
-    }
-    return "";
-})();
-
-KE.htmlPath = (function() {
-    return location.href.substring(0, location.href.lastIndexOf('/') + 1);
-})();
-
-KE.browser = (function() {
-    var ua = navigator.userAgent.toLowerCase();
-    if (ua.indexOf("msie") > -1) return 'IE';
-    else if (ua.indexOf("webkit") > -1) return 'WEBKIT';
-    else if (ua.indexOf("gecko") > -1) return 'GECKO';
-    else if (ua.indexOf("opera") > -1) return 'OPERA';
-    else return "";
-})();
-
-KE.setting = {
-    wyswygMode : true,
-    autoOnsubmitMode : true,
-    resizeMode : 2,
-    filterMode : true,
-    tagLineMode : false,
-    skinType : 'default',
-    cssPath : '',
-    skinsPath : KE.scriptPath + 'skins/',
-    pluginsPath : KE.scriptPath + 'plugins/',
-    minWidth : 200,
-    minHeight : 100,
-    minChangeSize : 5,
-    siteDomains : [],
-    items : [
-        'source', 'preview', 'fullscreen', 'undo', 'redo', 'print', 'cut', 'copy', 'paste',
-        'plainpaste', 'wordpaste', 'justifyleft', 'justifycenter', 'justifyright',
-        'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
-        'superscript', 'date', 'time', '-',
-        'title', 'fontname', 'fontsize', 'textcolor', 'bgcolor', 'bold',
-        'italic', 'underline', 'strikethrough', 'removeformat', 'selectall', 'image',
-        'flash', 'media', 'layer', 'table', 'specialchar', 'hr',
-        'emoticons', 'link', 'unlink', 'about'
-    ],
-    colorTable : [
-        ["#FFFFFF","#E5E4E4","#D9D8D8","#C0BDBD","#A7A4A4","#8E8A8B","#827E7F","#767173","#5C585A","#000000"],
-        ["#FEFCDF","#FEF4C4","#FEED9B","#FEE573","#FFED43","#F6CC0B","#E0B800","#C9A601","#AD8E00","#8C7301"],
-        ["#FFDED3","#FFC4B0","#FF9D7D","#FF7A4E","#FF6600","#E95D00","#D15502","#BA4B01","#A44201","#8D3901"],
-        ["#FFD2D0","#FFBAB7","#FE9A95","#FF7A73","#FF483F","#FE2419","#F10B00","#D40A00","#940000","#6D201B"],
-        ["#FFDAED","#FFB7DC","#FFA1D1","#FF84C3","#FF57AC","#FD1289","#EC0078","#D6006D","#BB005F","#9B014F"],
-        ["#FCD6FE","#FBBCFF","#F9A1FE","#F784FE","#F564FE","#F546FF","#F328FF","#D801E5","#C001CB","#8F0197"],
-        ["#E2F0FE","#C7E2FE","#ADD5FE","#92C7FE","#6EB5FF","#48A2FF","#2690FE","#0162F4","#013ADD","#0021B0"],
-        ["#D3FDFF","#ACFAFD","#7CFAFF","#4AF7FE","#1DE6FE","#01DEFF","#00CDEC","#01B6DE","#00A0C2","#0084A0"],
-        ["#EDFFCF","#DFFEAA","#D1FD88","#BEFA5A","#A8F32A","#8FD80A","#79C101","#3FA701","#307F00","#156200"],
-        ["#D4C89F","#DAAD88","#C49578","#C2877E","#AC8295","#C0A5C4","#969AC2","#92B7D7","#80ADAF","#9CA53B"]
-    ],
-    noEndTags : ['br', 'hr', 'img', 'area', 'col', 'embed', 'input', 'param'],
-    inlineTags : ['b', 'del', 'em', 'font', 'i', 'span', 'strike', 'strong', 'sub', 'sup', 'u'],
-    htmlTags : {
-        font : ['color', 'size', 'face', '.background-color'],
-        span : [
-            '.color', '.background-color', '.font-size', '.font-family',
-            '.font-weight', '.font-style', '.text-decoration', '.vertical-align'
-        ],
-        div : [
-            'class', 'align', '.border', '.margin', '.padding', '.text-align', '.color',
-            '.background-color', '.font-size', '.font-family', '.font-weight',
-            '.font-style', '.text-decoration', '.vertical-align'
-        ],
-        table: [
-            'class', 'border', 'cellspacing', 'cellpadding', 'width', 'height', 'align',
-            '.padding', '.margin', '.border', 'bgcolor', '.text-align', '.color', '.background-color',
-            '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration'
-        ],
-        'td,th': [
-            'class', 'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor',
-            '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight',
-            '.font-style', '.text-decoration', '.vertical-align'
-        ],
-        a : ['class', 'href', 'target', 'name'],
-        embed : ['src', 'type', 'loop', 'autostart', 'quality', '.width', '.height', '/'],
-        img : ['src', 'width', 'height', 'border', 'alt', 'title', '.width', '.height', '/'],
-        hr : ['class', '/'],
-        br : ['/'],
-        'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [
-            'align', '.text-align', '.color', '.background-color', '.font-size', '.font-family',
-            '.font-weight', '.font-style', '.text-decoration', '.vertical-align'
-        ],
-        'tbody,tr,strong,b,sub,sup,em,i,u,strike' : []
-    }
-};
-
-KE.g = {};
-
-KE.plugin = {};
-
-KE.$ = function(id, doc){
-    var doc = doc || document;
-    return doc.getElementById(id);
-};
-
-KE.$$ = function(name, doc){
-    var doc = doc || document;
-    return doc.createElement(name);
-};
-
-KE.event = {
-    add : function(el, event, listener) {
-        if (el.addEventListener){
-            el.addEventListener(event, listener, false);
-        } else if (el.attachEvent){
-            el.attachEvent('on' + event, listener);
-        }
-    },
-    remove : function(el, event, listener) {
-        if (el.removeEventListener){
-            el.removeEventListener(event, listener, false);
-        } else if (el.detachEvent){
-            el.detachEvent('on' + event, listener);
-        }
-    },
-    input : function(el, func) {
-        this.add(el, 'keyup', function(e) {
-            if (!e.ctrlKey && !e.shiftKey && !e.altKey && (e.keyCode < 16 || e.keyCode > 18)) {
-                func(e);
-                return false;
-            }
-        });
-    },
-    ctrl : function(el, key, func) {
-        this.add(el, 'keydown', function(e) {
-            if (e.ctrlKey && e.keyCode == key.toUpperCase().charCodeAt(0) && !e.shiftKey && !e.altKey) {
-                func(e);
-                return false;
-            }
-        });
-    }
-};
-
-KE.each = function(obj, func) {
-    for (var key in obj) {
-        if (obj.hasOwnProperty(key)) func(key, obj[key]);
-    }
-};
-
-KE.eachNode = function(node, func) {
-    var walkNodes = function(parent) {
-        if (KE.util.getNodeType(parent) != 1) return true;
-        var n = parent.firstChild;
-        while (n != null) {
-            var next = n.nextSibling;
-            if (!func(n)) return false;
-            if (!walkNodes(n)) return false;
-            n = next;
-        }
-        return true;
-    };
-    walkNodes(node);
-};
-
-KE.selection = function(win, doc) {
-    this.sel = null;
-    this.range = null;
-    this.keRange = null;
-    this.init = function() {
-        var sel = win.getSelection ? win.getSelection() : doc.selection;
-        var range;
-        try {
-            if (sel.rangeCount > 0) range = sel.getRangeAt(0);
-            else range = sel.createRange();
-        } catch(e) {}
-        if (!range) range = KE.util.createRange(doc);
-        this.sel = sel;
-        this.range = range;
-        var startNode, startPos, endNode, endPos;
-        if (KE.browser == 'IE') {
-            if (range.item) {
-                var el = range.item(0);
-                startNode = endNode = el;
-                startPos = endPos = 0;
-            } else {
-                var getStartEnd = function(isStart) {
-                    var pointRange = range.duplicate();
-                    pointRange.collapse(isStart);
-                    var parentNode = pointRange.parentElement();
-                    var nodes = parentNode.childNodes;
-                    if (nodes.length == 0) return {node: parentNode, pos: 0};
-                    var startNode;
-                    var endElement;
-                    var startPos = 0;
-                    var isEnd = false;
-                    var testRange = range.duplicate();
-                    testRange.moveToElementText(parentNode);
-                    for (var i = 0, len = nodes.length; i < len; i++) {
-                        var node = nodes[i];
-                        var cmp = testRange.compareEndPoints('StartToStart', pointRange);
-                        if (cmp > 0) {
-                            isEnd = true;
-                        } else if (cmp == 0) {
-                            if (node.nodeType == 1) {
-                                var keRange = new KE.range(doc);
-                                keRange.selectTextNode(node);
-                                return {node: keRange.startNode, pos: 0};
-                            } else {
-                                return {node: node, pos: 0};
-                            }
-                        }
-                        if (node.nodeType == 1) {
-                            var nodeRange = range.duplicate();
-                            nodeRange.moveToElementText(node);
-                            testRange.setEndPoint('StartToEnd', nodeRange);
-                            if (isEnd) startPos += nodeRange.text.length;
-                            else startPos = 0;
-                        } else if (node.nodeType == 3) {
-                            testRange.moveStart('character', node.nodeValue.length);
-                            startPos += node.nodeValue.length;
-                        }
-                        if (!isEnd) startNode = node;
-                    }
-                    if (!isEnd && startNode.nodeType == 1) {
-                        var startNode = parentNode.lastChild;
-                        return {node: startNode, pos: startNode.nodeType == 1 ? 1 : startNode.nodeValue.length};
-                    }
-                    testRange = range.duplicate();
-                    testRange.moveToElementText(parentNode);
-                    testRange.setEndPoint('StartToEnd', pointRange);
-                    startPos -= testRange.text.replace(/\r\n|\n|\r/g, '').length;
-                    return {node: startNode, pos: startPos};
-                };
-                var start = getStartEnd(true);
-                var end = getStartEnd(false);
-                startNode = start.node;
-                startPos = start.pos;
-                endNode = end.node;
-                endPos = end.pos;
-            }
-        } else {
-            startNode = range.startContainer;
-            startPos = range.startOffset;
-            endNode = range.endContainer;
-            endPos = range.endOffset;
-            if (startNode.nodeType == 1 && typeof startNode.childNodes[startPos] != "undefined") {
-                startNode = startNode.childNodes[startPos];
-                startPos = startNode.nodeType == 1 ? 0 : startNode.nodeValue.length;
-            }
-            if (endNode.nodeType == 1 && typeof endNode.childNodes[endPos] != "undefined") {
-                endNode = endNode.childNodes[endPos];
-                endPos = endNode.nodeType == 1 ? 0 : endNode.nodeValue.length;
-            }
-        }
-        var keRange = new KE.range(doc);
-        keRange.setTextStart(startNode, startPos);
-        keRange.setTextEnd(endNode, endPos);
-        this.keRange = keRange;
-    };
-    this.init();
-    this.addRange = function(keRange) {
-        this.keRange = keRange;
-        if (KE.browser == 'IE') {
-            var getEndRange = function(isStart) {
-                var range = KE.util.createRange(doc);
-                var node = isStart ? keRange.startNode : keRange.endNode;
-                if (node.nodeType == 1) {
-                    range.moveToElementText(node);
-                    range.collapse(isStart);
-                } else if (node.nodeType == 3) {
-                    range = KE.util.getNodeStartRange(doc, node);
-                    var pos = isStart ? keRange.startPos : keRange.endPos;
-                    range.moveStart('character', pos);
-                }
-                return range;
-            }
-            if (!this.range.item) {
-                var node = keRange.startNode;
-                if (node == keRange.endNode && KE.util.getNodeType(node) == 1 && KE.util.getNodeTextLength(node) == 0) {
-                    var temp = doc.createTextNode(" ");
-                    node.appendChild(temp);
-                    this.range.moveToElementText(node);
-                    this.range.collapse(false);
-                    this.range.select();
-                    node.removeChild(temp);
-                } else {
-                    this.range.setEndPoint('StartToStart', getEndRange(true));
-                    this.range.setEndPoint('EndToStart', getEndRange(false));
-                    this.range.select();
-                }
-            }
-        } else {
-            var range = new KE.range(doc);
-            range.setTextStart(keRange.startNode, keRange.startPos);
-            range.setTextEnd(keRange.endNode, keRange.endPos);
-            this.range.setStart(range.startNode, range.startPos);
-            this.range.setEnd(range.endNode, range.endPos);
-            this.sel.removeAllRanges();
-            this.sel.addRange(this.range);
-        }
-    };
-    this.focus = function() {
-        if (KE.browser == 'IE' && this.range != null) this.range.select();
-    }
-};
-
-KE.range = function(doc) {
-    this.startNode = null;
-    this.startPos = null;
-    this.endNode = null;
-    this.endPos = null;
-    this.getParentElement = function() {
-        var scanParent = function(node, func) {
-            while (node != null && node.tagName != 'body') {
-                node = node.parentNode;
-                if (func(node)) return;
-            }
-        }
-        var nodeList = [];
-        scanParent(this.startNode, function(node) {
-            nodeList.push(node);
-        });
-        var parentNode;
-        scanParent(this.endNode, function(node) {
-            if (KE.util.inArray(node, nodeList)) {
-                parentNode = node;
-                return true;
-            }
-        });
-        return parentNode ? parentNode : doc.body;
-    };
-    this.getNodeList = function() {
-        var parentNode = this.getParentElement();
-        var nodeList = [];
-        var keRange = this;
-        var startNode = this.startNode;
-        var isStarted = false;
-        if (parentNode == startNode) isStarted = true;
-        if (isStarted) nodeList.push(parentNode);
-        KE.eachNode(parentNode, function(node) {
-            if (node == startNode) isStarted = true;
-            var range = new KE.range(doc);
-            range.selectTextNode(node);
-            if (range.comparePoints('START_TO_END', keRange) >= 0) return false;
-            if (isStarted) nodeList.push(node);
-            return true;
-        });
-        return nodeList;
-    };
-    this.comparePoints = function(how, range) {
-        var compareNodes = function(nodeA, posA, nodeB, posB) {
-            var cmp;
-            if (KE.browser == 'IE') {
-                var getStartRange = function(node, pos, isStart) {
-                    var range = KE.util.createRange(doc);
-                    var type = KE.util.getNodeType(node);
-                    if (type == 1) {
-                        range.moveToElementText(node);
-                        range.collapse(isStart);
-                    } else if (type == 3) {
-                        range = KE.util.getNodeStartRange(doc, node);
-                        range.moveStart('character', pos);
-                        range.collapse(true);
-                    }
-                    return range;
-                }
-                var rangeA, rangeB;
-                if (how == 'START_TO_START' || how == 'START_TO_END') rangeA = getStartRange(nodeA, posA, true);
-                else rangeA = getStartRange(nodeA, posA, false);
-                if (how == 'START_TO_START' || how == 'END_TO_START') rangeB = getStartRange(nodeB, posB, true);
-                else rangeB = getStartRange(nodeB, posB, false);
-                return rangeA.compareEndPoints('StartToStart', rangeB);
-            } else {
-                var rangeA = KE.util.createRange(doc);
-                rangeA.selectNode(nodeA);
-                if (how == 'START_TO_START' || how == 'START_TO_END') rangeA.collapse(true);
-                else rangeA.collapse(false);
-                var rangeB = KE.util.createRange(doc);
-                rangeB.selectNode(nodeB);
-                if (how == 'START_TO_START' || how == 'END_TO_START') rangeB.collapse(true);
-                else rangeB.collapse(false);
-                if (rangeA.compareBoundaryPoints(Range.START_TO_START, rangeB) > 0) {
-                    cmp = 1;
-                } else if (rangeA.compareBoundaryPoints(Range.START_TO_START, rangeB) == 0) {
-                    if (posA > posB) cmp = 1;
-                    else if (posA == posB) cmp = 0;
-                    else cmp = -1;
-                } else {
-                    cmp = -1;
-                }
-            }
-            return cmp;
-        }
-        if (how == 'START_TO_START') return compareNodes(this.startNode, this.startPos, range.startNode, range.startPos);
-        if (how == 'START_TO_END') return compareNodes(this.startNode, this.startPos, range.endNode, range.endPos);
-        if (how == 'END_TO_START') return compareNodes(this.endNode, this.endPos, range.startNode, range.startPos);
-        if (how == 'END_TO_END') return compareNodes(this.endNode, this.endPos, range.endNode, range.endPos);
-    };
-    this.setTextStart = function(node, pos) {
-        var textNode = node;
-        KE.eachNode(node, function(n) {
-            if (KE.util.getNodeType(n) == 3 && n.nodeValue.length > 0) {
-                textNode = n;
-                pos = 0;
-                return false;
-            }
-            return true;
-        });
-        this.setStart(textNode, pos);
-    };
-    this.setStart = function(node, pos) {
-        this.startNode = node;
-        this.startPos = pos;
-        if (this.endNode === null) {
-            this.endNode = node;
-            this.endPos = pos;
-        }
-    };
-    this.setTextEnd = function(node, pos) {
-        var textNode = node;
-        KE.eachNode(node, function(n) {
-            if (KE.util.getNodeType(n) == 3 && n.nodeValue.length > 0) {
-                textNode = n;
-                pos = n.nodeValue.length;
-            }
-            return true;
-        });
-        this.setEnd(textNode, pos);
-    };
-    this.setEnd = function(node, pos) {
-        this.endNode = node;
-        this.endPos = pos;
-        if (this.startNode === null) {
-            this.startNode = node;
-            this.startPos = pos;
-        }
-    };
-    this.selectNode = function(node) {
-        this.setStart(node, 0);
-        this.setEnd(node, node.nodeType == 1 ? 0 : node.nodeValue.length);
-    };
-    this.selectTextNode = function(node) {
-        this.setTextStart(node, 0);
-        this.setTextEnd(node, node.nodeType == 1 ? 0 : node.nodeValue.length);
-    };
-    this.extractContents = function(isDelete) {
-        isDelete = (isDelete === false) ? false : true;
-        var thisRange = this;
-        var startNode = this.startNode;
-        var startPos = this.startPos;
-        var endNode = this.endNode;
-        var endPos = this.endPos;
-        var extractTextNode = function(node, startPos, endPos) {
-            var length = node.nodeValue.length;
-            var cloneNode = node.cloneNode(true);
-            var centerNode = cloneNode.splitText(startPos);
-            centerNode.splitText(endPos - startPos);
-            if (isDelete) {
-                var center = node;
-                if (startPos > 0) center = node.splitText(startPos);
-                if (endPos < length) center.splitText(endPos - startPos);
-                center.parentNode.removeChild(center);
-            }
-            return centerNode;
-        };
-        var isStarted = false;
-        var isEnd = false;
-        var extractNodes = function(parent, frag) {
-            if (KE.util.getNodeType(parent) != 1) return true;
-            var node = parent.firstChild;
-            while (node != null) {
-                if (node == startNode) isStarted = true;
-                if (node == endNode) isEnd = true;
-                var nextNode = node.nextSibling;
-                var type = KE.util.getNodeType(node);
-                if (type == 1) {
-                    var range = new KE.range(doc);
-                    range.selectNode(node);
-                    if (isStarted && range.comparePoints('END_TO_END', thisRange) < 0) {
-                        var cloneNode = node.cloneNode(true);
-                        frag.appendChild(cloneNode);
-                        if (isDelete) {
-                            node.parentNode.removeChild(node);
-                        }
-                    } else {
-                        var childFlag = node.cloneNode(false);
-                        frag.appendChild(childFlag);
-                        if (!extractNodes(node, childFlag)) return false;
-                    }
-                } else if (type == 3) {
-                    if (isStarted) {
-                        var textNode;
-                        if (node == startNode && node == endNode) {
-                            textNode = extractTextNode(node, startPos, endPos);
-                            frag.appendChild(textNode);
-                            return false;
-                        } else if (node == startNode) {
-                            textNode = extractTextNode(node, startPos, node.nodeValue.length);
-                            frag.appendChild(textNode);
-                        } else if (node == endNode) {
-                            textNode = extractTextNode(node, 0, endPos);
-                            frag.appendChild(textNode);
-                            return false;
-                        } else {
-                            textNode = extractTextNode(node, 0, node.nodeValue.length);
-                            frag.appendChild(textNode);
-                        }
-                    }
-                }
-                node = nextNode;
-                if (isEnd) return false;
-            }
-            return true;
-        }
-        var parentNode = this.getParentElement();
-        var docFrag = parentNode.cloneNode(false);
-        extractNodes(parentNode, docFrag);
-        return docFrag;
-    };
-    this.cloneContents = function() {
-        return this.extractContents(false);
-    };
-    this.getText = function() {
-        var html = this.cloneContents().innerHTML;
-        return html.replace(/<.*?>/g, "");
-    };
-};
-
-KE.cmd = function(id) {
-    this.doc = KE.g[id].iframeDoc;
-    this.keSel = KE.g[id].keSel;
-    this.keRange = KE.g[id].keRange;
-    this.mergeAttributes = function(el, attr) {
-        for (var i = 0, len = attr.length; i < len; i++) {
-            KE.each(attr[i], function(key, value) {
-                if (key.charAt(0) == '.') {
-                    var jsKey = KE.util.getJsKey(key.substr(1));
-                    eval('el.style.' + jsKey + ' = value;');
-                } else {
-                    el.setAttribute(key, value);
-                }
-            });
-        }
-        return el;
-    };
-    this.wrapTextNode = function(node, startPos, endPos, element, attributes) {
-        var length = node.nodeValue.length;
-        var isFull = (startPos == 0 && endPos == length);
-        var range = new KE.range(this.doc);
-        range.selectTextNode(node.parentNode);
-        if (isFull &&
-            node.parentNode.tagName == element.tagName &&
-            range.comparePoints('END_TO_END', this.keRange) <= 0 &&
-            range.comparePoints('START_TO_START', this.keRange) >= 0) {
-            this.mergeAttributes(node.parentNode, attributes);
-            return node;
-        } else {
-            var el = element.cloneNode(true);
-            if (isFull) {
-                var cloneNode = node.cloneNode(true);
-                el.appendChild(cloneNode);
-                node.parentNode.replaceChild(el, node);
-                return cloneNode;
-            } else {
-                var centerNode = node;
-                if (startPos < endPos) {
-                    if (startPos > 0) centerNode = node.splitText(startPos);
-                    if (endPos < length) centerNode.splitText(endPos - startPos);
-                    var cloneNode = centerNode.cloneNode(true);
-                    el.appendChild(cloneNode);
-                    centerNode.parentNode.replaceChild(el, centerNode);
-                    return cloneNode;
-                } else {
-                    if (startPos < length) {
-                        centerNode = node.splitText(startPos);
-                        centerNode.parentNode.insertBefore(el, centerNode);
-                    } else {
-                        if (centerNode.nextSibling) {
-                            centerNode.parentNode.insertBefore(el, centerNode.nextSibling);
-                        } else {
-                            centerNode.parentNode.appendChild(el);
-                        }
-                    }
-                    return el;
-                }
-            }
-        }
-    };
-    this.wrap = function(tagName, attributes) {
-        var self = this;
-        this.keSel.focus();
-        var element = KE.$$(tagName, this.doc);
-        this.mergeAttributes(element, attributes);
-        var keRange = this.keRange;
-        var startNode = keRange.startNode;
-        var startPos = keRange.startPos;
-        var endNode = keRange.endNode;
-        var endPos = keRange.endPos;
-        var parentNode = keRange.getParentElement();
-        var isStarted = false;
-        KE.eachNode(parentNode, function(node) {
-            if (node == startNode) isStarted = true;
-            if (node.nodeType == 1) {
-                if (node == startNode && node == endNode) {
-                    if (KE.util.inArray(node.tagName.toLowerCase(), KE.setting.noEndTags)) {
-                        if (startPos > 0) node.parentNode.appendChild(element);
-                        else node.parentNode.insertBefore(element, node);
-                    } else {
-                        node.appendChild(element);
-                    }
-                    keRange.selectNode(element);
-                    return false;
-                } else if (node == startNode) {
-                    keRange.setStart(node, 0);
-                } else if (node == endNode) {
-                    keRange.setEnd(node, 0);
-                    return false;
-                }
-            } else if (node.nodeType == 3) {
-                if (isStarted) {
-                    if (node == startNode && node == endNode) {
-                        var rangeNode = self.wrapTextNode(node, startPos, endPos, element, attributes);
-                        keRange.selectNode(rangeNode);
-                        return false;
-                    } else if (node == startNode) {
-                        var rangeNode = self.wrapTextNode(node, startPos, node.nodeValue.length, element, attributes);
-                        keRange.setStart(rangeNode, 0);
-                    } else if (node == endNode) {
-                        var rangeNode = self.wrapTextNode(node, 0, endPos, element, attributes);
-                        keRange.setEnd(rangeNode, rangeNode.nodeType == 1 ? 0 : rangeNode.nodeValue.length);
-                        return false;
-                    } else {
-                        self.wrapTextNode(node, 0, node.nodeValue.length, element, attributes);
-                    }
-                }
-            }
-            return true;
-        });
-        this.keSel.addRange(keRange);
-    };
-    this.getTopParent = function(tagNames, node) {
-        var parent = null;
-        while (node != null) {
-            node = node.parentNode;
-            if (KE.util.inArray(node.tagName.toLowerCase(), tagNames)) {
-                parent = node;
-            } else {
-                break;
-            }
-        }
-        return parent;
-    };
-    this.splitNodeParent = function(parent, node, pos) {
-        var leftRange = new KE.range(this.doc);
-        leftRange.selectNode(parent.firstChild);
-        leftRange.setEnd(node, pos);
-        var leftFrag = leftRange.extractContents();
-        parent.parentNode.insertBefore(leftFrag, parent);
-        return {left : leftFrag, right : parent};
-    };
-    this.remove = function(tagNames, attributes) {
-        var keRange = this.keRange;
-        var startNode = keRange.startNode;
-        var startPos = keRange.startPos;
-        var endNode = keRange.endNode;
-        var endPos = keRange.endPos;
-        this.keSel.focus();
-        if (keRange.getText().replace(/\s+/g, '') === '') return;
-        var startParent = this.getTopParent(tagNames, startNode);
-        var endParent = this.getTopParent(tagNames, endNode);
-        if (startParent) {
-            var startFrags = this.splitNodeParent(startParent, startNode, startPos);
-            keRange.setStart(startFrags.right, 0);
-            if (startNode == endNode && KE.util.getNodeTextLength(startFrags.right) > 0) {
-                keRange.selectNode(startFrags.right);
-                var range = new KE.range(this.doc);
-                range.selectTextNode(startFrags.left);
-                if (startPos > 0) endPos -= range.endNode.nodeValue.length;
-                range.selectTextNode(startFrags.right);
-                endNode = range.startNode;
-            }
-        }
-        if (endParent) {
-            var endFrags = this.splitNodeParent(endParent, endNode, endPos);
-            this.keRange.setEnd(endFrags.left, 0);
-            if (startParent == endParent) {
-                keRange.setStart(endFrags.left, 0);
-            }
-        }
-        var nodeList = keRange.getNodeList();
-        keRange.setTextStart(keRange.startNode, keRange.startPos);
-        keRange.setTextEnd(keRange.endNode, keRange.endPos);
-        for (var i = 0; i < nodeList.length; i++) {
-            var node = nodeList[i];
-            if (node.nodeType == 1) {
-                if (KE.util.inArray(node.tagName.toLowerCase(), tagNames)) {
-                    KE.util.removeParent(node);
-                } else {
-                    for (var j = 0; j < attributes.length; j++) {
-                        node.removeAttribute(attributes[j]);
-                    }
-                }
-            }
-        }
-        try {
-            this.keSel.addRange(keRange);
-        } catch(e) {}
-    };
-}
-
-KE.util = {
-    getDocumentElement : function() {
-        return (document.compatMode != "CSS1Compat") ? document.body : document.documentElement;
-    },
-    getDocumentHeight : function() {
-        var el = this.getDocumentElement();
-        return Math.max(el.scrollHeight, el.clientHeight);
-    },
-    getDocumentWidth : function() {
-        var el = this.getDocumentElement();
-        return Math.max(el.scrollWidth, el.clientWidth);
-    },
-    createTable : function() {
-        var table = KE.$$('table');
-        table.cellPadding = 0;
-        table.cellSpacing = 0;
-        table.border = 0;
-        return {table: table, cell: table.insertRow(0).insertCell(0)};
-    },
-    loadStyle : function(path) {
-        var link = KE.$$('link');
-        link.setAttribute('type', 'text/css');
-        link.setAttribute('rel', 'stylesheet');
-        link.setAttribute('href', path);
-        document.getElementsByTagName("head")[0].appendChild(link);
-    },
-    inArray : function(str, arr) {
-        for (var i = 0; i < arr.length; i++) {if (str == arr[i]) return true;}
-        return false;
-    },
-    getJsKey : function(key) {
-        var arr = key.split('-');
-        key = '';
-        for (var i = 0, len = arr.length; i < len; i++) {
-            key += (i > 0) ? arr[i].charAt(0).toUpperCase() + arr[i].substr(1) : arr[i];
-        }
-        return key;
-    },
-    escape : function(html) {
-        html = html.replace(/&/g, "&amp;");
-        html = html.replace(/</g, "&lt;");
-        html = html.replace(/>/g, "&gt;");
-        html = html.replace(/\xA0/g, "&nbsp;");
-        html = html.replace(/\x20/g, " ");
-        return html;
-    },
-    getElementPos : function(el) {
-        var x = 0;
-        var y = 0;
-        if (KE.browser != "WEBKIT") {
-            var box = el.getBoundingClientRect();
-            var el = this.getDocumentElement();
-            x = box.left + el.scrollLeft - el.clientLeft;
-            y = box.top + el.scrollTop - el.clientTop;
-        } else {
-            x = el.offsetLeft;
-            y = el.offsetTop;
-            var parent = el.offsetParent;
-            while (parent) {
-                x += parent.offsetLeft;
-                y += parent.offsetTop;
-                parent = parent.offsetParent;
-            }
-        }
-        return {'x' : x, 'y' : y};
-    },
-    getCoords : function(ev) {
-        ev = ev || window.event;
-        var el = this.getDocumentElement();
-        if (ev.pageX) return { x : ev.pageX, y : ev.pageY};
-        return {
-            x : ev.clientX + el.scrollLeft - el.clientLeft,
-            y : ev.clientY + el.scrollTop - el.clientTop
-        };
-    },
-    setOpacity : function(el, opacity) {
-        if (typeof el.style.opacity == "undefined") {
-            el.style.filter = (opacity == 100) ? "" : "alpha(opacity=" + opacity + ")";
-        } else {
-            el.style.opacity = (opacity == 100) ? "" : "0." + opacity.toString();
-        }
-    },
-    getIframeDoc : function(iframe) {
-        return iframe.contentDocument || iframe.contentWindow.document;
-    },
-    rgbToHex : function(str) {
-        function hex(s) {
-            s = parseInt(s).toString(16);
-            return s.length > 1 ? s : '0' + s;
-        };
-        return str.replace(/rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)/ig,
-                           function($0, $1, $2, $3) {
-                               return '#' + hex($1) + hex($2) + hex($3);
-                           }
-                          );
-    },
-    getStyle : function(el, key) {
-        var arr = key.split('-');
-        key = "";
-        for (var i = 0, len = arr.length; i < len; i++) {
-            key += (i > 0) ? arr[i].charAt(0).toUpperCase() + arr[i].substr(1) : arr[i];
-        }
-        var val = el.style[key];
-        if (!val) {
-            var css = el.getAttribute("style");
-            if (css) {
-                var re = new RegExp("(^|[^\w\-])" + key + "\s*:\s*([^;]+)", "ig");
-                var arr = re.exec(css);
-                if (arr) val = arr[2];
-            }
-        }
-        return KE.util.rgbToHex(val);
-    },
-    createRange : function(doc) {
-        return doc.createRange ? doc.createRange() : doc.body.createTextRange();
-    },
-    getNodeType : function(node) {
-        return (node.nodeType == 1 && KE.util.inArray(node.tagName.toLowerCase(), KE.setting.noEndTags)) ? 88 : node.nodeType;
-    },
-    getNodeTextLength : function(node) {
-        var type = KE.util.getNodeType(node);
-        if (type == 1) {
-            var html = node.innerHTML;
-            return html.replace(/<.*?>/ig, "").length;
-        } else if (type == 3) {
-            return node.nodeValue.length;
-        }
-    },
-    getNodeStartRange : function(doc, node) {
-        var range = KE.util.createRange(doc);
-        var type = node.nodeType;
-        if (type == 1) {
-            range.moveToElementText(node);
-            return range;
-        } else if (type == 3) {
-            var offset = 0;
-            var sibling = node.previousSibling;
-            while (sibling) {
-                if (sibling.nodeType == 1) {
-                    var nodeRange = KE.util.createRange(doc);
-                    nodeRange.moveToElementText(sibling);
-                    range.setEndPoint('StartToEnd', nodeRange);
-                    range.moveStart('character', offset);
-                    return range;
-                } else if (sibling.nodeType == 3) {
-                    offset += sibling.nodeValue.length;
-                }
-                sibling = sibling.previousSibling;
-            }
-            range.moveToElementText(node.parentNode);
-            range.moveStart('character', offset);
-            return range;
-        }
-    },
-    trimNodes : function(parent) {
-        if (KE.util.getNodeType(parent) != 1) return;
-        if (KE.util.inArray(parent.tagName.toLowerCase(), KE.setting.inlineTags) && KE.util.getNodeTextLength(parent) == 0) {
-            parent.parentNode.removeChild(parent);
-            return;
-        }
-        KE.eachNode(parent, function(node) {
-            KE.util.trimNodes(node);
-            return true;
-        });
-    },
-    removeParent : function(parent) {
-        if (parent.hasChildNodes) {
-            var node = parent.firstChild;
-            while (node != null) {
-                var nextNode = node.nextSibling;
-                parent.parentNode.insertBefore(node, parent);
-                node = nextNode;
-            }
-        }
-        parent.parentNode.removeChild(parent);
-    },
-    drag : function(id, mousedownObj, moveObj, func, hideFlag) {
-        var obj = KE.g[id];
-        mousedownObj.onmousedown = function(event) {
-            if (hideFlag && obj.wyswygMode) obj.iframe.style.display = 'none';
-            if (KE.browser != 'IE') event.preventDefault();
-            var ev = event || window.event;
-            var pos = KE.util.getCoords(ev);
-            var objTop = parseInt(moveObj.style.top);
-            var objLeft = parseInt(moveObj.style.left);
-            var objWidth = parseInt(moveObj.style.width);
-            var objHeight = parseInt(moveObj.style.height);
-            var mouseTop = pos.y;
-            var mouseLeft = pos.x;
-            var dragFlag = true;
-            var moveListener = function(event) {
-                if (dragFlag) {
-                    var ev = event || window.event;
-                    var pos = KE.util.getCoords(ev);
-                    var top = pos.y - mouseTop;
-                    var left = pos.x - mouseLeft;
-                    func(objTop, objLeft, objWidth, objHeight, top, left);
-                }
-                return false;
-            };
-            var upListener = function(event) {
-                if (hideFlag && obj.wyswygMode) obj.iframe.style.display = '';
-                dragFlag = false;
-                KE.event.remove(document, 'mousemove', moveListener);
-                KE.event.remove(document, 'mouseup', upListener);
-            };
-            KE.event.add(document, 'mousemove', moveListener);
-            KE.event.add(document, 'mouseup', upListener);
-        };
-    },
-    setDefaultPlugin : function(id) {
-        var items = [
-            'cut', 'copy', 'paste', 'selectall', 'justifyleft', 'justifycenter', 'justifyright',
-            'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript','superscript',
-            'bold', 'italic', 'underline', 'strikethrough', 'unlink'
-        ];
-        for (var i = 0; i < items.length; i++) {
-            KE.plugin[items[i]] = {
-                click : new Function('id', 'KE.util.execCommand(id, "' + items[i] + '", null);')
-            };
-        }
-    },
-    getFullHtml : function(id, tagLineMode) {
-        var html = '<html>';
-        html += '<head>';
-        html += '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
-        html += '<title>KindEditor</title>';
-        if (tagLineMode) {
-            html += '<link href="' + KE.g[id].skinsPath + 'editor.css" rel="stylesheet" type="text/css" />';
-        }
-        if (KE.g[id].cssPath) {
-            html += '<link href="' + KE.g[id].cssPath + '" rel="stylesheet" type="text/css" />';
-        }
-        html += '</head>';
-        html += '<body class="ke-content"></body>';
-        html += '</html>';
-        return html;
-    },
-    resize : function(id, width, height, isCheck) {
-        var obj = KE.g[id];
-        if (width.match(/%$/)) width = obj.container.offsetWidth + 'px';
-        if (height.match(/%$/)) height = obj.container.offsetHeight + 'px';
-        if (isCheck && (parseInt(width) <= obj.minWidth || parseInt(height) <= obj.minHeight)) return;
-        obj.container.style.width = width;
-        obj.container.style.height = height;
-        var diff = parseInt(height) - obj.toolbarTable.offsetHeight - obj.bottom.offsetHeight;
-        if (diff >= 0) {
-            obj.textareaTable.style.height = diff + 'px';
-            obj.iframe.style.height = diff + 'px';
-            obj.newTextarea.style.height = diff + 'px';
-        }
-    },
-    getData : function(id) {
-        var data;
-        if (KE.g[id].wyswygMode) {
-            if (KE.g[id].filterMode) {
-                data = KE.util.outputHtml(id, KE.g[id].iframeDoc.body);
-            } else {
-                data = KE.util.htmlToXhtml(id, KE.g[id].iframeDoc.body);
-            }
-        } else {
-            data = KE.g[id].newTextarea.value;
-        }
-        return data;
-    },
-    getSrcData : function(id) {
-        var data;
-        if (KE.g[id].wyswygMode) {
-            data = KE.g[id].iframeDoc.body.innerHTML;
-        } else {
-            data = KE.g[id].newTextarea.value;
-        }
-        return data;
-    },
-    getPureData : function(id) {
-        var data = this.getSrcData(id);
-        data = data.replace(/<br[\s\/]{0,2}>/ig, "\r\n");
-        data = data.replace(/<.*?>/ig, "");
-        data = data.replace(/&nbsp;/ig, "");
-        return data;
-    },
-    setData : function(id) {
-        var data = this.getData(id);
-        KE.g[id].srcTextarea.value = data;
-    },
-    setPureData : function(id) {
-        var data = this.getPureData(id);
-        KE.g[id].srcTextarea.value = data;
-    },
-    focus : function(id) {
-        if (KE.g[id].wyswygMode) {
-            KE.g[id].iframeWin.focus();
-        } else {
-            KE.g[id].newTextarea.focus();
-        }
-    },
-    click : function(id, cmd) {
-        KE.layout.hide(id);
-        KE.util.focus(id);
-        KE.plugin[cmd].click(id);
-    },
-    selection : function(id) {
-        var win = KE.g[id].iframeWin;
-        var doc = KE.g[id].iframeDoc;
-        KE.g[id].keSel = new KE.selection(win, doc);
-        KE.g[id].keRange = KE.g[id].keSel.keRange;
-        KE.g[id].sel = KE.g[id].keSel.sel;
-        KE.g[id].range = KE.g[id].keSel.range;
-    },
-    select : function(id) {
-        if (KE.browser == 'IE') KE.g[id].range.select();
-    },
-    pToBr : function(id) {
-        if(KE.browser == 'IE') {
-            KE.event.add(KE.g[id].iframeDoc, 'keydown', function(e) {
-                if (e.keyCode == 13) {
-                    KE.util.selection(id);
-                    if(KE.g[id].range.parentElement().tagName != 'LI') {
-                        KE.util.insertHtml(id, '<br />');
-                        KE.util.select(id);
-                        return false;
-                    }
-                }
-            });
-        }
-    },
-    execCommand : function(id, cmd, value) {
-        try {
-            KE.g[id].iframeDoc.execCommand(cmd, false, value);
-        } catch(e) {}
-        KE.toolbar.updateState(id);
-        KE.history.add(id, false);
-    },
-    insertHtml : function(id, html) {
-        if (html == '') return;
-        KE.util.select(id);
-        if (KE.browser == 'IE') {
-            if (KE.g[id].sel.type.toLowerCase() == 'control') {
-                KE.g[id].range.item(0).outerHTML = html;
-            } else {
-                KE.g[id].range.pasteHTML(html);
-            }
-            KE.history.add(id, false);
-        } else {
-            this.execCommand(id, 'inserthtml', html);
-        }
-    },
-    removeDomain : function(id, tagName, key, url) {
-        if ((tagName == 'a' && key == 'href') || (tagName == 'img' && key == 'src') || (tagName == 'embed' && key == 'src')) {
-            var domains = KE.g[id].siteDomains;
-            for (var i = 0, len = domains.length; i < len; i++) {
-                var domain = "http://" + domains[i];
-                if (url.indexOf(domain) == 0) return url.substr(domain.length);
-            }
-        }
-        return url;
-    },
-    htmlToXhtml : function(id, element) {
-        KE.util.trimNodes(element);
-        var html = element.innerHTML;
-        var tags = KE.setting.noEndTags;
-        for (var i = 0, len = tags.length; i < len; i++) {
-            html = html.replace(new RegExp("<(" + tags[i] + ")\\s+(.*?[^\\/])>", "gi"), "<$1 $2 />");
-            html = html.replace(new RegExp("<(" + tags[i] + ")>", "gi"), "<$1 />");
-        }
-        html = html.replace(/<(\w+)(.*?)>/g, function($0, $1, $2) {
-            var tagName = $1.toLowerCase();
-            var attr = $2;
-            attr = attr.replace(/(\w+)=([^\s]+)/gi, function($0, $1, $2) {
-                var key = $1.toLowerCase();
-                var val = $2;
-                var first = $2.charAt(0);
-                var last = $2.charAt($2.length - 1);
-                if (first === '"' && last === '"') {
-                    val = '"' + KE.util.removeDomain(id, tagName, key, val.substr(1, val.length - 2)) + '"';
-                } else if (first !== '"' && last !== '"') {
-                    val = '"' + KE.util.removeDomain(id, tagName, key, val) + '"';
-                }
-                return key + '=' + val;
-            });
-            attr = attr.replace(/\s+style=".*?"/gi, function($0) {
-                return KE.util.rgbToHex($0.toLowerCase());
-            });
-            return '<' + tagName + attr + '>';
-        });
-        html = html.replace(/(<\/\w+>)/g, function($0, $1) {
-            return $1.toLowerCase();
-        });
-        return html;
-    },
-    outputHtml : function(id, element) {
-        var newHtmlTags = [];
-        KE.each(KE.g[id].htmlTags, function(key, val) {
-            var arr = key.split(',');
-            for (var i = 0, len = arr.length; i < len; i++) {
-                newHtmlTags[arr[i]] = val;
-            }
-        });
-        var htmlList = [];
-        KE.util.trimNodes(element);
-        var scanNodes = function(el) {
-            var startTags = [];
-            var setStartTag = function(tagName, attrStr, styleStr, isEnd) {
-                var html = '';
-                html += '<' + tagName;
-                if (attrStr) html += attrStr;
-                if (styleStr) html += ' style="' + styleStr + '"';
-                html += isEnd ? ' />' : '>';
-                if (KE.browser == 'IE' && isEnd && KE.util.inArray(tagName, ['br', 'hr'])) html += "\n";
-                if (typeof newHtmlTags[tagName] == 'object') htmlList.push(html);
-                if (!isEnd) startTags.push(tagName);
-            };
-            var setEndTag = function() {
-                if (startTags.length > 0) {
-                    var tagName = startTags.pop();
-                    if (typeof newHtmlTags[tagName] != 'object') return;
-                    var html = '</' + tagName + '>';
-                    if (KE.browser == 'IE' && KE.util.inArray(tagName, ['p', 'div', 'table', 'ol', 'ul'])) html += "\n";
-                    htmlList.push(html);
-                }
-            };
-            var nodes = el.childNodes;
-            for (var i = 0, len = nodes.length; i < len; i++) {
-                var node = nodes[i];
-                switch (node.nodeType) {
-                case 1:
-                    var tagName = node.tagName.toLowerCase();
-                    var attrStr = '';
-                    var styleStr = '';
-                    var isEnd = false;
-                    if (typeof newHtmlTags[tagName] == 'object') {
-                        var attrList = newHtmlTags[tagName];
-                        for (var j = 0, l = attrList.length; j < l; j++) {
-                            var attr = attrList[j];
-                            if (attr == '/') isEnd = true;
-                            else if (attr.charAt(0) == '.') {
-                                var key = attr.substr(1);
-                                var val = KE.util.getStyle(node, key);
-                                if (val) styleStr += key + ':' + val + ';';
-                            } else {
-                                var val = node.getAttribute(attr);
-                                if (val !== null && val !== "") {
-                                    val = KE.util.removeDomain(id, tagName, attr, val);
-                                    attrStr += ' ' + attr + '="' + val + '"';
-                                }
-                            }
-                        }
-                    }
-                    setStartTag(tagName, attrStr, styleStr, isEnd);
-                    if (node.hasChildNodes()) {
-                        scanNodes(node);
-                    } else {
-                        if (startTags.length > 0) {
-                            var prevHtml = htmlList[htmlList.length - 1];
-                            if (typeof prevHtml != "undefined" && prevHtml.match(/^<p|^<div/) != null) {
-                                htmlList.push("&nbsp;");
-                            }
-                        }
-                    }
-                    break;
-                case 3:
-                    htmlList.push(KE.util.escape(node.nodeValue));
-                    break;
-                default:
-                    break;
-                }
-                setEndTag();
-            }
-            setEndTag();
-        };
-        scanNodes(element);
-        var html = htmlList.join('');
-        return html;
-    }
-};
-
-KE.layout = {
-    show : function(id, div) {
-        KE.layout.hide(id);
-        KE.g[id].hideDiv.appendChild(div);
-        KE.g[id].hideDiv.style.display = 'block';
-        KE.g[id].layoutDiv = div;
-    },
-    hide : function(id) {
-        try {
-            KE.g[id].hideDiv.removeChild(KE.g[id].layoutDiv);
-        } catch (e) {}
-        KE.g[id].hideDiv.style.display = 'none';
-        KE.g[id].maskDiv.style.display = 'none';
-        KE.util.focus(id);
-    },
-    make : function(id) {
-        var div = KE.$$('div');
-        div.style.position = 'absolute';
-        div.style.zIndex = 19811214;
-        return div;
-    }
-};
-
-KE.menu = function(arg){
-    this.arg = arg;
-    var div = KE.layout.make(arg.id);
-    div.className = 'ke-menu';
-    var obj = KE.g[arg.id].toolbarIcon[arg.cmd];
-    var pos = KE.util.getElementPos(obj[0]);
-    div.style.top = pos.y + obj[0].offsetHeight + 'px';
-    div.style.left = pos.x + 'px';
-    this.div = div;
-    this.add = function(html, event) {
-        var cDiv = KE.$$('div');
-        cDiv.className = 'ke-menu-noselected';
-        cDiv.style.width = this.arg.width;
-        cDiv.onmouseover = function() { this.className = 'ke-menu-selected'; }
-        cDiv.onmouseout = function() { this.className = 'ke-menu-noselected'; }
-        cDiv.onclick = event;
-        cDiv.innerHTML = html;
-        this.append(cDiv);
-    };
-    this.append = function(el) {
-        this.div.appendChild(el);
-    };
-    this.insert = function(html) {
-        this.div.innerHTML = html;
-    };
-    this.show = function() {
-        KE.layout.show(this.arg.id, this.div);
-    };
-    this.picker = function() {
-        var colorTable = KE.setting.colorTable;
-        var table = KE.$$('table');
-        table.cellPadding = 0;
-        table.cellSpacing = 0;
-        table.border = 0;
-        table.style.margin = 0;
-        table.style.padding = 0;
-        table.style.borderCollapse = 'separate';
-        for (var i = 0; i < colorTable.length; i++) {
-            var row = table.insertRow(i);
-            for (var j = 0; j < colorTable[i].length; j++) {
-                var cell = row.insertCell(j);
-                cell.className = 'ke-picker-cell';
-                cell.style.backgroundColor = colorTable[i][j];
-                cell.title = colorTable[i][j];
-                cell.onmouseover = function() {this.style.borderColor = '#000000'; }
-                cell.onmouseout = function() {this.style.borderColor = '#F0F0EE'; }
-                cell.onclick = new Function('KE.plugin["' + this.arg.cmd + '"].exec("' +
-                                            this.arg.id + '", "' + colorTable[i][j] + '")');
-                cell.innerHTML = '&nbsp;';
-            }
-        }
-        this.append(table);
-        this.show();
-    };
-};
-
-KE.dialog = function(arg){
-    this.arg = arg;
-    this.topHeight = 20;
-    this.bottomHeight = 76;
-    this.getPos = function() {
-        var arg = this.arg;
-        var id = this.arg.id;
-        var pos = KE.util.getElementPos(KE.g[id].container);
-        var height = arg.height + this.topHeight + this.bottomHeight;
-        var xDiff = Math.round(parseInt(KE.g[id].container.style.width) / 2) - Math.round(arg.width / 2);
-        var yDiff = Math.round(parseInt(KE.g[id].container.style.height) / 2) - Math.round(height / 2);
-        var x = xDiff < 0 ? pos.x : pos.x + xDiff;
-        var y = yDiff < 0 ? pos.y : pos.y + yDiff;
-        return {'x' : x, 'y' : y};
-    };
-    this.show = function() {
-        var arg = this.arg;
-        var id = arg.id;
-        var div = KE.layout.make(arg.id);
-        div.className = 'ke-dialog';
-        var pos = this.getPos();
-        div.style.width = (arg.width + this.topHeight) + 'px';
-        div.style.height = (arg.height + this.bottomHeight) + 'px';
-        div.style.top = pos.y + 'px';
-        div.style.left = pos.x + 'px';
-        var titleDiv = KE.$$('div');
-        titleDiv.className = 'ke-dialog-title';
-        titleDiv.innerHTML = arg.title;
-        var span = KE.$$('span');
-        var url = KE.g[id].skinsPath + KE.g[id].skinType + '.gif';
-        span.style.backgroundImage = "url(" + url + ")";
-        span.className = "ke-toolbar-close";
-        span.alt = KE.lang['close'];
-        span.title = KE.lang['close'];
-        span.onclick = new Function("KE.layout.hide('" + id + "')");
-        titleDiv.appendChild(span);
-        KE.util.drag(id, titleDiv, div, function(objTop, objLeft, objWidth, objHeight, top, left) {
-            div.style.top = (objTop + top) + 'px';
-            div.style.left = (objLeft + left) + 'px';
-        });
-        div.appendChild(titleDiv);
-        var bodyDiv = KE.$$('div');
-        bodyDiv.className = 'ke-dialog-body';
-        var dialog = KE.$$('iframe');
-        if (arg.useFrameCSS) {
-            dialog.className = 'ke-dialog-iframe';
-        }
-        dialog.width = arg.width + 'px';
-        dialog.height = arg.height + 'px';
-        dialog.setAttribute("frameBorder", "0");
-        bodyDiv.appendChild(dialog);
-        div.appendChild(bodyDiv);
-
-        var bottomDiv = KE.$$('div');
-        bottomDiv.className = 'ke-dialog-bottom';
-        var noButton = null;
-        var yesButton = null;
-        var previewButton = null;
-        if (arg.noButton) {
-            noButton = KE.$$('input');
-            noButton.className = 'ke-dialog-no';
-            noButton.type = 'button';
-            noButton.name = 'noButton';
-            noButton.value = arg.noButton;
-            noButton.onclick = new Function("KE.layout.hide('" + id + "')");
-            bottomDiv.appendChild(noButton);
-        }
-        if (arg.yesButton) {
-            yesButton = KE.$$('input');
-            yesButton.className = 'ke-dialog-yes';
-            yesButton.type = 'button';
-            yesButton.name = 'yesButton';
-            yesButton.value = arg.yesButton;
-            yesButton.onclick = new Function("KE.plugin['" + arg.cmd  + "'].exec('" + id + "')");
-            bottomDiv.appendChild(yesButton);
-        }
-        if (arg.previewButton) {
-            previewButton = KE.$$('input');
-            previewButton.className = 'ke-dialog-preview';
-            previewButton.type = 'button';
-            previewButton.name = 'previewButton';
-            previewButton.value = arg.previewButton;
-            previewButton.onclick = new Function("KE.plugin['" + arg.cmd  + "'].preview('" + id + "')");
-            bottomDiv.appendChild(previewButton);
-        }
-        div.appendChild(bottomDiv);
-        KE.layout.show(id, div);
-        window.focus();
-        if (yesButton) yesButton.focus();
-        else if (noButton) noButton.focus();
-        if (typeof arg.html != "undefined") {
-            var dialogDoc = KE.util.getIframeDoc(dialog);
-            var html = KE.util.getFullHtml(id, false);
-            dialogDoc.open();
-            dialogDoc.write(html);
-            dialogDoc.close();
-            dialogDoc.body.innerHTML = arg.html;
-        } else {
-            dialog.src = KE.g[id].pluginsPath + arg.cmd + '.html';
-        }
-        KE.g[id].maskDiv.style.width = KE.util.getDocumentWidth() + 'px';
-        KE.g[id].maskDiv.style.height = KE.util.getDocumentHeight() + 'px';
-        KE.g[id].maskDiv.style.display = 'block';
-        KE.g[id].dialog = dialog;
-        KE.g[id].noButton = noButton;
-        KE.g[id].yesButton = yesButton;
-        KE.g[id].previewButton = previewButton;
-    };
-};
-
-KE.toolbar = {
-    updateState : function(id) {
-        var cmdList = [
-            'justifyleft', 'justifycenter', 'justifyright',
-            'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript','superscript',
-            'bold', 'italic', 'underline', 'strikethrough'
-        ];
-        for (var i = 0; i < cmdList.length; i++) {
-            var cmd = cmdList[i];
-            var state = false;
-            try {
-                state = KE.g[id].iframeDoc.queryCommandState(cmd);
-            } catch(e) {}
-            if (state) {
-                KE.toolbar.select(id, cmd);
-            } else {
-                KE.toolbar.unselect(id, cmd);
-            }
-        }
-    },
-    isSelected : function(id, cmd) {
-        if (KE.plugin[cmd] && KE.plugin[cmd].isSelected) return true;
-        else return false;
-    },
-    select : function(id, cmd) {
-        if (KE.g[id].toolbarIcon[cmd]) {
-            var a = KE.g[id].toolbarIcon[cmd][0];
-            a.className = "ke-icon-selected";
-            a.onmouseover = null;
-            a.onmouseout = null;
-        }
-    },
-    unselect : function(id, cmd) {
-        if (KE.g[id].toolbarIcon[cmd]) {
-            var a = KE.g[id].toolbarIcon[cmd][0];
-            a.className = "ke-icon";
-            a.onmouseover = function(){ this.className = "ke-icon-on"; };
-            a.onmouseout = function(){ this.className = "ke-icon"; };
-        }
-    },
-    able : function(id, arr) {
-        KE.each(KE.g[id].toolbarIcon, function(cmd, obj) {
-            if (!KE.util.inArray(cmd, arr)) {
-                var a = obj[0];
-                var span = obj[1];
-                a.className = 'ke-icon';
-                KE.util.setOpacity(span, 100);
-                a.onclick = new Function('KE.util.click("' + id + '", "' + cmd + '");');
-                a.onmouseover = function(){ this.className = "ke-icon-on"; };
-                a.onmouseout = function(){ this.className = "ke-icon"; };
-            }
-        });
-    },
-    disable : function(id, arr) {
-        KE.each(KE.g[id].toolbarIcon, function(cmd, obj) {
-            if (!KE.util.inArray(cmd, arr)) {
-                var a = obj[0];
-                var span = obj[1];
-                a.className = 'ke-icon-disabled';
-                KE.util.setOpacity(span, 50);
-                a.onclick = null;
-                a.onmouseover = null;
-                a.onmouseout = null;
-            }
-        });
-    },
-    create : function(id) {
-        KE.g[id].toolbarIcon = [];
-        var tableObj = KE.util.createTable();
-        var toolbar = tableObj.table;
-        toolbar.className = 'ke-toolbar';
-        toolbar.oncontextmenu = function() { return false; };
-        toolbar.onmousedown = function() { return false; };
-        toolbar.onmousemove = function() { return false; };
-        var toolbarCell = tableObj.cell;
-        var length = KE.g[id].items.length;
-        var cellNum = 0;
-        var row;
-        for (var i = 0; i < length; i++) {
-            var cmd = KE.g[id].items[i];
-            if (i == 0 || cmd == '-') {
-                var table = KE.util.createTable().table;
-                table.className = 'ke-toolbar-table';
-                row = table.insertRow(0);
-                cellNum = 0;
-                toolbarCell.appendChild(table);
-                if (cmd == '-') continue;
-            }
-            var cell = row.insertCell(cellNum);
-            cell.hideforcus = true;
-            cellNum++;
-            var a = KE.$$('a');
-            a.className = 'ke-icon';
-            a.href = 'javascript:;';
-            a.onclick = new Function('KE.util.click("' + id + '", "' + cmd + '");');
-            a.onmouseover = function(){ this.className = "ke-icon-on"; };
-            a.onmouseout = function(){ this.className = "ke-icon"; };
-            a.hidefocus = true;
-            a.title = KE.lang[cmd];
-            var span = KE.$$('span');
-            span.className = "ke-common-icon ke-icon-" + cmd;
-            if (KE.util.inArray(cmd, KE.g[id].defaultItems)) {
-                var url = KE.g[id].skinsPath + KE.g[id].skinType + '.gif';
-                span.style.backgroundImage = "url(" + url + ")";
-            }
-            a.appendChild(span);
-            cell.appendChild(a);
-            KE.g[id].toolbarIcon[cmd] = [a, span];
-            if (KE.toolbar.isSelected(id, cmd)) KE.toolbar.select(id, cmd);
-        }
-        return toolbar;
-    }
-};
-
-KE.history = {
-    add : function(id, minChangeFlag) {
-        var obj = KE.g[id];
-        var html = KE.util.getSrcData(id);
-        if (obj.undoStack.length > 0) {
-            var prevHtml = obj.undoStack[obj.undoStack.length - 1];
-            if (html == prevHtml) return;
-            if (minChangeFlag && Math.abs(html.length - prevHtml.length) < obj.minChangeSize) return;
-        }
-        obj.undoStack.push(html);
-        obj.redoStack = [];
-    },
-    undo : function(id) {
-        var obj = KE.g[id];
-        if (obj.undoStack.length == 0) return;
-        var html = KE.util.getSrcData(id);
-        obj.redoStack.push(html);
-        var prevHtml = obj.undoStack.pop();
-        if (html == prevHtml && obj.undoStack.length > 0) {
-            prevHtml = obj.undoStack.pop();
-        }
-        obj.iframeDoc.body.innerHTML = prevHtml;
-        obj.newTextarea.value = prevHtml;
-    },
-    redo : function(id) {
-        var obj = KE.g[id];
-        if (obj.redoStack.length == 0) return;
-        var html = KE.util.getSrcData(id);
-        obj.undoStack.push(html);
-        var nextHtml = obj.redoStack.pop();
-        obj.iframeDoc.body.innerHTML = nextHtml;
-        obj.newTextarea.value = nextHtml;
-    }
-};
-
-KE.remove = function(id, mode) {
-    mode = (typeof mode == "undefined") ? 0 : mode;
-    var container = KE.g[id].container;
-    if (mode == 1) {
-        document.body.removeChild(container);
-    } else {
-        var srcTextarea = KE.$(id);
-        srcTextarea.parentNode.removeChild(container);
-    }
-    document.body.removeChild(KE.g[id].hideDiv);
-    document.body.removeChild(KE.g[id].maskDiv);
-    KE.g[id].containner = null;
-};
-
-KE.create = function(id, mode) {
-    if (KE.browser == 'IE') try { document.execCommand('BackgroundImageCache', false, true); }catch(e){}
-    var srcTextarea = KE.$(id);
-    mode = (typeof mode == "undefined") ? 0 : mode;
-    if (mode == 0 && KE.g[id].container != null) return;
-    var width = KE.g[id].width || srcTextarea.style.width;
-    var height = KE.g[id].height || srcTextarea.style.height;
-    var tableObj = KE.util.createTable();
-    var container = tableObj.table;
-    container.className = 'ke-container';
-    container.style.width = width;
-    container.style.height = height;
-    var toolbarOuter = tableObj.cell;
-    toolbarOuter.className = 'ke-toolbar-outer';
-    var textareaOuter = container.insertRow(1).insertCell(0);
-    textareaOuter.className = 'ke-textarea-outer';
-    tableObj = KE.util.createTable();
-    var textareaTable = tableObj.table;
-    textareaTable.className = 'ke-textarea-table';
-    var textareaCell = tableObj.cell;
-    textareaOuter.appendChild(textareaTable);
-    var bottomOuter = container.insertRow(2).insertCell(0);
-    bottomOuter.className = 'ke-bottom-outer';
-    if (mode == 1) document.body.appendChild(container);
-    else srcTextarea.parentNode.insertBefore(container, srcTextarea);
-    var toolbarTable = KE.toolbar.create(id);
-    toolbarOuter.appendChild(toolbarTable);
-    var iframe = KE.$$('iframe');
-    iframe.className = 'ke-iframe';
-    iframe.setAttribute("frameBorder", "0");
-    var newTextarea = KE.$$('textarea');
-    newTextarea.className = 'ke-textarea';
-    newTextarea.style.display = 'none';
-    textareaCell.appendChild(iframe);
-    textareaCell.appendChild(newTextarea);
-    var bottom = KE.$$('table');
-    bottom.className = 'ke-bottom';
-    bottom.cellPadding = 0;
-    bottom.cellSpacing = 0;
-    bottom.border = 0;
-    var row = bottom.insertRow(0);
-    var bottomLeft = row.insertCell(0);
-    bottomLeft.className = 'ke-bottom-left';
-    var bottomRight = row.insertCell(1);
-    bottomRight.className = 'ke-bottom-right';
-    var span = KE.$$('span');
-    var url = KE.g[id].skinsPath + KE.g[id].skinType + '.gif';
-    span.style.backgroundImage = "url(" + url + ")";
-    span.className = 'ke-bottom-right-img';
-    bottomRight.appendChild(span);
-    bottomOuter.appendChild(bottom);
-    var hideDiv = KE.$$('div');
-    hideDiv.style.display = 'none';
-    var maskDiv = KE.$$('div');
-    maskDiv.className = 'ke-mask';
-    KE.util.setOpacity(maskDiv, 50);
-    document.body.appendChild(hideDiv);
-    document.body.appendChild(maskDiv);
-    srcTextarea.style.display = "none";
-    KE.util.setDefaultPlugin(id);
-    var iframeWin = iframe.contentWindow;
-    var iframeDoc = KE.util.getIframeDoc(iframe);
-    iframeDoc.designMode = "On";
-    var html = KE.util.getFullHtml(id, KE.g[id].tagLineMode);
-    iframeDoc.open();
-    iframeDoc.write(html);
-    iframeDoc.close();
-    if (!KE.g[id].wyswygMode) {
-        newTextarea.value = srcTextarea.value;
-        newTextarea.style.display = 'block';
-        iframe.style.display = 'none';
-        KE.toolbar.disable(id, ['source', 'preview', 'fullscreen']);
-        KE.toolbar.select(id, 'source');
-    }
-    if (KE.g[id].autoOnsubmitMode) {
-        var form = srcTextarea.parentNode;
-        while (form != null && form.tagName != 'FORM') { form = form.parentNode; }
-        if (form != null && form.tagName == 'FORM') {
-            KE.event.add(form, 'submit', new Function('KE.util.setData("' + id + '")'));
-        }
-    }
-    KE.event.add(iframeDoc, 'click', new Function('KE.layout.hide("' + id + '")'));
-    KE.event.add(iframeDoc, 'click', new Function('KE.toolbar.updateState("' + id + '")'));
-    KE.event.input(iframeDoc, new Function('KE.history.add("' + id + '", true)'));
-    KE.event.add(iframeDoc, 'keyup', new Function('KE.toolbar.updateState("' + id + '")'));
-    KE.event.add(newTextarea, 'click', new Function('KE.layout.hide("' + id + '")'));
-    KE.event.input(newTextarea, new Function('KE.history.add("' + id + '", true)'));
-    KE.g[id].container = container;
-    KE.g[id].toolbarTable = toolbarTable;
-    KE.g[id].textareaTable = textareaTable;
-    KE.g[id].iframe = iframe;
-    KE.g[id].newTextarea = newTextarea;
-    KE.g[id].srcTextarea = srcTextarea;
-    KE.g[id].bottom = bottom;
-    KE.g[id].hideDiv = hideDiv;
-    KE.g[id].maskDiv = maskDiv;
-    KE.g[id].iframeWin = iframeWin;
-    KE.g[id].iframeDoc = iframeDoc;
-    KE.g[id].width = width;
-    KE.g[id].height = height;
-    KE.util.resize(id, width, height);
-    KE.util.drag(id, bottomRight, container, function(objTop, objLeft, objWidth, objHeight, top, left) {
-        if (KE.g[id].resizeMode == 2) KE.util.resize(id, (objWidth + left) + 'px', (objHeight + top) + 'px', true);
-        else if (KE.g[id].resizeMode == 1) KE.util.resize(id, objWidth + 'px', (objHeight + top) + 'px', true);
-    }, true);
-    KE.util.drag(id, bottomLeft, container, function(objTop, objLeft, objWidth, objHeight, top, left) {
-        if (KE.g[id].resizeMode > 0) KE.util.resize(id, objWidth + 'px', (objHeight + top) + 'px', true);
-    }, true);
-    for (var i = 0, len = KE.g[id].items.length; i < len; i++) {
-        var cmd = KE.g[id].items[i];
-        if (KE.plugin[cmd] && KE.plugin[cmd].init) KE.plugin[cmd].init(id);
-    }
-    setTimeout(
-        function(){
-            if (srcTextarea.value !== "") iframeDoc.body.innerHTML = srcTextarea.value;
-            KE.history.add(id, false);
-        }, 1);
-};
-
-KE.init = function(config) {
-    config.wyswygMode = (typeof config.wyswygMode == "undefined") ? KE.setting.wyswygMode : config.wyswygMode;
-    config.autoOnsubmitMode = (typeof config.autoOnsubmitMode == "undefined") ? KE.setting.autoOnsubmitMode : config.autoOnsubmitMode;
-    config.resizeMode = (typeof config.resizeMode == "undefined") ? KE.setting.resizeMode : config.resizeMode;
-    config.filterMode = (typeof config.filterMode == "undefined") ? KE.setting.filterMode : config.filterMode;
-    config.tagLineMode = (typeof config.tagLineMode == "undefined") ? KE.setting.tagLineMode : config.tagLineMode;
-    config.skinType = config.skinType || KE.setting.skinType;
-    config.cssPath = config.cssPath || KE.setting.cssPath;
-    config.skinsPath = config.skinsPath || KE.setting.skinsPath;
-    config.pluginsPath = config.pluginsPath || KE.setting.pluginsPath;
-    config.minWidth = config.minWidth || KE.setting.minWidth;
-    config.minHeight = config.minHeight || KE.setting.minHeight;
-    config.minChangeSize = config.minChangeSize || KE.setting.minChangeSize;
-    config.siteDomains = config.siteDomains || KE.setting.siteDomains;
-    config.defaultItems = KE.setting.items;
-    config.items = config.items || KE.setting.items;
-    config.htmlTags = config.htmlTags || KE.setting.htmlTags;
-    KE.g[config.id] = config;
-    KE.g[config.id].undoStack = [];
-    KE.g[config.id].redoStack = [];
-    KE.util.loadStyle(config.skinsPath + config.skinType + '.css');
-}
-
-KE.show = function(config) {
-    KE.init(config);
-    KE.event.add(window, 'load', new Function('KE.create("' + config.id + '")'));
-};
-
-KE.plugin['about'] = {
-    click : function(id) {
-        var dialog = new KE.dialog({
-            id : id,
-            cmd : 'about',
-            width : 300,
-            height : 80,
-            title : KE.lang['about'],
-            noButton : KE.lang['close']
-        });
-        dialog.show();
-    }
-};
-
-KE.plugin['undo'] = {
-    init : function(id) {
-        KE.event.ctrl(KE.g[id].iframeDoc, 'Z', function(e) {
-            KE.plugin['undo'].click(id);
-            KE.util.focus(id);
-        });
-    },
-    click : function(id) {
-        KE.history.undo(id);
-    }
-};
-
-KE.plugin['redo'] = {
-    init : function(id) {
-        KE.event.ctrl(KE.g[id].iframeDoc, 'Y', function(e) {
-            KE.plugin['redo'].click(id);
-            KE.util.focus(id);
-        });
-    },
-    click : function(id) {
-        KE.history.redo(id);
-    }
-};
-
-KE.plugin['plainpaste'] = {
-    click : function(id) {
-        KE.util.selection(id);
-        var dialog = new KE.dialog({
-            id : id,
-            cmd : 'plainpaste',
-            width : 330,
-            height : 300,
-            title : KE.lang['plainpaste'],
-            yesButton : KE.lang['yes'],
-            noButton : KE.lang['no']
-        });
-        dialog.show();
-    },
-    exec : function(id) {
-        KE.util.select(id);
-        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
-        var html = KE.$('textArea', dialogDoc).value;
-        html = KE.util.escape(html);
-        var re = new RegExp("\r\n|\n|\r", "g");
-        html = html.replace(re, "<br />$&");
-        KE.util.insertHtml(id, html);
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['wordpaste'] = {
-    click : function(id) {
-        KE.util.selection(id);
-        var dialog = new KE.dialog({
-            id : id,
-            cmd : 'wordpaste',
-            width : 330,
-            height : 300,
-            title : KE.lang['wordpaste'],
-            yesButton : KE.lang['yes'],
-            noButton : KE.lang['no']
-        });
-        dialog.show();
-    },
-    exec : function(id) {
-        KE.util.select(id);
-        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
-        var wordIframe = KE.$('wordIframe', dialogDoc);
-        var wordDoc = KE.util.getIframeDoc(wordIframe);
-        KE.util.insertHtml(id, KE.util.outputHtml(id, wordDoc.body));
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['fullscreen'] = {
-    resetFull : function(id) {
-        var el = KE.util.getDocumentElement();
-        var width = el.clientWidth;
-        var height = el.clientHeight;
-        var left,top;
-        if (KE.browser == 'IE' || KE.browser == 'OPERA') {
-            left = document.body.parentNode.scrollLeft;
-            top = document.body.parentNode.scrollTop;
-        } else {
-            left = window.scrollX;
-            top = window.scrollY;
-        }
-        var div = KE.g[id].container;
-        div.style.left = left + 'px';
-        div.style.top = top + 'px';
-        div.style.zIndex = 19811211;
-        KE.util.resize(id, width + 'px', height + 'px');
-    },
-    click : function(id) {
-        var obj = KE.g[id];
-        var self = this;
-        var resizeListener = function(e) {
-            if (self.isSelected) {
-                KE.plugin["fullscreen"].resetFull(id);
-            }
-        }
-        if (this.isSelected) {
-            this.isSelected = false;
-            KE.util.setData(id);
-            KE.remove(id, 1);
-            KE.create(id, 2);
-            document.body.parentNode.style.overflow = 'auto';
-            KE.util.resize(id, this.width, this.height);
-            KE.event.remove(window, 'resize', resizeListener);
-            KE.toolbar.unselect(id, "fullscreen");
-        } else {
-            this.isSelected = true;
-            KE.util.setData(id);
-            this.width = KE.g[id].container.style.width;
-            this.height = KE.g[id].container.style.height;
-            KE.remove(id, 2);
-            KE.create(id, 1);
-            document.body.parentNode.style.overflow = 'hidden';
-            var div = KE.g[id].container;
-            div.style.position = 'absolute';
-            this.resetFull(id);
-            KE.event.add(window, 'resize', resizeListener);
-            KE.toolbar.select(id, "fullscreen");
-        }
-    }
-};
-
-KE.plugin['bgcolor'] = {
-    click : function(id) {
-        KE.util.selection(id);
-        var menu = new KE.menu({
-            id : id,
-            cmd : 'bgcolor'
-        });
-        menu.picker();
-    },
-    exec : function(id, value) {
-        var cmd = new KE.cmd(id);
-        cmd.wrap('span', [{'.background-color': value}]);
-        KE.history.add(id, false);
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['date'] = {
-    click : function(id) {
-        var date = new Date();
-        var year = date.getFullYear().toString(10);
-        var month = (date.getMonth() + 1).toString(10);
-        month = month.length < 2 ? '0' + month : month;
-        var day = date.getDate().toString(10);
-        day = day.length < 2 ? '0' + day : day;
-        var value = year + '-' + month + '-' + day;
-        KE.util.selection(id);
-        KE.util.insertHtml(id, value);
-    }
-};
-
-KE.plugin['fontname'] = {
-    click : function(id) {
-        var fontName = {
-            'SimSun'             : '宋体',
-            'SimHei'             : '黑体',
-            'FangSong_GB2312'    : '仿宋体',
-            'KaiTi_GB2312'       : '楷体',
-            'NSimSun'            : '新宋体',
-            'Arial'              : 'Arial',
-            'Arial Black'        : 'Arial Black',
-            'Times New Roman'    : 'Times New Roman',
-            'Courier New'        : 'Courier New',
-            'Tahoma'             : 'Tahoma',
-            'Verdana'            : 'Verdana'
-        };
-        var cmd = 'fontname';
-        KE.util.selection(id);
-        var menu = new KE.menu({
-            id : id,
-            cmd : cmd,
-            width : '160px'
-        });
-        KE.each(fontName, function(key, value) {
-            var html = '<span style="font-family: ' + key + ';">' + value + '</span>';
-            menu.add(html, new Function('KE.plugin["' + cmd + '"].exec("' + id + '", "' + key + '")'));
-        });
-        menu.show();
-    },
-    exec : function(id, value) {
-        var cmd = new KE.cmd(id);
-        cmd.wrap('span', [{'.font-family': value}]);
-        KE.history.add(id, false);
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['fontsize'] = {
-    click : function(id) {
-        var fontSize = ['9px', '10px', '12px', '14px', '16px', '18px', '24px', '32px'];
-        var cmd = 'fontsize';
-        KE.util.selection(id);
-        var menu = new KE.menu({
-            id : id,
-            cmd : cmd,
-            width : '100px'
-        });
-        for (var i = 0, len = fontSize.length; i < len; i++) {
-            var value = fontSize[i];
-            var html = '<span style="font-size: ' + value + ';">' + value + '</span>';
-            menu.add(html, new Function('KE.plugin["' + cmd + '"].exec("' + id + '", "' + value + '")'));
-        }
-        menu.show();
-    },
-    exec : function(id, value) {
-        var cmd = new KE.cmd(id);
-        cmd.wrap('span', [{'.font-size': value}]);
-        KE.history.add(id, false);
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['hr'] = {
-    click : function(id) {
-        KE.util.selection(id);
-        KE.util.insertHtml(id, '<hr />');
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['preview'] = {
-    click : function(id) {
-        var dialog = new KE.dialog({
-            id : id,
-            cmd : 'preview',
-            html : KE.util.getData(id),
-            width : 600,
-            height : 400,
-            useFrameCSS : true,
-            title : KE.lang['preview'],
-            noButton : KE.lang['close']
-        });
-        dialog.show();
-    }
-};
-
-KE.plugin['print'] = {
-    click : function(id) {
-        KE.util.selection(id);
-        KE.g[id].iframeWin.print();
-    }
-};
-
-KE.plugin['removeformat'] = {
-    click : function(id) {
-        KE.util.selection(id);
-        var cmd = new KE.cmd(id);
-        cmd.remove(KE.setting.inlineTags, ['class', 'style']);
-        KE.history.add(id, false);
-        KE.toolbar.updateState(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['source'] = {
-    click : function(id) {
-        var obj = KE.g[id];
-        if (!obj.wyswygMode) {
-            obj.iframeDoc.body.innerHTML = obj.newTextarea.value;
-            obj.iframe.style.display = 'block';
-            obj.newTextarea.style.display = 'none';
-            KE.toolbar.able(id, ['source', 'preview', 'fullscreen']);
-            obj.wyswygMode = true;
-            this.isSelected = false;
-            KE.toolbar.unselect(id, "source");
-        } else {
-            KE.layout.hide(id);
-            if (KE.g[id].filterMode) {
-                obj.newTextarea.value = KE.util.outputHtml(id, obj.iframeDoc.body);
-            } else {
-                obj.newTextarea.value = KE.util.htmlToXhtml(id, obj.iframeDoc.body);
-            }
-            obj.iframe.style.display = 'none';
-            obj.newTextarea.style.display = 'block';
-            KE.toolbar.disable(id, ['source', 'preview', 'fullscreen']);
-            obj.wyswygMode = false;
-            this.isSelected = true;
-            KE.toolbar.select(id, "source");
-        }
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['textcolor'] = {
-    click : function(id) {
-        KE.util.selection(id);
-        var menu = new KE.menu({
-            id : id,
-            cmd : 'textcolor'
-        });
-        menu.picker();
-    },
-    exec : function(id, value) {
-        var cmd = new KE.cmd(id);
-        cmd.wrap('span', [{'.color': value}]);
-        KE.history.add(id, false);
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['time'] = {
-    click : function(id) {
-        var date = new Date();
-        var hour = date.getHours().toString(10);
-        hour = hour.length < 2 ? '0' + hour : hour;
-        var minute = date.getMinutes().toString(10);
-        minute = minute.length < 2 ? '0' + minute : minute;
-        var second = date.getSeconds().toString(10);
-        second = second.length < 2 ? '0' + second : second;
-        var value = hour + ':' + minute + ':' + second;
-        KE.util.selection(id);
-        KE.util.insertHtml(id, value);
-    }
-};
-
-KE.plugin['title'] = {
-    click : function(id) {
-        var title = {
-            'H1' : '标题 1',
-            'H2' : '标题 2',
-            'H3' : '标题 3',
-            'H4' : '标题 4',
-            'H5' : '标题 5',
-            'H6' : '标题 6'
-        };
-        var cmd = 'title';
-        KE.util.selection(id);
-        var menu = new KE.menu({
-            id : id,
-            cmd : cmd,
-            width : '120px'
-        });
-        KE.each(title, function(key, value) {
-            var html = '<' + key + ' style="margin:0px;">' + value + '</' + key + '>';
-            menu.add(html, new Function('KE.plugin["' + cmd + '"].exec("' + id + '", "<' + key + '>")'));
-        });
-        menu.show();
-    },
-    exec : function(id, value) {
-        KE.util.select(id);
-        KE.util.execCommand(id, 'formatblock', value);
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['emoticons'] = {
-    icon : 'emoticons.gif',
-    click : function(id) {
-        var emoticonTable = [
-            ['etc_01.gif','etc_02.gif','etc_03.gif','etc_04.gif','etc_05.gif','etc_06.gif'],
-            ['etc_07.gif','etc_08.gif','etc_09.gif','etc_10.gif','etc_11.gif','etc_12.gif'],
-            ['etc_13.gif','etc_14.gif','etc_15.gif','etc_16.gif','etc_17.gif','etc_18.gif'],
-            ['etc_19.gif','etc_20.gif','etc_21.gif','etc_22.gif','etc_23.gif','etc_24.gif'],
-            ['etc_25.gif','etc_26.gif','etc_27.gif','etc_28.gif','etc_29.gif','etc_30.gif'],
-            ['etc_31.gif','etc_32.gif','etc_33.gif','etc_34.gif','etc_35.gif','etc_36.gif']
-        ];
-        var cmd = 'emoticons';
-        KE.util.selection(id);
-        var table = KE.$$('table');
-        table.cellPadding = 0;
-        table.cellSpacing = 2;
-        table.border = 0;
-        table.style.margin = 0;
-        table.style.padding = 0;
-        table.style.borderCollapse = 'separate';
-        for (var i = 0; i < emoticonTable.length; i++) {
-            var row = table.insertRow(i);
-            for (var j = 0; j < emoticonTable[i].length; j++) {
-                var cell = row.insertCell(j);
-                cell.style.margin = 0;
-                cell.style.padding = '1px';
-                cell.style.border = '1px solid #F0F0EE';
-                cell.style.cursor = 'pointer';
-                cell.onmouseover = function() {this.style.borderColor = '#000000'; }
-                cell.onmouseout = function() {this.style.borderColor = '#F0F0EE'; }
-                cell.onclick = new Function('KE.plugin["' + cmd + '"].exec("' + id + '", "' + emoticonTable[i][j] + '")');
-                var img = KE.$$('img');
-                img.src = KE.g[id].pluginsPath + 'emoticons/' + emoticonTable[i][j];
-                cell.appendChild(img);
-            }
-        }
-        var menu = new KE.menu({
-            id : id,
-            cmd : cmd
-        });
-        menu.append(table);
-        menu.show();
-    },
-    exec : function(id, value) {
-        KE.util.select(id);
-        var html = '<img src="' + KE.g[id].pluginsPath + 'emoticons/' + value + '" border="0" />';
-        KE.util.insertHtml(id, html);
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['flash'] = {
-    click : function(id) {
-        KE.util.selection(id);
-        var dialog = new KE.dialog({
-            id : id,
-            cmd : 'flash',
-            width : 280,
-            height : 250,
-            title : "Flash",
-            previewButton : KE.lang['preview'],
-            yesButton : KE.lang['yes'],
-            noButton : KE.lang['no']
-        });
-        dialog.show();
-    },
-    check : function(id, url) {
-        if (url.match(/\w+:\/\/.{3,}/) == null) {
-            alert(KE.lang['invalidUrl']);
-            window.focus();
-            KE.g[id].yesButton.focus();
-            return false;
-        }
-        return true;
-    },
-    preview : function(id) {
-        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
-        var url = KE.$('url', dialogDoc).value;
-        if (!this.check(id, url)) return false;
-        var embed = KE.$$('embed', dialogDoc);
-        embed.src = url;
-        embed.type = "application/x-shockwave-flash";
-        embed.quality = "high";
-        embed.width = 190;
-        embed.height = 190;
-        KE.$('previewDiv', dialogDoc).innerHTML = "";
-        KE.$('previewDiv', dialogDoc).appendChild(embed);
-    },
-    exec : function(id) {
-        KE.util.select(id);
-        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
-        var url = KE.$('url', dialogDoc).value;
-        if (!this.check(id, url)) return false;
-        var html = '<embed src="' + url + '" type="application/x-shockwave-flash" quality="high" />';
-        KE.util.insertHtml(id, html);
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['image'] = {
-    click : function(id) {
-        KE.util.selection(id);
-        var dialog = new KE.dialog({
-            id : id,
-            cmd : 'image',
-            width : 310,
-            height : 90,
-            title : KE.lang['image'],
-            yesButton : KE.lang['yes'],
-            noButton : KE.lang['no']
-        });
-        dialog.show();
-    },
-    check : function(id) {
-        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
-        var type = KE.$('type', dialogDoc).value;
-        var url = '';
-        if (type == 1) {
-            url = KE.$('imgFile', dialogDoc).value;
-        } else {
-            url = KE.$('url', dialogDoc).value;
-        }
-        var width = KE.$('imgWidth', dialogDoc).value;
-        var height = KE.$('imgHeight', dialogDoc).value;
-        var border = KE.$('imgBorder', dialogDoc).value;
-        if (!url.match(/\.(jpg|jpeg|gif|bmp|png)(\s|$)/i)) {
-            alert(KE.lang['invalidImg']);
-            window.focus();
-            KE.g[id].yesButton.focus();
-            return false;
-        }
-        if (width.match(/^\d+$/) == null) {
-            alert(KE.lang['invalidWidth']);
-            window.focus();
-            KE.g[id].yesButton.focus();
-            return false;
-        }
-        if (height.match(/^\d+$/) == null) {
-            alert(KE.lang['invalidHeight']);
-            window.focus();
-            KE.g[id].yesButton.focus();
-            return false;
-        }
-        if (border.match(/^\d+$/) == null) {
-            alert(KE.lang['invalidBorder']);
-            window.focus();
-            KE.g[id].yesButton.focus();
-            return false;
-        }
-        return true;
-    },
-    exec : function(id) {
-        KE.util.select(id);
-        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
-        var type = KE.$('type', dialogDoc).value;
-        if (!this.check(id)) return false;
-        if (type == 1) {
-            KE.$('editorId', dialogDoc).value = id;
-            dialogDoc.uploadForm.submit();
-            return false;
-        } else {
-            var url = KE.$('url', dialogDoc).value;
-            var title = KE.$('imgTitle', dialogDoc).value;
-            var width = KE.$('imgWidth', dialogDoc).value;
-            var height = KE.$('imgHeight', dialogDoc).value;
-            var border = KE.$('imgBorder', dialogDoc).value;
-            this.insert(id, url, title, width, height, border);
-        }
-    },
-    insert : function(id, url, title, width, height, border) {
-        var html = '<img src="' + url + '" ';
-        if (width > 0) html += 'width="' + width + '" ';
-        if (height > 0) html += 'height="' + height + '" ';
-        if (title) html += 'title="' + title + '" ';
-        html += 'alt="' + title + '" ';
-        html += 'border="' + border + '" />';
-        KE.util.insertHtml(id, html);
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['layer'] = {
-    click : function(id) {
-        var cmd = 'layer';
-        var styles = [
-            'margin:5px;border:1px solid #000000;',
-            'margin:5px;border:2px solid #000000;',
-            'margin:5px;border:1px dashed #000000;',
-            'margin:5px;border:2px dashed #000000;',
-            'margin:5px;border:1px dotted #000000;',
-            'margin:5px;border:2px dotted #000000;'
-        ];
-        KE.util.selection(id);
-        var menu = new KE.menu({
-            id : id,
-            cmd : cmd,
-            width : '150px'
-        });
-        for (var i = 0; i < styles.length; i++) {
-            var html = '<div style="height:15px;' + styles[i] + '"></div>';
-            menu.add(html, new Function('KE.plugin["' + cmd + '"].exec("' + id + '", "padding:5px;' + styles[i] + '")'));
-        }
-        menu.show();
-    },
-    exec : function(id, value) {
-        KE.util.select(id);
-        var html = '<div style="' + value + '">' + KE.lang['pleaseInput'] + '</div>';
-        KE.util.insertHtml(id, html);
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['link'] = {
-    click : function(id) {
-        KE.util.selection(id);
-        var dialog = new KE.dialog({
-            id : id,
-            cmd : 'link',
-            width : 310,
-            height : 70,
-            title : KE.lang['link'],
-            yesButton : KE.lang['yes'],
-            noButton : KE.lang['no']
-        });
-        dialog.show();
-    },
-    exec : function(id) {
-        KE.util.select(id);
-        var iframeDoc = KE.g[id].iframeDoc;
-        var range = KE.g[id].range;
-        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
-        var url = KE.$('hyperLink', dialogDoc).value;
-        var target = KE.$('linkType', dialogDoc).value;
-        if (url.match(/\w+:\/\/.{3,}/) == null) {
-            alert(KE.lang['invalidUrl']);
-            window.focus();
-            KE.g[id].yesButton.focus();
-            return false;
-        }
-        var node;
-        if (KE.browser == 'IE') {
-            node = range.item ? range.item(0).parentNode : iframeDoc.body;
-        } else {
-            node = (range.startContainer == range.endContainer) ? range.startContainer.parentNode : iframeDoc.body;
-        }
-        if (node && node.tagName == 'A') node = node.parentNode;
-        if (!node) node = iframeDoc.body;
-        iframeDoc.execCommand("createlink", false, "__ke_temp_url__");
-        var arr = node.getElementsByTagName('a');
-        for (var i = 0, l = arr.length; i < l; i++) {
-            if (arr[i].href.match(/\/?__ke_temp_url__$/) != null) {
-                arr[i].href = url;
-                if (target) arr[i].target = target;
-            }
-        }
-        KE.history.add(id);
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['media'] = {
-    click : function(id) {
-        KE.util.selection(id);
-        var dialog = new KE.dialog({
-            id : id,
-            cmd : 'media',
-            width : 280,
-            height : 250,
-            title : KE.lang['media'],
-            previewButton : KE.lang['preview'],
-            yesButton : KE.lang['yes'],
-            noButton : KE.lang['no']
-        });
-        dialog.show();
-    },
-    check : function(id, url) {
-        if (!url.match(/^\w+:\/\/.{3,}\.(mp3|wav|wma|wmv|mid|avi|mpg|mpeg|asf|rm|rmvb)(\?|$)/i)) {
-            alert(KE.lang['invalidMedia']);
-            window.focus();
-            KE.g[id].yesButton.focus();
-            return false;
-        }
-        return true;
-    },
-    preview : function(id) {
-        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
-        var url = KE.$('url', dialogDoc).value;
-        if (!this.check(id, url)) return false;
-        var embed = KE.$$('embed', dialogDoc);
-        embed.src = url;
-        if (url.match(/\.(rm|rmvb)$/i) == null) {
-            embed.type = "video/x-ms-asf-plugin";
-        } else {
-            embed.type = "audio/x-pn-realaudio-plugin";
-        }
-        embed.loop = "true";
-        embed.autostart = "true";
-        embed.width = 260;
-        embed.height = 190;
-        KE.$('previewDiv', dialogDoc).innerHTML = "";
-        KE.$('previewDiv', dialogDoc).appendChild(embed);
-    },
-    exec : function(id) {
-        KE.util.select(id);
-        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
-        var url = KE.$('url', dialogDoc).value;
-        if (!this.check(id, url)) return false;
-        var html;
-        if (url.match(/\.(rm|rmvb)$/i) == null) {
-            html = '<embed src="' + url + '" type="video/x-ms-asf-plugin" loop="true" autostart="true" />';
-        } else {
-            html = '<embed src="' + url + '" type="audio/x-pn-realaudio-plugin" loop="true" autostart="true" />';
-        }
-        KE.util.insertHtml(id, html);
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['specialchar'] = {
-    click : function(id) {
-        var charTable = [
-            ['§','№','☆','★','○','●','◎','◇','◆','□'],
-            ['℃','‰','■','△','▲','※','→','←','↑','↓'],
-            ['〓','¤','°','#','&','@','\','︿','_',' ̄'],
-            ['―','α','β','γ','δ','ε','ζ','η','θ','ι'],
-            ['κ','λ','μ','ν','ξ','ο','π','ρ','σ','τ'],
-            ['υ','φ','χ','ψ','ω','≈','≡','≠','=','≤'],
-            ['≥','<','>','≮','≯','∷','±','+','-','×'],
-            ['÷','/','∫','∮','∝','∞','∧','∨','∑','∏'],
-            ['∪','∩','∈','∵','∴','⊥','∥','∠','⌒','⊙'],
-            ['≌','∽','〖','〗','【','】','(',')','[',']']
-        ];
-        var cmd = 'specialchar';
-        KE.util.selection(id);
-        var table = KE.$$('table');
-        table.cellPadding = 0;
-        table.cellSpacing = 2;
-        table.border = 0;
-        table.style.margin = 0;
-        table.style.padding = 0;
-        table.style.borderCollapse = 'separate';
-        for (var i = 0; i < charTable.length; i++) {
-            var row = table.insertRow(i);
-            for (var j = 0; j < charTable[i].length; j++) {
-                var cell = row.insertCell(j);
-                cell.style.padding = '1px';
-                cell.style.margin = 0;
-                cell.style.border = '1px solid #AAAAAA';
-                cell.style.fontSize = '12px';
-                cell.style.cursor = 'pointer';
-                cell.onmouseover = function() {this.style.borderColor = '#000000'; }
-                cell.onmouseout = function() {this.style.borderColor = '#AAAAAA'; }
-                cell.onclick = new Function('KE.plugin["' + cmd + '"].exec("' + id + '", "' + charTable[i][j] + '")');
-                cell.innerHTML = charTable[i][j];
-            }
-        }
-        var menu = new KE.menu({
-            id : id,
-            cmd : cmd
-        });
-        menu.append(table);
-        menu.show();
-    },
-    exec : function(id, value) {
-        KE.util.select(id);
-        KE.util.insertHtml(id, value);
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
-
-KE.plugin['table'] = {
-    selected : function(id, i, j) {
-        var text = i.toString(10) + ' by ' + j.toString(10) + ' Table';
-        KE.$('tableLocation' + id).innerHTML = text;
-        var num = 10;
-        for (var m = 1; m <= num; m++) {
-            for (var n = 1; n <= num; n++) {
-                var td = KE.$('tableTd' + id + m.toString(10) + '_' + n.toString(10) + '');
-                if (m <= i && n <= j) {
-                    td.style.backgroundColor = '#CCCCCC';
-                } else {
-                    td.style.backgroundColor = '#FFFFFF';
-                }
-            }
-        }
-    },
-    click : function(id) {
-        var cmd = 'table';
-        KE.util.selection(id);
-        var num = 10;
-        var html = '<table cellpadding="0" cellspacing="0" border="0" style="width:130px;border-collapse:separate;padding:0;margin:0;">';
-        for (var i = 1; i <= num; i++) {
-            html += '<tr>';
-            for (var j = 1; j <= num; j++) {
-                var value = i.toString(10) + ',' + j.toString(10);
-                html += '<td id="tableTd' + id + i.toString(10) + '_' + j.toString(10) +
-                    '" style="font-size:1px;width:12px;height:12px;background-color:#FFFFFF;' +
-                    'border:1px solid #DDDDDD;cursor:pointer;margin:0;padding:0;" ' +
-                    'onclick="javascript:KE.plugin[\'table\'].exec(\'' + id + '\', \'' + value + '\');" ' +
-                    'onmouseover="javascript:KE.plugin[\'table\'].selected(\'' + id + '\', \'' + i.toString(10) +
-                    '\', \'' + j.toString(10) + '\');">&nbsp;</td>';
-            }
-            html += '</tr>';
-        }
-        html += '<tr><td colspan="10" id="tableLocation' + id +
-            '" style="font-size:12px;text-align:center;height:20px;margin:0;padding:0;border:0;"></td></tr>';
-        html += '</table>';
-        var menu = new KE.menu({
-            id : id,
-            cmd : cmd
-        });
-        menu.insert(html);
-        menu.show();
-    },
-    exec : function(id, value) {
-        KE.util.select(id);
-        var location = value.split(',');
-        var html = '<table border="1">';
-        for (var i = 0; i < location[0]; i++) {
-            html += '<tr>';
-            for (var j = 0; j < location[1]; j++) {
-                html += '<td>&nbsp;</td>';
-            }
-            html += '</tr>';
-        }
-        html += '</table>';
-        KE.util.insertHtml(id, html);
-        KE.layout.hide(id);
-        KE.util.focus(id);
-    }
-};
+/*******************************************************************************
+* KindEditor - WYSIWYG HTML Editor for Internet
+*
+* @author Roddy <luolonghao@gmail.com>
+* @site http://www.kindsoft.net/
+* @licence LGPL(http://www.opensource.org/licenses/lgpl-license.php)
+* @version 3.2.1
+*******************************************************************************/
+
+var KE = {};
+
+KE.version = '3.2.1';
+
+KE.lang = {
+    source : '切换模式',
+    preview : '预览',
+    undo : '后退(Ctrl+Z)',
+    redo : '前进(Ctrl+Y)',
+    cut : '剪切(Ctrl+X)',
+    copy : '复制(Ctrl+C)',
+    paste : '粘贴(Ctrl+V)',
+    plainpaste : '粘贴为无格式文本',
+    wordpaste : '从Word粘贴',
+    selectall : '全选',
+    justifyleft : '左对齐',
+    justifycenter : '居中',
+    justifyright : '右对齐',
+    justifyfull : '两端对齐',
+    insertorderedlist : '编号',
+    insertunorderedlist : '项目符号',
+    indent : '增加缩进',
+    outdent : '减少缩进',
+    subscript : '下标',
+    superscript : '上标',
+    date : '插入当前日期',
+    time : '插入当前时间',
+    title : '标题',
+    fontname : '字体',
+    fontsize : '文字大小',
+    textcolor : '文字颜色',
+    bgcolor : '文字背景',
+    bold : '粗体',
+    italic : '斜体',
+    underline : '下划线',
+    strikethrough : '删除线',
+    removeformat : '删除格式',
+    image : '插入图片',
+    flash : '插入Flash',
+    media : '插入多媒体',
+    layer : '插入层',
+    table : '插入表格',
+    specialchar : '插入特殊字符',
+    hr : '插入横线',
+    emoticons : '插入笑脸',
+    link : '超级连接',
+    unlink : '取消超级连接',
+    fullscreen : '全屏显示',
+    about : '关于',
+    print : '打印',
+    yes : '确定',
+    no : '取消',
+    close : '关闭',
+    invalidImg : "请输入有效的URL地址。\n只允许jpg,gif,bmp,png格式。",
+    invalidMedia : "请输入有效的URL地址。\n只允许mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb格式。",
+    invalidWidth : "宽度必须为数字。",
+    invalidHeight : "高度必须为数字。",
+    invalidBorder : "边框必须为数字。",
+    invalidUrl : "URL不正确。",
+    pleaseInput : "请输入内容"
+};
+
+KE.scriptPath = (function() {
+    var elements = document.getElementsByTagName('script');
+    for (var i = 0, len = elements.length; i < len; i++) {
+        if (elements[i].src && elements[i].src.match(/kindeditor[\w\-\.]*\.js/)) {
+            return elements[i].src.substring(0, elements[i].src.lastIndexOf('/') + 1);
+        }
+    }
+    return "";
+})();
+
+KE.htmlPath = (function() {
+    return location.href.substring(0, location.href.lastIndexOf('/') + 1);
+})();
+
+KE.browser = (function() {
+    var ua = navigator.userAgent.toLowerCase();
+    if (ua.indexOf("msie") > -1) return 'IE';
+    else if (ua.indexOf("webkit") > -1) return 'WEBKIT';
+    else if (ua.indexOf("gecko") > -1) return 'GECKO';
+    else if (ua.indexOf("opera") > -1) return 'OPERA';
+    else return "";
+})();
+
+KE.setting = {
+    wyswygMode : true,
+    autoOnsubmitMode : true,
+    resizeMode : 2,
+    filterMode : true,
+    tagLineMode : false,
+    skinType : 'default',
+    cssPath : '',
+    skinsPath : KE.scriptPath + 'skins/',
+    pluginsPath : KE.scriptPath + 'plugins/',
+    minWidth : 200,
+    minHeight : 100,
+    minChangeSize : 5,
+    siteDomains : [],
+    items : [
+        'source', 'preview', 'fullscreen', 'undo', 'redo', 'print', 'cut', 'copy', 'paste',
+        'plainpaste', 'wordpaste', 'justifyleft', 'justifycenter', 'justifyright',
+        'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
+        'superscript', 'date', 'time', '-',
+        'title', 'fontname', 'fontsize', 'textcolor', 'bgcolor', 'bold',
+        'italic', 'underline', 'strikethrough', 'removeformat', 'selectall', 'image',
+        'flash', 'media', 'layer', 'table', 'specialchar', 'hr',
+        'emoticons', 'link', 'unlink', 'about'
+    ],
+    colorTable : [
+        ["#FFFFFF","#E5E4E4","#D9D8D8","#C0BDBD","#A7A4A4","#8E8A8B","#827E7F","#767173","#5C585A","#000000"],
+        ["#FEFCDF","#FEF4C4","#FEED9B","#FEE573","#FFED43","#F6CC0B","#E0B800","#C9A601","#AD8E00","#8C7301"],
+        ["#FFDED3","#FFC4B0","#FF9D7D","#FF7A4E","#FF6600","#E95D00","#D15502","#BA4B01","#A44201","#8D3901"],
+        ["#FFD2D0","#FFBAB7","#FE9A95","#FF7A73","#FF483F","#FE2419","#F10B00","#D40A00","#940000","#6D201B"],
+        ["#FFDAED","#FFB7DC","#FFA1D1","#FF84C3","#FF57AC","#FD1289","#EC0078","#D6006D","#BB005F","#9B014F"],
+        ["#FCD6FE","#FBBCFF","#F9A1FE","#F784FE","#F564FE","#F546FF","#F328FF","#D801E5","#C001CB","#8F0197"],
+        ["#E2F0FE","#C7E2FE","#ADD5FE","#92C7FE","#6EB5FF","#48A2FF","#2690FE","#0162F4","#013ADD","#0021B0"],
+        ["#D3FDFF","#ACFAFD","#7CFAFF","#4AF7FE","#1DE6FE","#01DEFF","#00CDEC","#01B6DE","#00A0C2","#0084A0"],
+        ["#EDFFCF","#DFFEAA","#D1FD88","#BEFA5A","#A8F32A","#8FD80A","#79C101","#3FA701","#307F00","#156200"],
+        ["#D4C89F","#DAAD88","#C49578","#C2877E","#AC8295","#C0A5C4","#969AC2","#92B7D7","#80ADAF","#9CA53B"]
+    ],
+    noEndTags : ['br', 'hr', 'img', 'area', 'col', 'embed', 'input', 'param'],
+    inlineTags : ['b', 'del', 'em', 'font', 'i', 'span', 'strike', 'strong', 'sub', 'sup', 'u'],
+    htmlTags : {
+        font : ['color', 'size', 'face', '.background-color'],
+        span : [
+            '.color', '.background-color', '.font-size', '.font-family',
+            '.font-weight', '.font-style', '.text-decoration', '.vertical-align'
+        ],
+        div : [
+            'class', 'align', '.border', '.margin', '.padding', '.text-align', '.color',
+            '.background-color', '.font-size', '.font-family', '.font-weight',
+            '.font-style', '.text-decoration', '.vertical-align'
+        ],
+        table: [
+            'class', 'border', 'cellspacing', 'cellpadding', 'width', 'height', 'align',
+            '.padding', '.margin', '.border', 'bgcolor', '.text-align', '.color', '.background-color',
+            '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration'
+        ],
+        'td,th': [
+            'class', 'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor',
+            '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight',
+            '.font-style', '.text-decoration', '.vertical-align'
+        ],
+        a : ['class', 'href', 'target', 'name'],
+        embed : ['src', 'type', 'loop', 'autostart', 'quality', '.width', '.height', '/'],
+        img : ['src', 'width', 'height', 'border', 'alt', 'title', '.width', '.height', '/'],
+        hr : ['class', '/'],
+        br : ['/'],
+        'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [
+            'align', '.text-align', '.color', '.background-color', '.font-size', '.font-family',
+            '.font-weight', '.font-style', '.text-decoration', '.vertical-align'
+        ],
+        'tbody,tr,strong,b,sub,sup,em,i,u,strike' : []
+    }
+};
+
+KE.g = {};
+
+KE.plugin = {};
+
+KE.$ = function(id, doc){
+    var doc = doc || document;
+    return doc.getElementById(id);
+};
+
+KE.$$ = function(name, doc){
+    var doc = doc || document;
+    return doc.createElement(name);
+};
+
+KE.event = {
+    add : function(el, event, listener) {
+        if (el.addEventListener){
+            el.addEventListener(event, listener, false);
+        } else if (el.attachEvent){
+            el.attachEvent('on' + event, listener);
+        }
+    },
+    remove : function(el, event, listener) {
+        if (el.removeEventListener){
+            el.removeEventListener(event, listener, false);
+        } else if (el.detachEvent){
+            el.detachEvent('on' + event, listener);
+        }
+    },
+    input : function(el, func) {
+        this.add(el, 'keyup', function(e) {
+            if (!e.ctrlKey && !e.shiftKey && !e.altKey && (e.keyCode < 16 || e.keyCode > 18)) {
+                func(e);
+                return false;
+            }
+        });
+    },
+    ctrl : function(el, key, func) {
+        this.add(el, 'keydown', function(e) {
+            if (e.ctrlKey && e.keyCode == key.toUpperCase().charCodeAt(0) && !e.shiftKey && !e.altKey) {
+                func(e);
+                return false;
+            }
+        });
+    }
+};
+
+KE.each = function(obj, func) {
+    for (var key in obj) {
+        if (obj.hasOwnProperty(key)) func(key, obj[key]);
+    }
+};
+
+KE.eachNode = function(node, func) {
+    var walkNodes = function(parent) {
+        if (KE.util.getNodeType(parent) != 1) return true;
+        var n = parent.firstChild;
+        while (n != null) {
+            var next = n.nextSibling;
+            if (!func(n)) return false;
+            if (!walkNodes(n)) return false;
+            n = next;
+        }
+        return true;
+    };
+    walkNodes(node);
+};
+
+KE.selection = function(win, doc) {
+    this.sel = null;
+    this.range = null;
+    this.keRange = null;
+    this.init = function() {
+        var sel = win.getSelection ? win.getSelection() : doc.selection;
+        var range;
+        try {
+            if (sel.rangeCount > 0) range = sel.getRangeAt(0);
+            else range = sel.createRange();
+        } catch(e) {}
+        if (!range) range = KE.util.createRange(doc);
+        this.sel = sel;
+        this.range = range;
+        var startNode, startPos, endNode, endPos;
+        if (KE.browser == 'IE') {
+            if (range.item) {
+                var el = range.item(0);
+                startNode = endNode = el;
+                startPos = endPos = 0;
+            } else {
+                var getStartEnd = function(isStart) {
+                    var pointRange = range.duplicate();
+                    pointRange.collapse(isStart);
+                    var parentNode = pointRange.parentElement();
+                    var nodes = parentNode.childNodes;
+                    if (nodes.length == 0) return {node: parentNode, pos: 0};
+                    var startNode;
+                    var endElement;
+                    var startPos = 0;
+                    var isEnd = false;
+                    var testRange = range.duplicate();
+                    testRange.moveToElementText(parentNode);
+                    for (var i = 0, len = nodes.length; i < len; i++) {
+                        var node = nodes[i];
+                        var cmp = testRange.compareEndPoints('StartToStart', pointRange);
+                        if (cmp > 0) {
+                            isEnd = true;
+                        } else if (cmp == 0) {
+                            if (node.nodeType == 1) {
+                                var keRange = new KE.range(doc);
+                                keRange.selectTextNode(node);
+                                return {node: keRange.startNode, pos: 0};
+                            } else {
+                                return {node: node, pos: 0};
+                            }
+                        }
+                        if (node.nodeType == 1) {
+                            var nodeRange = range.duplicate();
+                            nodeRange.moveToElementText(node);
+                            testRange.setEndPoint('StartToEnd', nodeRange);
+                            if (isEnd) startPos += nodeRange.text.length;
+                            else startPos = 0;
+                        } else if (node.nodeType == 3) {
+                            testRange.moveStart('character', node.nodeValue.length);
+                            startPos += node.nodeValue.length;
+                        }
+                        if (!isEnd) startNode = node;
+                    }
+                    if (!isEnd && startNode.nodeType == 1) {
+                        var startNode = parentNode.lastChild;
+                        return {node: startNode, pos: startNode.nodeType == 1 ? 1 : startNode.nodeValue.length};
+                    }
+                    testRange = range.duplicate();
+                    testRange.moveToElementText(parentNode);
+                    testRange.setEndPoint('StartToEnd', pointRange);
+                    startPos -= testRange.text.replace(/\r\n|\n|\r/g, '').length;
+                    return {node: startNode, pos: startPos};
+                };
+                var start = getStartEnd(true);
+                var end = getStartEnd(false);
+                startNode = start.node;
+                startPos = start.pos;
+                endNode = end.node;
+                endPos = end.pos;
+            }
+        } else {
+            startNode = range.startContainer;
+            startPos = range.startOffset;
+            endNode = range.endContainer;
+            endPos = range.endOffset;
+            if (startNode.nodeType == 1 && typeof startNode.childNodes[startPos] != "undefined") {
+                startNode = startNode.childNodes[startPos];
+                startPos = startNode.nodeType == 1 ? 0 : startNode.nodeValue.length;
+            }
+            if (endNode.nodeType == 1 && typeof endNode.childNodes[endPos] != "undefined") {
+                endNode = endNode.childNodes[endPos];
+                endPos = endNode.nodeType == 1 ? 0 : endNode.nodeValue.length;
+            }
+        }
+        var keRange = new KE.range(doc);
+        keRange.setTextStart(startNode, startPos);
+        keRange.setTextEnd(endNode, endPos);
+        this.keRange = keRange;
+    };
+    this.init();
+    this.addRange = function(keRange) {
+        this.keRange = keRange;
+        if (KE.browser == 'IE') {
+            var getEndRange = function(isStart) {
+                var range = KE.util.createRange(doc);
+                var node = isStart ? keRange.startNode : keRange.endNode;
+                if (node.nodeType == 1) {
+                    range.moveToElementText(node);
+                    range.collapse(isStart);
+                } else if (node.nodeType == 3) {
+                    range = KE.util.getNodeStartRange(doc, node);
+                    var pos = isStart ? keRange.startPos : keRange.endPos;
+                    range.moveStart('character', pos);
+                }
+                return range;
+            }
+            if (!this.range.item) {
+                var node = keRange.startNode;
+                if (node == keRange.endNode && KE.util.getNodeType(node) == 1 && KE.util.getNodeTextLength(node) == 0) {
+                    var temp = doc.createTextNode(" ");
+                    node.appendChild(temp);
+                    this.range.moveToElementText(node);
+                    this.range.collapse(false);
+                    this.range.select();
+                    node.removeChild(temp);
+                } else {
+                    this.range.setEndPoint('StartToStart', getEndRange(true));
+                    this.range.setEndPoint('EndToStart', getEndRange(false));
+                    this.range.select();
+                }
+            }
+        } else {
+            var range = new KE.range(doc);
+            range.setTextStart(keRange.startNode, keRange.startPos);
+            range.setTextEnd(keRange.endNode, keRange.endPos);
+            this.range.setStart(range.startNode, range.startPos);
+            this.range.setEnd(range.endNode, range.endPos);
+            this.sel.removeAllRanges();
+            this.sel.addRange(this.range);
+        }
+    };
+    this.focus = function() {
+        if (KE.browser == 'IE' && this.range != null) this.range.select();
+    }
+};
+
+KE.range = function(doc) {
+    this.startNode = null;
+    this.startPos = null;
+    this.endNode = null;
+    this.endPos = null;
+    this.getParentElement = function() {
+        var scanParent = function(node, func) {
+            while (node != null && node.tagName != 'body') {
+                node = node.parentNode;
+                if (func(node)) return;
+            }
+        }
+        var nodeList = [];
+        scanParent(this.startNode, function(node) {
+            nodeList.push(node);
+        });
+        var parentNode;
+        scanParent(this.endNode, function(node) {
+            if (KE.util.inArray(node, nodeList)) {
+                parentNode = node;
+                return true;
+            }
+        });
+        return parentNode ? parentNode : doc.body;
+    };
+    this.getNodeList = function() {
+        var parentNode = this.getParentElement();
+        var nodeList = [];
+        var keRange = this;
+        var startNode = this.startNode;
+        var isStarted = false;
+        if (parentNode == startNode) isStarted = true;
+        if (isStarted) nodeList.push(parentNode);
+        KE.eachNode(parentNode, function(node) {
+            if (node == startNode) isStarted = true;
+            var range = new KE.range(doc);
+            range.selectTextNode(node);
+            if (range.comparePoints('START_TO_END', keRange) >= 0) return false;
+            if (isStarted) nodeList.push(node);
+            return true;
+        });
+        return nodeList;
+    };
+    this.comparePoints = function(how, range) {
+        var compareNodes = function(nodeA, posA, nodeB, posB) {
+            var cmp;
+            if (KE.browser == 'IE') {
+                var getStartRange = function(node, pos, isStart) {
+                    var range = KE.util.createRange(doc);
+                    var type = KE.util.getNodeType(node);
+                    if (type == 1) {
+                        range.moveToElementText(node);
+                        range.collapse(isStart);
+                    } else if (type == 3) {
+                        range = KE.util.getNodeStartRange(doc, node);
+                        range.moveStart('character', pos);
+                        range.collapse(true);
+                    }
+                    return range;
+                }
+                var rangeA, rangeB;
+                if (how == 'START_TO_START' || how == 'START_TO_END') rangeA = getStartRange(nodeA, posA, true);
+                else rangeA = getStartRange(nodeA, posA, false);
+                if (how == 'START_TO_START' || how == 'END_TO_START') rangeB = getStartRange(nodeB, posB, true);
+                else rangeB = getStartRange(nodeB, posB, false);
+                return rangeA.compareEndPoints('StartToStart', rangeB);
+            } else {
+                var rangeA = KE.util.createRange(doc);
+                rangeA.selectNode(nodeA);
+                if (how == 'START_TO_START' || how == 'START_TO_END') rangeA.collapse(true);
+                else rangeA.collapse(false);
+                var rangeB = KE.util.createRange(doc);
+                rangeB.selectNode(nodeB);
+                if (how == 'START_TO_START' || how == 'END_TO_START') rangeB.collapse(true);
+                else rangeB.collapse(false);
+                if (rangeA.compareBoundaryPoints(Range.START_TO_START, rangeB) > 0) {
+                    cmp = 1;
+                } else if (rangeA.compareBoundaryPoints(Range.START_TO_START, rangeB) == 0) {
+                    if (posA > posB) cmp = 1;
+                    else if (posA == posB) cmp = 0;
+                    else cmp = -1;
+                } else {
+                    cmp = -1;
+                }
+            }
+            return cmp;
+        }
+        if (how == 'START_TO_START') return compareNodes(this.startNode, this.startPos, range.startNode, range.startPos);
+        if (how == 'START_TO_END') return compareNodes(this.startNode, this.startPos, range.endNode, range.endPos);
+        if (how == 'END_TO_START') return compareNodes(this.endNode, this.endPos, range.startNode, range.startPos);
+        if (how == 'END_TO_END') return compareNodes(this.endNode, this.endPos, range.endNode, range.endPos);
+    };
+    this.setTextStart = function(node, pos) {
+        var textNode = node;
+        KE.eachNode(node, function(n) {
+            if (KE.util.getNodeType(n) == 3 && n.nodeValue.length > 0) {
+                textNode = n;
+                pos = 0;
+                return false;
+            }
+            return true;
+        });
+        this.setStart(textNode, pos);
+    };
+    this.setStart = function(node, pos) {
+        this.startNode = node;
+        this.startPos = pos;
+        if (this.endNode === null) {
+            this.endNode = node;
+            this.endPos = pos;
+        }
+    };
+    this.setTextEnd = function(node, pos) {
+        var textNode = node;
+        KE.eachNode(node, function(n) {
+            if (KE.util.getNodeType(n) == 3 && n.nodeValue.length > 0) {
+                textNode = n;
+                pos = n.nodeValue.length;
+            }
+            return true;
+        });
+        this.setEnd(textNode, pos);
+    };
+    this.setEnd = function(node, pos) {
+        this.endNode = node;
+        this.endPos = pos;
+        if (this.startNode === null) {
+            this.startNode = node;
+            this.startPos = pos;
+        }
+    };
+    this.selectNode = function(node) {
+        this.setStart(node, 0);
+        this.setEnd(node, node.nodeType == 1 ? 0 : node.nodeValue.length);
+    };
+    this.selectTextNode = function(node) {
+        this.setTextStart(node, 0);
+        this.setTextEnd(node, node.nodeType == 1 ? 0 : node.nodeValue.length);
+    };
+    this.extractContents = function(isDelete) {
+        isDelete = (isDelete === false) ? false : true;
+        var thisRange = this;
+        var startNode = this.startNode;
+        var startPos = this.startPos;
+        var endNode = this.endNode;
+        var endPos = this.endPos;
+        var extractTextNode = function(node, startPos, endPos) {
+            var length = node.nodeValue.length;
+            var cloneNode = node.cloneNode(true);
+            var centerNode = cloneNode.splitText(startPos);
+            centerNode.splitText(endPos - startPos);
+            if (isDelete) {
+                var center = node;
+                if (startPos > 0) center = node.splitText(startPos);
+                if (endPos < length) center.splitText(endPos - startPos);
+                center.parentNode.removeChild(center);
+            }
+            return centerNode;
+        };
+        var isStarted = false;
+        var isEnd = false;
+        var extractNodes = function(parent, frag) {
+            if (KE.util.getNodeType(parent) != 1) return true;
+            var node = parent.firstChild;
+            while (node != null) {
+                if (node == startNode) isStarted = true;
+                if (node == endNode) isEnd = true;
+                var nextNode = node.nextSibling;
+                var type = KE.util.getNodeType(node);
+                if (type == 1) {
+                    var range = new KE.range(doc);
+                    range.selectNode(node);
+                    if (isStarted && range.comparePoints('END_TO_END', thisRange) < 0) {
+                        var cloneNode = node.cloneNode(true);
+                        frag.appendChild(cloneNode);
+                        if (isDelete) {
+                            node.parentNode.removeChild(node);
+                        }
+                    } else {
+                        var childFlag = node.cloneNode(false);
+                        frag.appendChild(childFlag);
+                        if (!extractNodes(node, childFlag)) return false;
+                    }
+                } else if (type == 3) {
+                    if (isStarted) {
+                        var textNode;
+                        if (node == startNode && node == endNode) {
+                            textNode = extractTextNode(node, startPos, endPos);
+                            frag.appendChild(textNode);
+                            return false;
+                        } else if (node == startNode) {
+                            textNode = extractTextNode(node, startPos, node.nodeValue.length);
+                            frag.appendChild(textNode);
+                        } else if (node == endNode) {
+                            textNode = extractTextNode(node, 0, endPos);
+                            frag.appendChild(textNode);
+                            return false;
+                        } else {
+                            textNode = extractTextNode(node, 0, node.nodeValue.length);
+                            frag.appendChild(textNode);
+                        }
+                    }
+                }
+                node = nextNode;
+                if (isEnd) return false;
+            }
+            return true;
+        }
+        var parentNode = this.getParentElement();
+        var docFrag = parentNode.cloneNode(false);
+        extractNodes(parentNode, docFrag);
+        return docFrag;
+    };
+    this.cloneContents = function() {
+        return this.extractContents(false);
+    };
+    this.getText = function() {
+        var html = this.cloneContents().innerHTML;
+        return html.replace(/<.*?>/g, "");
+    };
+};
+
+KE.cmd = function(id) {
+    this.doc = KE.g[id].iframeDoc;
+    this.keSel = KE.g[id].keSel;
+    this.keRange = KE.g[id].keRange;
+    this.mergeAttributes = function(el, attr) {
+        for (var i = 0, len = attr.length; i < len; i++) {
+            KE.each(attr[i], function(key, value) {
+                if (key.charAt(0) == '.') {
+                    var jsKey = KE.util.getJsKey(key.substr(1));
+                    eval('el.style.' + jsKey + ' = value;');
+                } else {
+                    el.setAttribute(key, value);
+                }
+            });
+        }
+        return el;
+    };
+    this.wrapTextNode = function(node, startPos, endPos, element, attributes) {
+        var length = node.nodeValue.length;
+        var isFull = (startPos == 0 && endPos == length);
+        var range = new KE.range(this.doc);
+        range.selectTextNode(node.parentNode);
+        if (isFull &&
+            node.parentNode.tagName == element.tagName &&
+            range.comparePoints('END_TO_END', this.keRange) <= 0 &&
+            range.comparePoints('START_TO_START', this.keRange) >= 0) {
+            this.mergeAttributes(node.parentNode, attributes);
+            return node;
+        } else {
+            var el = element.cloneNode(true);
+            if (isFull) {
+                var cloneNode = node.cloneNode(true);
+                el.appendChild(cloneNode);
+                node.parentNode.replaceChild(el, node);
+                return cloneNode;
+            } else {
+                var centerNode = node;
+                if (startPos < endPos) {
+                    if (startPos > 0) centerNode = node.splitText(startPos);
+                    if (endPos < length) centerNode.splitText(endPos - startPos);
+                    var cloneNode = centerNode.cloneNode(true);
+                    el.appendChild(cloneNode);
+                    centerNode.parentNode.replaceChild(el, centerNode);
+                    return cloneNode;
+                } else {
+                    if (startPos < length) {
+                        centerNode = node.splitText(startPos);
+                        centerNode.parentNode.insertBefore(el, centerNode);
+                    } else {
+                        if (centerNode.nextSibling) {
+                            centerNode.parentNode.insertBefore(el, centerNode.nextSibling);
+                        } else {
+                            centerNode.parentNode.appendChild(el);
+                        }
+                    }
+                    return el;
+                }
+            }
+        }
+    };
+    this.wrap = function(tagName, attributes) {
+        var self = this;
+        this.keSel.focus();
+        var element = KE.$$(tagName, this.doc);
+        this.mergeAttributes(element, attributes);
+        var keRange = this.keRange;
+        var startNode = keRange.startNode;
+        var startPos = keRange.startPos;
+        var endNode = keRange.endNode;
+        var endPos = keRange.endPos;
+        var parentNode = keRange.getParentElement();
+        var isStarted = false;
+        KE.eachNode(parentNode, function(node) {
+            if (node == startNode) isStarted = true;
+            if (node.nodeType == 1) {
+                if (node == startNode && node == endNode) {
+                    if (KE.util.inArray(node.tagName.toLowerCase(), KE.setting.noEndTags)) {
+                        if (startPos > 0) node.parentNode.appendChild(element);
+                        else node.parentNode.insertBefore(element, node);
+                    } else {
+                        node.appendChild(element);
+                    }
+                    keRange.selectNode(element);
+                    return false;
+                } else if (node == startNode) {
+                    keRange.setStart(node, 0);
+                } else if (node == endNode) {
+                    keRange.setEnd(node, 0);
+                    return false;
+                }
+            } else if (node.nodeType == 3) {
+                if (isStarted) {
+                    if (node == startNode && node == endNode) {
+                        var rangeNode = self.wrapTextNode(node, startPos, endPos, element, attributes);
+                        keRange.selectNode(rangeNode);
+                        return false;
+                    } else if (node == startNode) {
+                        var rangeNode = self.wrapTextNode(node, startPos, node.nodeValue.length, element, attributes);
+                        keRange.setStart(rangeNode, 0);
+                    } else if (node == endNode) {
+                        var rangeNode = self.wrapTextNode(node, 0, endPos, element, attributes);
+                        keRange.setEnd(rangeNode, rangeNode.nodeType == 1 ? 0 : rangeNode.nodeValue.length);
+                        return false;
+                    } else {
+                        self.wrapTextNode(node, 0, node.nodeValue.length, element, attributes);
+                    }
+                }
+            }
+            return true;
+        });
+        this.keSel.addRange(keRange);
+    };
+    this.getTopParent = function(tagNames, node) {
+        var parent = null;
+        while (node != null) {
+            node = node.parentNode;
+            if (KE.util.inArray(node.tagName.toLowerCase(), tagNames)) {
+                parent = node;
+            } else {
+                break;
+            }
+        }
+        return parent;
+    };
+    this.splitNodeParent = function(parent, node, pos) {
+        var leftRange = new KE.range(this.doc);
+        leftRange.selectNode(parent.firstChild);
+        leftRange.setEnd(node, pos);
+        var leftFrag = leftRange.extractContents();
+        parent.parentNode.insertBefore(leftFrag, parent);
+        return {left : leftFrag, right : parent};
+    };
+    this.remove = function(tagNames, attributes) {
+        var keRange = this.keRange;
+        var startNode = keRange.startNode;
+        var startPos = keRange.startPos;
+        var endNode = keRange.endNode;
+        var endPos = keRange.endPos;
+        this.keSel.focus();
+        if (keRange.getText().replace(/\s+/g, '') === '') return;
+        var startParent = this.getTopParent(tagNames, startNode);
+        var endParent = this.getTopParent(tagNames, endNode);
+        if (startParent) {
+            var startFrags = this.splitNodeParent(startParent, startNode, startPos);
+            keRange.setStart(startFrags.right, 0);
+            if (startNode == endNode && KE.util.getNodeTextLength(startFrags.right) > 0) {
+                keRange.selectNode(startFrags.right);
+                var range = new KE.range(this.doc);
+                range.selectTextNode(startFrags.left);
+                if (startPos > 0) endPos -= range.endNode.nodeValue.length;
+                range.selectTextNode(startFrags.right);
+                endNode = range.startNode;
+            }
+        }
+        if (endParent) {
+            var endFrags = this.splitNodeParent(endParent, endNode, endPos);
+            this.keRange.setEnd(endFrags.left, 0);
+            if (startParent == endParent) {
+                keRange.setStart(endFrags.left, 0);
+            }
+        }
+        var nodeList = keRange.getNodeList();
+        keRange.setTextStart(keRange.startNode, keRange.startPos);
+        keRange.setTextEnd(keRange.endNode, keRange.endPos);
+        for (var i = 0; i < nodeList.length; i++) {
+            var node = nodeList[i];
+            if (node.nodeType == 1) {
+                if (KE.util.inArray(node.tagName.toLowerCase(), tagNames)) {
+                    KE.util.removeParent(node);
+                } else {
+                    for (var j = 0; j < attributes.length; j++) {
+                        node.removeAttribute(attributes[j]);
+                    }
+                }
+            }
+        }
+        try {
+            this.keSel.addRange(keRange);
+        } catch(e) {}
+    };
+}
+
+KE.util = {
+    getDocumentElement : function() {
+        return (document.compatMode != "CSS1Compat") ? document.body : document.documentElement;
+    },
+    getDocumentHeight : function() {
+        var el = this.getDocumentElement();
+        return Math.max(el.scrollHeight, el.clientHeight);
+    },
+    getDocumentWidth : function() {
+        var el = this.getDocumentElement();
+        return Math.max(el.scrollWidth, el.clientWidth);
+    },
+    createTable : function() {
+        var table = KE.$$('table');
+        table.cellPadding = 0;
+        table.cellSpacing = 0;
+        table.border = 0;
+        return {table: table, cell: table.insertRow(0).insertCell(0)};
+    },
+    loadStyle : function(path) {
+        var link = KE.$$('link');
+        link.setAttribute('type', 'text/css');
+        link.setAttribute('rel', 'stylesheet');
+        link.setAttribute('href', path);
+        document.getElementsByTagName("head")[0].appendChild(link);
+    },
+    inArray : function(str, arr) {
+        for (var i = 0; i < arr.length; i++) {if (str == arr[i]) return true;}
+        return false;
+    },
+    getJsKey : function(key) {
+        var arr = key.split('-');
+        key = '';
+        for (var i = 0, len = arr.length; i < len; i++) {
+            key += (i > 0) ? arr[i].charAt(0).toUpperCase() + arr[i].substr(1) : arr[i];
+        }
+        return key;
+    },
+    escape : function(html) {
+        html = html.replace(/&/g, "&amp;");
+        html = html.replace(/</g, "&lt;");
+        html = html.replace(/>/g, "&gt;");
+        html = html.replace(/\xA0/g, "&nbsp;");
+        html = html.replace(/\x20/g, " ");
+        return html;
+    },
+    getElementPos : function(el) {
+        var x = 0;
+        var y = 0;
+        if (KE.browser != "WEBKIT") {
+            var box = el.getBoundingClientRect();
+            var el = this.getDocumentElement();
+            x = box.left + el.scrollLeft - el.clientLeft;
+            y = box.top + el.scrollTop - el.clientTop;
+        } else {
+            x = el.offsetLeft;
+            y = el.offsetTop;
+            var parent = el.offsetParent;
+            while (parent) {
+                x += parent.offsetLeft;
+                y += parent.offsetTop;
+                parent = parent.offsetParent;
+            }
+        }
+        return {'x' : x, 'y' : y};
+    },
+    getCoords : function(ev) {
+        ev = ev || window.event;
+        var el = this.getDocumentElement();
+        if (ev.pageX) return { x : ev.pageX, y : ev.pageY};
+        return {
+            x : ev.clientX + el.scrollLeft - el.clientLeft,
+            y : ev.clientY + el.scrollTop - el.clientTop
+        };
+    },
+    setOpacity : function(el, opacity) {
+        if (typeof el.style.opacity == "undefined") {
+            el.style.filter = (opacity == 100) ? "" : "alpha(opacity=" + opacity + ")";
+        } else {
+            el.style.opacity = (opacity == 100) ? "" : "0." + opacity.toString();
+        }
+    },
+    getIframeDoc : function(iframe) {
+        return iframe.contentDocument || iframe.contentWindow.document;
+    },
+    rgbToHex : function(str) {
+        function hex(s) {
+            s = parseInt(s).toString(16);
+            return s.length > 1 ? s : '0' + s;
+        };
+        return str.replace(/rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)/ig,
+                           function($0, $1, $2, $3) {
+                               return '#' + hex($1) + hex($2) + hex($3);
+                           }
+                          );
+    },
+    getStyle : function(el, key) {
+        var arr = key.split('-');
+        key = "";
+        for (var i = 0, len = arr.length; i < len; i++) {
+            key += (i > 0) ? arr[i].charAt(0).toUpperCase() + arr[i].substr(1) : arr[i];
+        }
+        var val = el.style[key];
+        if (!val) {
+            var css = el.getAttribute("style");
+            if (css) {
+                var re = new RegExp("(^|[^\w\-])" + key + "\s*:\s*([^;]+)", "ig");
+                var arr = re.exec(css);
+                if (arr) val = arr[2];
+            }
+        }
+        return KE.util.rgbToHex(val);
+    },
+    createRange : function(doc) {
+        return doc.createRange ? doc.createRange() : doc.body.createTextRange();
+    },
+    getNodeType : function(node) {
+        return (node.nodeType == 1 && KE.util.inArray(node.tagName.toLowerCase(), KE.setting.noEndTags)) ? 88 : node.nodeType;
+    },
+    getNodeTextLength : function(node) {
+        var type = KE.util.getNodeType(node);
+        if (type == 1) {
+            var html = node.innerHTML;
+            return html.replace(/<.*?>/ig, "").length;
+        } else if (type == 3) {
+            return node.nodeValue.length;
+        }
+    },
+    getNodeStartRange : function(doc, node) {
+        var range = KE.util.createRange(doc);
+        var type = node.nodeType;
+        if (type == 1) {
+            range.moveToElementText(node);
+            return range;
+        } else if (type == 3) {
+            var offset = 0;
+            var sibling = node.previousSibling;
+            while (sibling) {
+                if (sibling.nodeType == 1) {
+                    var nodeRange = KE.util.createRange(doc);
+                    nodeRange.moveToElementText(sibling);
+                    range.setEndPoint('StartToEnd', nodeRange);
+                    range.moveStart('character', offset);
+                    return range;
+                } else if (sibling.nodeType == 3) {
+                    offset += sibling.nodeValue.length;
+                }
+                sibling = sibling.previousSibling;
+            }
+            range.moveToElementText(node.parentNode);
+            range.moveStart('character', offset);
+            return range;
+        }
+    },
+    trimNodes : function(parent) {
+        if (KE.util.getNodeType(parent) != 1) return;
+        if (KE.util.inArray(parent.tagName.toLowerCase(), KE.setting.inlineTags) && KE.util.getNodeTextLength(parent) == 0) {
+            parent.parentNode.removeChild(parent);
+            return;
+        }
+        KE.eachNode(parent, function(node) {
+            KE.util.trimNodes(node);
+            return true;
+        });
+    },
+    removeParent : function(parent) {
+        if (parent.hasChildNodes) {
+            var node = parent.firstChild;
+            while (node != null) {
+                var nextNode = node.nextSibling;
+                parent.parentNode.insertBefore(node, parent);
+                node = nextNode;
+            }
+        }
+        parent.parentNode.removeChild(parent);
+    },
+    drag : function(id, mousedownObj, moveObj, func, hideFlag) {
+        var obj = KE.g[id];
+        mousedownObj.onmousedown = function(event) {
+            if (hideFlag && obj.wyswygMode) obj.iframe.style.display = 'none';
+            if (KE.browser != 'IE') event.preventDefault();
+            var ev = event || window.event;
+            var pos = KE.util.getCoords(ev);
+            var objTop = parseInt(moveObj.style.top);
+            var objLeft = parseInt(moveObj.style.left);
+            var objWidth = parseInt(moveObj.style.width);
+            var objHeight = parseInt(moveObj.style.height);
+            var mouseTop = pos.y;
+            var mouseLeft = pos.x;
+            var dragFlag = true;
+            var moveListener = function(event) {
+                if (dragFlag) {
+                    var ev = event || window.event;
+                    var pos = KE.util.getCoords(ev);
+                    var top = pos.y - mouseTop;
+                    var left = pos.x - mouseLeft;
+                    func(objTop, objLeft, objWidth, objHeight, top, left);
+                }
+                return false;
+            };
+            var upListener = function(event) {
+                if (hideFlag && obj.wyswygMode) obj.iframe.style.display = '';
+                dragFlag = false;
+                KE.event.remove(document, 'mousemove', moveListener);
+                KE.event.remove(document, 'mouseup', upListener);
+            };
+            KE.event.add(document, 'mousemove', moveListener);
+            KE.event.add(document, 'mouseup', upListener);
+        };
+    },
+    setDefaultPlugin : function(id) {
+        var items = [
+            'cut', 'copy', 'paste', 'selectall', 'justifyleft', 'justifycenter', 'justifyright',
+            'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript','superscript',
+            'bold', 'italic', 'underline', 'strikethrough', 'unlink'
+        ];
+        for (var i = 0; i < items.length; i++) {
+            KE.plugin[items[i]] = {
+                click : new Function('id', 'KE.util.execCommand(id, "' + items[i] + '", null);')
+            };
+        }
+    },
+    getFullHtml : function(id, tagLineMode) {
+        var html = '<html>';
+        html += '<head>';
+        html += '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
+        html += '<title>KindEditor</title>';
+        if (tagLineMode) {
+            html += '<link href="' + KE.g[id].skinsPath + 'editor.css" rel="stylesheet" type="text/css" />';
+        }
+        if (KE.g[id].cssPath) {
+            html += '<link href="' + KE.g[id].cssPath + '" rel="stylesheet" type="text/css" />';
+        }
+        html += '</head>';
+        html += '<body class="ke-content"></body>';
+        html += '</html>';
+        return html;
+    },
+    resize : function(id, width, height, isCheck) {
+        var obj = KE.g[id];
+        if (width.match(/%$/)) width = obj.container.offsetWidth + 'px';
+        if (height.match(/%$/)) height = obj.container.offsetHeight + 'px';
+        if (isCheck && (parseInt(width) <= obj.minWidth || parseInt(height) <= obj.minHeight)) return;
+        obj.container.style.width = width;
+        obj.container.style.height = height;
+        var diff = parseInt(height) - obj.toolbarTable.offsetHeight - obj.bottom.offsetHeight;
+        if (diff >= 0) {
+            obj.textareaTable.style.height = diff + 'px';
+            obj.iframe.style.height = diff + 'px';
+            obj.newTextarea.style.height = diff + 'px';
+        }
+    },
+    getData : function(id) {
+        var data;
+        if (KE.g[id].wyswygMode) {
+            if (KE.g[id].filterMode) {
+                data = KE.util.outputHtml(id, KE.g[id].iframeDoc.body);
+            } else {
+                data = KE.util.htmlToXhtml(id, KE.g[id].iframeDoc.body);
+            }
+        } else {
+            data = KE.g[id].newTextarea.value;
+        }
+        return data;
+    },
+    getSrcData : function(id) {
+        var data;
+        if (KE.g[id].wyswygMode) {
+            data = KE.g[id].iframeDoc.body.innerHTML;
+        } else {
+            data = KE.g[id].newTextarea.value;
+        }
+        return data;
+    },
+    getPureData : function(id) {
+        var data = this.getSrcData(id);
+        data = data.replace(/<br[\s\/]{0,2}>/ig, "\r\n");
+        data = data.replace(/<.*?>/ig, "");
+        data = data.replace(/&nbsp;/ig, "");
+        return data;
+    },
+    setData : function(id) {
+        var data = this.getData(id);
+        KE.g[id].srcTextarea.value = data;
+    },
+    setPureData : function(id) {
+        var data = this.getPureData(id);
+        KE.g[id].srcTextarea.value = data;
+    },
+    focus : function(id) {
+        if (KE.g[id].wyswygMode) {
+            KE.g[id].iframeWin.focus();
+        } else {
+            KE.g[id].newTextarea.focus();
+        }
+    },
+    click : function(id, cmd) {
+        KE.layout.hide(id);
+        KE.util.focus(id);
+        KE.plugin[cmd].click(id);
+    },
+    selection : function(id) {
+        var win = KE.g[id].iframeWin;
+        var doc = KE.g[id].iframeDoc;
+        KE.g[id].keSel = new KE.selection(win, doc);
+        KE.g[id].keRange = KE.g[id].keSel.keRange;
+        KE.g[id].sel = KE.g[id].keSel.sel;
+        KE.g[id].range = KE.g[id].keSel.range;
+    },
+    select : function(id) {
+        if (KE.browser == 'IE') KE.g[id].range.select();
+    },
+    pToBr : function(id) {
+        if(KE.browser == 'IE') {
+            KE.event.add(KE.g[id].iframeDoc, 'keydown', function(e) {
+                if (e.keyCode == 13) {
+                    KE.util.selection(id);
+                    if(KE.g[id].range.parentElement().tagName != 'LI') {
+                        KE.util.insertHtml(id, '<br />');
+                        KE.util.select(id);
+                        return false;
+                    }
+                }
+            });
+        }
+    },
+    execCommand : function(id, cmd, value) {
+        try {
+            KE.g[id].iframeDoc.execCommand(cmd, false, value);
+        } catch(e) {}
+        KE.toolbar.updateState(id);
+        KE.history.add(id, false);
+    },
+    insertHtml : function(id, html) {
+        if (html == '') return;
+        KE.util.select(id);
+        if (KE.browser == 'IE') {
+            if (KE.g[id].sel.type.toLowerCase() == 'control') {
+                KE.g[id].range.item(0).outerHTML = html;
+            } else {
+                KE.g[id].range.pasteHTML(html);
+            }
+            KE.history.add(id, false);
+        } else {
+            this.execCommand(id, 'inserthtml', html);
+        }
+    },
+    removeDomain : function(id, tagName, key, url) {
+        if ((tagName == 'a' && key == 'href') || (tagName == 'img' && key == 'src') || (tagName == 'embed' && key == 'src')) {
+            var domains = KE.g[id].siteDomains;
+            for (var i = 0, len = domains.length; i < len; i++) {
+                var domain = "http://" + domains[i];
+                if (url.indexOf(domain) == 0) return url.substr(domain.length);
+            }
+        }
+        return url;
+    },
+    htmlToXhtml : function(id, element) {
+        KE.util.trimNodes(element);
+        var html = element.innerHTML;
+        var tags = KE.setting.noEndTags;
+        for (var i = 0, len = tags.length; i < len; i++) {
+            html = html.replace(new RegExp("<(" + tags[i] + ")\\s+(.*?[^\\/])>", "gi"), "<$1 $2 />");
+            html = html.replace(new RegExp("<(" + tags[i] + ")>", "gi"), "<$1 />");
+        }
+        html = html.replace(/<(\w+)(.*?)>/g, function($0, $1, $2) {
+            var tagName = $1.toLowerCase();
+            var attr = $2;
+            attr = attr.replace(/(\w+)=([^\s]+)/gi, function($0, $1, $2) {
+                var key = $1.toLowerCase();
+                var val = $2;
+                var first = $2.charAt(0);
+                var last = $2.charAt($2.length - 1);
+                if (first === '"' && last === '"') {
+                    val = '"' + KE.util.removeDomain(id, tagName, key, val.substr(1, val.length - 2)) + '"';
+                } else if (first !== '"' && last !== '"') {
+                    val = '"' + KE.util.removeDomain(id, tagName, key, val) + '"';
+                }
+                return key + '=' + val;
+            });
+            attr = attr.replace(/\s+style=".*?"/gi, function($0) {
+                return KE.util.rgbToHex($0.toLowerCase());
+            });
+            return '<' + tagName + attr + '>';
+        });
+        html = html.replace(/(<\/\w+>)/g, function($0, $1) {
+            return $1.toLowerCase();
+        });
+        return html;
+    },
+    outputHtml : function(id, element) {
+        var newHtmlTags = [];
+        KE.each(KE.g[id].htmlTags, function(key, val) {
+            var arr = key.split(',');
+            for (var i = 0, len = arr.length; i < len; i++) {
+                newHtmlTags[arr[i]] = val;
+            }
+        });
+        var htmlList = [];
+        KE.util.trimNodes(element);
+        var scanNodes = function(el) {
+            var startTags = [];
+            var setStartTag = function(tagName, attrStr, styleStr, isEnd) {
+                var html = '';
+                html += '<' + tagName;
+                if (attrStr) html += attrStr;
+                if (styleStr) html += ' style="' + styleStr + '"';
+                html += isEnd ? ' />' : '>';
+                if (KE.browser == 'IE' && isEnd && KE.util.inArray(tagName, ['br', 'hr'])) html += "\n";
+                if (typeof newHtmlTags[tagName] == 'object') htmlList.push(html);
+                if (!isEnd) startTags.push(tagName);
+            };
+            var setEndTag = function() {
+                if (startTags.length > 0) {
+                    var tagName = startTags.pop();
+                    if (typeof newHtmlTags[tagName] != 'object') return;
+                    var html = '</' + tagName + '>';
+                    if (KE.browser == 'IE' && KE.util.inArray(tagName, ['p', 'div', 'table', 'ol', 'ul'])) html += "\n";
+                    htmlList.push(html);
+                }
+            };
+            var nodes = el.childNodes;
+            for (var i = 0, len = nodes.length; i < len; i++) {
+                var node = nodes[i];
+                switch (node.nodeType) {
+                case 1:
+                    var tagName = node.tagName.toLowerCase();
+                    var attrStr = '';
+                    var styleStr = '';
+                    var isEnd = false;
+                    if (typeof newHtmlTags[tagName] == 'object') {
+                        var attrList = newHtmlTags[tagName];
+                        for (var j = 0, l = attrList.length; j < l; j++) {
+                            var attr = attrList[j];
+                            if (attr == '/') isEnd = true;
+                            else if (attr.charAt(0) == '.') {
+                                var key = attr.substr(1);
+                                var val = KE.util.getStyle(node, key);
+                                if (val) styleStr += key + ':' + val + ';';
+                            } else {
+                                var val = node.getAttribute(attr);
+                                if (val !== null && val !== "") {
+                                    val = KE.util.removeDomain(id, tagName, attr, val);
+                                    attrStr += ' ' + attr + '="' + val + '"';
+                                }
+                            }
+                        }
+                    }
+                    setStartTag(tagName, attrStr, styleStr, isEnd);
+                    if (node.hasChildNodes()) {
+                        scanNodes(node);
+                    } else {
+                        if (startTags.length > 0) {
+                            var prevHtml = htmlList[htmlList.length - 1];
+                            if (typeof prevHtml != "undefined" && prevHtml.match(/^<p|^<div/) != null) {
+                                htmlList.push("&nbsp;");
+                            }
+                        }
+                    }
+                    break;
+                case 3:
+                    htmlList.push(KE.util.escape(node.nodeValue));
+                    break;
+                default:
+                    break;
+                }
+                setEndTag();
+            }
+            setEndTag();
+        };
+        scanNodes(element);
+        var html = htmlList.join('');
+        return html;
+    }
+};
+
+KE.layout = {
+    show : function(id, div) {
+        KE.layout.hide(id);
+        KE.g[id].hideDiv.appendChild(div);
+        KE.g[id].hideDiv.style.display = 'block';
+        KE.g[id].layoutDiv = div;
+    },
+    hide : function(id) {
+        try {
+            KE.g[id].hideDiv.removeChild(KE.g[id].layoutDiv);
+        } catch (e) {}
+        KE.g[id].hideDiv.style.display = 'none';
+        KE.g[id].maskDiv.style.display = 'none';
+        KE.util.focus(id);
+    },
+    make : function(id) {
+        var div = KE.$$('div');
+        div.style.position = 'absolute';
+        div.style.zIndex = 19811214;
+        return div;
+    }
+};
+
+KE.menu = function(arg){
+    this.arg = arg;
+    var div = KE.layout.make(arg.id);
+    div.className = 'ke-menu';
+    var obj = KE.g[arg.id].toolbarIcon[arg.cmd];
+    var pos = KE.util.getElementPos(obj[0]);
+    div.style.top = pos.y + obj[0].offsetHeight + 'px';
+    div.style.left = pos.x + 'px';
+    this.div = div;
+    this.add = function(html, event) {
+        var cDiv = KE.$$('div');
+        cDiv.className = 'ke-menu-noselected';
+        cDiv.style.width = this.arg.width;
+        cDiv.onmouseover = function() { this.className = 'ke-menu-selected'; }
+        cDiv.onmouseout = function() { this.className = 'ke-menu-noselected'; }
+        cDiv.onclick = event;
+        cDiv.innerHTML = html;
+        this.append(cDiv);
+    };
+    this.append = function(el) {
+        this.div.appendChild(el);
+    };
+    this.insert = function(html) {
+        this.div.innerHTML = html;
+    };
+    this.show = function() {
+        KE.layout.show(this.arg.id, this.div);
+    };
+    this.picker = function() {
+        var colorTable = KE.setting.colorTable;
+        var table = KE.$$('table');
+        table.cellPadding = 0;
+        table.cellSpacing = 0;
+        table.border = 0;
+        table.style.margin = 0;
+        table.style.padding = 0;
+        table.style.borderCollapse = 'separate';
+        for (var i = 0; i < colorTable.length; i++) {
+            var row = table.insertRow(i);
+            for (var j = 0; j < colorTable[i].length; j++) {
+                var cell = row.insertCell(j);
+                cell.className = 'ke-picker-cell';
+                cell.style.backgroundColor = colorTable[i][j];
+                cell.title = colorTable[i][j];
+                cell.onmouseover = function() {this.style.borderColor = '#000000'; }
+                cell.onmouseout = function() {this.style.borderColor = '#F0F0EE'; }
+                cell.onclick = new Function('KE.plugin["' + this.arg.cmd + '"].exec("' +
+                                            this.arg.id + '", "' + colorTable[i][j] + '")');
+                cell.innerHTML = '&nbsp;';
+            }
+        }
+        this.append(table);
+        this.show();
+    };
+};
+
+KE.dialog = function(arg){
+    this.arg = arg;
+    this.topHeight = 20;
+    this.bottomHeight = 76;
+    this.getPos = function() {
+        var arg = this.arg;
+        var id = this.arg.id;
+        var pos = KE.util.getElementPos(KE.g[id].container);
+        var height = arg.height + this.topHeight + this.bottomHeight;
+        var xDiff = Math.round(parseInt(KE.g[id].container.style.width) / 2) - Math.round(arg.width / 2);
+        var yDiff = Math.round(parseInt(KE.g[id].container.style.height) / 2) - Math.round(height / 2);
+        var x = xDiff < 0 ? pos.x : pos.x + xDiff;
+        var y = yDiff < 0 ? pos.y : pos.y + yDiff;
+        return {'x' : x, 'y' : y};
+    };
+    this.show = function() {
+        var arg = this.arg;
+        var id = arg.id;
+        var div = KE.layout.make(arg.id);
+        div.className = 'ke-dialog';
+        var pos = this.getPos();
+        div.style.width = (arg.width + this.topHeight) + 'px';
+        div.style.height = (arg.height + this.bottomHeight) + 'px';
+        div.style.top = pos.y + 'px';
+        div.style.left = pos.x + 'px';
+        var titleDiv = KE.$$('div');
+        titleDiv.className = 'ke-dialog-title';
+        titleDiv.innerHTML = arg.title;
+        var span = KE.$$('span');
+        var url = KE.g[id].skinsPath + KE.g[id].skinType + '.gif';
+        span.style.backgroundImage = "url(" + url + ")";
+        span.className = "ke-toolbar-close";
+        span.alt = KE.lang['close'];
+        span.title = KE.lang['close'];
+        span.onclick = new Function("KE.layout.hide('" + id + "')");
+        titleDiv.appendChild(span);
+        KE.util.drag(id, titleDiv, div, function(objTop, objLeft, objWidth, objHeight, top, left) {
+            div.style.top = (objTop + top) + 'px';
+            div.style.left = (objLeft + left) + 'px';
+        });
+        div.appendChild(titleDiv);
+        var bodyDiv = KE.$$('div');
+        bodyDiv.className = 'ke-dialog-body';
+        var dialog = KE.$$('iframe');
+        if (arg.useFrameCSS) {
+            dialog.className = 'ke-dialog-iframe';
+        }
+        dialog.width = arg.width + 'px';
+        dialog.height = arg.height + 'px';
+        dialog.setAttribute("frameBorder", "0");
+        bodyDiv.appendChild(dialog);
+        div.appendChild(bodyDiv);
+
+        var bottomDiv = KE.$$('div');
+        bottomDiv.className = 'ke-dialog-bottom';
+        var noButton = null;
+        var yesButton = null;
+        var previewButton = null;
+        if (arg.noButton) {
+            noButton = KE.$$('input');
+            noButton.className = 'ke-dialog-no';
+            noButton.type = 'button';
+            noButton.name = 'noButton';
+            noButton.value = arg.noButton;
+            noButton.onclick = new Function("KE.layout.hide('" + id + "')");
+            bottomDiv.appendChild(noButton);
+        }
+        if (arg.yesButton) {
+            yesButton = KE.$$('input');
+            yesButton.className = 'ke-dialog-yes';
+            yesButton.type = 'button';
+            yesButton.name = 'yesButton';
+            yesButton.value = arg.yesButton;
+            yesButton.onclick = new Function("KE.plugin['" + arg.cmd  + "'].exec('" + id + "')");
+            bottomDiv.appendChild(yesButton);
+        }
+        if (arg.previewButton) {
+            previewButton = KE.$$('input');
+            previewButton.className = 'ke-dialog-preview';
+            previewButton.type = 'button';
+            previewButton.name = 'previewButton';
+            previewButton.value = arg.previewButton;
+            previewButton.onclick = new Function("KE.plugin['" + arg.cmd  + "'].preview('" + id + "')");
+            bottomDiv.appendChild(previewButton);
+        }
+        div.appendChild(bottomDiv);
+        KE.layout.show(id, div);
+        window.focus();
+        if (yesButton) yesButton.focus();
+        else if (noButton) noButton.focus();
+        if (typeof arg.html != "undefined") {
+            var dialogDoc = KE.util.getIframeDoc(dialog);
+            var html = KE.util.getFullHtml(id, false);
+            dialogDoc.open();
+            dialogDoc.write(html);
+            dialogDoc.close();
+            dialogDoc.body.innerHTML = arg.html;
+        } else {
+            dialog.src = KE.g[id].pluginsPath + arg.cmd + '.html';
+        }
+        KE.g[id].maskDiv.style.width = KE.util.getDocumentWidth() + 'px';
+        KE.g[id].maskDiv.style.height = KE.util.getDocumentHeight() + 'px';
+        KE.g[id].maskDiv.style.display = 'block';
+        KE.g[id].dialog = dialog;
+        KE.g[id].noButton = noButton;
+        KE.g[id].yesButton = yesButton;
+        KE.g[id].previewButton = previewButton;
+    };
+};
+
+KE.toolbar = {
+    updateState : function(id) {
+        var cmdList = [
+            'justifyleft', 'justifycenter', 'justifyright',
+            'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript','superscript',
+            'bold', 'italic', 'underline', 'strikethrough'
+        ];
+        for (var i = 0; i < cmdList.length; i++) {
+            var cmd = cmdList[i];
+            var state = false;
+            try {
+                state = KE.g[id].iframeDoc.queryCommandState(cmd);
+            } catch(e) {}
+            if (state) {
+                KE.toolbar.select(id, cmd);
+            } else {
+                KE.toolbar.unselect(id, cmd);
+            }
+        }
+    },
+    isSelected : function(id, cmd) {
+        if (KE.plugin[cmd] && KE.plugin[cmd].isSelected) return true;
+        else return false;
+    },
+    select : function(id, cmd) {
+        if (KE.g[id].toolbarIcon[cmd]) {
+            var a = KE.g[id].toolbarIcon[cmd][0];
+            a.className = "ke-icon-selected";
+            a.onmouseover = null;
+            a.onmouseout = null;
+        }
+    },
+    unselect : function(id, cmd) {
+        if (KE.g[id].toolbarIcon[cmd]) {
+            var a = KE.g[id].toolbarIcon[cmd][0];
+            a.className = "ke-icon";
+            a.onmouseover = function(){ this.className = "ke-icon-on"; };
+            a.onmouseout = function(){ this.className = "ke-icon"; };
+        }
+    },
+    able : function(id, arr) {
+        KE.each(KE.g[id].toolbarIcon, function(cmd, obj) {
+            if (!KE.util.inArray(cmd, arr)) {
+                var a = obj[0];
+                var span = obj[1];
+                a.className = 'ke-icon';
+                KE.util.setOpacity(span, 100);
+                a.onclick = new Function('KE.util.click("' + id + '", "' + cmd + '");');
+                a.onmouseover = function(){ this.className = "ke-icon-on"; };
+                a.onmouseout = function(){ this.className = "ke-icon"; };
+            }
+        });
+    },
+    disable : function(id, arr) {
+        KE.each(KE.g[id].toolbarIcon, function(cmd, obj) {
+            if (!KE.util.inArray(cmd, arr)) {
+                var a = obj[0];
+                var span = obj[1];
+                a.className = 'ke-icon-disabled';
+                KE.util.setOpacity(span, 50);
+                a.onclick = null;
+                a.onmouseover = null;
+                a.onmouseout = null;
+            }
+        });
+    },
+    create : function(id) {
+        KE.g[id].toolbarIcon = [];
+        var tableObj = KE.util.createTable();
+        var toolbar = tableObj.table;
+        toolbar.className = 'ke-toolbar';
+        toolbar.oncontextmenu = function() { return false; };
+        toolbar.onmousedown = function() { return false; };
+        toolbar.onmousemove = function() { return false; };
+        var toolbarCell = tableObj.cell;
+        var length = KE.g[id].items.length;
+        var cellNum = 0;
+        var row;
+        for (var i = 0; i < length; i++) {
+            var cmd = KE.g[id].items[i];
+            if (i == 0 || cmd == '-') {
+                var table = KE.util.createTable().table;
+                table.className = 'ke-toolbar-table';
+                row = table.insertRow(0);
+                cellNum = 0;
+                toolbarCell.appendChild(table);
+                if (cmd == '-') continue;
+            }
+            var cell = row.insertCell(cellNum);
+            cell.hideforcus = true;
+            cellNum++;
+            var a = KE.$$('a');
+            a.className = 'ke-icon';
+            a.href = 'javascript:;';
+            a.onclick = new Function('KE.util.click("' + id + '", "' + cmd + '");');
+            a.onmouseover = function(){ this.className = "ke-icon-on"; };
+            a.onmouseout = function(){ this.className = "ke-icon"; };
+            a.hidefocus = true;
+            a.title = KE.lang[cmd];
+            var span = KE.$$('span');
+            span.className = "ke-common-icon ke-icon-" + cmd;
+            if (KE.util.inArray(cmd, KE.g[id].defaultItems)) {
+                var url = KE.g[id].skinsPath + KE.g[id].skinType + '.gif';
+                span.style.backgroundImage = "url(" + url + ")";
+            }
+            a.appendChild(span);
+            cell.appendChild(a);
+            KE.g[id].toolbarIcon[cmd] = [a, span];
+            if (KE.toolbar.isSelected(id, cmd)) KE.toolbar.select(id, cmd);
+        }
+        return toolbar;
+    }
+};
+
+KE.history = {
+    add : function(id, minChangeFlag) {
+        var obj = KE.g[id];
+        var html = KE.util.getSrcData(id);
+        if (obj.undoStack.length > 0) {
+            var prevHtml = obj.undoStack[obj.undoStack.length - 1];
+            if (html == prevHtml) return;
+            if (minChangeFlag && Math.abs(html.length - prevHtml.length) < obj.minChangeSize) return;
+        }
+        obj.undoStack.push(html);
+        obj.redoStack = [];
+    },
+    undo : function(id) {
+        var obj = KE.g[id];
+        if (obj.undoStack.length == 0) return;
+        var html = KE.util.getSrcData(id);
+        obj.redoStack.push(html);
+        var prevHtml = obj.undoStack.pop();
+        if (html == prevHtml && obj.undoStack.length > 0) {
+            prevHtml = obj.undoStack.pop();
+        }
+        obj.iframeDoc.body.innerHTML = prevHtml;
+        obj.newTextarea.value = prevHtml;
+    },
+    redo : function(id) {
+        var obj = KE.g[id];
+        if (obj.redoStack.length == 0) return;
+        var html = KE.util.getSrcData(id);
+        obj.undoStack.push(html);
+        var nextHtml = obj.redoStack.pop();
+        obj.iframeDoc.body.innerHTML = nextHtml;
+        obj.newTextarea.value = nextHtml;
+    }
+};
+
+KE.remove = function(id, mode) {
+    mode = (typeof mode == "undefined") ? 0 : mode;
+    var container = KE.g[id].container;
+    if (mode == 1) {
+        document.body.removeChild(container);
+    } else {
+        var srcTextarea = KE.$(id);
+        srcTextarea.parentNode.removeChild(container);
+    }
+    document.body.removeChild(KE.g[id].hideDiv);
+    document.body.removeChild(KE.g[id].maskDiv);
+    KE.g[id].containner = null;
+};
+
+KE.create = function(id, mode) {
+    if (KE.browser == 'IE') try { document.execCommand('BackgroundImageCache', false, true); }catch(e){}
+    var srcTextarea = KE.$(id);
+    mode = (typeof mode == "undefined") ? 0 : mode;
+    if (mode == 0 && KE.g[id].container != null) return;
+    var width = KE.g[id].width || srcTextarea.style.width;
+    var height = KE.g[id].height || srcTextarea.style.height;
+    var tableObj = KE.util.createTable();
+    var container = tableObj.table;
+    container.className = 'ke-container';
+    container.style.width = width;
+    container.style.height = height;
+    var toolbarOuter = tableObj.cell;
+    toolbarOuter.className = 'ke-toolbar-outer';
+    var textareaOuter = container.insertRow(1).insertCell(0);
+    textareaOuter.className = 'ke-textarea-outer';
+    tableObj = KE.util.createTable();
+    var textareaTable = tableObj.table;
+    textareaTable.className = 'ke-textarea-table';
+    var textareaCell = tableObj.cell;
+    textareaOuter.appendChild(textareaTable);
+    var bottomOuter = container.insertRow(2).insertCell(0);
+    bottomOuter.className = 'ke-bottom-outer';
+    if (mode == 1) document.body.appendChild(container);
+    else srcTextarea.parentNode.insertBefore(container, srcTextarea);
+    var toolbarTable = KE.toolbar.create(id);
+    toolbarOuter.appendChild(toolbarTable);
+    var iframe = KE.$$('iframe');
+    iframe.className = 'ke-iframe';
+    iframe.setAttribute("frameBorder", "0");
+    var newTextarea = KE.$$('textarea');
+    newTextarea.className = 'ke-textarea';
+    newTextarea.style.display = 'none';
+    textareaCell.appendChild(iframe);
+    textareaCell.appendChild(newTextarea);
+    var bottom = KE.$$('table');
+    bottom.className = 'ke-bottom';
+    bottom.cellPadding = 0;
+    bottom.cellSpacing = 0;
+    bottom.border = 0;
+    var row = bottom.insertRow(0);
+    var bottomLeft = row.insertCell(0);
+    bottomLeft.className = 'ke-bottom-left';
+    var bottomRight = row.insertCell(1);
+    bottomRight.className = 'ke-bottom-right';
+    var span = KE.$$('span');
+    var url = KE.g[id].skinsPath + KE.g[id].skinType + '.gif';
+    span.style.backgroundImage = "url(" + url + ")";
+    span.className = 'ke-bottom-right-img';
+    bottomRight.appendChild(span);
+    bottomOuter.appendChild(bottom);
+    var hideDiv = KE.$$('div');
+    hideDiv.style.display = 'none';
+    var maskDiv = KE.$$('div');
+    maskDiv.className = 'ke-mask';
+    KE.util.setOpacity(maskDiv, 50);
+    document.body.appendChild(hideDiv);
+    document.body.appendChild(maskDiv);
+    srcTextarea.style.display = "none";
+    KE.util.setDefaultPlugin(id);
+    var iframeWin = iframe.contentWindow;
+    var iframeDoc = KE.util.getIframeDoc(iframe);
+    iframeDoc.designMode = "On";
+    var html = KE.util.getFullHtml(id, KE.g[id].tagLineMode);
+    iframeDoc.open();
+    iframeDoc.write(html);
+    iframeDoc.close();
+    if (!KE.g[id].wyswygMode) {
+        newTextarea.value = srcTextarea.value;
+        newTextarea.style.display = 'block';
+        iframe.style.display = 'none';
+        KE.toolbar.disable(id, ['source', 'preview', 'fullscreen']);
+        KE.toolbar.select(id, 'source');
+    }
+    if (KE.g[id].autoOnsubmitMode) {
+        var form = srcTextarea.parentNode;
+        while (form != null && form.tagName != 'FORM') { form = form.parentNode; }
+        if (form != null && form.tagName == 'FORM') {
+            KE.event.add(form, 'submit', new Function('KE.util.setData("' + id + '")'));
+        }
+    }
+    KE.event.add(iframeDoc, 'click', new Function('KE.layout.hide("' + id + '")'));
+    KE.event.add(iframeDoc, 'click', new Function('KE.toolbar.updateState("' + id + '")'));
+    KE.event.input(iframeDoc, new Function('KE.history.add("' + id + '", true)'));
+    KE.event.add(iframeDoc, 'keyup', new Function('KE.toolbar.updateState("' + id + '")'));
+    KE.event.add(newTextarea, 'click', new Function('KE.layout.hide("' + id + '")'));
+    KE.event.input(newTextarea, new Function('KE.history.add("' + id + '", true)'));
+    KE.g[id].container = container;
+    KE.g[id].toolbarTable = toolbarTable;
+    KE.g[id].textareaTable = textareaTable;
+    KE.g[id].iframe = iframe;
+    KE.g[id].newTextarea = newTextarea;
+    KE.g[id].srcTextarea = srcTextarea;
+    KE.g[id].bottom = bottom;
+    KE.g[id].hideDiv = hideDiv;
+    KE.g[id].maskDiv = maskDiv;
+    KE.g[id].iframeWin = iframeWin;
+    KE.g[id].iframeDoc = iframeDoc;
+    KE.g[id].width = width;
+    KE.g[id].height = height;
+    KE.util.resize(id, width, height);
+    KE.util.drag(id, bottomRight, container, function(objTop, objLeft, objWidth, objHeight, top, left) {
+        if (KE.g[id].resizeMode == 2) KE.util.resize(id, (objWidth + left) + 'px', (objHeight + top) + 'px', true);
+        else if (KE.g[id].resizeMode == 1) KE.util.resize(id, objWidth + 'px', (objHeight + top) + 'px', true);
+    }, true);
+    KE.util.drag(id, bottomLeft, container, function(objTop, objLeft, objWidth, objHeight, top, left) {
+        if (KE.g[id].resizeMode > 0) KE.util.resize(id, objWidth + 'px', (objHeight + top) + 'px', true);
+    }, true);
+    for (var i = 0, len = KE.g[id].items.length; i < len; i++) {
+        var cmd = KE.g[id].items[i];
+        if (KE.plugin[cmd] && KE.plugin[cmd].init) KE.plugin[cmd].init(id);
+    }
+    setTimeout(
+        function(){
+            if (srcTextarea.value !== "") iframeDoc.body.innerHTML = srcTextarea.value;
+            KE.history.add(id, false);
+        }, 1);
+};
+
+KE.init = function(config) {
+    config.wyswygMode = (typeof config.wyswygMode == "undefined") ? KE.setting.wyswygMode : config.wyswygMode;
+    config.autoOnsubmitMode = (typeof config.autoOnsubmitMode == "undefined") ? KE.setting.autoOnsubmitMode : config.autoOnsubmitMode;
+    config.resizeMode = (typeof config.resizeMode == "undefined") ? KE.setting.resizeMode : config.resizeMode;
+    config.filterMode = (typeof config.filterMode == "undefined") ? KE.setting.filterMode : config.filterMode;
+    config.tagLineMode = (typeof config.tagLineMode == "undefined") ? KE.setting.tagLineMode : config.tagLineMode;
+    config.skinType = config.skinType || KE.setting.skinType;
+    config.cssPath = config.cssPath || KE.setting.cssPath;
+    config.skinsPath = config.skinsPath || KE.setting.skinsPath;
+    config.pluginsPath = config.pluginsPath || KE.setting.pluginsPath;
+    config.minWidth = config.minWidth || KE.setting.minWidth;
+    config.minHeight = config.minHeight || KE.setting.minHeight;
+    config.minChangeSize = config.minChangeSize || KE.setting.minChangeSize;
+    config.siteDomains = config.siteDomains || KE.setting.siteDomains;
+    config.defaultItems = KE.setting.items;
+    config.items = config.items || KE.setting.items;
+    config.htmlTags = config.htmlTags || KE.setting.htmlTags;
+    KE.g[config.id] = config;
+    KE.g[config.id].undoStack = [];
+    KE.g[config.id].redoStack = [];
+    KE.util.loadStyle(config.skinsPath + config.skinType + '.css');
+}
+
+KE.show = function(config) {
+    KE.init(config);
+    KE.event.add(window, 'load', new Function('KE.create("' + config.id + '")'));
+};
+
+KE.plugin['about'] = {
+    click : function(id) {
+        var dialog = new KE.dialog({
+            id : id,
+            cmd : 'about',
+            width : 300,
+            height : 80,
+            title : KE.lang['about'],
+            noButton : KE.lang['close']
+        });
+        dialog.show();
+    }
+};
+
+KE.plugin['undo'] = {
+    init : function(id) {
+        KE.event.ctrl(KE.g[id].iframeDoc, 'Z', function(e) {
+            KE.plugin['undo'].click(id);
+            KE.util.focus(id);
+        });
+    },
+    click : function(id) {
+        KE.history.undo(id);
+    }
+};
+
+KE.plugin['redo'] = {
+    init : function(id) {
+        KE.event.ctrl(KE.g[id].iframeDoc, 'Y', function(e) {
+            KE.plugin['redo'].click(id);
+            KE.util.focus(id);
+        });
+    },
+    click : function(id) {
+        KE.history.redo(id);
+    }
+};
+
+KE.plugin['plainpaste'] = {
+    click : function(id) {
+        KE.util.selection(id);
+        var dialog = new KE.dialog({
+            id : id,
+            cmd : 'plainpaste',
+            width : 330,
+            height : 300,
+            title : KE.lang['plainpaste'],
+            yesButton : KE.lang['yes'],
+            noButton : KE.lang['no']
+        });
+        dialog.show();
+    },
+    exec : function(id) {
+        KE.util.select(id);
+        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
+        var html = KE.$('textArea', dialogDoc).value;
+        html = KE.util.escape(html);
+        var re = new RegExp("\r\n|\n|\r", "g");
+        html = html.replace(re, "<br />$&");
+        KE.util.insertHtml(id, html);
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['wordpaste'] = {
+    click : function(id) {
+        KE.util.selection(id);
+        var dialog = new KE.dialog({
+            id : id,
+            cmd : 'wordpaste',
+            width : 330,
+            height : 300,
+            title : KE.lang['wordpaste'],
+            yesButton : KE.lang['yes'],
+            noButton : KE.lang['no']
+        });
+        dialog.show();
+    },
+    exec : function(id) {
+        KE.util.select(id);
+        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
+        var wordIframe = KE.$('wordIframe', dialogDoc);
+        var wordDoc = KE.util.getIframeDoc(wordIframe);
+        KE.util.insertHtml(id, KE.util.outputHtml(id, wordDoc.body));
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['fullscreen'] = {
+    resetFull : function(id) {
+        var el = KE.util.getDocumentElement();
+        var width = el.clientWidth;
+        var height = el.clientHeight;
+        var left,top;
+        if (KE.browser == 'IE' || KE.browser == 'OPERA') {
+            left = document.body.parentNode.scrollLeft;
+            top = document.body.parentNode.scrollTop;
+        } else {
+            left = window.scrollX;
+            top = window.scrollY;
+        }
+        var div = KE.g[id].container;
+        div.style.left = left + 'px';
+        div.style.top = top + 'px';
+        div.style.zIndex = 19811211;
+        KE.util.resize(id, width + 'px', height + 'px');
+    },
+    click : function(id) {
+        var obj = KE.g[id];
+        var self = this;
+        var resizeListener = function(e) {
+            if (self.isSelected) {
+                KE.plugin["fullscreen"].resetFull(id);
+            }
+        }
+        if (this.isSelected) {
+            this.isSelected = false;
+            KE.util.setData(id);
+            KE.remove(id, 1);
+            KE.create(id, 2);
+            document.body.parentNode.style.overflow = 'auto';
+            KE.util.resize(id, this.width, this.height);
+            KE.event.remove(window, 'resize', resizeListener);
+            KE.toolbar.unselect(id, "fullscreen");
+        } else {
+            this.isSelected = true;
+            KE.util.setData(id);
+            this.width = KE.g[id].container.style.width;
+            this.height = KE.g[id].container.style.height;
+            KE.remove(id, 2);
+            KE.create(id, 1);
+            document.body.parentNode.style.overflow = 'hidden';
+            var div = KE.g[id].container;
+            div.style.position = 'absolute';
+            this.resetFull(id);
+            KE.event.add(window, 'resize', resizeListener);
+            KE.toolbar.select(id, "fullscreen");
+        }
+    }
+};
+
+KE.plugin['bgcolor'] = {
+    click : function(id) {
+        KE.util.selection(id);
+        var menu = new KE.menu({
+            id : id,
+            cmd : 'bgcolor'
+        });
+        menu.picker();
+    },
+    exec : function(id, value) {
+        var cmd = new KE.cmd(id);
+        cmd.wrap('span', [{'.background-color': value}]);
+        KE.history.add(id, false);
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['date'] = {
+    click : function(id) {
+        var date = new Date();
+        var year = date.getFullYear().toString(10);
+        var month = (date.getMonth() + 1).toString(10);
+        month = month.length < 2 ? '0' + month : month;
+        var day = date.getDate().toString(10);
+        day = day.length < 2 ? '0' + day : day;
+        var value = year + '-' + month + '-' + day;
+        KE.util.selection(id);
+        KE.util.insertHtml(id, value);
+    }
+};
+
+KE.plugin['fontname'] = {
+    click : function(id) {
+        var fontName = {
+            'SimSun'             : '宋体',
+            'SimHei'             : '黑体',
+            'FangSong_GB2312'    : '仿宋体',
+            'KaiTi_GB2312'       : '楷体',
+            'NSimSun'            : '新宋体',
+            'Arial'              : 'Arial',
+            'Arial Black'        : 'Arial Black',
+            'Times New Roman'    : 'Times New Roman',
+            'Courier New'        : 'Courier New',
+            'Tahoma'             : 'Tahoma',
+            'Verdana'            : 'Verdana'
+        };
+        var cmd = 'fontname';
+        KE.util.selection(id);
+        var menu = new KE.menu({
+            id : id,
+            cmd : cmd,
+            width : '160px'
+        });
+        KE.each(fontName, function(key, value) {
+            var html = '<span style="font-family: ' + key + ';">' + value + '</span>';
+            menu.add(html, new Function('KE.plugin["' + cmd + '"].exec("' + id + '", "' + key + '")'));
+        });
+        menu.show();
+    },
+    exec : function(id, value) {
+        var cmd = new KE.cmd(id);
+        cmd.wrap('span', [{'.font-family': value}]);
+        KE.history.add(id, false);
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['fontsize'] = {
+    click : function(id) {
+        var fontSize = ['9px', '10px', '12px', '14px', '16px', '18px', '24px', '32px'];
+        var cmd = 'fontsize';
+        KE.util.selection(id);
+        var menu = new KE.menu({
+            id : id,
+            cmd : cmd,
+            width : '100px'
+        });
+        for (var i = 0, len = fontSize.length; i < len; i++) {
+            var value = fontSize[i];
+            var html = '<span style="font-size: ' + value + ';">' + value + '</span>';
+            menu.add(html, new Function('KE.plugin["' + cmd + '"].exec("' + id + '", "' + value + '")'));
+        }
+        menu.show();
+    },
+    exec : function(id, value) {
+        var cmd = new KE.cmd(id);
+        cmd.wrap('span', [{'.font-size': value}]);
+        KE.history.add(id, false);
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['hr'] = {
+    click : function(id) {
+        KE.util.selection(id);
+        KE.util.insertHtml(id, '<hr />');
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['preview'] = {
+    click : function(id) {
+        var dialog = new KE.dialog({
+            id : id,
+            cmd : 'preview',
+            html : KE.util.getData(id),
+            width : 600,
+            height : 400,
+            useFrameCSS : true,
+            title : KE.lang['preview'],
+            noButton : KE.lang['close']
+        });
+        dialog.show();
+    }
+};
+
+KE.plugin['print'] = {
+    click : function(id) {
+        KE.util.selection(id);
+        KE.g[id].iframeWin.print();
+    }
+};
+
+KE.plugin['removeformat'] = {
+    click : function(id) {
+        KE.util.selection(id);
+        var cmd = new KE.cmd(id);
+        cmd.remove(KE.setting.inlineTags, ['class', 'style']);
+        KE.history.add(id, false);
+        KE.toolbar.updateState(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['source'] = {
+    click : function(id) {
+        var obj = KE.g[id];
+        if (!obj.wyswygMode) {
+            obj.iframeDoc.body.innerHTML = obj.newTextarea.value;
+            obj.iframe.style.display = 'block';
+            obj.newTextarea.style.display = 'none';
+            KE.toolbar.able(id, ['source', 'preview', 'fullscreen']);
+            obj.wyswygMode = true;
+            this.isSelected = false;
+            KE.toolbar.unselect(id, "source");
+        } else {
+            KE.layout.hide(id);
+            if (KE.g[id].filterMode) {
+                obj.newTextarea.value = KE.util.outputHtml(id, obj.iframeDoc.body);
+            } else {
+                obj.newTextarea.value = KE.util.htmlToXhtml(id, obj.iframeDoc.body);
+            }
+            obj.iframe.style.display = 'none';
+            obj.newTextarea.style.display = 'block';
+            KE.toolbar.disable(id, ['source', 'preview', 'fullscreen']);
+            obj.wyswygMode = false;
+            this.isSelected = true;
+            KE.toolbar.select(id, "source");
+        }
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['textcolor'] = {
+    click : function(id) {
+        KE.util.selection(id);
+        var menu = new KE.menu({
+            id : id,
+            cmd : 'textcolor'
+        });
+        menu.picker();
+    },
+    exec : function(id, value) {
+        var cmd = new KE.cmd(id);
+        cmd.wrap('span', [{'.color': value}]);
+        KE.history.add(id, false);
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['time'] = {
+    click : function(id) {
+        var date = new Date();
+        var hour = date.getHours().toString(10);
+        hour = hour.length < 2 ? '0' + hour : hour;
+        var minute = date.getMinutes().toString(10);
+        minute = minute.length < 2 ? '0' + minute : minute;
+        var second = date.getSeconds().toString(10);
+        second = second.length < 2 ? '0' + second : second;
+        var value = hour + ':' + minute + ':' + second;
+        KE.util.selection(id);
+        KE.util.insertHtml(id, value);
+    }
+};
+
+KE.plugin['title'] = {
+    click : function(id) {
+        var title = {
+            'H1' : '标题 1',
+            'H2' : '标题 2',
+            'H3' : '标题 3',
+            'H4' : '标题 4',
+            'H5' : '标题 5',
+            'H6' : '标题 6'
+        };
+        var cmd = 'title';
+        KE.util.selection(id);
+        var menu = new KE.menu({
+            id : id,
+            cmd : cmd,
+            width : '120px'
+        });
+        KE.each(title, function(key, value) {
+            var html = '<' + key + ' style="margin:0px;">' + value + '</' + key + '>';
+            menu.add(html, new Function('KE.plugin["' + cmd + '"].exec("' + id + '", "<' + key + '>")'));
+        });
+        menu.show();
+    },
+    exec : function(id, value) {
+        KE.util.select(id);
+        KE.util.execCommand(id, 'formatblock', value);
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['emoticons'] = {
+    icon : 'emoticons.gif',
+    click : function(id) {
+        var emoticonTable = [
+            ['etc_01.gif','etc_02.gif','etc_03.gif','etc_04.gif','etc_05.gif','etc_06.gif'],
+            ['etc_07.gif','etc_08.gif','etc_09.gif','etc_10.gif','etc_11.gif','etc_12.gif'],
+            ['etc_13.gif','etc_14.gif','etc_15.gif','etc_16.gif','etc_17.gif','etc_18.gif'],
+            ['etc_19.gif','etc_20.gif','etc_21.gif','etc_22.gif','etc_23.gif','etc_24.gif'],
+            ['etc_25.gif','etc_26.gif','etc_27.gif','etc_28.gif','etc_29.gif','etc_30.gif'],
+            ['etc_31.gif','etc_32.gif','etc_33.gif','etc_34.gif','etc_35.gif','etc_36.gif']
+        ];
+        var cmd = 'emoticons';
+        KE.util.selection(id);
+        var table = KE.$$('table');
+        table.cellPadding = 0;
+        table.cellSpacing = 2;
+        table.border = 0;
+        table.style.margin = 0;
+        table.style.padding = 0;
+        table.style.borderCollapse = 'separate';
+        for (var i = 0; i < emoticonTable.length; i++) {
+            var row = table.insertRow(i);
+            for (var j = 0; j < emoticonTable[i].length; j++) {
+                var cell = row.insertCell(j);
+                cell.style.margin = 0;
+                cell.style.padding = '1px';
+                cell.style.border = '1px solid #F0F0EE';
+                cell.style.cursor = 'pointer';
+                cell.onmouseover = function() {this.style.borderColor = '#000000'; }
+                cell.onmouseout = function() {this.style.borderColor = '#F0F0EE'; }
+                cell.onclick = new Function('KE.plugin["' + cmd + '"].exec("' + id + '", "' + emoticonTable[i][j] + '")');
+                var img = KE.$$('img');
+                img.src = KE.g[id].pluginsPath + 'emoticons/' + emoticonTable[i][j];
+                cell.appendChild(img);
+            }
+        }
+        var menu = new KE.menu({
+            id : id,
+            cmd : cmd
+        });
+        menu.append(table);
+        menu.show();
+    },
+    exec : function(id, value) {
+        KE.util.select(id);
+        var html = '<img src="' + KE.g[id].pluginsPath + 'emoticons/' + value + '" border="0" />';
+        KE.util.insertHtml(id, html);
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['flash'] = {
+    click : function(id) {
+        KE.util.selection(id);
+        var dialog = new KE.dialog({
+            id : id,
+            cmd : 'flash',
+            width : 280,
+            height : 250,
+            title : "Flash",
+            previewButton : KE.lang['preview'],
+            yesButton : KE.lang['yes'],
+            noButton : KE.lang['no']
+        });
+        dialog.show();
+    },
+    check : function(id, url) {
+        if (url.match(/\w+:\/\/.{3,}/) == null) {
+            alert(KE.lang['invalidUrl']);
+            window.focus();
+            KE.g[id].yesButton.focus();
+            return false;
+        }
+        return true;
+    },
+    preview : function(id) {
+        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
+        var url = KE.$('url', dialogDoc).value;
+        if (!this.check(id, url)) return false;
+        var embed = KE.$$('embed', dialogDoc);
+        embed.src = url;
+        embed.type = "application/x-shockwave-flash";
+        embed.quality = "high";
+        embed.width = 190;
+        embed.height = 190;
+        KE.$('previewDiv', dialogDoc).innerHTML = "";
+        KE.$('previewDiv', dialogDoc).appendChild(embed);
+    },
+    exec : function(id) {
+        KE.util.select(id);
+        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
+        var url = KE.$('url', dialogDoc).value;
+        if (!this.check(id, url)) return false;
+        var html = '<embed src="' + url + '" type="application/x-shockwave-flash" quality="high" />';
+        KE.util.insertHtml(id, html);
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['image'] = {
+    click : function(id) {
+        KE.util.selection(id);
+        var dialog = new KE.dialog({
+            id : id,
+            cmd : 'image',
+            width : 310,
+            height : 90,
+            title : KE.lang['image'],
+            yesButton : KE.lang['yes'],
+            noButton : KE.lang['no']
+        });
+        dialog.show();
+    },
+    check : function(id) {
+        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
+        var type = KE.$('type', dialogDoc).value;
+        var url = '';
+        if (type == 1) {
+            url = KE.$('imgFile', dialogDoc).value;
+        } else {
+            url = KE.$('url', dialogDoc).value;
+        }
+        var width = KE.$('imgWidth', dialogDoc).value;
+        var height = KE.$('imgHeight', dialogDoc).value;
+        var border = KE.$('imgBorder', dialogDoc).value;
+        if (!url.match(/\.(jpg|jpeg|gif|bmp|png)(\s|$)/i)) {
+            alert(KE.lang['invalidImg']);
+            window.focus();
+            KE.g[id].yesButton.focus();
+            return false;
+        }
+        if (width.match(/^\d+$/) == null) {
+            alert(KE.lang['invalidWidth']);
+            window.focus();
+            KE.g[id].yesButton.focus();
+            return false;
+        }
+        if (height.match(/^\d+$/) == null) {
+            alert(KE.lang['invalidHeight']);
+            window.focus();
+            KE.g[id].yesButton.focus();
+            return false;
+        }
+        if (border.match(/^\d+$/) == null) {
+            alert(KE.lang['invalidBorder']);
+            window.focus();
+            KE.g[id].yesButton.focus();
+            return false;
+        }
+        return true;
+    },
+    exec : function(id) {
+        KE.util.select(id);
+        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
+        var type = KE.$('type', dialogDoc).value;
+        if (!this.check(id)) return false;
+        if (type == 1) {
+            KE.$('editorId', dialogDoc).value = id;
+            dialogDoc.uploadForm.submit();
+            return false;
+        } else {
+            var url = KE.$('url', dialogDoc).value;
+            var title = KE.$('imgTitle', dialogDoc).value;
+            var width = KE.$('imgWidth', dialogDoc).value;
+            var height = KE.$('imgHeight', dialogDoc).value;
+            var border = KE.$('imgBorder', dialogDoc).value;
+            this.insert(id, url, title, width, height, border);
+        }
+    },
+    insert : function(id, url, title, width, height, border) {
+        var html = '<img src="' + url + '" ';
+        if (width > 0) html += 'width="' + width + '" ';
+        if (height > 0) html += 'height="' + height + '" ';
+        if (title) html += 'title="' + title + '" ';
+        html += 'alt="' + title + '" ';
+        html += 'border="' + border + '" />';
+        KE.util.insertHtml(id, html);
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['layer'] = {
+    click : function(id) {
+        var cmd = 'layer';
+        var styles = [
+            'margin:5px;border:1px solid #000000;',
+            'margin:5px;border:2px solid #000000;',
+            'margin:5px;border:1px dashed #000000;',
+            'margin:5px;border:2px dashed #000000;',
+            'margin:5px;border:1px dotted #000000;',
+            'margin:5px;border:2px dotted #000000;'
+        ];
+        KE.util.selection(id);
+        var menu = new KE.menu({
+            id : id,
+            cmd : cmd,
+            width : '150px'
+        });
+        for (var i = 0; i < styles.length; i++) {
+            var html = '<div style="height:15px;' + styles[i] + '"></div>';
+            menu.add(html, new Function('KE.plugin["' + cmd + '"].exec("' + id + '", "padding:5px;' + styles[i] + '")'));
+        }
+        menu.show();
+    },
+    exec : function(id, value) {
+        KE.util.select(id);
+        var html = '<div style="' + value + '">' + KE.lang['pleaseInput'] + '</div>';
+        KE.util.insertHtml(id, html);
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['link'] = {
+    click : function(id) {
+        KE.util.selection(id);
+        var dialog = new KE.dialog({
+            id : id,
+            cmd : 'link',
+            width : 310,
+            height : 70,
+            title : KE.lang['link'],
+            yesButton : KE.lang['yes'],
+            noButton : KE.lang['no']
+        });
+        dialog.show();
+    },
+    exec : function(id) {
+        KE.util.select(id);
+        var iframeDoc = KE.g[id].iframeDoc;
+        var range = KE.g[id].range;
+        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
+        var url = KE.$('hyperLink', dialogDoc).value;
+        var target = KE.$('linkType', dialogDoc).value;
+        if (url.match(/\w+:\/\/.{3,}/) == null) {
+            alert(KE.lang['invalidUrl']);
+            window.focus();
+            KE.g[id].yesButton.focus();
+            return false;
+        }
+        var node;
+        if (KE.browser == 'IE') {
+            node = range.item ? range.item(0).parentNode : iframeDoc.body;
+        } else {
+            node = (range.startContainer == range.endContainer) ? range.startContainer.parentNode : iframeDoc.body;
+        }
+        if (node && node.tagName == 'A') node = node.parentNode;
+        if (!node) node = iframeDoc.body;
+        iframeDoc.execCommand("createlink", false, "__ke_temp_url__");
+        var arr = node.getElementsByTagName('a');
+        for (var i = 0, l = arr.length; i < l; i++) {
+            if (arr[i].href.match(/\/?__ke_temp_url__$/) != null) {
+                arr[i].href = url;
+                if (target) arr[i].target = target;
+            }
+        }
+        KE.history.add(id);
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['media'] = {
+    click : function(id) {
+        KE.util.selection(id);
+        var dialog = new KE.dialog({
+            id : id,
+            cmd : 'media',
+            width : 280,
+            height : 250,
+            title : KE.lang['media'],
+            previewButton : KE.lang['preview'],
+            yesButton : KE.lang['yes'],
+            noButton : KE.lang['no']
+        });
+        dialog.show();
+    },
+    check : function(id, url) {
+        if (!url.match(/^\w+:\/\/.{3,}\.(mp3|wav|wma|wmv|mid|avi|mpg|mpeg|asf|rm|rmvb)(\?|$)/i)) {
+            alert(KE.lang['invalidMedia']);
+            window.focus();
+            KE.g[id].yesButton.focus();
+            return false;
+        }
+        return true;
+    },
+    preview : function(id) {
+        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
+        var url = KE.$('url', dialogDoc).value;
+        if (!this.check(id, url)) return false;
+        var embed = KE.$$('embed', dialogDoc);
+        embed.src = url;
+        if (url.match(/\.(rm|rmvb)$/i) == null) {
+            embed.type = "video/x-ms-asf-plugin";
+        } else {
+            embed.type = "audio/x-pn-realaudio-plugin";
+        }
+        embed.loop = "true";
+        embed.autostart = "true";
+        embed.width = 260;
+        embed.height = 190;
+        KE.$('previewDiv', dialogDoc).innerHTML = "";
+        KE.$('previewDiv', dialogDoc).appendChild(embed);
+    },
+    exec : function(id) {
+        KE.util.select(id);
+        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
+        var url = KE.$('url', dialogDoc).value;
+        if (!this.check(id, url)) return false;
+        var html;
+        if (url.match(/\.(rm|rmvb)$/i) == null) {
+            html = '<embed src="' + url + '" type="video/x-ms-asf-plugin" loop="true" autostart="true" />';
+        } else {
+            html = '<embed src="' + url + '" type="audio/x-pn-realaudio-plugin" loop="true" autostart="true" />';
+        }
+        KE.util.insertHtml(id, html);
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['specialchar'] = {
+    click : function(id) {
+        var charTable = [
+            ['§','№','☆','★','○','●','◎','◇','◆','□'],
+            ['℃','‰','■','△','▲','※','→','←','↑','↓'],
+            ['〓','¤','°','#','&','@','\','︿','_',' ̄'],
+            ['―','α','β','γ','δ','ε','ζ','η','θ','ι'],
+            ['κ','λ','μ','ν','ξ','ο','π','ρ','σ','τ'],
+            ['υ','φ','χ','ψ','ω','≈','≡','≠','=','≤'],
+            ['≥','<','>','≮','≯','∷','±','+','-','×'],
+            ['÷','/','∫','∮','∝','∞','∧','∨','∑','∏'],
+            ['∪','∩','∈','∵','∴','⊥','∥','∠','⌒','⊙'],
+            ['≌','∽','〖','〗','【','】','(',')','[',']']
+        ];
+        var cmd = 'specialchar';
+        KE.util.selection(id);
+        var table = KE.$$('table');
+        table.cellPadding = 0;
+        table.cellSpacing = 2;
+        table.border = 0;
+        table.style.margin = 0;
+        table.style.padding = 0;
+        table.style.borderCollapse = 'separate';
+        for (var i = 0; i < charTable.length; i++) {
+            var row = table.insertRow(i);
+            for (var j = 0; j < charTable[i].length; j++) {
+                var cell = row.insertCell(j);
+                cell.style.padding = '1px';
+                cell.style.margin = 0;
+                cell.style.border = '1px solid #AAAAAA';
+                cell.style.fontSize = '12px';
+                cell.style.cursor = 'pointer';
+                cell.onmouseover = function() {this.style.borderColor = '#000000'; }
+                cell.onmouseout = function() {this.style.borderColor = '#AAAAAA'; }
+                cell.onclick = new Function('KE.plugin["' + cmd + '"].exec("' + id + '", "' + charTable[i][j] + '")');
+                cell.innerHTML = charTable[i][j];
+            }
+        }
+        var menu = new KE.menu({
+            id : id,
+            cmd : cmd
+        });
+        menu.append(table);
+        menu.show();
+    },
+    exec : function(id, value) {
+        KE.util.select(id);
+        KE.util.insertHtml(id, value);
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};
+
+KE.plugin['table'] = {
+    selected : function(id, i, j) {
+        var text = i.toString(10) + ' by ' + j.toString(10) + ' Table';
+        KE.$('tableLocation' + id).innerHTML = text;
+        var num = 10;
+        for (var m = 1; m <= num; m++) {
+            for (var n = 1; n <= num; n++) {
+                var td = KE.$('tableTd' + id + m.toString(10) + '_' + n.toString(10) + '');
+                if (m <= i && n <= j) {
+                    td.style.backgroundColor = '#CCCCCC';
+                } else {
+                    td.style.backgroundColor = '#FFFFFF';
+                }
+            }
+        }
+    },
+    click : function(id) {
+        var cmd = 'table';
+        KE.util.selection(id);
+        var num = 10;
+        var html = '<table cellpadding="0" cellspacing="0" border="0" style="width:130px;border-collapse:separate;padding:0;margin:0;">';
+        for (var i = 1; i <= num; i++) {
+            html += '<tr>';
+            for (var j = 1; j <= num; j++) {
+                var value = i.toString(10) + ',' + j.toString(10);
+                html += '<td id="tableTd' + id + i.toString(10) + '_' + j.toString(10) +
+                    '" style="font-size:1px;width:12px;height:12px;background-color:#FFFFFF;' +
+                    'border:1px solid #DDDDDD;cursor:pointer;margin:0;padding:0;" ' +
+                    'onclick="javascript:KE.plugin[\'table\'].exec(\'' + id + '\', \'' + value + '\');" ' +
+                    'onmouseover="javascript:KE.plugin[\'table\'].selected(\'' + id + '\', \'' + i.toString(10) +
+                    '\', \'' + j.toString(10) + '\');">&nbsp;</td>';
+            }
+            html += '</tr>';
+        }
+        html += '<tr><td colspan="10" id="tableLocation' + id +
+            '" style="font-size:12px;text-align:center;height:20px;margin:0;padding:0;border:0;"></td></tr>';
+        html += '</table>';
+        var menu = new KE.menu({
+            id : id,
+            cmd : cmd
+        });
+        menu.insert(html);
+        menu.show();
+    },
+    exec : function(id, value) {
+        KE.util.select(id);
+        var location = value.split(',');
+        var html = '<table border="1">';
+        for (var i = 0; i < location[0]; i++) {
+            html += '<tr>';
+            for (var j = 0; j < location[1]; j++) {
+                html += '<td>&nbsp;</td>';
+            }
+            html += '</tr>';
+        }
+        html += '</table>';
+        KE.util.insertHtml(id, html);
+        KE.layout.hide(id);
+        KE.util.focus(id);
+    }
+};

+ 42 - 42
demo/public/static/js/editor/plugins/about.html

@@ -1,42 +1,42 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-  <title>About</title>
-  <style type="text/css" rel="stylesheet">
-    body {
-    font-size:12px;
-    margin: 5px;
-    background-color:#F0F0EE;
-    }
-    div.title {
-    font-size: 18px;
-    font-weight: bold;
-    color: #FB7155;
-    margin-bottom: 5px;
-    }
-    td.left {
-    font-size: 12px;
-    width: 70px;
-    padding: 2px;
-    }
-    td.right {
-    font-size: 12px;
-    padding: 2px;
-    }
-  </style>
-</head>
-<body>
-  <div class="title">KindEditor</div>
-  <table border="0" cellpadding="0" cellspacing="0">
-    <tr>
-      <td class="left">版本: </td>
-      <td class="right">3.2.1</td>
-    </tr>
-    <tr>
-      <td class="left">技术支持: </td>
-      <td class="right"><a href="http://www.kindsoft.net/" target="_blank">http://www.kindsoft.net/</a></td>
-    </tr>
-  </table>
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+  <title>About</title>
+  <style type="text/css" rel="stylesheet">
+    body {
+    font-size:12px;
+    margin: 5px;
+    background-color:#F0F0EE;
+    }
+    div.title {
+    font-size: 18px;
+    font-weight: bold;
+    color: #FB7155;
+    margin-bottom: 5px;
+    }
+    td.left {
+    font-size: 12px;
+    width: 70px;
+    padding: 2px;
+    }
+    td.right {
+    font-size: 12px;
+    padding: 2px;
+    }
+  </style>
+</head>
+<body>
+  <div class="title">KindEditor</div>
+  <table border="0" cellpadding="0" cellspacing="0">
+    <tr>
+      <td class="left">版本: </td>
+      <td class="right">3.2.1</td>
+    </tr>
+    <tr>
+      <td class="left">技术支持: </td>
+      <td class="right"><a href="http://www.kindsoft.net/" target="_blank">http://www.kindsoft.net/</a></td>
+    </tr>
+  </table>
+</body>
+</html>

+ 44 - 44
demo/public/static/js/editor/plugins/flash.html

@@ -1,44 +1,44 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-  <title>Flash</title>
-  <style type="text/css" rel="stylesheet">
-    body {
-    font-size:12px;
-    margin: 0px;
-    background-color:#F0F0EE;
-    }
-    td.left {
-    font-size:12px;
-    width: 40px;
-    padding: 2px;
-    }
-    td.right {
-    font-size:12px;
-    padding: 2px;
-    }
-    div.preview {
-    border: 1px solid #AAAAAA;
-    background-color: #FFFFFF;
-    width: 270px;
-    height: 200px;
-    margin: 0px 0px 10px 0px;
-    }
-    div.preview div {
-    margin: 5px;
-    }
-  </style>
-</head>
-<body>
-  <div class="preview"><div id="previewDiv"></div></div>
-  <table border="0" cellpadding="0" cellspacing="0">
-    <tr>
-      <td class="left">URL:</td>
-      <td class="right">
-        <input type="text" id="url" name="url" value="http://" maxlength="255" style="width:210px;" />
-      </td>
-    </tr>
-  </table>
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+  <title>Flash</title>
+  <style type="text/css" rel="stylesheet">
+    body {
+    font-size:12px;
+    margin: 0px;
+    background-color:#F0F0EE;
+    }
+    td.left {
+    font-size:12px;
+    width: 40px;
+    padding: 2px;
+    }
+    td.right {
+    font-size:12px;
+    padding: 2px;
+    }
+    div.preview {
+    border: 1px solid #AAAAAA;
+    background-color: #FFFFFF;
+    width: 270px;
+    height: 200px;
+    margin: 0px 0px 10px 0px;
+    }
+    div.preview div {
+    margin: 5px;
+    }
+  </style>
+</head>
+<body>
+  <div class="preview"><div id="previewDiv"></div></div>
+  <table border="0" cellpadding="0" cellspacing="0">
+    <tr>
+      <td class="left">URL:</td>
+      <td class="right">
+        <input type="text" id="url" name="url" value="http://" maxlength="255" style="width:210px;" />
+      </td>
+    </tr>
+  </table>
+</body>
+</html>

+ 86 - 86
demo/public/static/js/editor/plugins/image.html

@@ -1,86 +1,86 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-  <title>Image</title>
-  <style type="text/css" rel="stylesheet">
-    body {
-    font-size:12px;
-    margin: 0px;
-    background-color:#F0F0EE;
-    overflow: hidden;
-    }
-    td.left1 {
-    font-size:12px;
-    width: 50px;
-    padding: 2px;
-    }
-    td.right1 {
-    font-size:12px;
-    padding: 2px;
-    }
-    td.left2 {
-    font-size:12px;
-    width: 35px;
-    padding: 2px;
-    }
-    td.right2 {
-    font-size:12px;
-    padding: 2px;
-    width: 50px;
-    }
-  </style>
-  <script type="text/javascript">
-    function changeType(obj) {
-        if (obj.value == 1) {
-            document.getElementById('url').style.display = 'none';
-            document.getElementById('imgFile').style.display = 'block';
-        } else {
-            document.getElementById('url').style.display = 'block';
-            document.getElementById('imgFile').style.display = 'none';
-        }
-    }
-  </script>
-</head>
-<body>
-  <form name="uploadForm" method="post" enctype="multipart/form-data" action="./../php/upload.php">
-    <input type="hidden" id="editorId" name="id" value="" />
-    <table border="0" cellpadding="0" cellspacing="0">
-      <tr>
-        <td class="left1">
-          <select id="type" name="type" onchange="javascript:changeType(this);">
-            <option value="1" selected="selected">本地</option>
-            <option value="2">远程</option>
-          </select>
-        </td>
-        <td class="right1">
-          <input type="file" id="imgFile" name="imgFile" style="width:220px;" />
-          <input type="text" id="url" name="url" value="http://" maxlength="255" style="width:220px;display:none;" />
-        </td>
-      </tr>
-      <tr>
-        <td class="left1">说明:</td>
-        <td class="right1">
-          <input type="text" id="imgTitle" name="imgTitle" value="" maxlength="100" style="width:220px;" />
-        </td>
-      </tr>
-    </table>
-    <table border="0" cellpadding="0" cellspacing="0">
-      <tr>
-        <td class="left2">宽度: </td>
-        <td class="right2">
-          <input type="text" name="imgWidth" id="imgWidth" value="0" maxlength="4" style="width:40px;" />
-        </td>
-        <td class="left2">高度: </td>
-        <td class="right2">
-          <input type="text" name="imgHeight" id="imgHeight" value="0" maxlength="4" style="width:40px;" />
-        </td>
-        <td class="left2">边框: </td>
-        <td class="right2">
-          <input type="text" name="imgBorder" id="imgBorder" value="0" maxlength="1" style="width:40px;" />
-        </td>
-      </tr>
-    </table>
-  </form>
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+  <title>Image</title>
+  <style type="text/css" rel="stylesheet">
+    body {
+    font-size:12px;
+    margin: 0px;
+    background-color:#F0F0EE;
+    overflow: hidden;
+    }
+    td.left1 {
+    font-size:12px;
+    width: 50px;
+    padding: 2px;
+    }
+    td.right1 {
+    font-size:12px;
+    padding: 2px;
+    }
+    td.left2 {
+    font-size:12px;
+    width: 35px;
+    padding: 2px;
+    }
+    td.right2 {
+    font-size:12px;
+    padding: 2px;
+    width: 50px;
+    }
+  </style>
+  <script type="text/javascript">
+    function changeType(obj) {
+        if (obj.value == 1) {
+            document.getElementById('url').style.display = 'none';
+            document.getElementById('imgFile').style.display = 'block';
+        } else {
+            document.getElementById('url').style.display = 'block';
+            document.getElementById('imgFile').style.display = 'none';
+        }
+    }
+  </script>
+</head>
+<body>
+  <form name="uploadForm" method="post" enctype="multipart/form-data" action="./../php/upload.php">
+    <input type="hidden" id="editorId" name="id" value="" />
+    <table border="0" cellpadding="0" cellspacing="0">
+      <tr>
+        <td class="left1">
+          <select id="type" name="type" onchange="javascript:changeType(this);">
+            <option value="1" selected="selected">本地</option>
+            <option value="2">远程</option>
+          </select>
+        </td>
+        <td class="right1">
+          <input type="file" id="imgFile" name="imgFile" style="width:220px;" />
+          <input type="text" id="url" name="url" value="http://" maxlength="255" style="width:220px;display:none;" />
+        </td>
+      </tr>
+      <tr>
+        <td class="left1">说明:</td>
+        <td class="right1">
+          <input type="text" id="imgTitle" name="imgTitle" value="" maxlength="100" style="width:220px;" />
+        </td>
+      </tr>
+    </table>
+    <table border="0" cellpadding="0" cellspacing="0">
+      <tr>
+        <td class="left2">宽度: </td>
+        <td class="right2">
+          <input type="text" name="imgWidth" id="imgWidth" value="0" maxlength="4" style="width:40px;" />
+        </td>
+        <td class="left2">高度: </td>
+        <td class="right2">
+          <input type="text" name="imgHeight" id="imgHeight" value="0" maxlength="4" style="width:40px;" />
+        </td>
+        <td class="left2">边框: </td>
+        <td class="right2">
+          <input type="text" name="imgBorder" id="imgBorder" value="0" maxlength="1" style="width:40px;" />
+        </td>
+      </tr>
+    </table>
+  </form>
+</body>
+</html>

+ 39 - 39
demo/public/static/js/editor/plugins/link.html

@@ -1,39 +1,39 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-  <title>Link</title>
-  <style type="text/css" rel="stylesheet">
-    body {
-    font-size:12px;
-    margin: 5px;
-    background-color:#F0F0EE;
-    }
-    td.left {
-    font-size: 12px;
-    width: 70px;
-    padding: 2px;
-    }
-    td.right {
-    padding: 2px;
-    }
-  </style>
-</head>
-<body>
-  <table border="0" cellpadding="0" cellspacing="0">
-    <tr>
-      <td class="left">URL: </td>
-      <td class="right"><input type="text" id="hyperLink" name="hyperLink" value="http://" style="width:200px;" /></td>
-    </tr>
-    <tr>
-      <td class="left">打开类型: </td>
-      <td class="right">
-        <select id="linkType" name="linkType">
-          <option value="_blank">新窗口</option>
-          <option value="_self">当前窗口</option>
-        </select>
-      </td>
-    </tr>
-  </table>
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+  <title>Link</title>
+  <style type="text/css" rel="stylesheet">
+    body {
+    font-size:12px;
+    margin: 5px;
+    background-color:#F0F0EE;
+    }
+    td.left {
+    font-size: 12px;
+    width: 70px;
+    padding: 2px;
+    }
+    td.right {
+    padding: 2px;
+    }
+  </style>
+</head>
+<body>
+  <table border="0" cellpadding="0" cellspacing="0">
+    <tr>
+      <td class="left">URL: </td>
+      <td class="right"><input type="text" id="hyperLink" name="hyperLink" value="http://" style="width:200px;" /></td>
+    </tr>
+    <tr>
+      <td class="left">打开类型: </td>
+      <td class="right">
+        <select id="linkType" name="linkType">
+          <option value="_blank">新窗口</option>
+          <option value="_self">当前窗口</option>
+        </select>
+      </td>
+    </tr>
+  </table>
+</body>
+</html>

+ 44 - 44
demo/public/static/js/editor/plugins/media.html

@@ -1,44 +1,44 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-  <title>Media</title>
-  <style type="text/css" rel="stylesheet">
-    body {
-    font-size:12px;
-    margin: 0px;
-    background-color:#F0F0EE;
-    }
-    td.left {
-    font-size:12px;
-    width: 40px;
-    padding: 2px;
-    }
-    td.right {
-    font-size:12px;
-    padding: 2px;
-    }
-    div.preview {
-    border: 1px solid #AAAAAA;
-    background-color: #FFFFFF;
-    width: 270px;
-    height: 200px;
-    margin: 0px 0px 10px 0px;
-    }
-    div.preview div {
-    margin: 5px;
-    }
-  </style>
-</head>
-<body>
-  <div class="preview"><div id="previewDiv"></div></div>
-  <table border="0" cellpadding="0" cellspacing="0">
-    <tr>
-      <td class="left">URL:</td>
-      <td class="right">
-        <input type="text" id="url" name="url" value="http://" maxlength="255" style="width:210px;" />
-      </td>
-    </tr>
-  </table>
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+  <title>Media</title>
+  <style type="text/css" rel="stylesheet">
+    body {
+    font-size:12px;
+    margin: 0px;
+    background-color:#F0F0EE;
+    }
+    td.left {
+    font-size:12px;
+    width: 40px;
+    padding: 2px;
+    }
+    td.right {
+    font-size:12px;
+    padding: 2px;
+    }
+    div.preview {
+    border: 1px solid #AAAAAA;
+    background-color: #FFFFFF;
+    width: 270px;
+    height: 200px;
+    margin: 0px 0px 10px 0px;
+    }
+    div.preview div {
+    margin: 5px;
+    }
+  </style>
+</head>
+<body>
+  <div class="preview"><div id="previewDiv"></div></div>
+  <table border="0" cellpadding="0" cellspacing="0">
+    <tr>
+      <td class="left">URL:</td>
+      <td class="right">
+        <input type="text" id="url" name="url" value="http://" maxlength="255" style="width:210px;" />
+      </td>
+    </tr>
+  </table>
+</body>
+</html>

+ 24 - 24
demo/public/static/js/editor/plugins/plainpaste.html

@@ -1,24 +1,24 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-  <title>PlainPaste</title>
-  <style type="text/css" rel="stylesheet">
-    body {
-    margin: 0px;
-    font-size:12px;
-    background-color:#F0F0EE;
-    }
-    #textArea {
-    width:320px;
-    height:250px;
-    border:1px solid #000000;
-    overflow: auto;
-    }
-  </style>
-</head>
-<body>
-<div style="margin-bottom:10px;">请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。</div>
-<textarea id="textArea" style="width:320px;height:250px;border:1px solid #000000;"></textarea>
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+  <title>PlainPaste</title>
+  <style type="text/css" rel="stylesheet">
+    body {
+    margin: 0px;
+    font-size:12px;
+    background-color:#F0F0EE;
+    }
+    #textArea {
+    width:320px;
+    height:250px;
+    border:1px solid #000000;
+    overflow: auto;
+    }
+  </style>
+</head>
+<body>
+<div style="margin-bottom:10px;">请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。</div>
+<textarea id="textArea" style="width:320px;height:250px;border:1px solid #000000;"></textarea>
+</body>
+</html>

+ 66 - 66
demo/public/static/js/editor/plugins/remote_image.html

@@ -1,66 +1,66 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-  <head>
-    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-    <title>Remote Image</title>
-    <style type="text/css" rel="stylesheet">
-      body {
-      font-size:12px;
-      margin: 0px;
-      background-color:#F0F0EE;
-      overflow: hidden;
-      }
-      td.left1 {
-      font-size:12px;
-      width: 50px;
-      padding: 2px;
-      }
-      td.right1 {
-      font-size:12px;
-      padding: 2px;
-      }
-      td.left2 {
-      font-size:12px;
-      width: 35px;
-      padding: 2px;
-      }
-      td.right2 {
-      font-size:12px;
-      padding: 2px;
-      width: 50px;
-      }
-    </style>
-  </head>
-  <body>
-    <table border="0" cellpadding="0" cellspacing="0">
-      <tr>
-        <td class="left1">URL:</td>
-        <td class="right1">
-          <input type="text" id="url" name="url" value="http://" maxlength="255" style="width:220px;" />
-        </td>
-      </tr>
-      <tr>
-        <td class="left1">说明:</td>
-        <td class="right1">
-          <input type="text" id="imgTitle" name="imgTitle" value="" maxlength="100" style="width:220px;" />
-        </td>
-      </tr>
-    </table>
-    <table border="0" cellpadding="0" cellspacing="0">
-      <tr>
-        <td class="left2">宽度: </td>
-        <td class="right2">
-          <input type="text" name="imgWidth" id="imgWidth" value="0" maxlength="4" style="width:40px;" />
-        </td>
-        <td class="left2">高度: </td>
-        <td class="right2">
-          <input type="text" name="imgHeight" id="imgHeight" value="0" maxlength="4" style="width:40px;" />
-        </td>
-        <td class="left2">边框: </td>
-        <td class="right2">
-          <input type="text" name="imgBorder" id="imgBorder" value="0" maxlength="1" style="width:40px;" />
-        </td>
-      </tr>
-    </table>
-  </body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <title>Remote Image</title>
+    <style type="text/css" rel="stylesheet">
+      body {
+      font-size:12px;
+      margin: 0px;
+      background-color:#F0F0EE;
+      overflow: hidden;
+      }
+      td.left1 {
+      font-size:12px;
+      width: 50px;
+      padding: 2px;
+      }
+      td.right1 {
+      font-size:12px;
+      padding: 2px;
+      }
+      td.left2 {
+      font-size:12px;
+      width: 35px;
+      padding: 2px;
+      }
+      td.right2 {
+      font-size:12px;
+      padding: 2px;
+      width: 50px;
+      }
+    </style>
+  </head>
+  <body>
+    <table border="0" cellpadding="0" cellspacing="0">
+      <tr>
+        <td class="left1">URL:</td>
+        <td class="right1">
+          <input type="text" id="url" name="url" value="http://" maxlength="255" style="width:220px;" />
+        </td>
+      </tr>
+      <tr>
+        <td class="left1">说明:</td>
+        <td class="right1">
+          <input type="text" id="imgTitle" name="imgTitle" value="" maxlength="100" style="width:220px;" />
+        </td>
+      </tr>
+    </table>
+    <table border="0" cellpadding="0" cellspacing="0">
+      <tr>
+        <td class="left2">宽度: </td>
+        <td class="right2">
+          <input type="text" name="imgWidth" id="imgWidth" value="0" maxlength="4" style="width:40px;" />
+        </td>
+        <td class="left2">高度: </td>
+        <td class="right2">
+          <input type="text" name="imgHeight" id="imgHeight" value="0" maxlength="4" style="width:40px;" />
+        </td>
+        <td class="left2">边框: </td>
+        <td class="right2">
+          <input type="text" name="imgBorder" id="imgBorder" value="0" maxlength="1" style="width:40px;" />
+        </td>
+      </tr>
+    </table>
+  </body>
+</html>

+ 36 - 36
demo/public/static/js/editor/plugins/wordpaste.html

@@ -1,36 +1,36 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-  <title>WordPaste</title>
-  <style type="text/css" rel="stylesheet">
-    body {
-    font-size:12px;
-    margin: 0px;
-    background-color:#F0F0EE;
-    }
-    #wordIframe {
-    width:320px;
-    height:250px;
-    border:1px solid #000000;
-    }
-  </style>
-  <script type="text/javascript">
-    function setIframe() {
-        var iframe = parent.KE.$('wordIframe', document);
-        var iframeDoc = parent.KE.util.getIframeDoc(iframe);
-        iframeDoc.designMode = "On";
-        iframeDoc.open();
-        iframeDoc.write('<html><head><title>WordPaste</title></head>');
-        iframeDoc.write('<body style="background-color:#FFFFFF;font-size:12px;margin:2px;" />');
-        if (parent.KE.browser != 'IE') iframeDoc.write('<br />');
-        iframeDoc.write('</body></html>');
-        iframeDoc.close();
-    }
-  </script>
-</head>
-<body onload="javascript:setIframe();">
-  <div style="margin-bottom:10px;">请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。</div>
-  <iframe id="wordIframe" name="wordIframe" frameBorder="0"></iframe>
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+  <title>WordPaste</title>
+  <style type="text/css" rel="stylesheet">
+    body {
+    font-size:12px;
+    margin: 0px;
+    background-color:#F0F0EE;
+    }
+    #wordIframe {
+    width:320px;
+    height:250px;
+    border:1px solid #000000;
+    }
+  </style>
+  <script type="text/javascript">
+    function setIframe() {
+        var iframe = parent.KE.$('wordIframe', document);
+        var iframeDoc = parent.KE.util.getIframeDoc(iframe);
+        iframeDoc.designMode = "On";
+        iframeDoc.open();
+        iframeDoc.write('<html><head><title>WordPaste</title></head>');
+        iframeDoc.write('<body style="background-color:#FFFFFF;font-size:12px;margin:2px;" />');
+        if (parent.KE.browser != 'IE') iframeDoc.write('<br />');
+        iframeDoc.write('</body></html>');
+        iframeDoc.close();
+    }
+  </script>
+</head>
+<body onload="javascript:setIframe();">
+  <div style="margin-bottom:10px;">请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。</div>
+  <iframe id="wordIframe" name="wordIframe" frameBorder="0"></iframe>
+</body>
+</html>

+ 473 - 473
demo/public/static/js/editor/skins/default.css

@@ -1,473 +1,473 @@
-.ke-text {
-    font-size: 12px;
-    font-family: "sans serif",tahoma,verdana,helvetica;
-}
-.ke-icon-source {
-    background-position: 0px 0px;
-    width: 39px;
-    height: 16px;
-}
-.ke-icon-preview {
-    background-position: 0px -16px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-print {
-    background-position: 0px -32px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-undo {
-    background-position: 0px -48px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-redo {
-    background-position: 0px -64px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-cut {
-    background-position: 0px -80px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-copy {
-    background-position: 0px -96px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-paste {
-    background-position: 0px -112px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-selectall {
-    background-position: 0px -128px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-justifyleft {
-    background-position: 0px -144px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-justifycenter {
-    background-position: 0px -160px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-justifyright {
-    background-position: 0px -176px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-justifyfull {
-    background-position: 0px -192px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-insertorderedlist {
-    background-position: 0px -208px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-insertunorderedlist {
-    background-position: 0px -224px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-indent {
-    background-position: 0px -240px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-outdent {
-    background-position: 0px -256px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-subscript {
-    background-position: 0px -272px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-superscript {
-    background-position: 0px -288px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-date {
-    background-position: 0px -304px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-time {
-    background-position: 0px -320px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-title {
-    background-position: 0px -336px;
-    width: 39px;
-    height: 16px;
-}
-.ke-icon-fontname {
-    background-position: 0px -352px;
-    width: 39px;
-    height: 16px;
-}
-.ke-icon-fontsize {
-    background-position: 0px -368px;
-    width: 39px;
-    height: 16px;
-}
-.ke-icon-textcolor {
-    background-position: 0px -384px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-bgcolor {
-    background-position: 0px -400px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-bold {
-    background-position: 0px -416px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-italic {
-    background-position: 0px -432px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-underline {
-    background-position: 0px -448px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-strikethrough {
-    background-position: 0px -464px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-removeformat {
-    background-position: 0px -480px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-image {
-    background-position: 0px -496px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-flash {
-    background-position: 0px -512px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-media {
-    background-position: 0px -528px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-layer {
-    background-position: 0px -544px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-table {
-    background-position: 0px -560px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-specialchar {
-    background-position: 0px -576px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-hr {
-    background-position: 0px -592px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-emoticons {
-    background-position: 0px -608px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-link {
-    background-position: 0px -624px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-unlink {
-    background-position: 0px -640px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-fullscreen {
-    background-position: 0px -656px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-about {
-    background-position: 0px -672px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-plainpaste {
-    background-position: 0px -704px;
-    width: 16px;
-    height: 16px;
-}
-.ke-icon-wordpaste {
-    background-position: 0px -720px;
-    width: 16px;
-    height: 16px;
-}
-.ke-container {
-    border: 1px solid #CCCCCC;
-    background-color: #F0F0EE;
-    table-layout: fixed;
-    overflow: hidden;
-    border-collapse:separate;
-    padding:0;
-    margin:0;
-}
-.ke-toolbar-outer {
-    border: 0;
-    padding: 0;
-    margin: 0;
-}
-.ke-toolbar {
-    width: 100%;
-    padding:0;
-    margin:0;
-    border-collapse:separate;
-}
-.ke-toolbar td {
-    border:0;
-    padding: 2px 5px;
-    margin:0;
-}
-.ke-toolbar-table {
-    font-size: 0;
-    float: left;
-    clear: both;
-    padding:0;
-    margin:0;
-    border-collapse:separate;
-}
-.ke-toolbar-table td {
-    border:0;
-    padding: 0;
-    margin:0;
-}
-.ke-toolbar-close {
-    display: block;
-    background-position: 0px -688px;
-    width: 16px;
-    height: 16px;
-    position: absolute;
-    margin-top: 2px;
-    margin-right: 3px;
-    right: 0;
-    top: 0;
-    cursor: pointer;
-}
-.ke-bottom-outer {
-    border: 0;
-    padding: 0;
-    margin: 0;
-}
-.ke-bottom {
-    width: 100%;
-    font-size: 0;
-    padding:0;
-    margin:0;
-    border-collapse:separate;
-}
-.ke-bottom-left {
-    width: 100%;
-    cursor: s-resize;
-    border:0;
-    margin:0;
-    padding:0;
-}
-.ke-bottom-right {
-    cursor: se-resize;
-    border:0;
-    margin:0;
-    padding:0;
-}
-.ke-bottom-right-img {
-    display: block;
-    background-position: -4px -740px;
-    width: 12px;
-    height: 12px;
-}
-.ke-textarea-outer {
-    border: 0;
-    padding: 0 5px;
-    margin: 0;
-}
-.ke-textarea-table {
-    width: 100%;
-    padding: 0;
-    margin: 0;
-    border: 1px solid #CCCCCC;
-    background-color: #FFFFFF;
-    border-collapse:separate;
-}
-.ke-textarea-table td {
-    border:0;
-    padding: 0 0 0 5px;
-}
-.ke-textarea {
-    width: 100%;
-    margin: 0;
-    padding: 0;
-    border: 0;
-    background-color: #FFFFFF;
-    color: #000000;
-    font-size: 12px;
-    font-family: "Courier New";
-    line-height: 18px;
-    overflow: auto;
-}
-.ke-iframe {
-    width: 100%;
-    margin: 0;
-    padding: 0;
-    border: 0;
-    background-color: #FFFFFF;
-}
-.ke-common-icon {
-    display: block;
-    background-repeat: no-repeat;
-    overflow: hidden;
-}
-.ke-icon {
-    display: block;
-    border: 1px solid #F0F0EE;
-    padding: 1px 2px;
-    margin: 1px;
-    cursor: pointer;
-}
-.ke-icon-on {
-    display: block;
-    border: 1px solid #1F3D74;
-    padding: 1px 2px;
-    margin: 1px;
-    cursor: pointer;
-}
-.ke-icon-selected {
-    display: block;
-    border: 1px solid #1F3D74;
-    background-color: #DDDDDD;
-    padding: 1px 2px;
-    margin: 1px;
-    cursor: pointer;
-}
-.ke-icon-disabled {
-    display: block;
-    border: 1px solid #F0F0EE;
-    padding: 1px 2px;
-    margin: 1px;
-    cursor: default;
-}
-.ke-menu {
-    border-top: 2px solid #DDDDDD;
-    border-left: 2px solid #DDDDDD;
-    border-right: 2px solid #AAAAAA;
-    border-bottom: 2px solid #AAAAAA;
-    background-color: #F0F0EE;
-    color: #222222;
-    font-size: 12px;
-    text-align: left;
-}
-.ke-menu-noselected {
-    background-color: #F0F0EE;
-    color: #222222;
-    font-size: 12px;
-    padding: 2px;
-    cursor: pointer;
-}
-.ke-menu-selected {
-    background-color: #1F3D74;
-    color: #FFFFFF;
-    font-size: 12px;
-    padding: 2px;
-    cursor: pointer;
-}
-.ke-dialog {
-    position: absolute;
-    border-top: 2px solid #DDDDDD;
-    border-left: 2px solid #DDDDDD;
-    border-right: 2px solid #AAAAAA;
-    border-bottom: 2px solid #AAAAAA;
-    background-color: #F0F0EE;
-    color: #222222;
-    text-align: left;
-}
-.ke-dialog-title {
-    background-color: #E0E0E0;
-    padding: 3px;
-    color: #000000;
-    text-align: left;
-    font-size: 12px;
-    cursor: move;
-}
-.ke-dialog-body {
-    margin: 10px;
-}
-.ke-dialog-iframe {
-    border: 1px solid #AAAAAA;
-}
-.ke-dialog-bottom {
-    font-size: 12px;
-}
-.ke-dialog-preview {
-    margin: 5px;
-    float: right;
-}
-.ke-dialog-yes {
-    margin: 5px;
-    float: right;
-}
-.ke-dialog-no {
-    margin: 5px 10px 5px 5px;
-    float: right;
-}
-.ke-mask {
-    position: absolute;
-    z-index: 19811212;
-    top: 0;
-    left: 0;
-    display: none;
-    background-color: #FFFFFF;
-}
-.ke-button {
-    background-color: #DDDDDD;
-    border-top: 2px solid #DDDDDD;
-    border-left: 2px solid #DDDDDD;
-    border-right: 2px solid #AAAAAA;
-    border-bottom: 2px solid #AAAAAA;
-    cursor: pointer;
-    font-size: 12px;
-}
-.ke-text-input {
-    background-color:#FFFFFF;
-    font-size: 12px;
-}
-.ke-picker-cell {
-    width: 12px;
-    height: 12px;
-    font-size: 1px;
-    border: 1px solid #F0F0EE;
-    cursor: pointer;
-    margin:0;
-    padding:0;
-}
+.ke-text {
+    font-size: 12px;
+    font-family: "sans serif",tahoma,verdana,helvetica;
+}
+.ke-icon-source {
+    background-position: 0px 0px;
+    width: 39px;
+    height: 16px;
+}
+.ke-icon-preview {
+    background-position: 0px -16px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-print {
+    background-position: 0px -32px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-undo {
+    background-position: 0px -48px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-redo {
+    background-position: 0px -64px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-cut {
+    background-position: 0px -80px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-copy {
+    background-position: 0px -96px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-paste {
+    background-position: 0px -112px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-selectall {
+    background-position: 0px -128px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-justifyleft {
+    background-position: 0px -144px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-justifycenter {
+    background-position: 0px -160px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-justifyright {
+    background-position: 0px -176px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-justifyfull {
+    background-position: 0px -192px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-insertorderedlist {
+    background-position: 0px -208px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-insertunorderedlist {
+    background-position: 0px -224px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-indent {
+    background-position: 0px -240px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-outdent {
+    background-position: 0px -256px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-subscript {
+    background-position: 0px -272px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-superscript {
+    background-position: 0px -288px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-date {
+    background-position: 0px -304px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-time {
+    background-position: 0px -320px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-title {
+    background-position: 0px -336px;
+    width: 39px;
+    height: 16px;
+}
+.ke-icon-fontname {
+    background-position: 0px -352px;
+    width: 39px;
+    height: 16px;
+}
+.ke-icon-fontsize {
+    background-position: 0px -368px;
+    width: 39px;
+    height: 16px;
+}
+.ke-icon-textcolor {
+    background-position: 0px -384px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-bgcolor {
+    background-position: 0px -400px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-bold {
+    background-position: 0px -416px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-italic {
+    background-position: 0px -432px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-underline {
+    background-position: 0px -448px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-strikethrough {
+    background-position: 0px -464px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-removeformat {
+    background-position: 0px -480px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-image {
+    background-position: 0px -496px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-flash {
+    background-position: 0px -512px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-media {
+    background-position: 0px -528px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-layer {
+    background-position: 0px -544px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-table {
+    background-position: 0px -560px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-specialchar {
+    background-position: 0px -576px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-hr {
+    background-position: 0px -592px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-emoticons {
+    background-position: 0px -608px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-link {
+    background-position: 0px -624px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-unlink {
+    background-position: 0px -640px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-fullscreen {
+    background-position: 0px -656px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-about {
+    background-position: 0px -672px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-plainpaste {
+    background-position: 0px -704px;
+    width: 16px;
+    height: 16px;
+}
+.ke-icon-wordpaste {
+    background-position: 0px -720px;
+    width: 16px;
+    height: 16px;
+}
+.ke-container {
+    border: 1px solid #CCCCCC;
+    background-color: #F0F0EE;
+    table-layout: fixed;
+    overflow: hidden;
+    border-collapse:separate;
+    padding:0;
+    margin:0;
+}
+.ke-toolbar-outer {
+    border: 0;
+    padding: 0;
+    margin: 0;
+}
+.ke-toolbar {
+    width: 100%;
+    padding:0;
+    margin:0;
+    border-collapse:separate;
+}
+.ke-toolbar td {
+    border:0;
+    padding: 2px 5px;
+    margin:0;
+}
+.ke-toolbar-table {
+    font-size: 0;
+    float: left;
+    clear: both;
+    padding:0;
+    margin:0;
+    border-collapse:separate;
+}
+.ke-toolbar-table td {
+    border:0;
+    padding: 0;
+    margin:0;
+}
+.ke-toolbar-close {
+    display: block;
+    background-position: 0px -688px;
+    width: 16px;
+    height: 16px;
+    position: absolute;
+    margin-top: 2px;
+    margin-right: 3px;
+    right: 0;
+    top: 0;
+    cursor: pointer;
+}
+.ke-bottom-outer {
+    border: 0;
+    padding: 0;
+    margin: 0;
+}
+.ke-bottom {
+    width: 100%;
+    font-size: 0;
+    padding:0;
+    margin:0;
+    border-collapse:separate;
+}
+.ke-bottom-left {
+    width: 100%;
+    cursor: s-resize;
+    border:0;
+    margin:0;
+    padding:0;
+}
+.ke-bottom-right {
+    cursor: se-resize;
+    border:0;
+    margin:0;
+    padding:0;
+}
+.ke-bottom-right-img {
+    display: block;
+    background-position: -4px -740px;
+    width: 12px;
+    height: 12px;
+}
+.ke-textarea-outer {
+    border: 0;
+    padding: 0 5px;
+    margin: 0;
+}
+.ke-textarea-table {
+    width: 100%;
+    padding: 0;
+    margin: 0;
+    border: 1px solid #CCCCCC;
+    background-color: #FFFFFF;
+    border-collapse:separate;
+}
+.ke-textarea-table td {
+    border:0;
+    padding: 0 0 0 5px;
+}
+.ke-textarea {
+    width: 100%;
+    margin: 0;
+    padding: 0;
+    border: 0;
+    background-color: #FFFFFF;
+    color: #000000;
+    font-size: 12px;
+    font-family: "Courier New";
+    line-height: 18px;
+    overflow: auto;
+}
+.ke-iframe {
+    width: 100%;
+    margin: 0;
+    padding: 0;
+    border: 0;
+    background-color: #FFFFFF;
+}
+.ke-common-icon {
+    display: block;
+    background-repeat: no-repeat;
+    overflow: hidden;
+}
+.ke-icon {
+    display: block;
+    border: 1px solid #F0F0EE;
+    padding: 1px 2px;
+    margin: 1px;
+    cursor: pointer;
+}
+.ke-icon-on {
+    display: block;
+    border: 1px solid #1F3D74;
+    padding: 1px 2px;
+    margin: 1px;
+    cursor: pointer;
+}
+.ke-icon-selected {
+    display: block;
+    border: 1px solid #1F3D74;
+    background-color: #DDDDDD;
+    padding: 1px 2px;
+    margin: 1px;
+    cursor: pointer;
+}
+.ke-icon-disabled {
+    display: block;
+    border: 1px solid #F0F0EE;
+    padding: 1px 2px;
+    margin: 1px;
+    cursor: default;
+}
+.ke-menu {
+    border-top: 2px solid #DDDDDD;
+    border-left: 2px solid #DDDDDD;
+    border-right: 2px solid #AAAAAA;
+    border-bottom: 2px solid #AAAAAA;
+    background-color: #F0F0EE;
+    color: #222222;
+    font-size: 12px;
+    text-align: left;
+}
+.ke-menu-noselected {
+    background-color: #F0F0EE;
+    color: #222222;
+    font-size: 12px;
+    padding: 2px;
+    cursor: pointer;
+}
+.ke-menu-selected {
+    background-color: #1F3D74;
+    color: #FFFFFF;
+    font-size: 12px;
+    padding: 2px;
+    cursor: pointer;
+}
+.ke-dialog {
+    position: absolute;
+    border-top: 2px solid #DDDDDD;
+    border-left: 2px solid #DDDDDD;
+    border-right: 2px solid #AAAAAA;
+    border-bottom: 2px solid #AAAAAA;
+    background-color: #F0F0EE;
+    color: #222222;
+    text-align: left;
+}
+.ke-dialog-title {
+    background-color: #E0E0E0;
+    padding: 3px;
+    color: #000000;
+    text-align: left;
+    font-size: 12px;
+    cursor: move;
+}
+.ke-dialog-body {
+    margin: 10px;
+}
+.ke-dialog-iframe {
+    border: 1px solid #AAAAAA;
+}
+.ke-dialog-bottom {
+    font-size: 12px;
+}
+.ke-dialog-preview {
+    margin: 5px;
+    float: right;
+}
+.ke-dialog-yes {
+    margin: 5px;
+    float: right;
+}
+.ke-dialog-no {
+    margin: 5px 10px 5px 5px;
+    float: right;
+}
+.ke-mask {
+    position: absolute;
+    z-index: 19811212;
+    top: 0;
+    left: 0;
+    display: none;
+    background-color: #FFFFFF;
+}
+.ke-button {
+    background-color: #DDDDDD;
+    border-top: 2px solid #DDDDDD;
+    border-left: 2px solid #DDDDDD;
+    border-right: 2px solid #AAAAAA;
+    border-bottom: 2px solid #AAAAAA;
+    cursor: pointer;
+    font-size: 12px;
+}
+.ke-text-input {
+    background-color:#FFFFFF;
+    font-size: 12px;
+}
+.ke-picker-cell {
+    width: 12px;
+    height: 12px;
+    font-size: 1px;
+    border: 1px solid #F0F0EE;
+    cursor: pointer;
+    margin:0;
+    padding:0;
+}

+ 28 - 28
demo/public/static/js/editor/skins/editor.css

@@ -1,28 +1,28 @@
-p {
-    background-image:url(./p.gif);
-    background-position:right top;
-    background-repeat:no-repeat;
-}
-div {
-    background-image:url(./div.gif);
-    background-position:right top;
-    background-repeat:no-repeat;
-}
-ul {
-    background-image:url(./ul.gif);
-    background-position:right top;
-    background-repeat:no-repeat;
-}
-ol {
-    background-image:url(./ol.gif);
-    background-position:right top;
-    background-repeat:no-repeat;
-}
-dl {
-    background-image:url(./dl.gif);
-    background-position:right top;
-    background-repeat:no-repeat;
-}
-p,div,ul,ol,dl {
-    border:1px dotted #CCCCCC;
-}
+p {
+    background-image:url(./p.gif);
+    background-position:right top;
+    background-repeat:no-repeat;
+}
+div {
+    background-image:url(./div.gif);
+    background-position:right top;
+    background-repeat:no-repeat;
+}
+ul {
+    background-image:url(./ul.gif);
+    background-position:right top;
+    background-repeat:no-repeat;
+}
+ol {
+    background-image:url(./ol.gif);
+    background-position:right top;
+    background-repeat:no-repeat;
+}
+dl {
+    background-image:url(./dl.gif);
+    background-position:right top;
+    background-repeat:no-repeat;
+}
+p,div,ul,ol,dl {
+    border:1px dotted #CCCCCC;
+}

+ 475 - 475
demo/public/static/js/editor/skins/tinymce.css

@@ -1,475 +1,475 @@
-.ke-text {
-    font-size: 12px;
-    font-family: "sans serif",tahoma,verdana,helvetica;
-}
-.ke-icon-source {
-    background-position: -260px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-preview {
-    background-position: -420px -20px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-print {
-    background-position: -440px -20px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-undo {
-    background-position: -160px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-redo {
-    background-position: -100px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-cut {
-    background-position: -680px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-copy {
-    background-position: -700px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-paste {
-    background-position: -560px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-selectall {
-    background-position: -400px -20px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-justifyleft {
-    background-position: -460px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-justifycenter {
-    background-position: -420px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-justifyright {
-    background-position: -480px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-justifyfull {
-    background-position: -440px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-insertorderedlist {
-    background-position: -80px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-insertunorderedlist {
-    background-position: -20px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-indent {
-    background-position: -400px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-outdent {
-    background-position: -540px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-subscript {
-    background-position: -600px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-superscript {
-    background-position: -620px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-date {
-    background-position: -140px -20px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-time {
-    background-position: -160px -20px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-title {
-    background-position: -20px -40px;
-    width: 86px;
-    height: 20px;
-}
-.ke-icon-fontname {
-    background-position: -120px -40px;
-    width: 86px;
-    height: 20px;
-}
-.ke-icon-fontsize {
-    background-position: -220px -40px;
-    width: 86px;
-    height: 20px;
-}
-.ke-icon-textcolor {
-    background-position: -720px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-bgcolor {
-    background-position: -760px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-bold {
-    background-position: 0px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-italic {
-    background-position: -60px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-underline {
-    background-position: -140px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-strikethrough {
-    background-position: -120px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-removeformat {
-    background-position: -580px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-image {
-    background-position: -380px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-flash {
-    background-position: -880px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-media {
-    background-position: -320px -20px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-layer {
-    background-position: -240px -20px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-table {
-    background-position: -580px -20px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-specialchar {
-    background-position: -240px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-hr {
-    background-position: -360px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-emoticons {
-    background-position: -60px -20px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-link {
-    background-position: -500px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-unlink {
-    background-position: -640px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-fullscreen {
-    background-position: -100px -20px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-about {
-    background-position: -340px 0px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-plainpaste {
-    background-position: -360px -20px;
-    width: 20px;
-    height: 20px;
-}
-.ke-icon-wordpaste {
-    background-position: -380px -20px;
-    width: 20px;
-    height: 20px;
-}
-.ke-container {
-    border: 1px solid #CCCCCC;
-    background-color: #F0F0EE;
-    table-layout: fixed;
-    overflow: hidden;
-    border-collapse:separate;
-    padding:0;
-    margin:0;
-}
-.ke-toolbar-outer {
-    border: 0;
-    padding:0;
-    margin: 0;
-}
-.ke-toolbar {
-    width: 100%;
-    padding:0;
-    margin:0;
-    border-collapse:separate;
-}
-.ke-toolbar td {
-    border:0;
-    padding: 2px 5px;
-    margin:0;
-}
-.ke-toolbar-table {
-    font-size: 0;
-    float: left;
-    clear: both;
-    padding:0;
-    margin:0;
-    border-collapse:separate;
-}
-.ke-toolbar-table td {
-    border:0;
-    padding: 0;
-    margin:0;
-}
-.ke-toolbar-close {
-    display: block;
-    background-position: -902px -2px;
-    width: 16px;
-    height: 16px;
-    position: absolute;
-    margin-top: 2px;
-    margin-right: 3px;
-    right: 0;
-    top: 0;
-    cursor: pointer;
-}
-.ke-bottom-outer {
-    border: 0;
-    padding: 0;
-    margin: 0;
-}
-.ke-bottom {
-    width: 100%;
-    font-size: 0;
-    padding:0;
-    margin:0;
-    border-collapse:separate;
-}
-.ke-bottom-left {
-    width: 100%;
-    cursor: s-resize;
-    border:0;
-    margin:0;
-    padding:0;
-}
-.ke-bottom-right {
-    cursor: se-resize;
-    border:0;
-    margin:0;
-    padding:0;
-}
-.ke-bottom-right-img {
-    display: block;
-    background-position: -810px -10px;
-    width: 10px;
-    height: 10px;
-}
-.ke-textarea-outer {
-    border:0;
-    padding: 0;
-    margin: 0;
-}
-.ke-textarea-table {
-    width: 100%;
-    padding: 0;
-    margin: 0;
-    border-top: 1px solid #CCCCCC;
-    border-bottom: 1px solid #CCCCCC;
-    background-color: #FFFFFF;
-    border-collapse:separate;
-}
-.ke-textarea-table td {
-    border:0;
-    padding: 0 0 0 5px;
-}
-.ke-textarea {
-    width: 100%;
-    margin: 0;
-    padding: 0;
-    border: 0;
-    background-color: #FFFFFF;
-    color: #000000;
-    font-size: 12px;
-    font-family: "Courier New";
-    line-height: 18px;
-    overflow: auto;
-}
-.ke-iframe {
-    width: 100%;
-    margin: 0;
-    padding: 0;
-    border: 0;
-    background-color: #FFFFFF;
-}
-.ke-common-icon {
-    display: block;
-    background-repeat: no-repeat;
-    overflow: hidden;
-}
-.ke-icon {
-    display: block;
-    border: 1px solid #F0F0EE;
-    padding: 0px;
-    margin: 1px;
-    cursor: pointer;
-}
-.ke-icon-on {
-    display: block;
-    border: 1px solid #1F3D74;
-    background-color: #B2BBD0;
-    padding: 0px;
-    margin: 1px;
-    cursor: pointer;
-}
-.ke-icon-selected {
-    display: block;
-    border: 1px solid #1F3D74;
-    background-color: #B2BBD0;
-    padding: 0;
-    margin: 1px;
-    cursor: pointer;
-}
-.ke-icon-disabled {
-    display: block;
-    border: 1px solid #F0F0EE;
-    padding: 0;
-    margin: 1px;
-    cursor: default;
-}
-.ke-menu {
-    border-top: 2px solid #DDDDDD;
-    border-left: 2px solid #DDDDDD;
-    border-right: 2px solid #AAAAAA;
-    border-bottom: 2px solid #AAAAAA;
-    background-color: #F0F0EE;
-    color: #222222;
-    font-size: 12px;
-    text-align: left;
-}
-.ke-menu-noselected {
-    background-color: #F0F0EE;
-    color: #222222;
-    font-size: 12px;
-    padding: 2px;
-    cursor: pointer;
-}
-.ke-menu-selected {
-    background-color: #1F3D74;
-    color: #FFFFFF;
-    font-size: 12px;
-    padding: 2px;
-    cursor: pointer;
-}
-.ke-dialog {
-    position: absolute;
-    border-top: 2px solid #DDDDDD;
-    border-left: 2px solid #DDDDDD;
-    border-right: 2px solid #AAAAAA;
-    border-bottom: 2px solid #AAAAAA;
-    background-color: #F0F0EE;
-    color: #222222;
-    text-align: left;
-}
-.ke-dialog-title {
-    background-color: #E0E0E0;
-    padding: 3px;
-    color: #000000;
-    text-align: left;
-    font-size: 12px;
-    cursor: move;
-}
-.ke-dialog-body {
-    margin: 10px;
-}
-.ke-dialog-iframe {
-    border: 1px solid #AAAAAA;
-}
-.ke-dialog-bottom {
-    font-size: 12px;
-}
-.ke-dialog-preview {
-    margin: 5px;
-    float: right;
-}
-.ke-dialog-yes {
-    margin: 5px;
-    float: right;
-}
-.ke-dialog-no {
-    margin: 5px 10px 5px 5px;
-    float: right;
-}
-.ke-mask {
-    position: absolute;
-    z-index: 19811212;
-    top: 0;
-    left: 0;
-    display: none;
-    background-color: #FFFFFF;
-}
-.ke-button {
-    background-color: #DDDDDD;
-    border-top: 2px solid #DDDDDD;
-    border-left: 2px solid #DDDDDD;
-    border-right: 2px solid #AAAAAA;
-    border-bottom: 2px solid #AAAAAA;
-    cursor: pointer;
-    font-size: 12px;
-}
-.ke-text-input {
-    background-color:#FFFFFF;
-    font-size: 12px;
-}
-.ke-picker-cell {
-    width: 12px;
-    height: 12px;
-    font-size: 1px;
-    border: 1px solid #F0F0EE;
-    cursor: pointer;
-    margin:0;
-    padding:0;
-}
+.ke-text {
+    font-size: 12px;
+    font-family: "sans serif",tahoma,verdana,helvetica;
+}
+.ke-icon-source {
+    background-position: -260px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-preview {
+    background-position: -420px -20px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-print {
+    background-position: -440px -20px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-undo {
+    background-position: -160px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-redo {
+    background-position: -100px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-cut {
+    background-position: -680px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-copy {
+    background-position: -700px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-paste {
+    background-position: -560px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-selectall {
+    background-position: -400px -20px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-justifyleft {
+    background-position: -460px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-justifycenter {
+    background-position: -420px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-justifyright {
+    background-position: -480px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-justifyfull {
+    background-position: -440px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-insertorderedlist {
+    background-position: -80px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-insertunorderedlist {
+    background-position: -20px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-indent {
+    background-position: -400px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-outdent {
+    background-position: -540px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-subscript {
+    background-position: -600px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-superscript {
+    background-position: -620px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-date {
+    background-position: -140px -20px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-time {
+    background-position: -160px -20px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-title {
+    background-position: -20px -40px;
+    width: 86px;
+    height: 20px;
+}
+.ke-icon-fontname {
+    background-position: -120px -40px;
+    width: 86px;
+    height: 20px;
+}
+.ke-icon-fontsize {
+    background-position: -220px -40px;
+    width: 86px;
+    height: 20px;
+}
+.ke-icon-textcolor {
+    background-position: -720px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-bgcolor {
+    background-position: -760px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-bold {
+    background-position: 0px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-italic {
+    background-position: -60px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-underline {
+    background-position: -140px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-strikethrough {
+    background-position: -120px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-removeformat {
+    background-position: -580px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-image {
+    background-position: -380px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-flash {
+    background-position: -880px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-media {
+    background-position: -320px -20px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-layer {
+    background-position: -240px -20px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-table {
+    background-position: -580px -20px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-specialchar {
+    background-position: -240px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-hr {
+    background-position: -360px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-emoticons {
+    background-position: -60px -20px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-link {
+    background-position: -500px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-unlink {
+    background-position: -640px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-fullscreen {
+    background-position: -100px -20px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-about {
+    background-position: -340px 0px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-plainpaste {
+    background-position: -360px -20px;
+    width: 20px;
+    height: 20px;
+}
+.ke-icon-wordpaste {
+    background-position: -380px -20px;
+    width: 20px;
+    height: 20px;
+}
+.ke-container {
+    border: 1px solid #CCCCCC;
+    background-color: #F0F0EE;
+    table-layout: fixed;
+    overflow: hidden;
+    border-collapse:separate;
+    padding:0;
+    margin:0;
+}
+.ke-toolbar-outer {
+    border: 0;
+    padding:0;
+    margin: 0;
+}
+.ke-toolbar {
+    width: 100%;
+    padding:0;
+    margin:0;
+    border-collapse:separate;
+}
+.ke-toolbar td {
+    border:0;
+    padding: 2px 5px;
+    margin:0;
+}
+.ke-toolbar-table {
+    font-size: 0;
+    float: left;
+    clear: both;
+    padding:0;
+    margin:0;
+    border-collapse:separate;
+}
+.ke-toolbar-table td {
+    border:0;
+    padding: 0;
+    margin:0;
+}
+.ke-toolbar-close {
+    display: block;
+    background-position: -902px -2px;
+    width: 16px;
+    height: 16px;
+    position: absolute;
+    margin-top: 2px;
+    margin-right: 3px;
+    right: 0;
+    top: 0;
+    cursor: pointer;
+}
+.ke-bottom-outer {
+    border: 0;
+    padding: 0;
+    margin: 0;
+}
+.ke-bottom {
+    width: 100%;
+    font-size: 0;
+    padding:0;
+    margin:0;
+    border-collapse:separate;
+}
+.ke-bottom-left {
+    width: 100%;
+    cursor: s-resize;
+    border:0;
+    margin:0;
+    padding:0;
+}
+.ke-bottom-right {
+    cursor: se-resize;
+    border:0;
+    margin:0;
+    padding:0;
+}
+.ke-bottom-right-img {
+    display: block;
+    background-position: -810px -10px;
+    width: 10px;
+    height: 10px;
+}
+.ke-textarea-outer {
+    border:0;
+    padding: 0;
+    margin: 0;
+}
+.ke-textarea-table {
+    width: 100%;
+    padding: 0;
+    margin: 0;
+    border-top: 1px solid #CCCCCC;
+    border-bottom: 1px solid #CCCCCC;
+    background-color: #FFFFFF;
+    border-collapse:separate;
+}
+.ke-textarea-table td {
+    border:0;
+    padding: 0 0 0 5px;
+}
+.ke-textarea {
+    width: 100%;
+    margin: 0;
+    padding: 0;
+    border: 0;
+    background-color: #FFFFFF;
+    color: #000000;
+    font-size: 12px;
+    font-family: "Courier New";
+    line-height: 18px;
+    overflow: auto;
+}
+.ke-iframe {
+    width: 100%;
+    margin: 0;
+    padding: 0;
+    border: 0;
+    background-color: #FFFFFF;
+}
+.ke-common-icon {
+    display: block;
+    background-repeat: no-repeat;
+    overflow: hidden;
+}
+.ke-icon {
+    display: block;
+    border: 1px solid #F0F0EE;
+    padding: 0px;
+    margin: 1px;
+    cursor: pointer;
+}
+.ke-icon-on {
+    display: block;
+    border: 1px solid #1F3D74;
+    background-color: #B2BBD0;
+    padding: 0px;
+    margin: 1px;
+    cursor: pointer;
+}
+.ke-icon-selected {
+    display: block;
+    border: 1px solid #1F3D74;
+    background-color: #B2BBD0;
+    padding: 0;
+    margin: 1px;
+    cursor: pointer;
+}
+.ke-icon-disabled {
+    display: block;
+    border: 1px solid #F0F0EE;
+    padding: 0;
+    margin: 1px;
+    cursor: default;
+}
+.ke-menu {
+    border-top: 2px solid #DDDDDD;
+    border-left: 2px solid #DDDDDD;
+    border-right: 2px solid #AAAAAA;
+    border-bottom: 2px solid #AAAAAA;
+    background-color: #F0F0EE;
+    color: #222222;
+    font-size: 12px;
+    text-align: left;
+}
+.ke-menu-noselected {
+    background-color: #F0F0EE;
+    color: #222222;
+    font-size: 12px;
+    padding: 2px;
+    cursor: pointer;
+}
+.ke-menu-selected {
+    background-color: #1F3D74;
+    color: #FFFFFF;
+    font-size: 12px;
+    padding: 2px;
+    cursor: pointer;
+}
+.ke-dialog {
+    position: absolute;
+    border-top: 2px solid #DDDDDD;
+    border-left: 2px solid #DDDDDD;
+    border-right: 2px solid #AAAAAA;
+    border-bottom: 2px solid #AAAAAA;
+    background-color: #F0F0EE;
+    color: #222222;
+    text-align: left;
+}
+.ke-dialog-title {
+    background-color: #E0E0E0;
+    padding: 3px;
+    color: #000000;
+    text-align: left;
+    font-size: 12px;
+    cursor: move;
+}
+.ke-dialog-body {
+    margin: 10px;
+}
+.ke-dialog-iframe {
+    border: 1px solid #AAAAAA;
+}
+.ke-dialog-bottom {
+    font-size: 12px;
+}
+.ke-dialog-preview {
+    margin: 5px;
+    float: right;
+}
+.ke-dialog-yes {
+    margin: 5px;
+    float: right;
+}
+.ke-dialog-no {
+    margin: 5px 10px 5px 5px;
+    float: right;
+}
+.ke-mask {
+    position: absolute;
+    z-index: 19811212;
+    top: 0;
+    left: 0;
+    display: none;
+    background-color: #FFFFFF;
+}
+.ke-button {
+    background-color: #DDDDDD;
+    border-top: 2px solid #DDDDDD;
+    border-left: 2px solid #DDDDDD;
+    border-right: 2px solid #AAAAAA;
+    border-bottom: 2px solid #AAAAAA;
+    cursor: pointer;
+    font-size: 12px;
+}
+.ke-text-input {
+    background-color:#FFFFFF;
+    font-size: 12px;
+}
+.ke-picker-cell {
+    width: 12px;
+    height: 12px;
+    font-size: 1px;
+    border: 1px solid #F0F0EE;
+    cursor: pointer;
+    margin:0;
+    padding:0;
+}

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 209
demo/public/static/js/format+zh_CN,default,corechart.I.js


+ 2 - 2
demo/public/static/js/google-code-prettify/lang-apollo.js

@@ -1,2 +1,2 @@
-PR.registerLangHandler(PR.createSimpleLexer([["com",/^#[^\n\r]*/,null,"#"],["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,null,'"']],[["kwd",/^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/,
-null],["typ",/^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[ES]?BANK=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[!-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["apollo","agc","aea"]);
+PR.registerLangHandler(PR.createSimpleLexer([["com",/^#[^\n\r]*/,null,"#"],["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,null,'"']],[["kwd",/^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/,
+null],["typ",/^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[ES]?BANK=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[!-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["apollo","agc","aea"]);

+ 3 - 3
demo/public/static/js/google-code-prettify/lang-basic.js

@@ -1,3 +1,3 @@
-var a=null;
-PR.registerLangHandler(PR.createSimpleLexer([["str",/^"(?:[^\n\r"\\]|\\.)*(?:"|$)/,a,'"'],["pln",/^\s+/,a," \r\n\t\u00a0"]],[["com",/^REM[^\n\r]*/,a],["kwd",/^\b(?:AND|CLOSE|CLR|CMD|CONT|DATA|DEF ?FN|DIM|END|FOR|GET|GOSUB|GOTO|IF|INPUT|LET|LIST|LOAD|NEW|NEXT|NOT|ON|OPEN|OR|POKE|PRINT|READ|RESTORE|RETURN|RUN|SAVE|STEP|STOP|SYS|THEN|TO|VERIFY|WAIT)\b/,a],["pln",/^[a-z][^\W_]?(?:\$|%)?/i,a],["lit",/^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?/i,a,"0123456789"],["pun",
-/^.[^\s\w"$%.]*/,a]]),["basic","cbm"]);
+var a=null;
+PR.registerLangHandler(PR.createSimpleLexer([["str",/^"(?:[^\n\r"\\]|\\.)*(?:"|$)/,a,'"'],["pln",/^\s+/,a," \r\n\t\u00a0"]],[["com",/^REM[^\n\r]*/,a],["kwd",/^\b(?:AND|CLOSE|CLR|CMD|CONT|DATA|DEF ?FN|DIM|END|FOR|GET|GOSUB|GOTO|IF|INPUT|LET|LIST|LOAD|NEW|NEXT|NOT|ON|OPEN|OR|POKE|PRINT|READ|RESTORE|RETURN|RUN|SAVE|STEP|STOP|SYS|THEN|TO|VERIFY|WAIT)\b/,a],["pln",/^[a-z][^\W_]?(?:\$|%)?/i,a],["lit",/^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?/i,a,"0123456789"],["pun",
+/^.[^\s\w"$%.]*/,a]]),["basic","cbm"]);

+ 18 - 18
demo/public/static/js/google-code-prettify/lang-clj.js

@@ -1,18 +1,18 @@
-/*
- Copyright (C) 2011 Google Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-var a=null;
-PR.registerLangHandler(PR.createSimpleLexer([["opn",/^[([{]+/,a,"([{"],["clo",/^[)\]}]+/,a,")]}"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:def|if|do|let|quote|var|fn|loop|recur|throw|try|monitor-enter|monitor-exit|defmacro|defn|defn-|macroexpand|macroexpand-1|for|doseq|dosync|dotimes|and|or|when|not|assert|doto|proxy|defstruct|first|rest|cons|defprotocol|deftype|defrecord|reify|defmulti|defmethod|meta|with-meta|ns|in-ns|create-ns|import|intern|refer|alias|namespace|resolve|ref|deref|refset|new|set!|memfn|to-array|into-array|aset|gen-class|reduce|map|filter|find|nil?|empty?|hash-map|hash-set|vec|vector|seq|flatten|reverse|assoc|dissoc|list|list?|disj|get|union|difference|intersection|extend|extend-type|extend-protocol|prn)\b/,a],
-["typ",/^:[\dA-Za-z-]+/]]),["clj"]);
+/*
+ Copyright (C) 2011 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+var a=null;
+PR.registerLangHandler(PR.createSimpleLexer([["opn",/^[([{]+/,a,"([{"],["clo",/^[)\]}]+/,a,")]}"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:def|if|do|let|quote|var|fn|loop|recur|throw|try|monitor-enter|monitor-exit|defmacro|defn|defn-|macroexpand|macroexpand-1|for|doseq|dosync|dotimes|and|or|when|not|assert|doto|proxy|defstruct|first|rest|cons|defprotocol|deftype|defrecord|reify|defmulti|defmethod|meta|with-meta|ns|in-ns|create-ns|import|intern|refer|alias|namespace|resolve|ref|deref|refset|new|set!|memfn|to-array|into-array|aset|gen-class|reduce|map|filter|find|nil?|empty?|hash-map|hash-set|vec|vector|seq|flatten|reverse|assoc|dissoc|list|list?|disj|get|union|difference|intersection|extend|extend-type|extend-protocol|prn)\b/,a],
+["typ",/^:[\dA-Za-z-]+/]]),["clj"]);

+ 2 - 2
demo/public/static/js/google-code-prettify/lang-css.js

@@ -1,2 +1,2 @@
-PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n\u000c"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]+)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],
-["com",/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}\b/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);
+PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n\u000c"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]+)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],
+["com",/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}\b/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);

+ 3 - 3
demo/public/static/js/google-code-prettify/lang-dart.js

@@ -1,3 +1,3 @@
-PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"]],[["com",/^#!.*/],["kwd",/^\b(?:import|library|part of|part|as|show|hide)\b/i],["com",/^\/\/.*/],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["kwd",/^\b(?:class|interface)\b/i],["kwd",/^\b(?:assert|break|case|catch|continue|default|do|else|finally|for|if|in|is|new|return|super|switch|this|throw|try|while)\b/i],["kwd",/^\b(?:abstract|const|extends|factory|final|get|implements|native|operator|set|static|typedef|var)\b/i],
-["typ",/^\b(?:bool|double|dynamic|int|num|object|string|void)\b/i],["kwd",/^\b(?:false|null|true)\b/i],["str",/^r?'''[\S\s]*?[^\\]'''/],["str",/^r?"""[\S\s]*?[^\\]"""/],["str",/^r?'('|[^\n\f\r]*?[^\\]')/],["str",/^r?"("|[^\n\f\r]*?[^\\]")/],["pln",/^[$_a-z]\w*/i],["pun",/^[!%&*+/:<-?^|~-]/],["lit",/^\b0x[\da-f]+/i],["lit",/^\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i],["lit",/^\b\.\d+(?:e[+-]?\d+)?/i],["pun",/^[(),.;[\]{}]/]]),
-["dart"]);
+PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"]],[["com",/^#!.*/],["kwd",/^\b(?:import|library|part of|part|as|show|hide)\b/i],["com",/^\/\/.*/],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["kwd",/^\b(?:class|interface)\b/i],["kwd",/^\b(?:assert|break|case|catch|continue|default|do|else|finally|for|if|in|is|new|return|super|switch|this|throw|try|while)\b/i],["kwd",/^\b(?:abstract|const|extends|factory|final|get|implements|native|operator|set|static|typedef|var)\b/i],
+["typ",/^\b(?:bool|double|dynamic|int|num|object|string|void)\b/i],["kwd",/^\b(?:false|null|true)\b/i],["str",/^r?'''[\S\s]*?[^\\]'''/],["str",/^r?"""[\S\s]*?[^\\]"""/],["str",/^r?'('|[^\n\f\r]*?[^\\]')/],["str",/^r?"("|[^\n\f\r]*?[^\\]")/],["pln",/^[$_a-z]\w*/i],["pun",/^[!%&*+/:<-?^|~-]/],["lit",/^\b0x[\da-f]+/i],["lit",/^\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i],["lit",/^\b\.\d+(?:e[+-]?\d+)?/i],["pun",/^[(),.;[\]{}]/]]),
+["dart"]);

+ 2 - 2
demo/public/static/js/google-code-prettify/lang-erlang.js

@@ -1,2 +1,2 @@
-PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n\u000b\u000c\r "],["str",/^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["lit",/^[a-z]\w*/],["lit",/^'(?:[^\n\f\r'\\]|\\[^&])+'?/,null,"'"],["lit",/^\?[^\t\n ({]+/,null,"?"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,null,"0123456789"]],[["com",/^%[^\n]*/],["kwd",/^(?:module|attributes|do|let|in|letrec|apply|call|primop|case|of|end|when|fun|try|catch|receive|after|char|integer|float,atom,string,var)\b/],
-["kwd",/^-[_a-z]+/],["typ",/^[A-Z_]\w*/],["pun",/^[,.;]/]]),["erlang","erl"]);
+PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n\u000b\u000c\r "],["str",/^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["lit",/^[a-z]\w*/],["lit",/^'(?:[^\n\f\r'\\]|\\[^&])+'?/,null,"'"],["lit",/^\?[^\t\n ({]+/,null,"?"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,null,"0123456789"]],[["com",/^%[^\n]*/],["kwd",/^(?:module|attributes|do|let|in|letrec|apply|call|primop|case|of|end|when|fun|try|catch|receive|after|char|integer|float,atom,string,var)\b/],
+["kwd",/^-[_a-z]+/],["typ",/^[A-Z_]\w*/],["pun",/^[,.;]/]]),["erlang","erl"]);

+ 1 - 1
demo/public/static/js/google-code-prettify/lang-go.js

@@ -1 +1 @@
-PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["pln",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])+(?:'|$)|`[^`]*(?:`|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\n\r]*|\/\*[\S\s]*?\*\/)/],["pln",/^(?:[^"'/`]|\/(?![*/]))+/]]),["go"]);
+PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["pln",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])+(?:'|$)|`[^`]*(?:`|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\n\r]*|\/\*[\S\s]*?\*\/)/],["pln",/^(?:[^"'/`]|\/(?![*/]))+/]]),["go"]);

+ 2 - 2
demo/public/static/js/google-code-prettify/lang-hs.js

@@ -1,2 +1,2 @@
-PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n\u000b\u000c\r "],["str",/^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["str",/^'(?:[^\n\f\r'\\]|\\[^&])'?/,null,"'"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,null,"0123456789"]],[["com",/^(?:--+[^\n\f\r]*|{-(?:[^-]|-+[^}-])*-})/],["kwd",/^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^\d'A-Za-z]|$)/,
-null],["pln",/^(?:[A-Z][\w']*\.)*[A-Za-z][\w']*/],["pun",/^[^\d\t-\r "'A-Za-z]+/]]),["hs"]);
+PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n\u000b\u000c\r "],["str",/^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["str",/^'(?:[^\n\f\r'\\]|\\[^&])'?/,null,"'"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,null,"0123456789"]],[["com",/^(?:--+[^\n\f\r]*|{-(?:[^-]|-+[^}-])*-})/],["kwd",/^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^\d'A-Za-z]|$)/,
+null],["pln",/^(?:[A-Z][\w']*\.)*[A-Za-z][\w']*/],["pun",/^[^\d\t-\r "'A-Za-z]+/]]),["hs"]);

+ 3 - 3
demo/public/static/js/google-code-prettify/lang-lisp.js

@@ -1,3 +1,3 @@
-var a=null;
-PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,a,"("],["clo",/^\)+/,a,")"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,a],
-["lit",/^[+-]?(?:[#0]x[\da-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[de][+-]?\d+)?)/i],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[_a-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/i],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["cl","el","lisp","lsp","scm","ss","rkt"]);
+var a=null;
+PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,a,"("],["clo",/^\)+/,a,")"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,a],
+["lit",/^[+-]?(?:[#0]x[\da-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[de][+-]?\d+)?)/i],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[_a-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/i],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["cl","el","lisp","lsp","scm","ss","rkt"]);

+ 1 - 1
demo/public/static/js/google-code-prettify/lang-llvm.js

@@ -1 +1 @@
-PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^!?"(?:[^"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["com",/^;[^\n\r]*/,null,";"]],[["pln",/^[!%@](?:[$\-.A-Z_a-z][\w$\-.]*|\d+)/],["kwd",/^[^\W\d]\w*/,null],["lit",/^\d+\.\d+/],["lit",/^(?:\d+|0[Xx][\dA-Fa-f]+)/],["pun",/^[(-*,:<->[\]{}]|\.\.\.$/]]),["llvm","ll"]);
+PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^!?"(?:[^"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["com",/^;[^\n\r]*/,null,";"]],[["pln",/^[!%@](?:[$\-.A-Z_a-z][\w$\-.]*|\d+)/],["kwd",/^[^\W\d]\w*/,null],["lit",/^\d+\.\d+/],["lit",/^(?:\d+|0[Xx][\dA-Fa-f]+)/],["pun",/^[(-*,:<->[\]{}]|\.\.\.$/]]),["llvm","ll"]);

+ 2 - 2
demo/public/static/js/google-code-prettify/lang-lua.js

@@ -1,2 +1,2 @@
-PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$))/,null,"\"'"]],[["com",/^--(?:\[(=*)\[[\S\s]*?(?:]\1]|$)|[^\n\r]*)/],["str",/^\[(=*)\[[\S\s]*?(?:]\1]|$)/],["kwd",/^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,null],["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],
-["pln",/^[_a-z]\w*/i],["pun",/^[^\w\t\n\r \xa0][^\w\t\n\r "'+=\xa0-]*/]]),["lua"]);
+PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$))/,null,"\"'"]],[["com",/^--(?:\[(=*)\[[\S\s]*?(?:]\1]|$)|[^\n\r]*)/],["str",/^\[(=*)\[[\S\s]*?(?:]\1]|$)/],["kwd",/^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,null],["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],
+["pln",/^[_a-z]\w*/i],["pun",/^[^\w\t\n\r \xa0][^\w\t\n\r "'+=\xa0-]*/]]),["lua"]);

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 2
demo/public/static/js/google-code-prettify/lang-matlab.js


+ 2 - 2
demo/public/static/js/google-code-prettify/lang-ml.js

@@ -1,2 +1,2 @@
-PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["com",/^#(?:if[\t\n\r \xa0]+(?:[$_a-z][\w']*|``[^\t\n\r`]*(?:``|$))|else|endif|light)/i,null,"#"],["str",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])(?:'|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\n\r]*|\(\*[\S\s]*?\*\))/],["kwd",/^(?:abstract|and|as|assert|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|if|in|inherit|inline|interface|internal|lazy|let|match|member|module|mutable|namespace|new|null|of|open|or|override|private|public|rec|return|static|struct|then|to|true|try|type|upcast|use|val|void|when|while|with|yield|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|global|include|method|mixin|object|parallel|process|protected|pure|sealed|trait|virtual|volatile)\b/],
-["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],["pln",/^(?:[_a-z][\w']*[!#?]?|``[^\t\n\r`]*(?:``|$))/i],["pun",/^[^\w\t\n\r "'\xa0]+/]]),["fs","ml"]);
+PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["com",/^#(?:if[\t\n\r \xa0]+(?:[$_a-z][\w']*|``[^\t\n\r`]*(?:``|$))|else|endif|light)/i,null,"#"],["str",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])(?:'|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\n\r]*|\(\*[\S\s]*?\*\))/],["kwd",/^(?:abstract|and|as|assert|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|if|in|inherit|inline|interface|internal|lazy|let|match|member|module|mutable|namespace|new|null|of|open|or|override|private|public|rec|return|static|struct|then|to|true|try|type|upcast|use|val|void|when|while|with|yield|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|global|include|method|mixin|object|parallel|process|protected|pure|sealed|trait|virtual|volatile)\b/],
+["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],["pln",/^(?:[_a-z][\w']*[!#?]?|``[^\t\n\r`]*(?:``|$))/i],["pun",/^[^\w\t\n\r "'\xa0]+/]]),["fs","ml"]);

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott