summaryrefslogtreecommitdiffstats
path: root/common/src/main/webapp/thirdparty/zTree/js
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/main/webapp/thirdparty/zTree/js')
-rw-r--r--common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.all.js3506
-rw-r--r--common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.all.min.js160
-rw-r--r--common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.core.js1684
-rw-r--r--common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.core.min.js69
-rw-r--r--common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.excheck.js629
-rw-r--r--common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.excheck.min.js34
-rw-r--r--common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exedit.js1191
-rw-r--r--common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exedit.min.js53
-rw-r--r--common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exhide.js363
-rw-r--r--common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exhide.min.js22
10 files changed, 7711 insertions, 0 deletions
diff --git a/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.all.js b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.all.js
new file mode 100644
index 0000000..28bca45
--- /dev/null
+++ b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.all.js
@@ -0,0 +1,3506 @@
+
+/*
+ * JQuery zTree core v3.5.16
+ * http://zTree.me/
+ *
+ * Copyright (c) 2010 Hunter.z
+ *
+ * Licensed same as jquery - MIT License
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * email: hunter.z@263.net
+ * Date: 2014-03-09
+ */
+(function($){
+ var settings = {}, roots = {}, caches = {},
+ //default consts of core
+ _consts = {
+ className: {
+ BUTTON: "button",
+ LEVEL: "level",
+ ICO_LOADING: "ico_loading",
+ SWITCH: "switch"
+ },
+ event: {
+ NODECREATED: "ztree_nodeCreated",
+ CLICK: "ztree_click",
+ EXPAND: "ztree_expand",
+ COLLAPSE: "ztree_collapse",
+ ASYNC_SUCCESS: "ztree_async_success",
+ ASYNC_ERROR: "ztree_async_error",
+ REMOVE: "ztree_remove"
+ },
+ id: {
+ A: "_a",
+ ICON: "_ico",
+ SPAN: "_span",
+ SWITCH: "_switch",
+ UL: "_ul"
+ },
+ line: {
+ ROOT: "root",
+ ROOTS: "roots",
+ CENTER: "center",
+ BOTTOM: "bottom",
+ NOLINE: "noline",
+ LINE: "line"
+ },
+ folder: {
+ OPEN: "open",
+ CLOSE: "close",
+ DOCU: "docu"
+ },
+ node: {
+ CURSELECTED: "curSelectedNode"
+ }
+ },
+ //default setting of core
+ _setting = {
+ treeId: "",
+ treeObj: null,
+ view: {
+ addDiyDom: null,
+ autoCancelSelected: true,
+ dblClickExpand: true,
+ expandSpeed: "fast",
+ fontCss: {},
+ nameIsHTML: false,
+ selectedMulti: true,
+ showIcon: true,
+ showLine: true,
+ showTitle: true,
+ txtSelectedEnable: false
+ },
+ data: {
+ key: {
+ children: "children",
+ name: "name",
+ title: "",
+ url: "url"
+ },
+ simpleData: {
+ enable: false,
+ idKey: "id",
+ pIdKey: "pId",
+ rootPId: null
+ },
+ keep: {
+ parent: false,
+ leaf: false
+ }
+ },
+ async: {
+ enable: false,
+ contentType: "application/x-www-form-urlencoded",
+ type: "post",
+ dataType: "text",
+ url: "",
+ autoParam: [],
+ otherParam: [],
+ dataFilter: null
+ },
+ callback: {
+ beforeAsync:null,
+ beforeClick:null,
+ beforeDblClick:null,
+ beforeRightClick:null,
+ beforeMouseDown:null,
+ beforeMouseUp:null,
+ beforeExpand:null,
+ beforeCollapse:null,
+ beforeRemove:null,
+
+ onAsyncError:null,
+ onAsyncSuccess:null,
+ onNodeCreated:null,
+ onClick:null,
+ onDblClick:null,
+ onRightClick:null,
+ onMouseDown:null,
+ onMouseUp:null,
+ onExpand:null,
+ onCollapse:null,
+ onRemove:null
+ }
+ },
+ //default root of core
+ //zTree use root to save full data
+ _initRoot = function (setting) {
+ var r = data.getRoot(setting);
+ if (!r) {
+ r = {};
+ data.setRoot(setting, r);
+ }
+ r[setting.data.key.children] = [];
+ r.expandTriggerFlag = false;
+ r.curSelectedList = [];
+ r.noSelection = true;
+ r.createdNodes = [];
+ r.zId = 0;
+ r._ver = (new Date()).getTime();
+ },
+ //default cache of core
+ _initCache = function(setting) {
+ var c = data.getCache(setting);
+ if (!c) {
+ c = {};
+ data.setCache(setting, c);
+ }
+ c.nodes = [];
+ c.doms = [];
+ },
+ //default bindEvent of core
+ _bindEvent = function(setting) {
+ var o = setting.treeObj,
+ c = consts.event;
+ o.bind(c.NODECREATED, function (event, treeId, node) {
+ tools.apply(setting.callback.onNodeCreated, [event, treeId, node]);
+ });
+
+ o.bind(c.CLICK, function (event, srcEvent, treeId, node, clickFlag) {
+ tools.apply(setting.callback.onClick, [srcEvent, treeId, node, clickFlag]);
+ });
+
+ o.bind(c.EXPAND, function (event, treeId, node) {
+ tools.apply(setting.callback.onExpand, [event, treeId, node]);
+ });
+
+ o.bind(c.COLLAPSE, function (event, treeId, node) {
+ tools.apply(setting.callback.onCollapse, [event, treeId, node]);
+ });
+
+ o.bind(c.ASYNC_SUCCESS, function (event, treeId, node, msg) {
+ tools.apply(setting.callback.onAsyncSuccess, [event, treeId, node, msg]);
+ });
+
+ o.bind(c.ASYNC_ERROR, function (event, treeId, node, XMLHttpRequest, textStatus, errorThrown) {
+ tools.apply(setting.callback.onAsyncError, [event, treeId, node, XMLHttpRequest, textStatus, errorThrown]);
+ });
+
+ o.bind(c.REMOVE, function (event, treeId, treeNode) {
+ tools.apply(setting.callback.onRemove, [event, treeId, treeNode]);
+ });
+ },
+ _unbindEvent = function(setting) {
+ var o = setting.treeObj,
+ c = consts.event;
+ o.unbind(c.NODECREATED)
+ .unbind(c.CLICK)
+ .unbind(c.EXPAND)
+ .unbind(c.COLLAPSE)
+ .unbind(c.ASYNC_SUCCESS)
+ .unbind(c.ASYNC_ERROR)
+ .unbind(c.REMOVE);
+ },
+ //default event proxy of core
+ _eventProxy = function(event) {
+ var target = event.target,
+ setting = data.getSetting(event.data.treeId),
+ tId = "", node = null,
+ nodeEventType = "", treeEventType = "",
+ nodeEventCallback = null, treeEventCallback = null,
+ tmp = null;
+
+ if (tools.eqs(event.type, "mousedown")) {
+ treeEventType = "mousedown";
+ } else if (tools.eqs(event.type, "mouseup")) {
+ treeEventType = "mouseup";
+ } else if (tools.eqs(event.type, "contextmenu")) {
+ treeEventType = "contextmenu";
+ } else if (tools.eqs(event.type, "click")) {
+ if (tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.SWITCH) !== null) {
+ tId = tools.getNodeMainDom(target).id;
+ nodeEventType = "switchNode";
+ } else {
+ tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
+ if (tmp) {
+ tId = tools.getNodeMainDom(tmp).id;
+ nodeEventType = "clickNode";
+ }
+ }
+ } else if (tools.eqs(event.type, "dblclick")) {
+ treeEventType = "dblclick";
+ tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
+ if (tmp) {
+ tId = tools.getNodeMainDom(tmp).id;
+ nodeEventType = "switchNode";
+ }
+ }
+ if (treeEventType.length > 0 && tId.length == 0) {
+ tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
+ if (tmp) {tId = tools.getNodeMainDom(tmp).id;}
+ }
+ // event to node
+ if (tId.length>0) {
+ node = data.getNodeCache(setting, tId);
+ switch (nodeEventType) {
+ case "switchNode" :
+ if (!node.isParent) {
+ nodeEventType = "";
+ } else if (tools.eqs(event.type, "click")
+ || (tools.eqs(event.type, "dblclick") && tools.apply(setting.view.dblClickExpand, [setting.treeId, node], setting.view.dblClickExpand))) {
+ nodeEventCallback = handler.onSwitchNode;
+ } else {
+ nodeEventType = "";
+ }
+ break;
+ case "clickNode" :
+ nodeEventCallback = handler.onClickNode;
+ break;
+ }
+ }
+ // event to zTree
+ switch (treeEventType) {
+ case "mousedown" :
+ treeEventCallback = handler.onZTreeMousedown;
+ break;
+ case "mouseup" :
+ treeEventCallback = handler.onZTreeMouseup;
+ break;
+ case "dblclick" :
+ treeEventCallback = handler.onZTreeDblclick;
+ break;
+ case "contextmenu" :
+ treeEventCallback = handler.onZTreeContextmenu;
+ break;
+ }
+ var proxyResult = {
+ stop: false,
+ node: node,
+ nodeEventType: nodeEventType,
+ nodeEventCallback: nodeEventCallback,
+ treeEventType: treeEventType,
+ treeEventCallback: treeEventCallback
+ };
+ return proxyResult
+ },
+ //default init node of core
+ _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {
+ if (!n) return;
+ var r = data.getRoot(setting),
+ childKey = setting.data.key.children;
+ n.level = level;
+ n.tId = setting.treeId + "_" + (++r.zId);
+ n.parentTId = parentNode ? parentNode.tId : null;
+ n.open = (typeof n.open == "string") ? tools.eqs(n.open, "true") : !!n.open;
+ if (n[childKey] && n[childKey].length > 0) {
+ n.isParent = true;
+ n.zAsync = true;
+ } else {
+ n.isParent = (typeof n.isParent == "string") ? tools.eqs(n.isParent, "true") : !!n.isParent;
+ n.open = (n.isParent && !setting.async.enable) ? n.open : false;
+ n.zAsync = !n.isParent;
+ }
+ n.isFirstNode = isFirstNode;
+ n.isLastNode = isLastNode;
+ n.getParentNode = function() {return data.getNodeCache(setting, n.parentTId);};
+ n.getPreNode = function() {return data.getPreNode(setting, n);};
+ n.getNextNode = function() {return data.getNextNode(setting, n);};
+ n.isAjaxing = false;
+ data.fixPIdKeyValue(setting, n);
+ },
+ _init = {
+ bind: [_bindEvent],
+ unbind: [_unbindEvent],
+ caches: [_initCache],
+ nodes: [_initNode],
+ proxys: [_eventProxy],
+ roots: [_initRoot],
+ beforeA: [],
+ afterA: [],
+ innerBeforeA: [],
+ innerAfterA: [],
+ zTreeTools: []
+ },
+ //method of operate data
+ data = {
+ addNodeCache: function(setting, node) {
+ data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = node;
+ },
+ getNodeCacheId: function(tId) {
+ return tId.substring(tId.lastIndexOf("_")+1);
+ },
+ addAfterA: function(afterA) {
+ _init.afterA.push(afterA);
+ },
+ addBeforeA: function(beforeA) {
+ _init.beforeA.push(beforeA);
+ },
+ addInnerAfterA: function(innerAfterA) {
+ _init.innerAfterA.push(innerAfterA);
+ },
+ addInnerBeforeA: function(innerBeforeA) {
+ _init.innerBeforeA.push(innerBeforeA);
+ },
+ addInitBind: function(bindEvent) {
+ _init.bind.push(bindEvent);
+ },
+ addInitUnBind: function(unbindEvent) {
+ _init.unbind.push(unbindEvent);
+ },
+ addInitCache: function(initCache) {
+ _init.caches.push(initCache);
+ },
+ addInitNode: function(initNode) {
+ _init.nodes.push(initNode);
+ },
+ addInitProxy: function(initProxy, isFirst) {
+ if (!!isFirst) {
+ _init.proxys.splice(0,0,initProxy);
+ } else {
+ _init.proxys.push(initProxy);
+ }
+ },
+ addInitRoot: function(initRoot) {
+ _init.roots.push(initRoot);
+ },
+ addNodesData: function(setting, parentNode, nodes) {
+ var childKey = setting.data.key.children;
+ if (!parentNode[childKey]) parentNode[childKey] = [];
+ if (parentNode[childKey].length > 0) {
+ parentNode[childKey][parentNode[childKey].length - 1].isLastNode = false;
+ view.setNodeLineIcos(setting, parentNode[childKey][parentNode[childKey].length - 1]);
+ }
+ parentNode.isParent = true;
+ parentNode[childKey] = parentNode[childKey].concat(nodes);
+ },
+ addSelectedNode: function(setting, node) {
+ var root = data.getRoot(setting);
+ if (!data.isSelectedNode(setting, node)) {
+ root.curSelectedList.push(node);
+ }
+ },
+ addCreatedNode: function(setting, node) {
+ if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) {
+ var root = data.getRoot(setting);
+ root.createdNodes.push(node);
+ }
+ },
+ addZTreeTools: function(zTreeTools) {
+ _init.zTreeTools.push(zTreeTools);
+ },
+ exSetting: function(s) {
+ $.extend(true, _setting, s);
+ },
+ fixPIdKeyValue: function(setting, node) {
+ if (setting.data.simpleData.enable) {
+ node[setting.data.simpleData.pIdKey] = node.parentTId ? node.getParentNode()[setting.data.simpleData.idKey] : setting.data.simpleData.rootPId;
+ }
+ },
+ getAfterA: function(setting, node, array) {
+ for (var i=0, j=_init.afterA.length; i<j; i++) {
+ _init.afterA[i].apply(this, arguments);
+ }
+ },
+ getBeforeA: function(setting, node, array) {
+ for (var i=0, j=_init.beforeA.length; i<j; i++) {
+ _init.beforeA[i].apply(this, arguments);
+ }
+ },
+ getInnerAfterA: function(setting, node, array) {
+ for (var i=0, j=_init.innerAfterA.length; i<j; i++) {
+ _init.innerAfterA[i].apply(this, arguments);
+ }
+ },
+ getInnerBeforeA: function(setting, node, array) {
+ for (var i=0, j=_init.innerBeforeA.length; i<j; i++) {
+ _init.innerBeforeA[i].apply(this, arguments);
+ }
+ },
+ getCache: function(setting) {
+ return caches[setting.treeId];
+ },
+ getNextNode: function(setting, node) {
+ if (!node) return null;
+ var childKey = setting.data.key.children,
+ p = node.parentTId ? node.getParentNode() : data.getRoot(setting);
+ for (var i=0, l=p[childKey].length-1; i<=l; i++) {
+ if (p[childKey][i] === node) {
+ return (i==l ? null : p[childKey][i+1]);
+ }
+ }
+ return null;
+ },
+ getNodeByParam: function(setting, nodes, key, value) {
+ if (!nodes || !key) return null;
+ var childKey = setting.data.key.children;
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ if (nodes[i][key] == value) {
+ return nodes[i];
+ }
+ var tmp = data.getNodeByParam(setting, nodes[i][childKey], key, value);
+ if (tmp) return tmp;
+ }
+ return null;
+ },
+ getNodeCache: function(setting, tId) {
+ if (!tId) return null;
+ var n = caches[setting.treeId].nodes[data.getNodeCacheId(tId)];
+ return n ? n : null;
+ },
+ getNodeName: function(setting, node) {
+ var nameKey = setting.data.key.name;
+ return "" + node[nameKey];
+ },
+ getNodeTitle: function(setting, node) {
+ var t = setting.data.key.title === "" ? setting.data.key.name : setting.data.key.title;
+ return "" + node[t];
+ },
+ getNodes: function(setting) {
+ return data.getRoot(setting)[setting.data.key.children];
+ },
+ getNodesByParam: function(setting, nodes, key, value) {
+ if (!nodes || !key) return [];
+ var childKey = setting.data.key.children,
+ result = [];
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ if (nodes[i][key] == value) {
+ result.push(nodes[i]);
+ }
+ result = result.concat(data.getNodesByParam(setting, nodes[i][childKey], key, value));
+ }
+ return result;
+ },
+ getNodesByParamFuzzy: function(setting, nodes, key, value) {
+ if (!nodes || !key) return [];
+ var childKey = setting.data.key.children,
+ result = [];
+ value = value.toLowerCase();
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ if (typeof nodes[i][key] == "string" && nodes[i][key].toLowerCase().indexOf(value)>-1) {
+ result.push(nodes[i]);
+ }
+ result = result.concat(data.getNodesByParamFuzzy(setting, nodes[i][childKey], key, value));
+ }
+ return result;
+ },
+ getNodesByFilter: function(setting, nodes, filter, isSingle, invokeParam) {
+ if (!nodes) return (isSingle ? null : []);
+ var childKey = setting.data.key.children,
+ result = isSingle ? null : [];
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ if (tools.apply(filter, [nodes[i], invokeParam], false)) {
+ if (isSingle) {return nodes[i];}
+ result.push(nodes[i]);
+ }
+ var tmpResult = data.getNodesByFilter(setting, nodes[i][childKey], filter, isSingle, invokeParam);
+ if (isSingle && !!tmpResult) {return tmpResult;}
+ result = isSingle ? tmpResult : result.concat(tmpResult);
+ }
+ return result;
+ },
+ getPreNode: function(setting, node) {
+ if (!node) return null;
+ var childKey = setting.data.key.children,
+ p = node.parentTId ? node.getParentNode() : data.getRoot(setting);
+ for (var i=0, l=p[childKey].length; i<l; i++) {
+ if (p[childKey][i] === node) {
+ return (i==0 ? null : p[childKey][i-1]);
+ }
+ }
+ return null;
+ },
+ getRoot: function(setting) {
+ return setting ? roots[setting.treeId] : null;
+ },
+ getRoots: function() {
+ return roots;
+ },
+ getSetting: function(treeId) {
+ return settings[treeId];
+ },
+ getSettings: function() {
+ return settings;
+ },
+ getZTreeTools: function(treeId) {
+ var r = this.getRoot(this.getSetting(treeId));
+ return r ? r.treeTools : null;
+ },
+ initCache: function(setting) {
+ for (var i=0, j=_init.caches.length; i<j; i++) {
+ _init.caches[i].apply(this, arguments);
+ }
+ },
+ initNode: function(setting, level, node, parentNode, preNode, nextNode) {
+ for (var i=0, j=_init.nodes.length; i<j; i++) {
+ _init.nodes[i].apply(this, arguments);
+ }
+ },
+ initRoot: function(setting) {
+ for (var i=0, j=_init.roots.length; i<j; i++) {
+ _init.roots[i].apply(this, arguments);
+ }
+ },
+ isSelectedNode: function(setting, node) {
+ var root = data.getRoot(setting);
+ for (var i=0, j=root.curSelectedList.length; i<j; i++) {
+ if(node === root.curSelectedList[i]) return true;
+ }
+ return false;
+ },
+ removeNodeCache: function(setting, node) {
+ var childKey = setting.data.key.children;
+ if (node[childKey]) {
+ for (var i=0, l=node[childKey].length; i<l; i++) {
+ arguments.callee(setting, node[childKey][i]);
+ }
+ }
+ data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = null;
+ },
+ removeSelectedNode: function(setting, node) {
+ var root = data.getRoot(setting);
+ for (var i=0, j=root.curSelectedList.length; i<j; i++) {
+ if(node === root.curSelectedList[i] || !data.getNodeCache(setting, root.curSelectedList[i].tId)) {
+ root.curSelectedList.splice(i, 1);
+ i--;j--;
+ }
+ }
+ },
+ setCache: function(setting, cache) {
+ caches[setting.treeId] = cache;
+ },
+ setRoot: function(setting, root) {
+ roots[setting.treeId] = root;
+ },
+ setZTreeTools: function(setting, zTreeTools) {
+ for (var i=0, j=_init.zTreeTools.length; i<j; i++) {
+ _init.zTreeTools[i].apply(this, arguments);
+ }
+ },
+ transformToArrayFormat: function (setting, nodes) {
+ if (!nodes) return [];
+ var childKey = setting.data.key.children,
+ r = [];
+ if (tools.isArray(nodes)) {
+ for (var i=0, l=nodes.length; i<l; i++) {
+ r.push(nodes[i]);
+ if (nodes[i][childKey])
+ r = r.concat(data.transformToArrayFormat(setting, nodes[i][childKey]));
+ }
+ } else {
+ r.push(nodes);
+ if (nodes[childKey])
+ r = r.concat(data.transformToArrayFormat(setting, nodes[childKey]));
+ }
+ return r;
+ },
+ transformTozTreeFormat: function(setting, sNodes) {
+ var i,l,
+ key = setting.data.simpleData.idKey,
+ parentKey = setting.data.simpleData.pIdKey,
+ childKey = setting.data.key.children;
+ if (!key || key=="" || !sNodes) return [];
+
+ if (tools.isArray(sNodes)) {
+ var r = [];
+ var tmpMap = [];
+ for (i=0, l=sNodes.length; i<l; i++) {
+ tmpMap[sNodes[i][key]] = sNodes[i];
+ }
+ for (i=0, l=sNodes.length; i<l; i++) {
+ if (tmpMap[sNodes[i][parentKey]] && sNodes[i][key] != sNodes[i][parentKey]) {
+ if (!tmpMap[sNodes[i][parentKey]][childKey])
+ tmpMap[sNodes[i][parentKey]][childKey] = [];
+ tmpMap[sNodes[i][parentKey]][childKey].push(sNodes[i]);
+ } else {
+ r.push(sNodes[i]);
+ }
+ }
+ return r;
+ }else {
+ return [sNodes];
+ }
+ }
+ },
+ //method of event proxy
+ event = {
+ bindEvent: function(setting) {
+ for (var i=0, j=_init.bind.length; i<j; i++) {
+ _init.bind[i].apply(this, arguments);
+ }
+ },
+ unbindEvent: function(setting) {
+ for (var i=0, j=_init.unbind.length; i<j; i++) {
+ _init.unbind[i].apply(this, arguments);
+ }
+ },
+ bindTree: function(setting) {
+ var eventParam = {
+ treeId: setting.treeId
+ },
+ o = setting.treeObj;
+ if (!setting.view.txtSelectedEnable) {
+ // for can't select text
+ o.bind('selectstart', function(e){
+ var node
+ var n = e.originalEvent.srcElement.nodeName.toLowerCase();
+ return (n === "input" || n === "textarea" );
+ }).css({
+ "-moz-user-select":"-moz-none"
+ });
+ }
+ o.bind('click', eventParam, event.proxy);
+ o.bind('dblclick', eventParam, event.proxy);
+ o.bind('mouseover', eventParam, event.proxy);
+ o.bind('mouseout', eventParam, event.proxy);
+ o.bind('mousedown', eventParam, event.proxy);
+ o.bind('mouseup', eventParam, event.proxy);
+ o.bind('contextmenu', eventParam, event.proxy);
+ },
+ unbindTree: function(setting) {
+ var o = setting.treeObj;
+ o.unbind('click', event.proxy)
+ .unbind('dblclick', event.proxy)
+ .unbind('mouseover', event.proxy)
+ .unbind('mouseout', event.proxy)
+ .unbind('mousedown', event.proxy)
+ .unbind('mouseup', event.proxy)
+ .unbind('contextmenu', event.proxy);
+ },
+ doProxy: function(e) {
+ var results = [];
+ for (var i=0, j=_init.proxys.length; i<j; i++) {
+ var proxyResult = _init.proxys[i].apply(this, arguments);
+ results.push(proxyResult);
+ if (proxyResult.stop) {
+ break;
+ }
+ }
+ return results;
+ },
+ proxy: function(e) {
+ var setting = data.getSetting(e.data.treeId);
+ if (!tools.uCanDo(setting, e)) return true;
+ var results = event.doProxy(e),
+ r = true, x = false;
+ for (var i=0, l=results.length; i<l; i++) {
+ var proxyResult = results[i];
+ if (proxyResult.nodeEventCallback) {
+ x = true;
+ r = proxyResult.nodeEventCallback.apply(proxyResult, [e, proxyResult.node]) && r;
+ }
+ if (proxyResult.treeEventCallback) {
+ x = true;
+ r = proxyResult.treeEventCallback.apply(proxyResult, [e, proxyResult.node]) && r;
+ }
+ }
+ return r;
+ }
+ },
+ //method of event handler
+ handler = {
+ onSwitchNode: function (event, node) {
+ var setting = data.getSetting(event.data.treeId);
+ if (node.open) {
+ if (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false) return true;
+ data.getRoot(setting).expandTriggerFlag = true;
+ view.switchNode(setting, node);
+ } else {
+ if (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false) return true;
+ data.getRoot(setting).expandTriggerFlag = true;
+ view.switchNode(setting, node);
+ }
+ return true;
+ },
+ onClickNode: function (event, node) {
+ var setting = data.getSetting(event.data.treeId),
+ clickFlag = ( (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey)) && data.isSelectedNode(setting, node)) ? 0 : (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey) && setting.view.selectedMulti) ? 2 : 1;
+ if (tools.apply(setting.callback.beforeClick, [setting.treeId, node, clickFlag], true) == false) return true;
+ if (clickFlag === 0) {
+ view.cancelPreSelectedNode(setting, node);
+ } else {
+ view.selectNode(setting, node, clickFlag === 2);
+ }
+ setting.treeObj.trigger(consts.event.CLICK, [event, setting.treeId, node, clickFlag]);
+ return true;
+ },
+ onZTreeMousedown: function(event, node) {
+ var setting = data.getSetting(event.data.treeId);
+ if (tools.apply(setting.callback.beforeMouseDown, [setting.treeId, node], true)) {
+ tools.apply(setting.callback.onMouseDown, [event, setting.treeId, node]);
+ }
+ return true;
+ },
+ onZTreeMouseup: function(event, node) {
+ var setting = data.getSetting(event.data.treeId);
+ if (tools.apply(setting.callback.beforeMouseUp, [setting.treeId, node], true)) {
+ tools.apply(setting.callback.onMouseUp, [event, setting.treeId, node]);
+ }
+ return true;
+ },
+ onZTreeDblclick: function(event, node) {
+ var setting = data.getSetting(event.data.treeId);
+ if (tools.apply(setting.callback.beforeDblClick, [setting.treeId, node], true)) {
+ tools.apply(setting.callback.onDblClick, [event, setting.treeId, node]);
+ }
+ return true;
+ },
+ onZTreeContextmenu: function(event, node) {
+ var setting = data.getSetting(event.data.treeId);
+ if (tools.apply(setting.callback.beforeRightClick, [setting.treeId, node], true)) {
+ tools.apply(setting.callback.onRightClick, [event, setting.treeId, node]);
+ }
+ return (typeof setting.callback.onRightClick) != "function";
+ }
+ },
+ //method of tools for zTree
+ tools = {
+ apply: function(fun, param, defaultValue) {
+ if ((typeof fun) == "function") {
+ return fun.apply(zt, param?param:[]);
+ }
+ return defaultValue;
+ },
+ canAsync: function(setting, node) {
+ var childKey = setting.data.key.children;
+ return (setting.async.enable && node && node.isParent && !(node.zAsync || (node[childKey] && node[childKey].length > 0)));
+ },
+ clone: function (obj){
+ if (obj === null) return null;
+ var o = tools.isArray(obj) ? [] : {};
+ for(var i in obj){
+ o[i] = (obj[i] instanceof Date) ? new Date(obj[i].getTime()) : (typeof obj[i] === "object" ? arguments.callee(obj[i]) : obj[i]);
+ }
+ return o;
+ },
+ eqs: function(str1, str2) {
+ return str1.toLowerCase() === str2.toLowerCase();
+ },
+ isArray: function(arr) {
+ return Object.prototype.toString.apply(arr) === "[object Array]";
+ },
+ $: function(node, exp, setting) {
+ if (!!exp && typeof exp != "string") {
+ setting = exp;
+ exp = "";
+ }
+ if (typeof node == "string") {
+ return $(node, setting ? setting.treeObj.get(0).ownerDocument : null);
+ } else {
+ return $("#" + node.tId + exp, setting ? setting.treeObj : null);
+ }
+ },
+ getMDom: function (setting, curDom, targetExpr) {
+ if (!curDom) return null;
+ while (curDom && curDom.id !== setting.treeId) {
+ for (var i=0, l=targetExpr.length; curDom.tagName && i<l; i++) {
+ if (tools.eqs(curDom.tagName, targetExpr[i].tagName) && curDom.getAttribute(targetExpr[i].attrName) !== null) {
+ return curDom;
+ }
+ }
+ curDom = curDom.parentNode;
+ }
+ return null;
+ },
+ getNodeMainDom:function(target) {
+ return ($(target).parent("li").get(0) || $(target).parentsUntil("li").parent().get(0));
+ },
+ isChildOrSelf: function(dom, parentId) {
+ return ( $(dom).closest("#" + parentId).length> 0 );
+ },
+ uCanDo: function(setting, e) {
+ return true;
+ }
+ },
+ //method of operate ztree dom
+ view = {
+ addNodes: function(setting, parentNode, newNodes, isSilent) {
+ if (setting.data.keep.leaf && parentNode && !parentNode.isParent) {
+ return;
+ }
+ if (!tools.isArray(newNodes)) {
+ newNodes = [newNodes];
+ }
+ if (setting.data.simpleData.enable) {
+ newNodes = data.transformTozTreeFormat(setting, newNodes);
+ }
+ if (parentNode) {
+ var target_switchObj = $$(parentNode, consts.id.SWITCH, setting),
+ target_icoObj = $$(parentNode, consts.id.ICON, setting),
+ target_ulObj = $$(parentNode, consts.id.UL, setting);
+
+ if (!parentNode.open) {
+ view.replaceSwitchClass(parentNode, target_switchObj, consts.folder.CLOSE);
+ view.replaceIcoClass(parentNode, target_icoObj, consts.folder.CLOSE);
+ parentNode.open = false;
+ target_ulObj.css({
+ "display": "none"
+ });
+ }
+
+ data.addNodesData(setting, parentNode, newNodes);
+ view.createNodes(setting, parentNode.level + 1, newNodes, parentNode);
+ if (!isSilent) {
+ view.expandCollapseParentNode(setting, parentNode, true);
+ }
+ } else {
+ data.addNodesData(setting, data.getRoot(setting), newNodes);
+ view.createNodes(setting, 0, newNodes, null);
+ }
+ },
+ appendNodes: function(setting, level, nodes, parentNode, initFlag, openFlag) {
+ if (!nodes) return [];
+ var html = [],
+ childKey = setting.data.key.children;
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ var node = nodes[i];
+ if (initFlag) {
+ var tmpPNode = (parentNode) ? parentNode: data.getRoot(setting),
+ tmpPChild = tmpPNode[childKey],
+ isFirstNode = ((tmpPChild.length == nodes.length) && (i == 0)),
+ isLastNode = (i == (nodes.length - 1));
+ data.initNode(setting, level, node, parentNode, isFirstNode, isLastNode, openFlag);
+ data.addNodeCache(setting, node);
+ }
+
+ var childHtml = [];
+ if (node[childKey] && node[childKey].length > 0) {
+ //make child html first, because checkType
+ childHtml = view.appendNodes(setting, level + 1, node[childKey], node, initFlag, openFlag && node.open);
+ }
+ if (openFlag) {
+
+ view.makeDOMNodeMainBefore(html, setting, node);
+ view.makeDOMNodeLine(html, setting, node);
+ data.getBeforeA(setting, node, html);
+ view.makeDOMNodeNameBefore(html, setting, node);
+ data.getInnerBeforeA(setting, node, html);
+ view.makeDOMNodeIcon(html, setting, node);
+ data.getInnerAfterA(setting, node, html);
+ view.makeDOMNodeNameAfter(html, setting, node);
+ data.getAfterA(setting, node, html);
+ if (node.isParent && node.open) {
+ view.makeUlHtml(setting, node, html, childHtml.join(''));
+ }
+ view.makeDOMNodeMainAfter(html, setting, node);
+ data.addCreatedNode(setting, node);
+ }
+ }
+ return html;
+ },
+ appendParentULDom: function(setting, node) {
+ var html = [],
+ nObj = $$(node, setting);
+ if (!nObj.get(0) && !!node.parentTId) {
+ view.appendParentULDom(setting, node.getParentNode());
+ nObj = $$(node, setting);
+ }
+ var ulObj = $$(node, consts.id.UL, setting);
+ if (ulObj.get(0)) {
+ ulObj.remove();
+ }
+ var childKey = setting.data.key.children,
+ childHtml = view.appendNodes(setting, node.level+1, node[childKey], node, false, true);
+ view.makeUlHtml(setting, node, html, childHtml.join(''));
+ nObj.append(html.join(''));
+ },
+ asyncNode: function(setting, node, isSilent, callback) {
+ var i, l;
+ if (node && !node.isParent) {
+ tools.apply(callback);
+ return false;
+ } else if (node && node.isAjaxing) {
+ return false;
+ } else if (tools.apply(setting.callback.beforeAsync, [setting.treeId, node], true) == false) {
+ tools.apply(callback);
+ return false;
+ }
+ if (node) {
+ node.isAjaxing = true;
+ var icoObj = $$(node, consts.id.ICON, setting);
+ icoObj.attr({"style":"", "class":consts.className.BUTTON + " " + consts.className.ICO_LOADING});
+ }
+
+ var tmpParam = {};
+ for (i = 0, l = setting.async.autoParam.length; node && i < l; i++) {
+ var pKey = setting.async.autoParam[i].split("="), spKey = pKey;
+ if (pKey.length>1) {
+ spKey = pKey[1];
+ pKey = pKey[0];
+ }
+ tmpParam[spKey] = node[pKey];
+ }
+ if (tools.isArray(setting.async.otherParam)) {
+ for (i = 0, l = setting.async.otherParam.length; i < l; i += 2) {
+ tmpParam[setting.async.otherParam[i]] = setting.async.otherParam[i + 1];
+ }
+ } else {
+ for (var p in setting.async.otherParam) {
+ tmpParam[p] = setting.async.otherParam[p];
+ }
+ }
+
+ var _tmpV = data.getRoot(setting)._ver;
+ $.ajax({
+ contentType: setting.async.contentType,
+ type: setting.async.type,
+ url: tools.apply(setting.async.url, [setting.treeId, node], setting.async.url),
+ data: tmpParam,
+ dataType: setting.async.dataType,
+ success: function(msg) {
+ if (_tmpV != data.getRoot(setting)._ver) {
+ return;
+ }
+ var newNodes = [];
+ try {
+ if (!msg || msg.length == 0) {
+ newNodes = [];
+ } else if (typeof msg == "string") {
+ newNodes = eval("(" + msg + ")");
+ } else {
+ newNodes = msg;
+ }
+ } catch(err) {
+ newNodes = msg;
+ }
+
+ if (node) {
+ node.isAjaxing = null;
+ node.zAsync = true;
+ }
+ view.setNodeLineIcos(setting, node);
+ if (newNodes && newNodes !== "") {
+ newNodes = tools.apply(setting.async.dataFilter, [setting.treeId, node, newNodes], newNodes);
+ view.addNodes(setting, node, !!newNodes ? tools.clone(newNodes) : [], !!isSilent);
+ } else {
+ view.addNodes(setting, node, [], !!isSilent);
+ }
+ setting.treeObj.trigger(consts.event.ASYNC_SUCCESS, [setting.treeId, node, msg]);
+ tools.apply(callback);
+ },
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
+ if (_tmpV != data.getRoot(setting)._ver) {
+ return;
+ }
+ if (node) node.isAjaxing = null;
+ view.setNodeLineIcos(setting, node);
+ setting.treeObj.trigger(consts.event.ASYNC_ERROR, [setting.treeId, node, XMLHttpRequest, textStatus, errorThrown]);
+ }
+ });
+ return true;
+ },
+ cancelPreSelectedNode: function (setting, node) {
+ var list = data.getRoot(setting).curSelectedList;
+ for (var i=0, j=list.length-1; j>=i; j--) {
+ if (!node || node === list[j]) {
+ $$(list[j], consts.id.A, setting).removeClass(consts.node.CURSELECTED);
+ if (node) {
+ data.removeSelectedNode(setting, node);
+ break;
+ }
+ }
+ }
+ if (!node) data.getRoot(setting).curSelectedList = [];
+ },
+ createNodeCallback: function(setting) {
+ if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) {
+ var root = data.getRoot(setting);
+ while (root.createdNodes.length>0) {
+ var node = root.createdNodes.shift();
+ tools.apply(setting.view.addDiyDom, [setting.treeId, node]);
+ if (!!setting.callback.onNodeCreated) {
+ setting.treeObj.trigger(consts.event.NODECREATED, [setting.treeId, node]);
+ }
+ }
+ }
+ },
+ createNodes: function(setting, level, nodes, parentNode) {
+ if (!nodes || nodes.length == 0) return;
+ var root = data.getRoot(setting),
+ childKey = setting.data.key.children,
+ openFlag = !parentNode || parentNode.open || !!$$(parentNode[childKey][0], setting).get(0);
+ root.createdNodes = [];
+ var zTreeHtml = view.appendNodes(setting, level, nodes, parentNode, true, openFlag);
+ if (!parentNode) {
+ setting.treeObj.append(zTreeHtml.join(''));
+ } else {
+ var ulObj = $$(parentNode, consts.id.UL, setting);
+ if (ulObj.get(0)) {
+ ulObj.append(zTreeHtml.join(''));
+ }
+ }
+ view.createNodeCallback(setting);
+ },
+ destroy: function(setting) {
+ if (!setting) return;
+ data.initCache(setting);
+ data.initRoot(setting);
+ event.unbindTree(setting);
+ event.unbindEvent(setting);
+ setting.treeObj.empty();
+ delete settings[setting.treeId];
+ },
+ expandCollapseNode: function(setting, node, expandFlag, animateFlag, callback) {
+ var root = data.getRoot(setting),
+ childKey = setting.data.key.children;
+ if (!node) {
+ tools.apply(callback, []);
+ return;
+ }
+ if (root.expandTriggerFlag) {
+ var _callback = callback;
+ callback = function(){
+ if (_callback) _callback();
+ if (node.open) {
+ setting.treeObj.trigger(consts.event.EXPAND, [setting.treeId, node]);
+ } else {
+ setting.treeObj.trigger(consts.event.COLLAPSE, [setting.treeId, node]);
+ }
+ };
+ root.expandTriggerFlag = false;
+ }
+ if (!node.open && node.isParent && ((!$$(node, consts.id.UL, setting).get(0)) || (node[childKey] && node[childKey].length>0 && !$$(node[childKey][0], setting).get(0)))) {
+ view.appendParentULDom(setting, node);
+ view.createNodeCallback(setting);
+ }
+ if (node.open == expandFlag) {
+ tools.apply(callback, []);
+ return;
+ }
+ var ulObj = $$(node, consts.id.UL, setting),
+ switchObj = $$(node, consts.id.SWITCH, setting),
+ icoObj = $$(node, consts.id.ICON, setting);
+
+ if (node.isParent) {
+ node.open = !node.open;
+ if (node.iconOpen && node.iconClose) {
+ icoObj.attr("style", view.makeNodeIcoStyle(setting, node));
+ }
+
+ if (node.open) {
+ view.replaceSwitchClass(node, switchObj, consts.folder.OPEN);
+ view.replaceIcoClass(node, icoObj, consts.folder.OPEN);
+ if (animateFlag == false || setting.view.expandSpeed == "") {
+ ulObj.show();
+ tools.apply(callback, []);
+ } else {
+ if (node[childKey] && node[childKey].length > 0) {
+ ulObj.slideDown(setting.view.expandSpeed, callback);
+ } else {
+ ulObj.show();
+ tools.apply(callback, []);
+ }
+ }
+ } else {
+ view.replaceSwitchClass(node, switchObj, consts.folder.CLOSE);
+ view.replaceIcoClass(node, icoObj, consts.folder.CLOSE);
+ if (animateFlag == false || setting.view.expandSpeed == "" || !(node[childKey] && node[childKey].length > 0)) {
+ ulObj.hide();
+ tools.apply(callback, []);
+ } else {
+ ulObj.slideUp(setting.view.expandSpeed, callback);
+ }
+ }
+ } else {
+ tools.apply(callback, []);
+ }
+ },
+ expandCollapseParentNode: function(setting, node, expandFlag, animateFlag, callback) {
+ if (!node) return;
+ if (!node.parentTId) {
+ view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback);
+ return;
+ } else {
+ view.expandCollapseNode(setting, node, expandFlag, animateFlag);
+ }
+ if (node.parentTId) {
+ view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, animateFlag, callback);
+ }
+ },
+ expandCollapseSonNode: function(setting, node, expandFlag, animateFlag, callback) {
+ var root = data.getRoot(setting),
+ childKey = setting.data.key.children,
+ treeNodes = (node) ? node[childKey]: root[childKey],
+ selfAnimateSign = (node) ? false : animateFlag,
+ expandTriggerFlag = data.getRoot(setting).expandTriggerFlag;
+ data.getRoot(setting).expandTriggerFlag = false;
+ if (treeNodes) {
+ for (var i = 0, l = treeNodes.length; i < l; i++) {
+ if (treeNodes[i]) view.expandCollapseSonNode(setting, treeNodes[i], expandFlag, selfAnimateSign);
+ }
+ }
+ data.getRoot(setting).expandTriggerFlag = expandTriggerFlag;
+ view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback );
+ },
+ makeDOMNodeIcon: function(html, setting, node) {
+ var nameStr = data.getNodeName(setting, node),
+ name = setting.view.nameIsHTML ? nameStr : nameStr.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
+ html.push("<span id='", node.tId, consts.id.ICON,
+ "' title='' treeNode", consts.id.ICON," class='", view.makeNodeIcoClass(setting, node),
+ "' style='", view.makeNodeIcoStyle(setting, node), "'></span><span id='", node.tId, consts.id.SPAN,
+ "'>",name,"</span>");
+ },
+ makeDOMNodeLine: function(html, setting, node) {
+ html.push("<span id='", node.tId, consts.id.SWITCH, "' title='' class='", view.makeNodeLineClass(setting, node), "' treeNode", consts.id.SWITCH,"></span>");
+ },
+ makeDOMNodeMainAfter: function(html, setting, node) {
+ html.push("</li>");
+ },
+ makeDOMNodeMainBefore: function(html, setting, node) {
+ html.push("<li id='", node.tId, "' class='", consts.className.LEVEL, node.level,"' tabindex='0' hidefocus='true' treenode>");
+ },
+ makeDOMNodeNameAfter: function(html, setting, node) {
+ html.push("</a>");
+ },
+ makeDOMNodeNameBefore: function(html, setting, node) {
+ var title = data.getNodeTitle(setting, node),
+ url = view.makeNodeUrl(setting, node),
+ fontcss = view.makeNodeFontCss(setting, node),
+ fontStyle = [];
+ for (var f in fontcss) {
+ fontStyle.push(f, ":", fontcss[f], ";");
+ }
+ html.push("<a id='", node.tId, consts.id.A, "' class='", consts.className.LEVEL, node.level,"' treeNode", consts.id.A," onclick=\"", (node.click || ''),
+ "\" ", ((url != null && url.length > 0) ? "href='" + url + "'" : ""), " target='",view.makeNodeTarget(node),"' style='", fontStyle.join(''),
+ "'");
+ if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle) && title) {html.push("title='", title.replace(/'/g,"&#39;").replace(/</g,'&lt;').replace(/>/g,'&gt;'),"'");}
+ html.push(">");
+ },
+ makeNodeFontCss: function(setting, node) {
+ var fontCss = tools.apply(setting.view.fontCss, [setting.treeId, node], setting.view.fontCss);
+ return (fontCss && ((typeof fontCss) != "function")) ? fontCss : {};
+ },
+ makeNodeIcoClass: function(setting, node) {
+ var icoCss = ["ico"];
+ if (!node.isAjaxing) {
+ icoCss[0] = (node.iconSkin ? node.iconSkin + "_" : "") + icoCss[0];
+ if (node.isParent) {
+ icoCss.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE);
+ } else {
+ icoCss.push(consts.folder.DOCU);
+ }
+ }
+ return consts.className.BUTTON + " " + icoCss.join('_');
+ },
+ makeNodeIcoStyle: function(setting, node) {
+ var icoStyle = [];
+ if (!node.isAjaxing) {
+ var icon = (node.isParent && node.iconOpen && node.iconClose) ? (node.open ? node.iconOpen : node.iconClose) : node.icon;
+ if (icon) icoStyle.push("background:url(", icon, ") 0 0 no-repeat;");
+ if (setting.view.showIcon == false || !tools.apply(setting.view.showIcon, [setting.treeId, node], true)) {
+ icoStyle.push("width:0px;height:0px;");
+ }
+ }
+ return icoStyle.join('');
+ },
+ makeNodeLineClass: function(setting, node) {
+ var lineClass = [];
+ if (setting.view.showLine) {
+ if (node.level == 0 && node.isFirstNode && node.isLastNode) {
+ lineClass.push(consts.line.ROOT);
+ } else if (node.level == 0 && node.isFirstNode) {
+ lineClass.push(consts.line.ROOTS);
+ } else if (node.isLastNode) {
+ lineClass.push(consts.line.BOTTOM);
+ } else {
+ lineClass.push(consts.line.CENTER);
+ }
+ } else {
+ lineClass.push(consts.line.NOLINE);
+ }
+ if (node.isParent) {
+ lineClass.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE);
+ } else {
+ lineClass.push(consts.folder.DOCU);
+ }
+ return view.makeNodeLineClassEx(node) + lineClass.join('_');
+ },
+ makeNodeLineClassEx: function(node) {
+ return consts.className.BUTTON + " " + consts.className.LEVEL + node.level + " " + consts.className.SWITCH + " ";
+ },
+ makeNodeTarget: function(node) {
+ return (node.target || "_blank");
+ },
+ makeNodeUrl: function(setting, node) {
+ var urlKey = setting.data.key.url;
+ return node[urlKey] ? node[urlKey] : null;
+ },
+ makeUlHtml: function(setting, node, html, content) {
+ html.push("<ul id='", node.tId, consts.id.UL, "' class='", consts.className.LEVEL, node.level, " ", view.makeUlLineClass(setting, node), "' style='display:", (node.open ? "block": "none"),"'>");
+ html.push(content);
+ html.push("</ul>");
+ },
+ makeUlLineClass: function(setting, node) {
+ return ((setting.view.showLine && !node.isLastNode) ? consts.line.LINE : "");
+ },
+ removeChildNodes: function(setting, node) {
+ if (!node) return;
+ var childKey = setting.data.key.children,
+ nodes = node[childKey];
+ if (!nodes) return;
+
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ data.removeNodeCache(setting, nodes[i]);
+ }
+ data.removeSelectedNode(setting);
+ delete node[childKey];
+
+ if (!setting.data.keep.parent) {
+ node.isParent = false;
+ node.open = false;
+ var tmp_switchObj = $$(node, consts.id.SWITCH, setting),
+ tmp_icoObj = $$(node, consts.id.ICON, setting);
+ view.replaceSwitchClass(node, tmp_switchObj, consts.folder.DOCU);
+ view.replaceIcoClass(node, tmp_icoObj, consts.folder.DOCU);
+ $$(node, consts.id.UL, setting).remove();
+ } else {
+ $$(node, consts.id.UL, setting).empty();
+ }
+ },
+ setFirstNode: function(setting, parentNode) {
+ var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
+ if ( childLength > 0) {
+ parentNode[childKey][0].isFirstNode = true;
+ }
+ },
+ setLastNode: function(setting, parentNode) {
+ var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
+ if ( childLength > 0) {
+ parentNode[childKey][childLength - 1].isLastNode = true;
+ }
+ },
+ removeNode: function(setting, node) {
+ var root = data.getRoot(setting),
+ childKey = setting.data.key.children,
+ parentNode = (node.parentTId) ? node.getParentNode() : root;
+
+ node.isFirstNode = false;
+ node.isLastNode = false;
+ node.getPreNode = function() {return null;};
+ node.getNextNode = function() {return null;};
+
+ if (!data.getNodeCache(setting, node.tId)) {
+ return;
+ }
+
+ $$(node, setting).remove();
+ data.removeNodeCache(setting, node);
+ data.removeSelectedNode(setting, node);
+
+ for (var i = 0, l = parentNode[childKey].length; i < l; i++) {
+ if (parentNode[childKey][i].tId == node.tId) {
+ parentNode[childKey].splice(i, 1);
+ break;
+ }
+ }
+ view.setFirstNode(setting, parentNode);
+ view.setLastNode(setting, parentNode);
+
+ var tmp_ulObj,tmp_switchObj,tmp_icoObj,
+ childLength = parentNode[childKey].length;
+
+ //repair nodes old parent
+ if (!setting.data.keep.parent && childLength == 0) {
+ //old parentNode has no child nodes
+ parentNode.isParent = false;
+ parentNode.open = false;
+ tmp_ulObj = $$(parentNode, consts.id.UL, setting);
+ tmp_switchObj = $$(parentNode, consts.id.SWITCH, setting);
+ tmp_icoObj = $$(parentNode, consts.id.ICON, setting);
+ view.replaceSwitchClass(parentNode, tmp_switchObj, consts.folder.DOCU);
+ view.replaceIcoClass(parentNode, tmp_icoObj, consts.folder.DOCU);
+ tmp_ulObj.css("display", "none");
+
+ } else if (setting.view.showLine && childLength > 0) {
+ //old parentNode has child nodes
+ var newLast = parentNode[childKey][childLength - 1];
+ tmp_ulObj = $$(newLast, consts.id.UL, setting);
+ tmp_switchObj = $$(newLast, consts.id.SWITCH, setting);
+ tmp_icoObj = $$(newLast, consts.id.ICON, setting);
+ if (parentNode == root) {
+ if (parentNode[childKey].length == 1) {
+ //node was root, and ztree has only one root after move node
+ view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.ROOT);
+ } else {
+ var tmp_first_switchObj = $$(parentNode[childKey][0], consts.id.SWITCH, setting);
+ view.replaceSwitchClass(parentNode[childKey][0], tmp_first_switchObj, consts.line.ROOTS);
+ view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM);
+ }
+ } else {
+ view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM);
+ }
+ tmp_ulObj.removeClass(consts.line.LINE);
+ }
+ },
+ replaceIcoClass: function(node, obj, newName) {
+ if (!obj || node.isAjaxing) return;
+ var tmpName = obj.attr("class");
+ if (tmpName == undefined) return;
+ var tmpList = tmpName.split("_");
+ switch (newName) {
+ case consts.folder.OPEN:
+ case consts.folder.CLOSE:
+ case consts.folder.DOCU:
+ tmpList[tmpList.length-1] = newName;
+ break;
+ }
+ obj.attr("class", tmpList.join("_"));
+ },
+ replaceSwitchClass: function(node, obj, newName) {
+ if (!obj) return;
+ var tmpName = obj.attr("class");
+ if (tmpName == undefined) return;
+ var tmpList = tmpName.split("_");
+ switch (newName) {
+ case consts.line.ROOT:
+ case consts.line.ROOTS:
+ case consts.line.CENTER:
+ case consts.line.BOTTOM:
+ case consts.line.NOLINE:
+ tmpList[0] = view.makeNodeLineClassEx(node) + newName;
+ break;
+ case consts.folder.OPEN:
+ case consts.folder.CLOSE:
+ case consts.folder.DOCU:
+ tmpList[1] = newName;
+ break;
+ }
+ obj.attr("class", tmpList.join("_"));
+ if (newName !== consts.folder.DOCU) {
+ obj.removeAttr("disabled");
+ } else {
+ obj.attr("disabled", "disabled");
+ }
+ },
+ selectNode: function(setting, node, addFlag) {
+ if (!addFlag) {
+ view.cancelPreSelectedNode(setting);
+ }
+ $$(node, consts.id.A, setting).addClass(consts.node.CURSELECTED);
+ data.addSelectedNode(setting, node);
+ },
+ setNodeFontCss: function(setting, treeNode) {
+ var aObj = $$(treeNode, consts.id.A, setting),
+ fontCss = view.makeNodeFontCss(setting, treeNode);
+ if (fontCss) {
+ aObj.css(fontCss);
+ }
+ },
+ setNodeLineIcos: function(setting, node) {
+ if (!node) return;
+ var switchObj = $$(node, consts.id.SWITCH, setting),
+ ulObj = $$(node, consts.id.UL, setting),
+ icoObj = $$(node, consts.id.ICON, setting),
+ ulLine = view.makeUlLineClass(setting, node);
+ if (ulLine.length==0) {
+ ulObj.removeClass(consts.line.LINE);
+ } else {
+ ulObj.addClass(ulLine);
+ }
+ switchObj.attr("class", view.makeNodeLineClass(setting, node));
+ if (node.isParent) {
+ switchObj.removeAttr("disabled");
+ } else {
+ switchObj.attr("disabled", "disabled");
+ }
+ icoObj.removeAttr("style");
+ icoObj.attr("style", view.makeNodeIcoStyle(setting, node));
+ icoObj.attr("class", view.makeNodeIcoClass(setting, node));
+ },
+ setNodeName: function(setting, node) {
+ var title = data.getNodeTitle(setting, node),
+ nObj = $$(node, consts.id.SPAN, setting);
+ nObj.empty();
+ if (setting.view.nameIsHTML) {
+ nObj.html(data.getNodeName(setting, node));
+ } else {
+ nObj.text(data.getNodeName(setting, node));
+ }
+ if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle)) {
+ var aObj = $$(node, consts.id.A, setting);
+ aObj.attr("title", !title ? "" : title);
+ }
+ },
+ setNodeTarget: function(setting, node) {
+ var aObj = $$(node, consts.id.A, setting);
+ aObj.attr("target", view.makeNodeTarget(node));
+ },
+ setNodeUrl: function(setting, node) {
+ var aObj = $$(node, consts.id.A, setting),
+ url = view.makeNodeUrl(setting, node);
+ if (url == null || url.length == 0) {
+ aObj.removeAttr("href");
+ } else {
+ aObj.attr("href", url);
+ }
+ },
+ switchNode: function(setting, node) {
+ if (node.open || !tools.canAsync(setting, node)) {
+ view.expandCollapseNode(setting, node, !node.open);
+ } else if (setting.async.enable) {
+ if (!view.asyncNode(setting, node)) {
+ view.expandCollapseNode(setting, node, !node.open);
+ return;
+ }
+ } else if (node) {
+ view.expandCollapseNode(setting, node, !node.open);
+ }
+ }
+ };
+ // zTree defind
+ $.fn.zTree = {
+ consts : _consts,
+ _z : {
+ tools: tools,
+ view: view,
+ event: event,
+ data: data
+ },
+ getZTreeObj: function(treeId) {
+ var o = data.getZTreeTools(treeId);
+ return o ? o : null;
+ },
+ destroy: function(treeId) {
+ if (!!treeId && treeId.length > 0) {
+ view.destroy(data.getSetting(treeId));
+ } else {
+ for(var s in settings) {
+ view.destroy(settings[s]);
+ }
+ }
+ },
+ init: function(obj, zSetting, zNodes) {
+ var setting = tools.clone(_setting);
+ $.extend(true, setting, zSetting);
+ setting.treeId = obj.attr("id");
+ setting.treeObj = obj;
+ setting.treeObj.empty();
+ settings[setting.treeId] = setting;
+ //For some older browser,(e.g., ie6)
+ if(typeof document.body.style.maxHeight === "undefined") {
+ setting.view.expandSpeed = "";
+ }
+ data.initRoot(setting);
+ var root = data.getRoot(setting),
+ childKey = setting.data.key.children;
+ zNodes = zNodes ? tools.clone(tools.isArray(zNodes)? zNodes : [zNodes]) : [];
+ if (setting.data.simpleData.enable) {
+ root[childKey] = data.transformTozTreeFormat(setting, zNodes);
+ } else {
+ root[childKey] = zNodes;
+ }
+
+ data.initCache(setting);
+ event.unbindTree(setting);
+ event.bindTree(setting);
+ event.unbindEvent(setting);
+ event.bindEvent(setting);
+
+ var zTreeTools = {
+ setting : setting,
+ addNodes : function(parentNode, newNodes, isSilent) {
+ if (!newNodes) return null;
+ if (!parentNode) parentNode = null;
+ if (parentNode && !parentNode.isParent && setting.data.keep.leaf) return null;
+ var xNewNodes = tools.clone(tools.isArray(newNodes)? newNodes: [newNodes]);
+ function addCallback() {
+ view.addNodes(setting, parentNode, xNewNodes, (isSilent==true));
+ }
+
+ if (tools.canAsync(setting, parentNode)) {
+ view.asyncNode(setting, parentNode, isSilent, addCallback);
+ } else {
+ addCallback();
+ }
+ return xNewNodes;
+ },
+ cancelSelectedNode : function(node) {
+ view.cancelPreSelectedNode(setting, node);
+ },
+ destroy : function() {
+ view.destroy(setting);
+ },
+ expandAll : function(expandFlag) {
+ expandFlag = !!expandFlag;
+ view.expandCollapseSonNode(setting, null, expandFlag, true);
+ return expandFlag;
+ },
+ expandNode : function(node, expandFlag, sonSign, focus, callbackFlag) {
+ if (!node || !node.isParent) return null;
+ if (expandFlag !== true && expandFlag !== false) {
+ expandFlag = !node.open;
+ }
+ callbackFlag = !!callbackFlag;
+
+ if (callbackFlag && expandFlag && (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false)) {
+ return null;
+ } else if (callbackFlag && !expandFlag && (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false)) {
+ return null;
+ }
+ if (expandFlag && node.parentTId) {
+ view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, false);
+ }
+ if (expandFlag === node.open && !sonSign) {
+ return null;
+ }
+
+ data.getRoot(setting).expandTriggerFlag = callbackFlag;
+ if (!tools.canAsync(setting, node) && sonSign) {
+ view.expandCollapseSonNode(setting, node, expandFlag, true, function() {
+ if (focus !== false) {try{$$(node, setting).focus().blur();}catch(e){}}
+ });
+ } else {
+ node.open = !expandFlag;
+ view.switchNode(this.setting, node);
+ if (focus !== false) {try{$$(node, setting).focus().blur();}catch(e){}}
+ }
+ return expandFlag;
+ },
+ getNodes : function() {
+ return data.getNodes(setting);
+ },
+ getNodeByParam : function(key, value, parentNode) {
+ if (!key) return null;
+ return data.getNodeByParam(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value);
+ },
+ getNodeByTId : function(tId) {
+ return data.getNodeCache(setting, tId);
+ },
+ getNodesByParam : function(key, value, parentNode) {
+ if (!key) return null;
+ return data.getNodesByParam(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value);
+ },
+ getNodesByParamFuzzy : function(key, value, parentNode) {
+ if (!key) return null;
+ return data.getNodesByParamFuzzy(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value);
+ },
+ getNodesByFilter: function(filter, isSingle, parentNode, invokeParam) {
+ isSingle = !!isSingle;
+ if (!filter || (typeof filter != "function")) return (isSingle ? null : []);
+ return data.getNodesByFilter(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), filter, isSingle, invokeParam);
+ },
+ getNodeIndex : function(node) {
+ if (!node) return null;
+ var childKey = setting.data.key.children,
+ parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting);
+ for (var i=0, l = parentNode[childKey].length; i < l; i++) {
+ if (parentNode[childKey][i] == node) return i;
+ }
+ return -1;
+ },
+ getSelectedNodes : function() {
+ var r = [], list = data.getRoot(setting).curSelectedList;
+ for (var i=0, l=list.length; i<l; i++) {
+ r.push(list[i]);
+ }
+ return r;
+ },
+ isSelectedNode : function(node) {
+ return data.isSelectedNode(setting, node);
+ },
+ reAsyncChildNodes : function(parentNode, reloadType, isSilent) {
+ if (!this.setting.async.enable) return;
+ var isRoot = !parentNode;
+ if (isRoot) {
+ parentNode = data.getRoot(setting);
+ }
+ if (reloadType=="refresh") {
+ var childKey = this.setting.data.key.children;
+ for (var i = 0, l = parentNode[childKey] ? parentNode[childKey].length : 0; i < l; i++) {
+ data.removeNodeCache(setting, parentNode[childKey][i]);
+ }
+ data.removeSelectedNode(setting);
+ parentNode[childKey] = [];
+ if (isRoot) {
+ this.setting.treeObj.empty();
+ } else {
+ var ulObj = $$(parentNode, consts.id.UL, setting);
+ ulObj.empty();
+ }
+ }
+ view.asyncNode(this.setting, isRoot? null:parentNode, !!isSilent);
+ },
+ refresh : function() {
+ this.setting.treeObj.empty();
+ var root = data.getRoot(setting),
+ nodes = root[setting.data.key.children]
+ data.initRoot(setting);
+ root[setting.data.key.children] = nodes
+ data.initCache(setting);
+ view.createNodes(setting, 0, root[setting.data.key.children]);
+ },
+ removeChildNodes : function(node) {
+ if (!node) return null;
+ var childKey = setting.data.key.children,
+ nodes = node[childKey];
+ view.removeChildNodes(setting, node);
+ return nodes ? nodes : null;
+ },
+ removeNode : function(node, callbackFlag) {
+ if (!node) return;
+ callbackFlag = !!callbackFlag;
+ if (callbackFlag && tools.apply(setting.callback.beforeRemove, [setting.treeId, node], true) == false) return;
+ view.removeNode(setting, node);
+ if (callbackFlag) {
+ this.setting.treeObj.trigger(consts.event.REMOVE, [setting.treeId, node]);
+ }
+ },
+ selectNode : function(node, addFlag) {
+ if (!node) return;
+ if (tools.uCanDo(setting)) {
+ addFlag = setting.view.selectedMulti && addFlag;
+ if (node.parentTId) {
+ view.expandCollapseParentNode(setting, node.getParentNode(), true, false, function() {
+ try{$$(node, setting).focus().blur();}catch(e){}
+ });
+ } else {
+ try{$$(node, setting).focus().blur();}catch(e){}
+ }
+ view.selectNode(setting, node, addFlag);
+ }
+ },
+ transformTozTreeNodes : function(simpleNodes) {
+ return data.transformTozTreeFormat(setting, simpleNodes);
+ },
+ transformToArray : function(nodes) {
+ return data.transformToArrayFormat(setting, nodes);
+ },
+ updateNode : function(node, checkTypeFlag) {
+ if (!node) return;
+ var nObj = $$(node, setting);
+ if (nObj.get(0) && tools.uCanDo(setting)) {
+ view.setNodeName(setting, node);
+ view.setNodeTarget(setting, node);
+ view.setNodeUrl(setting, node);
+ view.setNodeLineIcos(setting, node);
+ view.setNodeFontCss(setting, node);
+ }
+ }
+ }
+ root.treeTools = zTreeTools;
+ data.setZTreeTools(setting, zTreeTools);
+
+ if (root[childKey] && root[childKey].length > 0) {
+ view.createNodes(setting, 0, root[childKey]);
+ } else if (setting.async.enable && setting.async.url && setting.async.url !== '') {
+ view.asyncNode(setting);
+ }
+ return zTreeTools;
+ }
+ };
+
+ var zt = $.fn.zTree,
+ $$ = tools.$,
+ consts = zt.consts;
+})(jQuery);
+/*
+ * JQuery zTree excheck v3.5.16
+ * http://zTree.me/
+ *
+ * Copyright (c) 2010 Hunter.z
+ *
+ * Licensed same as jquery - MIT License
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * email: hunter.z@263.net
+ * Date: 2014-03-09
+ */
+(function($){
+ //default consts of excheck
+ var _consts = {
+ event: {
+ CHECK: "ztree_check"
+ },
+ id: {
+ CHECK: "_check"
+ },
+ checkbox: {
+ STYLE: "checkbox",
+ DEFAULT: "chk",
+ DISABLED: "disable",
+ FALSE: "false",
+ TRUE: "true",
+ FULL: "full",
+ PART: "part",
+ FOCUS: "focus"
+ },
+ radio: {
+ STYLE: "radio",
+ TYPE_ALL: "all",
+ TYPE_LEVEL: "level"
+ }
+ },
+ //default setting of excheck
+ _setting = {
+ check: {
+ enable: false,
+ autoCheckTrigger: false,
+ chkStyle: _consts.checkbox.STYLE,
+ nocheckInherit: false,
+ chkDisabledInherit: false,
+ radioType: _consts.radio.TYPE_LEVEL,
+ chkboxType: {
+ "Y": "ps",
+ "N": "ps"
+ }
+ },
+ data: {
+ key: {
+ checked: "checked"
+ }
+ },
+ callback: {
+ beforeCheck:null,
+ onCheck:null
+ }
+ },
+ //default root of excheck
+ _initRoot = function (setting) {
+ var r = data.getRoot(setting);
+ r.radioCheckedList = [];
+ },
+ //default cache of excheck
+ _initCache = function(treeId) {},
+ //default bind event of excheck
+ _bindEvent = function(setting) {
+ var o = setting.treeObj,
+ c = consts.event;
+ o.bind(c.CHECK, function (event, srcEvent, treeId, node) {
+ event.srcEvent = srcEvent;
+ tools.apply(setting.callback.onCheck, [event, treeId, node]);
+ });
+ },
+ _unbindEvent = function(setting) {
+ var o = setting.treeObj,
+ c = consts.event;
+ o.unbind(c.CHECK);
+ },
+ //default event proxy of excheck
+ _eventProxy = function(e) {
+ var target = e.target,
+ setting = data.getSetting(e.data.treeId),
+ tId = "", node = null,
+ nodeEventType = "", treeEventType = "",
+ nodeEventCallback = null, treeEventCallback = null;
+
+ if (tools.eqs(e.type, "mouseover")) {
+ if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) {
+ tId = tools.getNodeMainDom(target).id;
+ nodeEventType = "mouseoverCheck";
+ }
+ } else if (tools.eqs(e.type, "mouseout")) {
+ if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) {
+ tId = tools.getNodeMainDom(target).id;
+ nodeEventType = "mouseoutCheck";
+ }
+ } else if (tools.eqs(e.type, "click")) {
+ if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) {
+ tId = tools.getNodeMainDom(target).id;
+ nodeEventType = "checkNode";
+ }
+ }
+ if (tId.length>0) {
+ node = data.getNodeCache(setting, tId);
+ switch (nodeEventType) {
+ case "checkNode" :
+ nodeEventCallback = _handler.onCheckNode;
+ break;
+ case "mouseoverCheck" :
+ nodeEventCallback = _handler.onMouseoverCheck;
+ break;
+ case "mouseoutCheck" :
+ nodeEventCallback = _handler.onMouseoutCheck;
+ break;
+ }
+ }
+ var proxyResult = {
+ stop: nodeEventType === "checkNode",
+ node: node,
+ nodeEventType: nodeEventType,
+ nodeEventCallback: nodeEventCallback,
+ treeEventType: treeEventType,
+ treeEventCallback: treeEventCallback
+ };
+ return proxyResult
+ },
+ //default init node of excheck
+ _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {
+ if (!n) return;
+ var checkedKey = setting.data.key.checked;
+ if (typeof n[checkedKey] == "string") n[checkedKey] = tools.eqs(n[checkedKey], "true");
+ n[checkedKey] = !!n[checkedKey];
+ n.checkedOld = n[checkedKey];
+ if (typeof n.nocheck == "string") n.nocheck = tools.eqs(n.nocheck, "true");
+ n.nocheck = !!n.nocheck || (setting.check.nocheckInherit && parentNode && !!parentNode.nocheck);
+ if (typeof n.chkDisabled == "string") n.chkDisabled = tools.eqs(n.chkDisabled, "true");
+ n.chkDisabled = !!n.chkDisabled || (setting.check.chkDisabledInherit && parentNode && !!parentNode.chkDisabled);
+ if (typeof n.halfCheck == "string") n.halfCheck = tools.eqs(n.halfCheck, "true");
+ n.halfCheck = !!n.halfCheck;
+ n.check_Child_State = -1;
+ n.check_Focus = false;
+ n.getCheckStatus = function() {return data.getCheckStatus(setting, n);};
+
+ if (setting.check.chkStyle == consts.radio.STYLE && setting.check.radioType == consts.radio.TYPE_ALL && n[checkedKey] ) {
+ var r = data.getRoot(setting);
+ r.radioCheckedList.push(n);
+ }
+ },
+ //add dom for check
+ _beforeA = function(setting, node, html) {
+ var checkedKey = setting.data.key.checked;
+ if (setting.check.enable) {
+ data.makeChkFlag(setting, node);
+ html.push("<span ID='", node.tId, consts.id.CHECK, "' class='", view.makeChkClass(setting, node), "' treeNode", consts.id.CHECK, (node.nocheck === true?" style='display:none;'":""),"></span>");
+ }
+ },
+ //update zTreeObj, add method of check
+ _zTreeTools = function(setting, zTreeTools) {
+ zTreeTools.checkNode = function(node, checked, checkTypeFlag, callbackFlag) {
+ var checkedKey = this.setting.data.key.checked;
+ if (node.chkDisabled === true) return;
+ if (checked !== true && checked !== false) {
+ checked = !node[checkedKey];
+ }
+ callbackFlag = !!callbackFlag;
+
+ if (node[checkedKey] === checked && !checkTypeFlag) {
+ return;
+ } else if (callbackFlag && tools.apply(this.setting.callback.beforeCheck, [this.setting.treeId, node], true) == false) {
+ return;
+ }
+ if (tools.uCanDo(this.setting) && this.setting.check.enable && node.nocheck !== true) {
+ node[checkedKey] = checked;
+ var checkObj = $$(node, consts.id.CHECK, this.setting);
+ if (checkTypeFlag || this.setting.check.chkStyle === consts.radio.STYLE) view.checkNodeRelation(this.setting, node);
+ view.setChkClass(this.setting, checkObj, node);
+ view.repairParentChkClassWithSelf(this.setting, node);
+ if (callbackFlag) {
+ this.setting.treeObj.trigger(consts.event.CHECK, [null, this.setting.treeId, node]);
+ }
+ }
+ }
+
+ zTreeTools.checkAllNodes = function(checked) {
+ view.repairAllChk(this.setting, !!checked);
+ }
+
+ zTreeTools.getCheckedNodes = function(checked) {
+ var childKey = this.setting.data.key.children;
+ checked = (checked !== false);
+ return data.getTreeCheckedNodes(this.setting, data.getRoot(this.setting)[childKey], checked);
+ }
+
+ zTreeTools.getChangeCheckedNodes = function() {
+ var childKey = this.setting.data.key.children;
+ return data.getTreeChangeCheckedNodes(this.setting, data.getRoot(this.setting)[childKey]);
+ }
+
+ zTreeTools.setChkDisabled = function(node, disabled, inheritParent, inheritChildren) {
+ disabled = !!disabled;
+ inheritParent = !!inheritParent;
+ inheritChildren = !!inheritChildren;
+ view.repairSonChkDisabled(this.setting, node, disabled, inheritChildren);
+ view.repairParentChkDisabled(this.setting, node.getParentNode(), disabled, inheritParent);
+ }
+
+ var _updateNode = zTreeTools.updateNode;
+ zTreeTools.updateNode = function(node, checkTypeFlag) {
+ if (_updateNode) _updateNode.apply(zTreeTools, arguments);
+ if (!node || !this.setting.check.enable) return;
+ var nObj = $$(node, this.setting);
+ if (nObj.get(0) && tools.uCanDo(this.setting)) {
+ var checkObj = $$(node, consts.id.CHECK, this.setting);
+ if (checkTypeFlag == true || this.setting.check.chkStyle === consts.radio.STYLE) view.checkNodeRelation(this.setting, node);
+ view.setChkClass(this.setting, checkObj, node);
+ view.repairParentChkClassWithSelf(this.setting, node);
+ }
+ }
+ },
+ //method of operate data
+ _data = {
+ getRadioCheckedList: function(setting) {
+ var checkedList = data.getRoot(setting).radioCheckedList;
+ for (var i=0, j=checkedList.length; i<j; i++) {
+ if(!data.getNodeCache(setting, checkedList[i].tId)) {
+ checkedList.splice(i, 1);
+ i--; j--;
+ }
+ }
+ return checkedList;
+ },
+ getCheckStatus: function(setting, node) {
+ if (!setting.check.enable || node.nocheck || node.chkDisabled) return null;
+ var checkedKey = setting.data.key.checked,
+ r = {
+ checked: node[checkedKey],
+ half: node.halfCheck ? node.halfCheck : (setting.check.chkStyle == consts.radio.STYLE ? (node.check_Child_State === 2) : (node[checkedKey] ? (node.check_Child_State > -1 && node.check_Child_State < 2) : (node.check_Child_State > 0)))
+ };
+ return r;
+ },
+ getTreeCheckedNodes: function(setting, nodes, checked, results) {
+ if (!nodes) return [];
+ var childKey = setting.data.key.children,
+ checkedKey = setting.data.key.checked,
+ onlyOne = (checked && setting.check.chkStyle == consts.radio.STYLE && setting.check.radioType == consts.radio.TYPE_ALL);
+ results = !results ? [] : results;
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ if (nodes[i].nocheck !== true && nodes[i].chkDisabled !== true && nodes[i][checkedKey] == checked) {
+ results.push(nodes[i]);
+ if(onlyOne) {
+ break;
+ }
+ }
+ data.getTreeCheckedNodes(setting, nodes[i][childKey], checked, results);
+ if(onlyOne && results.length > 0) {
+ break;
+ }
+ }
+ return results;
+ },
+ getTreeChangeCheckedNodes: function(setting, nodes, results) {
+ if (!nodes) return [];
+ var childKey = setting.data.key.children,
+ checkedKey = setting.data.key.checked;
+ results = !results ? [] : results;
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ if (nodes[i].nocheck !== true && nodes[i].chkDisabled !== true && nodes[i][checkedKey] != nodes[i].checkedOld) {
+ results.push(nodes[i]);
+ }
+ data.getTreeChangeCheckedNodes(setting, nodes[i][childKey], results);
+ }
+ return results;
+ },
+ makeChkFlag: function(setting, node) {
+ if (!node) return;
+ var childKey = setting.data.key.children,
+ checkedKey = setting.data.key.checked,
+ chkFlag = -1;
+ if (node[childKey]) {
+ for (var i = 0, l = node[childKey].length; i < l; i++) {
+ var cNode = node[childKey][i];
+ var tmp = -1;
+ if (setting.check.chkStyle == consts.radio.STYLE) {
+ if (cNode.nocheck === true || cNode.chkDisabled === true) {
+ tmp = cNode.check_Child_State;
+ } else if (cNode.halfCheck === true) {
+ tmp = 2;
+ } else if (cNode[checkedKey]) {
+ tmp = 2;
+ } else {
+ tmp = cNode.check_Child_State > 0 ? 2:0;
+ }
+ if (tmp == 2) {
+ chkFlag = 2; break;
+ } else if (tmp == 0){
+ chkFlag = 0;
+ }
+ } else if (setting.check.chkStyle == consts.checkbox.STYLE) {
+ if (cNode.nocheck === true || cNode.chkDisabled === true) {
+ tmp = cNode.check_Child_State;
+ } else if (cNode.halfCheck === true) {
+ tmp = 1;
+ } else if (cNode[checkedKey] ) {
+ tmp = (cNode.check_Child_State === -1 || cNode.check_Child_State === 2) ? 2 : 1;
+ } else {
+ tmp = (cNode.check_Child_State > 0) ? 1 : 0;
+ }
+ if (tmp === 1) {
+ chkFlag = 1; break;
+ } else if (tmp === 2 && chkFlag > -1 && i > 0 && tmp !== chkFlag) {
+ chkFlag = 1; break;
+ } else if (chkFlag === 2 && tmp > -1 && tmp < 2) {
+ chkFlag = 1; break;
+ } else if (tmp > -1) {
+ chkFlag = tmp;
+ }
+ }
+ }
+ }
+ node.check_Child_State = chkFlag;
+ }
+ },
+ //method of event proxy
+ _event = {
+
+ },
+ //method of event handler
+ _handler = {
+ onCheckNode: function (event, node) {
+ if (node.chkDisabled === true) return false;
+ var setting = data.getSetting(event.data.treeId),
+ checkedKey = setting.data.key.checked;
+ if (tools.apply(setting.callback.beforeCheck, [setting.treeId, node], true) == false) return true;
+ node[checkedKey] = !node[checkedKey];
+ view.checkNodeRelation(setting, node);
+ var checkObj = $$(node, consts.id.CHECK, setting);
+ view.setChkClass(setting, checkObj, node);
+ view.repairParentChkClassWithSelf(setting, node);
+ setting.treeObj.trigger(consts.event.CHECK, [event, setting.treeId, node]);
+ return true;
+ },
+ onMouseoverCheck: function(event, node) {
+ if (node.chkDisabled === true) return false;
+ var setting = data.getSetting(event.data.treeId),
+ checkObj = $$(node, consts.id.CHECK, setting);
+ node.check_Focus = true;
+ view.setChkClass(setting, checkObj, node);
+ return true;
+ },
+ onMouseoutCheck: function(event, node) {
+ if (node.chkDisabled === true) return false;
+ var setting = data.getSetting(event.data.treeId),
+ checkObj = $$(node, consts.id.CHECK, setting);
+ node.check_Focus = false;
+ view.setChkClass(setting, checkObj, node);
+ return true;
+ }
+ },
+ //method of tools for zTree
+ _tools = {
+
+ },
+ //method of operate ztree dom
+ _view = {
+ checkNodeRelation: function(setting, node) {
+ var pNode, i, l,
+ childKey = setting.data.key.children,
+ checkedKey = setting.data.key.checked,
+ r = consts.radio;
+ if (setting.check.chkStyle == r.STYLE) {
+ var checkedList = data.getRadioCheckedList(setting);
+ if (node[checkedKey]) {
+ if (setting.check.radioType == r.TYPE_ALL) {
+ for (i = checkedList.length-1; i >= 0; i--) {
+ pNode = checkedList[i];
+ if (pNode[checkedKey] && pNode != node) {
+ pNode[checkedKey] = false;
+ checkedList.splice(i, 1);
+
+ view.setChkClass(setting, $$(pNode, consts.id.CHECK, setting), pNode);
+ if (pNode.parentTId != node.parentTId) {
+ view.repairParentChkClassWithSelf(setting, pNode);
+ }
+ }
+ }
+ checkedList.push(node);
+ } else {
+ var parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting);
+ for (i = 0, l = parentNode[childKey].length; i < l; i++) {
+ pNode = parentNode[childKey][i];
+ if (pNode[checkedKey] && pNode != node) {
+ pNode[checkedKey] = false;
+ view.setChkClass(setting, $$(pNode, consts.id.CHECK, setting), pNode);
+ }
+ }
+ }
+ } else if (setting.check.radioType == r.TYPE_ALL) {
+ for (i = 0, l = checkedList.length; i < l; i++) {
+ if (node == checkedList[i]) {
+ checkedList.splice(i, 1);
+ break;
+ }
+ }
+ }
+
+ } else {
+ if (node[checkedKey] && (!node[childKey] || node[childKey].length==0 || setting.check.chkboxType.Y.indexOf("s") > -1)) {
+ view.setSonNodeCheckBox(setting, node, true);
+ }
+ if (!node[checkedKey] && (!node[childKey] || node[childKey].length==0 || setting.check.chkboxType.N.indexOf("s") > -1)) {
+ view.setSonNodeCheckBox(setting, node, false);
+ }
+ if (node[checkedKey] && setting.check.chkboxType.Y.indexOf("p") > -1) {
+ view.setParentNodeCheckBox(setting, node, true);
+ }
+ if (!node[checkedKey] && setting.check.chkboxType.N.indexOf("p") > -1) {
+ view.setParentNodeCheckBox(setting, node, false);
+ }
+ }
+ },
+ makeChkClass: function(setting, node) {
+ var checkedKey = setting.data.key.checked,
+ c = consts.checkbox, r = consts.radio,
+ fullStyle = "";
+ if (node.chkDisabled === true) {
+ fullStyle = c.DISABLED;
+ } else if (node.halfCheck) {
+ fullStyle = c.PART;
+ } else if (setting.check.chkStyle == r.STYLE) {
+ fullStyle = (node.check_Child_State < 1)? c.FULL:c.PART;
+ } else {
+ fullStyle = node[checkedKey] ? ((node.check_Child_State === 2 || node.check_Child_State === -1) ? c.FULL:c.PART) : ((node.check_Child_State < 1)? c.FULL:c.PART);
+ }
+ var chkName = setting.check.chkStyle + "_" + (node[checkedKey] ? c.TRUE : c.FALSE) + "_" + fullStyle;
+ chkName = (node.check_Focus && node.chkDisabled !== true) ? chkName + "_" + c.FOCUS : chkName;
+ return consts.className.BUTTON + " " + c.DEFAULT + " " + chkName;
+ },
+ repairAllChk: function(setting, checked) {
+ if (setting.check.enable && setting.check.chkStyle === consts.checkbox.STYLE) {
+ var checkedKey = setting.data.key.checked,
+ childKey = setting.data.key.children,
+ root = data.getRoot(setting);
+ for (var i = 0, l = root[childKey].length; i<l ; i++) {
+ var node = root[childKey][i];
+ if (node.nocheck !== true && node.chkDisabled !== true) {
+ node[checkedKey] = checked;
+ }
+ view.setSonNodeCheckBox(setting, node, checked);
+ }
+ }
+ },
+ repairChkClass: function(setting, node) {
+ if (!node) return;
+ data.makeChkFlag(setting, node);
+ if (node.nocheck !== true) {
+ var checkObj = $$(node, consts.id.CHECK, setting);
+ view.setChkClass(setting, checkObj, node);
+ }
+ },
+ repairParentChkClass: function(setting, node) {
+ if (!node || !node.parentTId) return;
+ var pNode = node.getParentNode();
+ view.repairChkClass(setting, pNode);
+ view.repairParentChkClass(setting, pNode);
+ },
+ repairParentChkClassWithSelf: function(setting, node) {
+ if (!node) return;
+ var childKey = setting.data.key.children;
+ if (node[childKey] && node[childKey].length > 0) {
+ view.repairParentChkClass(setting, node[childKey][0]);
+ } else {
+ view.repairParentChkClass(setting, node);
+ }
+ },
+ repairSonChkDisabled: function(setting, node, chkDisabled, inherit) {
+ if (!node) return;
+ var childKey = setting.data.key.children;
+ if (node.chkDisabled != chkDisabled) {
+ node.chkDisabled = chkDisabled;
+ }
+ view.repairChkClass(setting, node);
+ if (node[childKey] && inherit) {
+ for (var i = 0, l = node[childKey].length; i < l; i++) {
+ var sNode = node[childKey][i];
+ view.repairSonChkDisabled(setting, sNode, chkDisabled, inherit);
+ }
+ }
+ },
+ repairParentChkDisabled: function(setting, node, chkDisabled, inherit) {
+ if (!node) return;
+ if (node.chkDisabled != chkDisabled && inherit) {
+ node.chkDisabled = chkDisabled;
+ }
+ view.repairChkClass(setting, node);
+ view.repairParentChkDisabled(setting, node.getParentNode(), chkDisabled, inherit);
+ },
+ setChkClass: function(setting, obj, node) {
+ if (!obj) return;
+ if (node.nocheck === true) {
+ obj.hide();
+ } else {
+ obj.show();
+ }
+ obj.removeClass();
+ obj.addClass(view.makeChkClass(setting, node));
+ },
+ setParentNodeCheckBox: function(setting, node, value, srcNode) {
+ var childKey = setting.data.key.children,
+ checkedKey = setting.data.key.checked,
+ checkObj = $$(node, consts.id.CHECK, setting);
+ if (!srcNode) srcNode = node;
+ data.makeChkFlag(setting, node);
+ if (node.nocheck !== true && node.chkDisabled !== true) {
+ node[checkedKey] = value;
+ view.setChkClass(setting, checkObj, node);
+ if (setting.check.autoCheckTrigger && node != srcNode) {
+ setting.treeObj.trigger(consts.event.CHECK, [null, setting.treeId, node]);
+ }
+ }
+ if (node.parentTId) {
+ var pSign = true;
+ if (!value) {
+ var pNodes = node.getParentNode()[childKey];
+ for (var i = 0, l = pNodes.length; i < l; i++) {
+ if ((pNodes[i].nocheck !== true && pNodes[i].chkDisabled !== true && pNodes[i][checkedKey])
+ || ((pNodes[i].nocheck === true || pNodes[i].chkDisabled === true) && pNodes[i].check_Child_State > 0)) {
+ pSign = false;
+ break;
+ }
+ }
+ }
+ if (pSign) {
+ view.setParentNodeCheckBox(setting, node.getParentNode(), value, srcNode);
+ }
+ }
+ },
+ setSonNodeCheckBox: function(setting, node, value, srcNode) {
+ if (!node) return;
+ var childKey = setting.data.key.children,
+ checkedKey = setting.data.key.checked,
+ checkObj = $$(node, consts.id.CHECK, setting);
+ if (!srcNode) srcNode = node;
+
+ var hasDisable = false;
+ if (node[childKey]) {
+ for (var i = 0, l = node[childKey].length; i < l && node.chkDisabled !== true; i++) {
+ var sNode = node[childKey][i];
+ view.setSonNodeCheckBox(setting, sNode, value, srcNode);
+ if (sNode.chkDisabled === true) hasDisable = true;
+ }
+ }
+
+ if (node != data.getRoot(setting) && node.chkDisabled !== true) {
+ if (hasDisable && node.nocheck !== true) {
+ data.makeChkFlag(setting, node);
+ }
+ if (node.nocheck !== true && node.chkDisabled !== true) {
+ node[checkedKey] = value;
+ if (!hasDisable) node.check_Child_State = (node[childKey] && node[childKey].length > 0) ? (value ? 2 : 0) : -1;
+ } else {
+ node.check_Child_State = -1;
+ }
+ view.setChkClass(setting, checkObj, node);
+ if (setting.check.autoCheckTrigger && node != srcNode && node.nocheck !== true && node.chkDisabled !== true) {
+ setting.treeObj.trigger(consts.event.CHECK, [null, setting.treeId, node]);
+ }
+ }
+
+ }
+ },
+
+ _z = {
+ tools: _tools,
+ view: _view,
+ event: _event,
+ data: _data
+ };
+ $.extend(true, $.fn.zTree.consts, _consts);
+ $.extend(true, $.fn.zTree._z, _z);
+
+ var zt = $.fn.zTree,
+ tools = zt._z.tools,
+ consts = zt.consts,
+ view = zt._z.view,
+ data = zt._z.data,
+ event = zt._z.event,
+ $$ = tools.$;
+
+ data.exSetting(_setting);
+ data.addInitBind(_bindEvent);
+ data.addInitUnBind(_unbindEvent);
+ data.addInitCache(_initCache);
+ data.addInitNode(_initNode);
+ data.addInitProxy(_eventProxy, true);
+ data.addInitRoot(_initRoot);
+ data.addBeforeA(_beforeA);
+ data.addZTreeTools(_zTreeTools);
+
+ var _createNodes = view.createNodes;
+ view.createNodes = function(setting, level, nodes, parentNode) {
+ if (_createNodes) _createNodes.apply(view, arguments);
+ if (!nodes) return;
+ view.repairParentChkClassWithSelf(setting, parentNode);
+ }
+ var _removeNode = view.removeNode;
+ view.removeNode = function(setting, node) {
+ var parentNode = node.getParentNode();
+ if (_removeNode) _removeNode.apply(view, arguments);
+ if (!node || !parentNode) return;
+ view.repairChkClass(setting, parentNode);
+ view.repairParentChkClass(setting, parentNode);
+ }
+
+ var _appendNodes = view.appendNodes;
+ view.appendNodes = function(setting, level, nodes, parentNode, initFlag, openFlag) {
+ var html = "";
+ if (_appendNodes) {
+ html = _appendNodes.apply(view, arguments);
+ }
+ if (parentNode) {
+ data.makeChkFlag(setting, parentNode);
+ }
+ return html;
+ }
+})(jQuery);
+/*
+ * JQuery zTree exedit v3.5.16
+ * http://zTree.me/
+ *
+ * Copyright (c) 2010 Hunter.z
+ *
+ * Licensed same as jquery - MIT License
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * email: hunter.z@263.net
+ * Date: 2014-03-09
+ */
+(function($){
+ //default consts of exedit
+ var _consts = {
+ event: {
+ DRAG: "ztree_drag",
+ DROP: "ztree_drop",
+ RENAME: "ztree_rename",
+ DRAGMOVE:"ztree_dragmove"
+ },
+ id: {
+ EDIT: "_edit",
+ INPUT: "_input",
+ REMOVE: "_remove"
+ },
+ move: {
+ TYPE_INNER: "inner",
+ TYPE_PREV: "prev",
+ TYPE_NEXT: "next"
+ },
+ node: {
+ CURSELECTED_EDIT: "curSelectedNode_Edit",
+ TMPTARGET_TREE: "tmpTargetzTree",
+ TMPTARGET_NODE: "tmpTargetNode"
+ }
+ },
+ //default setting of exedit
+ _setting = {
+ edit: {
+ enable: false,
+ editNameSelectAll: false,
+ showRemoveBtn: true,
+ showRenameBtn: true,
+ removeTitle: "remove",
+ renameTitle: "rename",
+ drag: {
+ autoExpandTrigger: false,
+ isCopy: true,
+ isMove: true,
+ prev: true,
+ next: true,
+ inner: true,
+ minMoveSize: 5,
+ borderMax: 10,
+ borderMin: -5,
+ maxShowNodeNum: 5,
+ autoOpenTime: 500
+ }
+ },
+ view: {
+ addHoverDom: null,
+ removeHoverDom: null
+ },
+ callback: {
+ beforeDrag:null,
+ beforeDragOpen:null,
+ beforeDrop:null,
+ beforeEditName:null,
+ beforeRename:null,
+ onDrag:null,
+ onDragMove:null,
+ onDrop:null,
+ onRename:null
+ }
+ },
+ //default root of exedit
+ _initRoot = function (setting) {
+ var r = data.getRoot(setting), rs = data.getRoots();
+ r.curEditNode = null;
+ r.curEditInput = null;
+ r.curHoverNode = null;
+ r.dragFlag = 0;
+ r.dragNodeShowBefore = [];
+ r.dragMaskList = new Array();
+ rs.showHoverDom = true;
+ },
+ //default cache of exedit
+ _initCache = function(treeId) {},
+ //default bind event of exedit
+ _bindEvent = function(setting) {
+ var o = setting.treeObj;
+ var c = consts.event;
+ o.bind(c.RENAME, function (event, treeId, treeNode, isCancel) {
+ tools.apply(setting.callback.onRename, [event, treeId, treeNode, isCancel]);
+ });
+
+ o.bind(c.DRAG, function (event, srcEvent, treeId, treeNodes) {
+ tools.apply(setting.callback.onDrag, [srcEvent, treeId, treeNodes]);
+ });
+
+ o.bind(c.DRAGMOVE,function(event, srcEvent, treeId, treeNodes){
+ tools.apply(setting.callback.onDragMove,[srcEvent, treeId, treeNodes]);
+ });
+
+ o.bind(c.DROP, function (event, srcEvent, treeId, treeNodes, targetNode, moveType, isCopy) {
+ tools.apply(setting.callback.onDrop, [srcEvent, treeId, treeNodes, targetNode, moveType, isCopy]);
+ });
+ },
+ _unbindEvent = function(setting) {
+ var o = setting.treeObj;
+ var c = consts.event;
+ o.unbind(c.RENAME);
+ o.unbind(c.DRAG);
+ o.unbind(c.DRAGMOVE);
+ o.unbind(c.DROP);
+ },
+ //default event proxy of exedit
+ _eventProxy = function(e) {
+ var target = e.target,
+ setting = data.getSetting(e.data.treeId),
+ relatedTarget = e.relatedTarget,
+ tId = "", node = null,
+ nodeEventType = "", treeEventType = "",
+ nodeEventCallback = null, treeEventCallback = null,
+ tmp = null;
+
+ if (tools.eqs(e.type, "mouseover")) {
+ tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
+ if (tmp) {
+ tId = tools.getNodeMainDom(tmp).id;
+ nodeEventType = "hoverOverNode";
+ }
+ } else if (tools.eqs(e.type, "mouseout")) {
+ tmp = tools.getMDom(setting, relatedTarget, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
+ if (!tmp) {
+ tId = "remove";
+ nodeEventType = "hoverOutNode";
+ }
+ } else if (tools.eqs(e.type, "mousedown")) {
+ tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
+ if (tmp) {
+ tId = tools.getNodeMainDom(tmp).id;
+ nodeEventType = "mousedownNode";
+ }
+ }
+ if (tId.length>0) {
+ node = data.getNodeCache(setting, tId);
+ switch (nodeEventType) {
+ case "mousedownNode" :
+ nodeEventCallback = _handler.onMousedownNode;
+ break;
+ case "hoverOverNode" :
+ nodeEventCallback = _handler.onHoverOverNode;
+ break;
+ case "hoverOutNode" :
+ nodeEventCallback = _handler.onHoverOutNode;
+ break;
+ }
+ }
+ var proxyResult = {
+ stop: false,
+ node: node,
+ nodeEventType: nodeEventType,
+ nodeEventCallback: nodeEventCallback,
+ treeEventType: treeEventType,
+ treeEventCallback: treeEventCallback
+ };
+ return proxyResult
+ },
+ //default init node of exedit
+ _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {
+ if (!n) return;
+ n.isHover = false;
+ n.editNameFlag = false;
+ },
+ //update zTreeObj, add method of edit
+ _zTreeTools = function(setting, zTreeTools) {
+ zTreeTools.cancelEditName = function(newName) {
+ var root = data.getRoot(this.setting);
+ if (!root.curEditNode) return;
+ view.cancelCurEditNode(this.setting, newName?newName:null, true);
+ }
+ zTreeTools.copyNode = function(targetNode, node, moveType, isSilent) {
+ if (!node) return null;
+ if (targetNode && !targetNode.isParent && this.setting.data.keep.leaf && moveType === consts.move.TYPE_INNER) return null;
+ var _this = this,
+ newNode = tools.clone(node);
+ if (!targetNode) {
+ targetNode = null;
+ moveType = consts.move.TYPE_INNER;
+ }
+ if (moveType == consts.move.TYPE_INNER) {
+ function copyCallback() {
+ view.addNodes(_this.setting, targetNode, [newNode], isSilent);
+ }
+
+ if (tools.canAsync(this.setting, targetNode)) {
+ view.asyncNode(this.setting, targetNode, isSilent, copyCallback);
+ } else {
+ copyCallback();
+ }
+ } else {
+ view.addNodes(this.setting, targetNode.parentNode, [newNode], isSilent);
+ view.moveNode(this.setting, targetNode, newNode, moveType, false, isSilent);
+ }
+ return newNode;
+ }
+ zTreeTools.editName = function(node) {
+ if (!node || !node.tId || node !== data.getNodeCache(this.setting, node.tId)) return;
+ if (node.parentTId) view.expandCollapseParentNode(this.setting, node.getParentNode(), true);
+ view.editNode(this.setting, node)
+ }
+ zTreeTools.moveNode = function(targetNode, node, moveType, isSilent) {
+ if (!node) return node;
+ if (targetNode && !targetNode.isParent && this.setting.data.keep.leaf && moveType === consts.move.TYPE_INNER) {
+ return null;
+ } else if (targetNode && ((node.parentTId == targetNode.tId && moveType == consts.move.TYPE_INNER) || $$(node, this.setting).find("#" + targetNode.tId).length > 0)) {
+ return null;
+ } else if (!targetNode) {
+ targetNode = null;
+ }
+ var _this = this;
+ function moveCallback() {
+ view.moveNode(_this.setting, targetNode, node, moveType, false, isSilent);
+ }
+ if (tools.canAsync(this.setting, targetNode) && moveType === consts.move.TYPE_INNER) {
+ view.asyncNode(this.setting, targetNode, isSilent, moveCallback);
+ } else {
+ moveCallback();
+ }
+ return node;
+ }
+ zTreeTools.setEditable = function(editable) {
+ this.setting.edit.enable = editable;
+ return this.refresh();
+ }
+ },
+ //method of operate data
+ _data = {
+ setSonNodeLevel: function(setting, parentNode, node) {
+ if (!node) return;
+ var childKey = setting.data.key.children;
+ node.level = (parentNode)? parentNode.level + 1 : 0;
+ if (!node[childKey]) return;
+ for (var i = 0, l = node[childKey].length; i < l; i++) {
+ if (node[childKey][i]) data.setSonNodeLevel(setting, node, node[childKey][i]);
+ }
+ }
+ },
+ //method of event proxy
+ _event = {
+
+ },
+ //method of event handler
+ _handler = {
+ onHoverOverNode: function(event, node) {
+ var setting = data.getSetting(event.data.treeId),
+ root = data.getRoot(setting);
+ if (root.curHoverNode != node) {
+ _handler.onHoverOutNode(event);
+ }
+ root.curHoverNode = node;
+ view.addHoverDom(setting, node);
+ },
+ onHoverOutNode: function(event, node) {
+ var setting = data.getSetting(event.data.treeId),
+ root = data.getRoot(setting);
+ if (root.curHoverNode && !data.isSelectedNode(setting, root.curHoverNode)) {
+ view.removeTreeDom(setting, root.curHoverNode);
+ root.curHoverNode = null;
+ }
+ },
+ onMousedownNode: function(eventMouseDown, _node) {
+ var i,l,
+ setting = data.getSetting(eventMouseDown.data.treeId),
+ root = data.getRoot(setting), roots = data.getRoots();
+ //right click can't drag & drop
+ if (eventMouseDown.button == 2 || !setting.edit.enable || (!setting.edit.drag.isCopy && !setting.edit.drag.isMove)) return true;
+
+ //input of edit node name can't drag & drop
+ var target = eventMouseDown.target,
+ _nodes = data.getRoot(setting).curSelectedList,
+ nodes = [];
+ if (!data.isSelectedNode(setting, _node)) {
+ nodes = [_node];
+ } else {
+ for (i=0, l=_nodes.length; i<l; i++) {
+ if (_nodes[i].editNameFlag && tools.eqs(target.tagName, "input") && target.getAttribute("treeNode"+consts.id.INPUT) !== null) {
+ return true;
+ }
+ nodes.push(_nodes[i]);
+ if (nodes[0].parentTId !== _nodes[i].parentTId) {
+ nodes = [_node];
+ break;
+ }
+ }
+ }
+
+ view.editNodeBlur = true;
+ view.cancelCurEditNode(setting);
+
+ var doc = $(setting.treeObj.get(0).ownerDocument),
+ body = $(setting.treeObj.get(0).ownerDocument.body), curNode, tmpArrow, tmpTarget,
+ isOtherTree = false,
+ targetSetting = setting,
+ sourceSetting = setting,
+ preNode, nextNode,
+ preTmpTargetNodeId = null,
+ preTmpMoveType = null,
+ tmpTargetNodeId = null,
+ moveType = consts.move.TYPE_INNER,
+ mouseDownX = eventMouseDown.clientX,
+ mouseDownY = eventMouseDown.clientY,
+ startTime = (new Date()).getTime();
+
+ if (tools.uCanDo(setting)) {
+ doc.bind("mousemove", _docMouseMove);
+ }
+ function _docMouseMove(event) {
+ //avoid start drag after click node
+ if (root.dragFlag == 0 && Math.abs(mouseDownX - event.clientX) < setting.edit.drag.minMoveSize
+ && Math.abs(mouseDownY - event.clientY) < setting.edit.drag.minMoveSize) {
+ return true;
+ }
+ var i, l, tmpNode, tmpDom, tmpNodes,
+ childKey = setting.data.key.children;
+ body.css("cursor", "pointer");
+
+ if (root.dragFlag == 0) {
+ if (tools.apply(setting.callback.beforeDrag, [setting.treeId, nodes], true) == false) {
+ _docMouseUp(event);
+ return true;
+ }
+
+ for (i=0, l=nodes.length; i<l; i++) {
+ if (i==0) {
+ root.dragNodeShowBefore = [];
+ }
+ tmpNode = nodes[i];
+ if (tmpNode.isParent && tmpNode.open) {
+ view.expandCollapseNode(setting, tmpNode, !tmpNode.open);
+ root.dragNodeShowBefore[tmpNode.tId] = true;
+ } else {
+ root.dragNodeShowBefore[tmpNode.tId] = false;
+ }
+ }
+
+ root.dragFlag = 1;
+ roots.showHoverDom = false;
+ tools.showIfameMask(setting, true);
+
+ //sort
+ var isOrder = true, lastIndex = -1;
+ if (nodes.length>1) {
+ var pNodes = nodes[0].parentTId ? nodes[0].getParentNode()[childKey] : data.getNodes(setting);
+ tmpNodes = [];
+ for (i=0, l=pNodes.length; i<l; i++) {
+ if (root.dragNodeShowBefore[pNodes[i].tId] !== undefined) {
+ if (isOrder && lastIndex > -1 && (lastIndex+1) !== i) {
+ isOrder = false;
+ }
+ tmpNodes.push(pNodes[i]);
+ lastIndex = i;
+ }
+ if (nodes.length === tmpNodes.length) {
+ nodes = tmpNodes;
+ break;
+ }
+ }
+ }
+ if (isOrder) {
+ preNode = nodes[0].getPreNode();
+ nextNode = nodes[nodes.length-1].getNextNode();
+ }
+
+ //set node in selected
+ curNode = $$("<ul class='zTreeDragUL'></ul>", setting);
+ for (i=0, l=nodes.length; i<l; i++) {
+ tmpNode = nodes[i];
+ tmpNode.editNameFlag = false;
+ view.selectNode(setting, tmpNode, i>0);
+ view.removeTreeDom(setting, tmpNode);
+
+ if (i > setting.edit.drag.maxShowNodeNum-1) {
+ continue;
+ }
+
+ tmpDom = $$("<li id='"+ tmpNode.tId +"_tmp'></li>", setting);
+ tmpDom.append($$(tmpNode, consts.id.A, setting).clone());
+ tmpDom.css("padding", "0");
+ tmpDom.children("#" + tmpNode.tId + consts.id.A).removeClass(consts.node.CURSELECTED);
+ curNode.append(tmpDom);
+ if (i == setting.edit.drag.maxShowNodeNum-1) {
+ tmpDom = $$("<li id='"+ tmpNode.tId +"_moretmp'><a> ... </a></li>", setting);
+ curNode.append(tmpDom);
+ }
+ }
+ curNode.attr("id", nodes[0].tId + consts.id.UL + "_tmp");
+ curNode.addClass(setting.treeObj.attr("class"));
+ curNode.appendTo(body);
+
+ tmpArrow = $$("<span class='tmpzTreeMove_arrow'></span>", setting);
+ tmpArrow.attr("id", "zTreeMove_arrow_tmp");
+ tmpArrow.appendTo(body);
+
+ setting.treeObj.trigger(consts.event.DRAG, [event, setting.treeId, nodes]);
+ }
+
+ if (root.dragFlag == 1) {
+ if (tmpTarget && tmpArrow.attr("id") == event.target.id && tmpTargetNodeId && (event.clientX + doc.scrollLeft()+2) > ($("#" + tmpTargetNodeId + consts.id.A, tmpTarget).offset().left)) {
+ var xT = $("#" + tmpTargetNodeId + consts.id.A, tmpTarget);
+ event.target = (xT.length > 0) ? xT.get(0) : event.target;
+ } else if (tmpTarget) {
+ tmpTarget.removeClass(consts.node.TMPTARGET_TREE);
+ if (tmpTargetNodeId) $("#" + tmpTargetNodeId + consts.id.A, tmpTarget).removeClass(consts.node.TMPTARGET_NODE + "_" + consts.move.TYPE_PREV)
+ .removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_NEXT).removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_INNER);
+ }
+ tmpTarget = null;
+ tmpTargetNodeId = null;
+
+ //judge drag & drop in multi ztree
+ isOtherTree = false;
+ targetSetting = setting;
+ var settings = data.getSettings();
+ for (var s in settings) {
+ if (settings[s].treeId && settings[s].edit.enable && settings[s].treeId != setting.treeId
+ && (event.target.id == settings[s].treeId || $(event.target).parents("#" + settings[s].treeId).length>0)) {
+ isOtherTree = true;
+ targetSetting = settings[s];
+ }
+ }
+
+ var docScrollTop = doc.scrollTop(),
+ docScrollLeft = doc.scrollLeft(),
+ treeOffset = targetSetting.treeObj.offset(),
+ scrollHeight = targetSetting.treeObj.get(0).scrollHeight,
+ scrollWidth = targetSetting.treeObj.get(0).scrollWidth,
+ dTop = (event.clientY + docScrollTop - treeOffset.top),
+ dBottom = (targetSetting.treeObj.height() + treeOffset.top - event.clientY - docScrollTop),
+ dLeft = (event.clientX + docScrollLeft - treeOffset.left),
+ dRight = (targetSetting.treeObj.width() + treeOffset.left - event.clientX - docScrollLeft),
+ isTop = (dTop < setting.edit.drag.borderMax && dTop > setting.edit.drag.borderMin),
+ isBottom = (dBottom < setting.edit.drag.borderMax && dBottom > setting.edit.drag.borderMin),
+ isLeft = (dLeft < setting.edit.drag.borderMax && dLeft > setting.edit.drag.borderMin),
+ isRight = (dRight < setting.edit.drag.borderMax && dRight > setting.edit.drag.borderMin),
+ isTreeInner = dTop > setting.edit.drag.borderMin && dBottom > setting.edit.drag.borderMin && dLeft > setting.edit.drag.borderMin && dRight > setting.edit.drag.borderMin,
+ isTreeTop = (isTop && targetSetting.treeObj.scrollTop() <= 0),
+ isTreeBottom = (isBottom && (targetSetting.treeObj.scrollTop() + targetSetting.treeObj.height()+10) >= scrollHeight),
+ isTreeLeft = (isLeft && targetSetting.treeObj.scrollLeft() <= 0),
+ isTreeRight = (isRight && (targetSetting.treeObj.scrollLeft() + targetSetting.treeObj.width()+10) >= scrollWidth);
+
+ if (event.target && tools.isChildOrSelf(event.target, targetSetting.treeId)) {
+ //get node <li> dom
+ var targetObj = event.target;
+ while (targetObj && targetObj.tagName && !tools.eqs(targetObj.tagName, "li") && targetObj.id != targetSetting.treeId) {
+ targetObj = targetObj.parentNode;
+ }
+
+ var canMove = true;
+ //don't move to self or children of self
+ for (i=0, l=nodes.length; i<l; i++) {
+ tmpNode = nodes[i];
+ if (targetObj.id === tmpNode.tId) {
+ canMove = false;
+ break;
+ } else if ($$(tmpNode, setting).find("#" + targetObj.id).length > 0) {
+ canMove = false;
+ break;
+ }
+ }
+ if (canMove && event.target && tools.isChildOrSelf(event.target, targetObj.id + consts.id.A)) {
+ tmpTarget = $(targetObj);
+ tmpTargetNodeId = targetObj.id;
+ }
+ }
+
+ //the mouse must be in zTree
+ tmpNode = nodes[0];
+ if (isTreeInner && tools.isChildOrSelf(event.target, targetSetting.treeId)) {
+ //judge mouse move in root of ztree
+ if (!tmpTarget && (event.target.id == targetSetting.treeId || isTreeTop || isTreeBottom || isTreeLeft || isTreeRight) && (isOtherTree || (!isOtherTree && tmpNode.parentTId))) {
+ tmpTarget = targetSetting.treeObj;
+ }
+ //auto scroll top
+ if (isTop) {
+ targetSetting.treeObj.scrollTop(targetSetting.treeObj.scrollTop()-10);
+ } else if (isBottom) {
+ targetSetting.treeObj.scrollTop(targetSetting.treeObj.scrollTop()+10);
+ }
+ if (isLeft) {
+ targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()-10);
+ } else if (isRight) {
+ targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()+10);
+ }
+ //auto scroll left
+ if (tmpTarget && tmpTarget != targetSetting.treeObj && tmpTarget.offset().left < targetSetting.treeObj.offset().left) {
+ targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()+ tmpTarget.offset().left - targetSetting.treeObj.offset().left);
+ }
+ }
+
+ curNode.css({
+ "top": (event.clientY + docScrollTop + 3) + "px",
+ "left": (event.clientX + docScrollLeft + 3) + "px"
+ });
+
+ var dX = 0;
+ var dY = 0;
+ if (tmpTarget && tmpTarget.attr("id")!=targetSetting.treeId) {
+ var tmpTargetNode = tmpTargetNodeId == null ? null: data.getNodeCache(targetSetting, tmpTargetNodeId),
+ isCopy = ((event.ctrlKey || event.metaKey) && setting.edit.drag.isMove && setting.edit.drag.isCopy) || (!setting.edit.drag.isMove && setting.edit.drag.isCopy),
+ isPrev = !!(preNode && tmpTargetNodeId === preNode.tId),
+ isNext = !!(nextNode && tmpTargetNodeId === nextNode.tId),
+ isInner = (tmpNode.parentTId && tmpNode.parentTId == tmpTargetNodeId),
+ canPrev = (isCopy || !isNext) && tools.apply(targetSetting.edit.drag.prev, [targetSetting.treeId, nodes, tmpTargetNode], !!targetSetting.edit.drag.prev),
+ canNext = (isCopy || !isPrev) && tools.apply(targetSetting.edit.drag.next, [targetSetting.treeId, nodes, tmpTargetNode], !!targetSetting.edit.drag.next),
+ canInner = (isCopy || !isInner) && !(targetSetting.data.keep.leaf && !tmpTargetNode.isParent) && tools.apply(targetSetting.edit.drag.inner, [targetSetting.treeId, nodes, tmpTargetNode], !!targetSetting.edit.drag.inner);
+ if (!canPrev && !canNext && !canInner) {
+ tmpTarget = null;
+ tmpTargetNodeId = "";
+ moveType = consts.move.TYPE_INNER;
+ tmpArrow.css({
+ "display":"none"
+ });
+ if (window.zTreeMoveTimer) {
+ clearTimeout(window.zTreeMoveTimer);
+ window.zTreeMoveTargetNodeTId = null
+ }
+ } else {
+ var tmpTargetA = $("#" + tmpTargetNodeId + consts.id.A, tmpTarget),
+ tmpNextA = tmpTargetNode.isLastNode ? null : $("#" + tmpTargetNode.getNextNode().tId + consts.id.A, tmpTarget.next()),
+ tmpTop = tmpTargetA.offset().top,
+ tmpLeft = tmpTargetA.offset().left,
+ prevPercent = canPrev ? (canInner ? 0.25 : (canNext ? 0.5 : 1) ) : -1,
+ nextPercent = canNext ? (canInner ? 0.75 : (canPrev ? 0.5 : 0) ) : -1,
+ dY_percent = (event.clientY + docScrollTop - tmpTop)/tmpTargetA.height();
+ if ((prevPercent==1 ||dY_percent<=prevPercent && dY_percent>=-.2) && canPrev) {
+ dX = 1 - tmpArrow.width();
+ dY = tmpTop - tmpArrow.height()/2;
+ moveType = consts.move.TYPE_PREV;
+ } else if ((nextPercent==0 || dY_percent>=nextPercent && dY_percent<=1.2) && canNext) {
+ dX = 1 - tmpArrow.width();
+ dY = (tmpNextA == null || (tmpTargetNode.isParent && tmpTargetNode.open)) ? (tmpTop + tmpTargetA.height() - tmpArrow.height()/2) : (tmpNextA.offset().top - tmpArrow.height()/2);
+ moveType = consts.move.TYPE_NEXT;
+ }else {
+ dX = 5 - tmpArrow.width();
+ dY = tmpTop;
+ moveType = consts.move.TYPE_INNER;
+ }
+ tmpArrow.css({
+ "display":"block",
+ "top": dY + "px",
+ "left": (tmpLeft + dX) + "px"
+ });
+ tmpTargetA.addClass(consts.node.TMPTARGET_NODE + "_" + moveType);
+
+ if (preTmpTargetNodeId != tmpTargetNodeId || preTmpMoveType != moveType) {
+ startTime = (new Date()).getTime();
+ }
+ if (tmpTargetNode && tmpTargetNode.isParent && moveType == consts.move.TYPE_INNER) {
+ var startTimer = true;
+ if (window.zTreeMoveTimer && window.zTreeMoveTargetNodeTId !== tmpTargetNode.tId) {
+ clearTimeout(window.zTreeMoveTimer);
+ window.zTreeMoveTargetNodeTId = null;
+ }else if (window.zTreeMoveTimer && window.zTreeMoveTargetNodeTId === tmpTargetNode.tId) {
+ startTimer = false;
+ }
+ if (startTimer) {
+ window.zTreeMoveTimer = setTimeout(function() {
+ if (moveType != consts.move.TYPE_INNER) return;
+ if (tmpTargetNode && tmpTargetNode.isParent && !tmpTargetNode.open && (new Date()).getTime() - startTime > targetSetting.edit.drag.autoOpenTime
+ && tools.apply(targetSetting.callback.beforeDragOpen, [targetSetting.treeId, tmpTargetNode], true)) {
+ view.switchNode(targetSetting, tmpTargetNode);
+ if (targetSetting.edit.drag.autoExpandTrigger) {
+ targetSetting.treeObj.trigger(consts.event.EXPAND, [targetSetting.treeId, tmpTargetNode]);
+ }
+ }
+ }, targetSetting.edit.drag.autoOpenTime+50);
+ window.zTreeMoveTargetNodeTId = tmpTargetNode.tId;
+ }
+ }
+ }
+ } else {
+ moveType = consts.move.TYPE_INNER;
+ if (tmpTarget && tools.apply(targetSetting.edit.drag.inner, [targetSetting.treeId, nodes, null], !!targetSetting.edit.drag.inner)) {
+ tmpTarget.addClass(consts.node.TMPTARGET_TREE);
+ } else {
+ tmpTarget = null;
+ }
+ tmpArrow.css({
+ "display":"none"
+ });
+ if (window.zTreeMoveTimer) {
+ clearTimeout(window.zTreeMoveTimer);
+ window.zTreeMoveTargetNodeTId = null;
+ }
+ }
+ preTmpTargetNodeId = tmpTargetNodeId;
+ preTmpMoveType = moveType;
+
+ setting.treeObj.trigger(consts.event.DRAGMOVE, [event, setting.treeId, nodes]);
+ }
+ return false;
+ }
+
+ doc.bind("mouseup", _docMouseUp);
+ function _docMouseUp(event) {
+ if (window.zTreeMoveTimer) {
+ clearTimeout(window.zTreeMoveTimer);
+ window.zTreeMoveTargetNodeTId = null;
+ }
+ preTmpTargetNodeId = null;
+ preTmpMoveType = null;
+ doc.unbind("mousemove", _docMouseMove);
+ doc.unbind("mouseup", _docMouseUp);
+ doc.unbind("selectstart", _docSelect);
+ body.css("cursor", "auto");
+ if (tmpTarget) {
+ tmpTarget.removeClass(consts.node.TMPTARGET_TREE);
+ if (tmpTargetNodeId) $("#" + tmpTargetNodeId + consts.id.A, tmpTarget).removeClass(consts.node.TMPTARGET_NODE + "_" + consts.move.TYPE_PREV)
+ .removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_NEXT).removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_INNER);
+ }
+ tools.showIfameMask(setting, false);
+
+ roots.showHoverDom = true;
+ if (root.dragFlag == 0) return;
+ root.dragFlag = 0;
+
+ var i, l, tmpNode;
+ for (i=0, l=nodes.length; i<l; i++) {
+ tmpNode = nodes[i];
+ if (tmpNode.isParent && root.dragNodeShowBefore[tmpNode.tId] && !tmpNode.open) {
+ view.expandCollapseNode(setting, tmpNode, !tmpNode.open);
+ delete root.dragNodeShowBefore[tmpNode.tId];
+ }
+ }
+
+ if (curNode) curNode.remove();
+ if (tmpArrow) tmpArrow.remove();
+
+ var isCopy = ((event.ctrlKey || event.metaKey) && setting.edit.drag.isMove && setting.edit.drag.isCopy) || (!setting.edit.drag.isMove && setting.edit.drag.isCopy);
+ if (!isCopy && tmpTarget && tmpTargetNodeId && nodes[0].parentTId && tmpTargetNodeId==nodes[0].parentTId && moveType == consts.move.TYPE_INNER) {
+ tmpTarget = null;
+ }
+ if (tmpTarget) {
+ var dragTargetNode = tmpTargetNodeId == null ? null: data.getNodeCache(targetSetting, tmpTargetNodeId);
+ if (tools.apply(setting.callback.beforeDrop, [targetSetting.treeId, nodes, dragTargetNode, moveType, isCopy], true) == false) {
+ view.selectNodes(sourceSetting, nodes);
+ return;
+ }
+ var newNodes = isCopy ? tools.clone(nodes) : nodes;
+
+ function dropCallback() {
+ if (isOtherTree) {
+ if (!isCopy) {
+ for(var i=0, l=nodes.length; i<l; i++) {
+ view.removeNode(setting, nodes[i]);
+ }
+ }
+ if (moveType == consts.move.TYPE_INNER) {
+ view.addNodes(targetSetting, dragTargetNode, newNodes);
+ } else {
+ view.addNodes(targetSetting, dragTargetNode.getParentNode(), newNodes);
+ if (moveType == consts.move.TYPE_PREV) {
+ for (i=0, l=newNodes.length; i<l; i++) {
+ view.moveNode(targetSetting, dragTargetNode, newNodes[i], moveType, false);
+ }
+ } else {
+ for (i=-1, l=newNodes.length-1; i<l; l--) {
+ view.moveNode(targetSetting, dragTargetNode, newNodes[l], moveType, false);
+ }
+ }
+ }
+ } else {
+ if (isCopy && moveType == consts.move.TYPE_INNER) {
+ view.addNodes(targetSetting, dragTargetNode, newNodes);
+ } else {
+ if (isCopy) {
+ view.addNodes(targetSetting, dragTargetNode.getParentNode(), newNodes);
+ }
+ if (moveType != consts.move.TYPE_NEXT) {
+ for (i=0, l=newNodes.length; i<l; i++) {
+ view.moveNode(targetSetting, dragTargetNode, newNodes[i], moveType, false);
+ }
+ } else {
+ for (i=-1, l=newNodes.length-1; i<l; l--) {
+ view.moveNode(targetSetting, dragTargetNode, newNodes[l], moveType, false);
+ }
+ }
+ }
+ }
+ view.selectNodes(targetSetting, newNodes);
+ $$(newNodes[0], setting).focus().blur();
+
+ setting.treeObj.trigger(consts.event.DROP, [event, targetSetting.treeId, newNodes, dragTargetNode, moveType, isCopy]);
+ }
+
+ if (moveType == consts.move.TYPE_INNER && tools.canAsync(targetSetting, dragTargetNode)) {
+ view.asyncNode(targetSetting, dragTargetNode, false, dropCallback);
+ } else {
+ dropCallback();
+ }
+
+ } else {
+ view.selectNodes(sourceSetting, nodes);
+ setting.treeObj.trigger(consts.event.DROP, [event, setting.treeId, nodes, null, null, null]);
+ }
+ }
+
+ doc.bind("selectstart", _docSelect);
+ function _docSelect() {
+ return false;
+ }
+
+ //Avoid FireFox's Bug
+ //If zTree Div CSS set 'overflow', so drag node outside of zTree, and event.target is error.
+ if(eventMouseDown.preventDefault) {
+ eventMouseDown.preventDefault();
+ }
+ return true;
+ }
+ },
+ //method of tools for zTree
+ _tools = {
+ getAbs: function (obj) {
+ var oRect = obj.getBoundingClientRect(),
+ scrollTop = document.body.scrollTop+document.documentElement.scrollTop,
+ scrollLeft = document.body.scrollLeft+document.documentElement.scrollLeft;
+ return [oRect.left+scrollLeft,oRect.top+scrollTop];
+ },
+ inputFocus: function(inputObj) {
+ if (inputObj.get(0)) {
+ inputObj.focus();
+ tools.setCursorPosition(inputObj.get(0), inputObj.val().length);
+ }
+ },
+ inputSelect: function(inputObj) {
+ if (inputObj.get(0)) {
+ inputObj.focus();
+ inputObj.select();
+ }
+ },
+ setCursorPosition: function(obj, pos){
+ if(obj.setSelectionRange) {
+ obj.focus();
+ obj.setSelectionRange(pos,pos);
+ } else if (obj.createTextRange) {
+ var range = obj.createTextRange();
+ range.collapse(true);
+ range.moveEnd('character', pos);
+ range.moveStart('character', pos);
+ range.select();
+ }
+ },
+ showIfameMask: function(setting, showSign) {
+ var root = data.getRoot(setting);
+ //clear full mask
+ while (root.dragMaskList.length > 0) {
+ root.dragMaskList[0].remove();
+ root.dragMaskList.shift();
+ }
+ if (showSign) {
+ //show mask
+ var iframeList = $$("iframe", setting);
+ for (var i = 0, l = iframeList.length; i < l; i++) {
+ var obj = iframeList.get(i),
+ r = tools.getAbs(obj),
+ dragMask = $$("<div id='zTreeMask_" + i + "' class='zTreeMask' style='top:" + r[1] + "px; left:" + r[0] + "px; width:" + obj.offsetWidth + "px; height:" + obj.offsetHeight + "px;'></div>", setting);
+ dragMask.appendTo($$("body", setting));
+ root.dragMaskList.push(dragMask);
+ }
+ }
+ }
+ },
+ //method of operate ztree dom
+ _view = {
+ addEditBtn: function(setting, node) {
+ if (node.editNameFlag || $$(node, consts.id.EDIT, setting).length > 0) {
+ return;
+ }
+ if (!tools.apply(setting.edit.showRenameBtn, [setting.treeId, node], setting.edit.showRenameBtn)) {
+ return;
+ }
+ var aObj = $$(node, consts.id.A, setting),
+ editStr = "<span class='" + consts.className.BUTTON + " edit' id='" + node.tId + consts.id.EDIT + "' title='"+tools.apply(setting.edit.renameTitle, [setting.treeId, node], setting.edit.renameTitle)+"' treeNode"+consts.id.EDIT+" style='display:none;'></span>";
+ aObj.append(editStr);
+
+ $$(node, consts.id.EDIT, setting).bind('click',
+ function() {
+ if (!tools.uCanDo(setting) || tools.apply(setting.callback.beforeEditName, [setting.treeId, node], true) == false) return false;
+ view.editNode(setting, node);
+ return false;
+ }
+ ).show();
+ },
+ addRemoveBtn: function(setting, node) {
+ if (node.editNameFlag || $$(node, consts.id.REMOVE, setting).length > 0) {
+ return;
+ }
+ if (!tools.apply(setting.edit.showRemoveBtn, [setting.treeId, node], setting.edit.showRemoveBtn)) {
+ return;
+ }
+ var aObj = $$(node, consts.id.A, setting),
+ removeStr = "<span class='" + consts.className.BUTTON + " remove' id='" + node.tId + consts.id.REMOVE + "' title='"+tools.apply(setting.edit.removeTitle, [setting.treeId, node], setting.edit.removeTitle)+"' treeNode"+consts.id.REMOVE+" style='display:none;'></span>";
+ aObj.append(removeStr);
+
+ $$(node, consts.id.REMOVE, setting).bind('click',
+ function() {
+ if (!tools.uCanDo(setting) || tools.apply(setting.callback.beforeRemove, [setting.treeId, node], true) == false) return false;
+ view.removeNode(setting, node);
+ setting.treeObj.trigger(consts.event.REMOVE, [setting.treeId, node]);
+ return false;
+ }
+ ).bind('mousedown',
+ function(eventMouseDown) {
+ return true;
+ }
+ ).show();
+ },
+ addHoverDom: function(setting, node) {
+ if (data.getRoots().showHoverDom) {
+ node.isHover = true;
+ if (setting.edit.enable) {
+ //view.addEditBtn(setting, node);
+ view.addRemoveBtn(setting, node);
+ view.addEditBtn(setting, node);
+ }
+ tools.apply(setting.view.addHoverDom, [setting.treeId, node]);
+ }
+ },
+ cancelCurEditNode: function (setting, forceName, isCancel) {
+ var root = data.getRoot(setting),
+ nameKey = setting.data.key.name,
+ node = root.curEditNode;
+
+ if (node) {
+ var inputObj = root.curEditInput,
+ newName = forceName ? forceName:(isCancel ? node[nameKey]: inputObj.val());
+ if (tools.apply(setting.callback.beforeRename, [setting.treeId, node, newName, isCancel], true) === false) {
+ return false;
+ } else {
+ node[nameKey] = newName;
+ setting.treeObj.trigger(consts.event.RENAME, [setting.treeId, node, isCancel]);
+ }
+ var aObj = $$(node, consts.id.A, setting);
+ aObj.removeClass(consts.node.CURSELECTED_EDIT);
+ inputObj.unbind();
+ view.setNodeName(setting, node);
+ node.editNameFlag = false;
+ root.curEditNode = null;
+ root.curEditInput = null;
+ view.selectNode(setting, node, false);
+ }
+ root.noSelection = true;
+ return true;
+ },
+ editNode: function(setting, node) {
+ var root = data.getRoot(setting);
+ view.editNodeBlur = false;
+ if (data.isSelectedNode(setting, node) && root.curEditNode == node && node.editNameFlag) {
+ setTimeout(function() {tools.inputFocus(root.curEditInput);}, 0);
+ return;
+ }
+ var nameKey = setting.data.key.name;
+ node.editNameFlag = true;
+ view.removeTreeDom(setting, node);
+ view.cancelCurEditNode(setting);
+ view.selectNode(setting, node, false);
+ $$(node, consts.id.SPAN, setting).html("<input type=text class='rename' id='" + node.tId + consts.id.INPUT + "' treeNode" + consts.id.INPUT + " >");
+ var inputObj = $$(node, consts.id.INPUT, setting);
+ inputObj.attr("value", node[nameKey]);
+ if (setting.edit.editNameSelectAll) {
+ tools.inputSelect(inputObj);
+ } else {
+ tools.inputFocus(inputObj);
+ }
+
+ inputObj.bind('blur', function(event) {
+ if (!view.editNodeBlur) {
+ view.cancelCurEditNode(setting);
+ }
+ }).bind('keydown', function(event) {
+ if (event.keyCode=="13") {
+ view.editNodeBlur = true;
+ view.cancelCurEditNode(setting);
+ } else if (event.keyCode=="27") {
+ view.cancelCurEditNode(setting, null, true);
+ }
+ }).bind('click', function(event) {
+ return false;
+ }).bind('dblclick', function(event) {
+ return false;
+ });
+
+ $$(node, consts.id.A, setting).addClass(consts.node.CURSELECTED_EDIT);
+ root.curEditInput = inputObj;
+ root.noSelection = false;
+ root.curEditNode = node;
+ },
+ moveNode: function(setting, targetNode, node, moveType, animateFlag, isSilent) {
+ var root = data.getRoot(setting),
+ childKey = setting.data.key.children;
+ if (targetNode == node) return;
+ if (setting.data.keep.leaf && targetNode && !targetNode.isParent && moveType == consts.move.TYPE_INNER) return;
+ var oldParentNode = (node.parentTId ? node.getParentNode(): root),
+ targetNodeIsRoot = (targetNode === null || targetNode == root);
+ if (targetNodeIsRoot && targetNode === null) targetNode = root;
+ if (targetNodeIsRoot) moveType = consts.move.TYPE_INNER;
+ var targetParentNode = (targetNode.parentTId ? targetNode.getParentNode() : root);
+
+ if (moveType != consts.move.TYPE_PREV && moveType != consts.move.TYPE_NEXT) {
+ moveType = consts.move.TYPE_INNER;
+ }
+
+ if (moveType == consts.move.TYPE_INNER) {
+ if (targetNodeIsRoot) {
+ //parentTId of root node is null
+ node.parentTId = null;
+ } else {
+ if (!targetNode.isParent) {
+ targetNode.isParent = true;
+ targetNode.open = !!targetNode.open;
+ view.setNodeLineIcos(setting, targetNode);
+ }
+ node.parentTId = targetNode.tId;
+ }
+ }
+
+ //move node Dom
+ var targetObj, target_ulObj;
+ if (targetNodeIsRoot) {
+ targetObj = setting.treeObj;
+ target_ulObj = targetObj;
+ } else {
+ if (!isSilent && moveType == consts.move.TYPE_INNER) {
+ view.expandCollapseNode(setting, targetNode, true, false);
+ } else if (!isSilent) {
+ view.expandCollapseNode(setting, targetNode.getParentNode(), true, false);
+ }
+ targetObj = $$(targetNode, setting);
+ target_ulObj = $$(targetNode, consts.id.UL, setting);
+ if (!!targetObj.get(0) && !target_ulObj.get(0)) {
+ var ulstr = [];
+ view.makeUlHtml(setting, targetNode, ulstr, '');
+ targetObj.append(ulstr.join(''));
+ }
+ target_ulObj = $$(targetNode, consts.id.UL, setting);
+ }
+ var nodeDom = $$(node, setting);
+ if (!nodeDom.get(0)) {
+ nodeDom = view.appendNodes(setting, node.level, [node], null, false, true).join('');
+ } else if (!targetObj.get(0)) {
+ nodeDom.remove();
+ }
+ if (target_ulObj.get(0) && moveType == consts.move.TYPE_INNER) {
+ target_ulObj.append(nodeDom);
+ } else if (targetObj.get(0) && moveType == consts.move.TYPE_PREV) {
+ targetObj.before(nodeDom);
+ } else if (targetObj.get(0) && moveType == consts.move.TYPE_NEXT) {
+ targetObj.after(nodeDom);
+ }
+
+ //repair the data after move
+ var i,l,
+ tmpSrcIndex = -1,
+ tmpTargetIndex = 0,
+ oldNeighbor = null,
+ newNeighbor = null,
+ oldLevel = node.level;
+ if (node.isFirstNode) {
+ tmpSrcIndex = 0;
+ if (oldParentNode[childKey].length > 1 ) {
+ oldNeighbor = oldParentNode[childKey][1];
+ oldNeighbor.isFirstNode = true;
+ }
+ } else if (node.isLastNode) {
+ tmpSrcIndex = oldParentNode[childKey].length -1;
+ oldNeighbor = oldParentNode[childKey][tmpSrcIndex - 1];
+ oldNeighbor.isLastNode = true;
+ } else {
+ for (i = 0, l = oldParentNode[childKey].length; i < l; i++) {
+ if (oldParentNode[childKey][i].tId == node.tId) {
+ tmpSrcIndex = i;
+ break;
+ }
+ }
+ }
+ if (tmpSrcIndex >= 0) {
+ oldParentNode[childKey].splice(tmpSrcIndex, 1);
+ }
+ if (moveType != consts.move.TYPE_INNER) {
+ for (i = 0, l = targetParentNode[childKey].length; i < l; i++) {
+ if (targetParentNode[childKey][i].tId == targetNode.tId) tmpTargetIndex = i;
+ }
+ }
+ if (moveType == consts.move.TYPE_INNER) {
+ if (!targetNode[childKey]) targetNode[childKey] = new Array();
+ if (targetNode[childKey].length > 0) {
+ newNeighbor = targetNode[childKey][targetNode[childKey].length - 1];
+ newNeighbor.isLastNode = false;
+ }
+ targetNode[childKey].splice(targetNode[childKey].length, 0, node);
+ node.isLastNode = true;
+ node.isFirstNode = (targetNode[childKey].length == 1);
+ } else if (targetNode.isFirstNode && moveType == consts.move.TYPE_PREV) {
+ targetParentNode[childKey].splice(tmpTargetIndex, 0, node);
+ newNeighbor = targetNode;
+ newNeighbor.isFirstNode = false;
+ node.parentTId = targetNode.parentTId;
+ node.isFirstNode = true;
+ node.isLastNode = false;
+
+ } else if (targetNode.isLastNode && moveType == consts.move.TYPE_NEXT) {
+ targetParentNode[childKey].splice(tmpTargetIndex + 1, 0, node);
+ newNeighbor = targetNode;
+ newNeighbor.isLastNode = false;
+ node.parentTId = targetNode.parentTId;
+ node.isFirstNode = false;
+ node.isLastNode = true;
+
+ } else {
+ if (moveType == consts.move.TYPE_PREV) {
+ targetParentNode[childKey].splice(tmpTargetIndex, 0, node);
+ } else {
+ targetParentNode[childKey].splice(tmpTargetIndex + 1, 0, node);
+ }
+ node.parentTId = targetNode.parentTId;
+ node.isFirstNode = false;
+ node.isLastNode = false;
+ }
+ data.fixPIdKeyValue(setting, node);
+ data.setSonNodeLevel(setting, node.getParentNode(), node);
+
+ //repair node what been moved
+ view.setNodeLineIcos(setting, node);
+ view.repairNodeLevelClass(setting, node, oldLevel)
+
+ //repair node's old parentNode dom
+ if (!setting.data.keep.parent && oldParentNode[childKey].length < 1) {
+ //old parentNode has no child nodes
+ oldParentNode.isParent = false;
+ oldParentNode.open = false;
+ var tmp_ulObj = $$(oldParentNode, consts.id.UL, setting),
+ tmp_switchObj = $$(oldParentNode, consts.id.SWITCH, setting),
+ tmp_icoObj = $$(oldParentNode, consts.id.ICON, setting);
+ view.replaceSwitchClass(oldParentNode, tmp_switchObj, consts.folder.DOCU);
+ view.replaceIcoClass(oldParentNode, tmp_icoObj, consts.folder.DOCU);
+ tmp_ulObj.css("display", "none");
+
+ } else if (oldNeighbor) {
+ //old neigbor node
+ view.setNodeLineIcos(setting, oldNeighbor);
+ }
+
+ //new neigbor node
+ if (newNeighbor) {
+ view.setNodeLineIcos(setting, newNeighbor);
+ }
+
+ //repair checkbox / radio
+ if (!!setting.check && setting.check.enable && view.repairChkClass) {
+ view.repairChkClass(setting, oldParentNode);
+ view.repairParentChkClassWithSelf(setting, oldParentNode);
+ if (oldParentNode != node.parent)
+ view.repairParentChkClassWithSelf(setting, node);
+ }
+
+ //expand parents after move
+ if (!isSilent) {
+ view.expandCollapseParentNode(setting, node.getParentNode(), true, animateFlag);
+ }
+ },
+ removeEditBtn: function(setting, node) {
+ $$(node, consts.id.EDIT, setting).unbind().remove();
+ },
+ removeRemoveBtn: function(setting, node) {
+ $$(node, consts.id.REMOVE, setting).unbind().remove();
+ },
+ removeTreeDom: function(setting, node) {
+ node.isHover = false;
+ view.removeEditBtn(setting, node);
+ view.removeRemoveBtn(setting, node);
+ tools.apply(setting.view.removeHoverDom, [setting.treeId, node]);
+ },
+ repairNodeLevelClass: function(setting, node, oldLevel) {
+ if (oldLevel === node.level) return;
+ var liObj = $$(node, setting),
+ aObj = $$(node, consts.id.A, setting),
+ ulObj = $$(node, consts.id.UL, setting),
+ oldClass = consts.className.LEVEL + oldLevel,
+ newClass = consts.className.LEVEL + node.level;
+ liObj.removeClass(oldClass);
+ liObj.addClass(newClass);
+ aObj.removeClass(oldClass);
+ aObj.addClass(newClass);
+ ulObj.removeClass(oldClass);
+ ulObj.addClass(newClass);
+ },
+ selectNodes : function(setting, nodes) {
+ for (var i=0, l=nodes.length; i<l; i++) {
+ view.selectNode(setting, nodes[i], i>0);
+ }
+ }
+ },
+
+ _z = {
+ tools: _tools,
+ view: _view,
+ event: _event,
+ data: _data
+ };
+ $.extend(true, $.fn.zTree.consts, _consts);
+ $.extend(true, $.fn.zTree._z, _z);
+
+ var zt = $.fn.zTree,
+ tools = zt._z.tools,
+ consts = zt.consts,
+ view = zt._z.view,
+ data = zt._z.data,
+ event = zt._z.event,
+ $$ = tools.$;
+
+ data.exSetting(_setting);
+ data.addInitBind(_bindEvent);
+ data.addInitUnBind(_unbindEvent);
+ data.addInitCache(_initCache);
+ data.addInitNode(_initNode);
+ data.addInitProxy(_eventProxy);
+ data.addInitRoot(_initRoot);
+ data.addZTreeTools(_zTreeTools);
+
+ var _cancelPreSelectedNode = view.cancelPreSelectedNode;
+ view.cancelPreSelectedNode = function (setting, node) {
+ var list = data.getRoot(setting).curSelectedList;
+ for (var i=0, j=list.length; i<j; i++) {
+ if (!node || node === list[i]) {
+ view.removeTreeDom(setting, list[i]);
+ if (node) break;
+ }
+ }
+ if (_cancelPreSelectedNode) _cancelPreSelectedNode.apply(view, arguments);
+ }
+
+ var _createNodes = view.createNodes;
+ view.createNodes = function(setting, level, nodes, parentNode) {
+ if (_createNodes) {
+ _createNodes.apply(view, arguments);
+ }
+ if (!nodes) return;
+ if (view.repairParentChkClassWithSelf) {
+ view.repairParentChkClassWithSelf(setting, parentNode);
+ }
+ }
+
+ var _makeNodeUrl = view.makeNodeUrl;
+ view.makeNodeUrl = function(setting, node) {
+ return setting.edit.enable ? null : (_makeNodeUrl.apply(view, arguments));
+ }
+
+ var _removeNode = view.removeNode;
+ view.removeNode = function(setting, node) {
+ var root = data.getRoot(setting);
+ if (root.curEditNode === node) root.curEditNode = null;
+ if (_removeNode) {
+ _removeNode.apply(view, arguments);
+ }
+ }
+
+ var _selectNode = view.selectNode;
+ view.selectNode = function(setting, node, addFlag) {
+ var root = data.getRoot(setting);
+ if (data.isSelectedNode(setting, node) && root.curEditNode == node && node.editNameFlag) {
+ return false;
+ }
+ if (_selectNode) _selectNode.apply(view, arguments);
+ view.addHoverDom(setting, node);
+ return true;
+ }
+
+ var _uCanDo = tools.uCanDo;
+ tools.uCanDo = function(setting, e) {
+ var root = data.getRoot(setting);
+ if (e && (tools.eqs(e.type, "mouseover") || tools.eqs(e.type, "mouseout") || tools.eqs(e.type, "mousedown") || tools.eqs(e.type, "mouseup"))) {
+ return true;
+ }
+ if (root.curEditNode) {
+ view.editNodeBlur = false;
+ root.curEditInput.focus();
+ }
+ return (!root.curEditNode) && (_uCanDo ? _uCanDo.apply(view, arguments) : true);
+ }
+})(jQuery);
diff --git a/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.all.min.js b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.all.min.js
new file mode 100644
index 0000000..0677d9e
--- /dev/null
+++ b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.all.min.js
@@ -0,0 +1,160 @@
+
+/*
+ * JQuery zTree core v3.5.16
+ * http://zTree.me/
+ *
+ * Copyright (c) 2010 Hunter.z
+ *
+ * Licensed same as jquery - MIT License
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * email: hunter.z@263.net
+ * Date: 2014-03-09
+ */
+(function(p){var G,H,I,J,K,L,r={},u={},v={},M={treeId:"",treeObj:null,view:{addDiyDom:null,autoCancelSelected:!0,dblClickExpand:!0,expandSpeed:"fast",fontCss:{},nameIsHTML:!1,selectedMulti:!0,showIcon:!0,showLine:!0,showTitle:!0,txtSelectedEnable:!1},data:{key:{children:"children",name:"name",title:"",url:"url"},simpleData:{enable:!1,idKey:"id",pIdKey:"pId",rootPId:null},keep:{parent:!1,leaf:!1}},async:{enable:!1,contentType:"application/x-www-form-urlencoded",type:"post",dataType:"text",url:"",autoParam:[],
+otherParam:[],dataFilter:null},callback:{beforeAsync:null,beforeClick:null,beforeDblClick:null,beforeRightClick:null,beforeMouseDown:null,beforeMouseUp:null,beforeExpand:null,beforeCollapse:null,beforeRemove:null,onAsyncError:null,onAsyncSuccess:null,onNodeCreated:null,onClick:null,onDblClick:null,onRightClick:null,onMouseDown:null,onMouseUp:null,onExpand:null,onCollapse:null,onRemove:null}},w=[function(b){var a=b.treeObj,c=e.event;a.bind(c.NODECREATED,function(a,c,g){j.apply(b.callback.onNodeCreated,
+[a,c,g])});a.bind(c.CLICK,function(a,c,g,l,h){j.apply(b.callback.onClick,[c,g,l,h])});a.bind(c.EXPAND,function(a,c,g){j.apply(b.callback.onExpand,[a,c,g])});a.bind(c.COLLAPSE,function(a,c,g){j.apply(b.callback.onCollapse,[a,c,g])});a.bind(c.ASYNC_SUCCESS,function(a,c,g,l){j.apply(b.callback.onAsyncSuccess,[a,c,g,l])});a.bind(c.ASYNC_ERROR,function(a,c,g,l,h,e){j.apply(b.callback.onAsyncError,[a,c,g,l,h,e])});a.bind(c.REMOVE,function(a,c,g){j.apply(b.callback.onRemove,[a,c,g])})}],x=[function(b){var a=
+e.event;b.treeObj.unbind(a.NODECREATED).unbind(a.CLICK).unbind(a.EXPAND).unbind(a.COLLAPSE).unbind(a.ASYNC_SUCCESS).unbind(a.ASYNC_ERROR).unbind(a.REMOVE)}],y=[function(b){var a=h.getCache(b);a||(a={},h.setCache(b,a));a.nodes=[];a.doms=[]}],z=[function(b,a,c,d,f,g){if(c){var l=h.getRoot(b),e=b.data.key.children;c.level=a;c.tId=b.treeId+"_"+ ++l.zId;c.parentTId=d?d.tId:null;c.open=typeof c.open=="string"?j.eqs(c.open,"true"):!!c.open;c[e]&&c[e].length>0?(c.isParent=!0,c.zAsync=!0):(c.isParent=typeof c.isParent==
+"string"?j.eqs(c.isParent,"true"):!!c.isParent,c.open=c.isParent&&!b.async.enable?c.open:!1,c.zAsync=!c.isParent);c.isFirstNode=f;c.isLastNode=g;c.getParentNode=function(){return h.getNodeCache(b,c.parentTId)};c.getPreNode=function(){return h.getPreNode(b,c)};c.getNextNode=function(){return h.getNextNode(b,c)};c.isAjaxing=!1;h.fixPIdKeyValue(b,c)}}],s=[function(b){var a=b.target,c=h.getSetting(b.data.treeId),d="",f=null,g="",l="",i=null,n=null,k=null;if(j.eqs(b.type,"mousedown"))l="mousedown";else if(j.eqs(b.type,
+"mouseup"))l="mouseup";else if(j.eqs(b.type,"contextmenu"))l="contextmenu";else if(j.eqs(b.type,"click"))if(j.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+e.id.SWITCH)!==null)d=j.getNodeMainDom(a).id,g="switchNode";else{if(k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+e.id.A}]))d=j.getNodeMainDom(k).id,g="clickNode"}else if(j.eqs(b.type,"dblclick")&&(l="dblclick",k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+e.id.A}])))d=j.getNodeMainDom(k).id,g="switchNode";if(l.length>0&&d.length==0&&
+(k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+e.id.A}])))d=j.getNodeMainDom(k).id;if(d.length>0)switch(f=h.getNodeCache(c,d),g){case "switchNode":f.isParent?j.eqs(b.type,"click")||j.eqs(b.type,"dblclick")&&j.apply(c.view.dblClickExpand,[c.treeId,f],c.view.dblClickExpand)?i=G:g="":g="";break;case "clickNode":i=H}switch(l){case "mousedown":n=I;break;case "mouseup":n=J;break;case "dblclick":n=K;break;case "contextmenu":n=L}return{stop:!1,node:f,nodeEventType:g,nodeEventCallback:i,treeEventType:l,
+treeEventCallback:n}}],A=[function(b){var a=h.getRoot(b);a||(a={},h.setRoot(b,a));a[b.data.key.children]=[];a.expandTriggerFlag=!1;a.curSelectedList=[];a.noSelection=!0;a.createdNodes=[];a.zId=0;a._ver=(new Date).getTime()}],B=[],C=[],D=[],E=[],F=[],h={addNodeCache:function(b,a){h.getCache(b).nodes[h.getNodeCacheId(a.tId)]=a},getNodeCacheId:function(b){return b.substring(b.lastIndexOf("_")+1)},addAfterA:function(b){C.push(b)},addBeforeA:function(b){B.push(b)},addInnerAfterA:function(b){E.push(b)},
+addInnerBeforeA:function(b){D.push(b)},addInitBind:function(b){w.push(b)},addInitUnBind:function(b){x.push(b)},addInitCache:function(b){y.push(b)},addInitNode:function(b){z.push(b)},addInitProxy:function(b,a){a?s.splice(0,0,b):s.push(b)},addInitRoot:function(b){A.push(b)},addNodesData:function(b,a,c){var d=b.data.key.children;a[d]||(a[d]=[]);if(a[d].length>0)a[d][a[d].length-1].isLastNode=!1,i.setNodeLineIcos(b,a[d][a[d].length-1]);a.isParent=!0;a[d]=a[d].concat(c)},addSelectedNode:function(b,a){var c=
+h.getRoot(b);h.isSelectedNode(b,a)||c.curSelectedList.push(a)},addCreatedNode:function(b,a){(b.callback.onNodeCreated||b.view.addDiyDom)&&h.getRoot(b).createdNodes.push(a)},addZTreeTools:function(b){F.push(b)},exSetting:function(b){p.extend(!0,M,b)},fixPIdKeyValue:function(b,a){b.data.simpleData.enable&&(a[b.data.simpleData.pIdKey]=a.parentTId?a.getParentNode()[b.data.simpleData.idKey]:b.data.simpleData.rootPId)},getAfterA:function(b,a,c){for(var d=0,f=C.length;d<f;d++)C[d].apply(this,arguments)},
+getBeforeA:function(b,a,c){for(var d=0,f=B.length;d<f;d++)B[d].apply(this,arguments)},getInnerAfterA:function(b,a,c){for(var d=0,f=E.length;d<f;d++)E[d].apply(this,arguments)},getInnerBeforeA:function(b,a,c){for(var d=0,f=D.length;d<f;d++)D[d].apply(this,arguments)},getCache:function(b){return v[b.treeId]},getNextNode:function(b,a){if(!a)return null;for(var c=b.data.key.children,d=a.parentTId?a.getParentNode():h.getRoot(b),f=0,g=d[c].length-1;f<=g;f++)if(d[c][f]===a)return f==g?null:d[c][f+1];return null},
+getNodeByParam:function(b,a,c,d){if(!a||!c)return null;for(var f=b.data.key.children,g=0,l=a.length;g<l;g++){if(a[g][c]==d)return a[g];var e=h.getNodeByParam(b,a[g][f],c,d);if(e)return e}return null},getNodeCache:function(b,a){if(!a)return null;var c=v[b.treeId].nodes[h.getNodeCacheId(a)];return c?c:null},getNodeName:function(b,a){return""+a[b.data.key.name]},getNodeTitle:function(b,a){return""+a[b.data.key.title===""?b.data.key.name:b.data.key.title]},getNodes:function(b){return h.getRoot(b)[b.data.key.children]},
+getNodesByParam:function(b,a,c,d){if(!a||!c)return[];for(var f=b.data.key.children,g=[],l=0,e=a.length;l<e;l++)a[l][c]==d&&g.push(a[l]),g=g.concat(h.getNodesByParam(b,a[l][f],c,d));return g},getNodesByParamFuzzy:function(b,a,c,d){if(!a||!c)return[];for(var f=b.data.key.children,g=[],d=d.toLowerCase(),l=0,e=a.length;l<e;l++)typeof a[l][c]=="string"&&a[l][c].toLowerCase().indexOf(d)>-1&&g.push(a[l]),g=g.concat(h.getNodesByParamFuzzy(b,a[l][f],c,d));return g},getNodesByFilter:function(b,a,c,d,f){if(!a)return d?
+null:[];for(var g=b.data.key.children,e=d?null:[],i=0,n=a.length;i<n;i++){if(j.apply(c,[a[i],f],!1)){if(d)return a[i];e.push(a[i])}var k=h.getNodesByFilter(b,a[i][g],c,d,f);if(d&&k)return k;e=d?k:e.concat(k)}return e},getPreNode:function(b,a){if(!a)return null;for(var c=b.data.key.children,d=a.parentTId?a.getParentNode():h.getRoot(b),f=0,g=d[c].length;f<g;f++)if(d[c][f]===a)return f==0?null:d[c][f-1];return null},getRoot:function(b){return b?u[b.treeId]:null},getRoots:function(){return u},getSetting:function(b){return r[b]},
+getSettings:function(){return r},getZTreeTools:function(b){return(b=this.getRoot(this.getSetting(b)))?b.treeTools:null},initCache:function(b){for(var a=0,c=y.length;a<c;a++)y[a].apply(this,arguments)},initNode:function(b,a,c,d,f,g){for(var e=0,h=z.length;e<h;e++)z[e].apply(this,arguments)},initRoot:function(b){for(var a=0,c=A.length;a<c;a++)A[a].apply(this,arguments)},isSelectedNode:function(b,a){for(var c=h.getRoot(b),d=0,f=c.curSelectedList.length;d<f;d++)if(a===c.curSelectedList[d])return!0;return!1},
+removeNodeCache:function(b,a){var c=b.data.key.children;if(a[c])for(var d=0,f=a[c].length;d<f;d++)arguments.callee(b,a[c][d]);h.getCache(b).nodes[h.getNodeCacheId(a.tId)]=null},removeSelectedNode:function(b,a){for(var c=h.getRoot(b),d=0,f=c.curSelectedList.length;d<f;d++)if(a===c.curSelectedList[d]||!h.getNodeCache(b,c.curSelectedList[d].tId))c.curSelectedList.splice(d,1),d--,f--},setCache:function(b,a){v[b.treeId]=a},setRoot:function(b,a){u[b.treeId]=a},setZTreeTools:function(b,a){for(var c=0,d=
+F.length;c<d;c++)F[c].apply(this,arguments)},transformToArrayFormat:function(b,a){if(!a)return[];var c=b.data.key.children,d=[];if(j.isArray(a))for(var f=0,g=a.length;f<g;f++)d.push(a[f]),a[f][c]&&(d=d.concat(h.transformToArrayFormat(b,a[f][c])));else d.push(a),a[c]&&(d=d.concat(h.transformToArrayFormat(b,a[c])));return d},transformTozTreeFormat:function(b,a){var c,d,f=b.data.simpleData.idKey,g=b.data.simpleData.pIdKey,e=b.data.key.children;if(!f||f==""||!a)return[];if(j.isArray(a)){var h=[],i=[];
+for(c=0,d=a.length;c<d;c++)i[a[c][f]]=a[c];for(c=0,d=a.length;c<d;c++)i[a[c][g]]&&a[c][f]!=a[c][g]?(i[a[c][g]][e]||(i[a[c][g]][e]=[]),i[a[c][g]][e].push(a[c])):h.push(a[c]);return h}else return[a]}},m={bindEvent:function(b){for(var a=0,c=w.length;a<c;a++)w[a].apply(this,arguments)},unbindEvent:function(b){for(var a=0,c=x.length;a<c;a++)x[a].apply(this,arguments)},bindTree:function(b){var a={treeId:b.treeId},c=b.treeObj;b.view.txtSelectedEnable||c.bind("selectstart",function(a){a=a.originalEvent.srcElement.nodeName.toLowerCase();
+return a==="input"||a==="textarea"}).css({"-moz-user-select":"-moz-none"});c.bind("click",a,m.proxy);c.bind("dblclick",a,m.proxy);c.bind("mouseover",a,m.proxy);c.bind("mouseout",a,m.proxy);c.bind("mousedown",a,m.proxy);c.bind("mouseup",a,m.proxy);c.bind("contextmenu",a,m.proxy)},unbindTree:function(b){b.treeObj.unbind("click",m.proxy).unbind("dblclick",m.proxy).unbind("mouseover",m.proxy).unbind("mouseout",m.proxy).unbind("mousedown",m.proxy).unbind("mouseup",m.proxy).unbind("contextmenu",m.proxy)},
+doProxy:function(b){for(var a=[],c=0,d=s.length;c<d;c++){var f=s[c].apply(this,arguments);a.push(f);if(f.stop)break}return a},proxy:function(b){var a=h.getSetting(b.data.treeId);if(!j.uCanDo(a,b))return!0;for(var a=m.doProxy(b),c=!0,d=0,f=a.length;d<f;d++){var g=a[d];g.nodeEventCallback&&(c=g.nodeEventCallback.apply(g,[b,g.node])&&c);g.treeEventCallback&&(c=g.treeEventCallback.apply(g,[b,g.node])&&c)}return c}};G=function(b,a){var c=h.getSetting(b.data.treeId);if(a.open){if(j.apply(c.callback.beforeCollapse,
+[c.treeId,a],!0)==!1)return!0}else if(j.apply(c.callback.beforeExpand,[c.treeId,a],!0)==!1)return!0;h.getRoot(c).expandTriggerFlag=!0;i.switchNode(c,a);return!0};H=function(b,a){var c=h.getSetting(b.data.treeId),d=c.view.autoCancelSelected&&(b.ctrlKey||b.metaKey)&&h.isSelectedNode(c,a)?0:c.view.autoCancelSelected&&(b.ctrlKey||b.metaKey)&&c.view.selectedMulti?2:1;if(j.apply(c.callback.beforeClick,[c.treeId,a,d],!0)==!1)return!0;d===0?i.cancelPreSelectedNode(c,a):i.selectNode(c,a,d===2);c.treeObj.trigger(e.event.CLICK,
+[b,c.treeId,a,d]);return!0};I=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeMouseDown,[c.treeId,a],!0)&&j.apply(c.callback.onMouseDown,[b,c.treeId,a]);return!0};J=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeMouseUp,[c.treeId,a],!0)&&j.apply(c.callback.onMouseUp,[b,c.treeId,a]);return!0};K=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeDblClick,[c.treeId,a],!0)&&j.apply(c.callback.onDblClick,[b,c.treeId,a]);return!0};
+L=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeRightClick,[c.treeId,a],!0)&&j.apply(c.callback.onRightClick,[b,c.treeId,a]);return typeof c.callback.onRightClick!="function"};var j={apply:function(b,a,c){return typeof b=="function"?b.apply(N,a?a:[]):c},canAsync:function(b,a){var c=b.data.key.children;return b.async.enable&&a&&a.isParent&&!(a.zAsync||a[c]&&a[c].length>0)},clone:function(b){if(b===null)return null;var a=j.isArray(b)?[]:{},c;for(c in b)a[c]=b[c]instanceof
+Date?new Date(b[c].getTime()):typeof b[c]==="object"?arguments.callee(b[c]):b[c];return a},eqs:function(b,a){return b.toLowerCase()===a.toLowerCase()},isArray:function(b){return Object.prototype.toString.apply(b)==="[object Array]"},$:function(b,a,c){a&&typeof a!="string"&&(c=a,a="");return typeof b=="string"?p(b,c?c.treeObj.get(0).ownerDocument:null):p("#"+b.tId+a,c?c.treeObj:null)},getMDom:function(b,a,c){if(!a)return null;for(;a&&a.id!==b.treeId;){for(var d=0,f=c.length;a.tagName&&d<f;d++)if(j.eqs(a.tagName,
+c[d].tagName)&&a.getAttribute(c[d].attrName)!==null)return a;a=a.parentNode}return null},getNodeMainDom:function(b){return p(b).parent("li").get(0)||p(b).parentsUntil("li").parent().get(0)},isChildOrSelf:function(b,a){return p(b).closest("#"+a).length>0},uCanDo:function(){return!0}},i={addNodes:function(b,a,c,d){if(!b.data.keep.leaf||!a||a.isParent)if(j.isArray(c)||(c=[c]),b.data.simpleData.enable&&(c=h.transformTozTreeFormat(b,c)),a){var f=k(a,e.id.SWITCH,b),g=k(a,e.id.ICON,b),l=k(a,e.id.UL,b);if(!a.open)i.replaceSwitchClass(a,
+f,e.folder.CLOSE),i.replaceIcoClass(a,g,e.folder.CLOSE),a.open=!1,l.css({display:"none"});h.addNodesData(b,a,c);i.createNodes(b,a.level+1,c,a);d||i.expandCollapseParentNode(b,a,!0)}else h.addNodesData(b,h.getRoot(b),c),i.createNodes(b,0,c,null)},appendNodes:function(b,a,c,d,f,g){if(!c)return[];for(var e=[],j=b.data.key.children,k=0,m=c.length;k<m;k++){var o=c[k];if(f){var t=(d?d:h.getRoot(b))[j].length==c.length&&k==0;h.initNode(b,a,o,d,t,k==c.length-1,g);h.addNodeCache(b,o)}t=[];o[j]&&o[j].length>
+0&&(t=i.appendNodes(b,a+1,o[j],o,f,g&&o.open));g&&(i.makeDOMNodeMainBefore(e,b,o),i.makeDOMNodeLine(e,b,o),h.getBeforeA(b,o,e),i.makeDOMNodeNameBefore(e,b,o),h.getInnerBeforeA(b,o,e),i.makeDOMNodeIcon(e,b,o),h.getInnerAfterA(b,o,e),i.makeDOMNodeNameAfter(e,b,o),h.getAfterA(b,o,e),o.isParent&&o.open&&i.makeUlHtml(b,o,e,t.join("")),i.makeDOMNodeMainAfter(e,b,o),h.addCreatedNode(b,o))}return e},appendParentULDom:function(b,a){var c=[],d=k(a,b);!d.get(0)&&a.parentTId&&(i.appendParentULDom(b,a.getParentNode()),
+d=k(a,b));var f=k(a,e.id.UL,b);f.get(0)&&f.remove();f=i.appendNodes(b,a.level+1,a[b.data.key.children],a,!1,!0);i.makeUlHtml(b,a,c,f.join(""));d.append(c.join(""))},asyncNode:function(b,a,c,d){var f,g;if(a&&!a.isParent)return j.apply(d),!1;else if(a&&a.isAjaxing)return!1;else if(j.apply(b.callback.beforeAsync,[b.treeId,a],!0)==!1)return j.apply(d),!1;if(a)a.isAjaxing=!0,k(a,e.id.ICON,b).attr({style:"","class":e.className.BUTTON+" "+e.className.ICO_LOADING});var l={};for(f=0,g=b.async.autoParam.length;a&&
+f<g;f++){var q=b.async.autoParam[f].split("="),n=q;q.length>1&&(n=q[1],q=q[0]);l[n]=a[q]}if(j.isArray(b.async.otherParam))for(f=0,g=b.async.otherParam.length;f<g;f+=2)l[b.async.otherParam[f]]=b.async.otherParam[f+1];else for(var m in b.async.otherParam)l[m]=b.async.otherParam[m];var o=h.getRoot(b)._ver;p.ajax({contentType:b.async.contentType,type:b.async.type,url:j.apply(b.async.url,[b.treeId,a],b.async.url),data:l,dataType:b.async.dataType,success:function(f){if(o==h.getRoot(b)._ver){var g=[];try{g=
+!f||f.length==0?[]:typeof f=="string"?eval("("+f+")"):f}catch(l){g=f}if(a)a.isAjaxing=null,a.zAsync=!0;i.setNodeLineIcos(b,a);g&&g!==""?(g=j.apply(b.async.dataFilter,[b.treeId,a,g],g),i.addNodes(b,a,g?j.clone(g):[],!!c)):i.addNodes(b,a,[],!!c);b.treeObj.trigger(e.event.ASYNC_SUCCESS,[b.treeId,a,f]);j.apply(d)}},error:function(c,d,f){if(o==h.getRoot(b)._ver){if(a)a.isAjaxing=null;i.setNodeLineIcos(b,a);b.treeObj.trigger(e.event.ASYNC_ERROR,[b.treeId,a,c,d,f])}}});return!0},cancelPreSelectedNode:function(b,
+a){for(var c=h.getRoot(b).curSelectedList,d=c.length-1;d>=0;d--)if(!a||a===c[d])if(k(c[d],e.id.A,b).removeClass(e.node.CURSELECTED),a){h.removeSelectedNode(b,a);break}if(!a)h.getRoot(b).curSelectedList=[]},createNodeCallback:function(b){if(b.callback.onNodeCreated||b.view.addDiyDom)for(var a=h.getRoot(b);a.createdNodes.length>0;){var c=a.createdNodes.shift();j.apply(b.view.addDiyDom,[b.treeId,c]);b.callback.onNodeCreated&&b.treeObj.trigger(e.event.NODECREATED,[b.treeId,c])}},createNodes:function(b,
+a,c,d){if(c&&c.length!=0){var f=h.getRoot(b),g=b.data.key.children,g=!d||d.open||!!k(d[g][0],b).get(0);f.createdNodes=[];a=i.appendNodes(b,a,c,d,!0,g);d?(d=k(d,e.id.UL,b),d.get(0)&&d.append(a.join(""))):b.treeObj.append(a.join(""));i.createNodeCallback(b)}},destroy:function(b){b&&(h.initCache(b),h.initRoot(b),m.unbindTree(b),m.unbindEvent(b),b.treeObj.empty(),delete r[b.treeId])},expandCollapseNode:function(b,a,c,d,f){var g=h.getRoot(b),l=b.data.key.children;if(a){if(g.expandTriggerFlag){var q=f,
+f=function(){q&&q();a.open?b.treeObj.trigger(e.event.EXPAND,[b.treeId,a]):b.treeObj.trigger(e.event.COLLAPSE,[b.treeId,a])};g.expandTriggerFlag=!1}if(!a.open&&a.isParent&&(!k(a,e.id.UL,b).get(0)||a[l]&&a[l].length>0&&!k(a[l][0],b).get(0)))i.appendParentULDom(b,a),i.createNodeCallback(b);if(a.open==c)j.apply(f,[]);else{var c=k(a,e.id.UL,b),g=k(a,e.id.SWITCH,b),n=k(a,e.id.ICON,b);a.isParent?(a.open=!a.open,a.iconOpen&&a.iconClose&&n.attr("style",i.makeNodeIcoStyle(b,a)),a.open?(i.replaceSwitchClass(a,
+g,e.folder.OPEN),i.replaceIcoClass(a,n,e.folder.OPEN),d==!1||b.view.expandSpeed==""?(c.show(),j.apply(f,[])):a[l]&&a[l].length>0?c.slideDown(b.view.expandSpeed,f):(c.show(),j.apply(f,[]))):(i.replaceSwitchClass(a,g,e.folder.CLOSE),i.replaceIcoClass(a,n,e.folder.CLOSE),d==!1||b.view.expandSpeed==""||!(a[l]&&a[l].length>0)?(c.hide(),j.apply(f,[])):c.slideUp(b.view.expandSpeed,f))):j.apply(f,[])}}else j.apply(f,[])},expandCollapseParentNode:function(b,a,c,d,f){a&&(a.parentTId?(i.expandCollapseNode(b,
+a,c,d),a.parentTId&&i.expandCollapseParentNode(b,a.getParentNode(),c,d,f)):i.expandCollapseNode(b,a,c,d,f))},expandCollapseSonNode:function(b,a,c,d,f){var g=h.getRoot(b),e=b.data.key.children,g=a?a[e]:g[e],e=a?!1:d,j=h.getRoot(b).expandTriggerFlag;h.getRoot(b).expandTriggerFlag=!1;if(g)for(var k=0,m=g.length;k<m;k++)g[k]&&i.expandCollapseSonNode(b,g[k],c,e);h.getRoot(b).expandTriggerFlag=j;i.expandCollapseNode(b,a,c,d,f)},makeDOMNodeIcon:function(b,a,c){var d=h.getNodeName(a,c),d=a.view.nameIsHTML?
+d:d.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");b.push("<span id='",c.tId,e.id.ICON,"' title='' treeNode",e.id.ICON," class='",i.makeNodeIcoClass(a,c),"' style='",i.makeNodeIcoStyle(a,c),"'></span><span id='",c.tId,e.id.SPAN,"'>",d,"</span>")},makeDOMNodeLine:function(b,a,c){b.push("<span id='",c.tId,e.id.SWITCH,"' title='' class='",i.makeNodeLineClass(a,c),"' treeNode",e.id.SWITCH,"></span>")},makeDOMNodeMainAfter:function(b){b.push("</li>")},makeDOMNodeMainBefore:function(b,
+a,c){b.push("<li id='",c.tId,"' class='",e.className.LEVEL,c.level,"' tabindex='0' hidefocus='true' treenode>")},makeDOMNodeNameAfter:function(b){b.push("</a>")},makeDOMNodeNameBefore:function(b,a,c){var d=h.getNodeTitle(a,c),f=i.makeNodeUrl(a,c),g=i.makeNodeFontCss(a,c),l=[],k;for(k in g)l.push(k,":",g[k],";");b.push("<a id='",c.tId,e.id.A,"' class='",e.className.LEVEL,c.level,"' treeNode",e.id.A,' onclick="',c.click||"",'" ',f!=null&&f.length>0?"href='"+f+"'":""," target='",i.makeNodeTarget(c),
+"' style='",l.join(""),"'");j.apply(a.view.showTitle,[a.treeId,c],a.view.showTitle)&&d&&b.push("title='",d.replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),"'");b.push(">")},makeNodeFontCss:function(b,a){var c=j.apply(b.view.fontCss,[b.treeId,a],b.view.fontCss);return c&&typeof c!="function"?c:{}},makeNodeIcoClass:function(b,a){var c=["ico"];a.isAjaxing||(c[0]=(a.iconSkin?a.iconSkin+"_":"")+c[0],a.isParent?c.push(a.open?e.folder.OPEN:e.folder.CLOSE):c.push(e.folder.DOCU));return e.className.BUTTON+
+" "+c.join("_")},makeNodeIcoStyle:function(b,a){var c=[];if(!a.isAjaxing){var d=a.isParent&&a.iconOpen&&a.iconClose?a.open?a.iconOpen:a.iconClose:a.icon;d&&c.push("background:url(",d,") 0 0 no-repeat;");(b.view.showIcon==!1||!j.apply(b.view.showIcon,[b.treeId,a],!0))&&c.push("width:0px;height:0px;")}return c.join("")},makeNodeLineClass:function(b,a){var c=[];b.view.showLine?a.level==0&&a.isFirstNode&&a.isLastNode?c.push(e.line.ROOT):a.level==0&&a.isFirstNode?c.push(e.line.ROOTS):a.isLastNode?c.push(e.line.BOTTOM):
+c.push(e.line.CENTER):c.push(e.line.NOLINE);a.isParent?c.push(a.open?e.folder.OPEN:e.folder.CLOSE):c.push(e.folder.DOCU);return i.makeNodeLineClassEx(a)+c.join("_")},makeNodeLineClassEx:function(b){return e.className.BUTTON+" "+e.className.LEVEL+b.level+" "+e.className.SWITCH+" "},makeNodeTarget:function(b){return b.target||"_blank"},makeNodeUrl:function(b,a){var c=b.data.key.url;return a[c]?a[c]:null},makeUlHtml:function(b,a,c,d){c.push("<ul id='",a.tId,e.id.UL,"' class='",e.className.LEVEL,a.level,
+" ",i.makeUlLineClass(b,a),"' style='display:",a.open?"block":"none","'>");c.push(d);c.push("</ul>")},makeUlLineClass:function(b,a){return b.view.showLine&&!a.isLastNode?e.line.LINE:""},removeChildNodes:function(b,a){if(a){var c=b.data.key.children,d=a[c];if(d){for(var f=0,g=d.length;f<g;f++)h.removeNodeCache(b,d[f]);h.removeSelectedNode(b);delete a[c];b.data.keep.parent?k(a,e.id.UL,b).empty():(a.isParent=!1,a.open=!1,c=k(a,e.id.SWITCH,b),d=k(a,e.id.ICON,b),i.replaceSwitchClass(a,c,e.folder.DOCU),
+i.replaceIcoClass(a,d,e.folder.DOCU),k(a,e.id.UL,b).remove())}}},setFirstNode:function(b,a){var c=b.data.key.children;if(a[c].length>0)a[c][0].isFirstNode=!0},setLastNode:function(b,a){var c=b.data.key.children,d=a[c].length;if(d>0)a[c][d-1].isLastNode=!0},removeNode:function(b,a){var c=h.getRoot(b),d=b.data.key.children,f=a.parentTId?a.getParentNode():c;a.isFirstNode=!1;a.isLastNode=!1;a.getPreNode=function(){return null};a.getNextNode=function(){return null};if(h.getNodeCache(b,a.tId)){k(a,b).remove();
+h.removeNodeCache(b,a);h.removeSelectedNode(b,a);for(var g=0,l=f[d].length;g<l;g++)if(f[d][g].tId==a.tId){f[d].splice(g,1);break}i.setFirstNode(b,f);i.setLastNode(b,f);var j,g=f[d].length;if(!b.data.keep.parent&&g==0)f.isParent=!1,f.open=!1,g=k(f,e.id.UL,b),l=k(f,e.id.SWITCH,b),j=k(f,e.id.ICON,b),i.replaceSwitchClass(f,l,e.folder.DOCU),i.replaceIcoClass(f,j,e.folder.DOCU),g.css("display","none");else if(b.view.showLine&&g>0){var n=f[d][g-1],g=k(n,e.id.UL,b),l=k(n,e.id.SWITCH,b);j=k(n,e.id.ICON,b);
+f==c?f[d].length==1?i.replaceSwitchClass(n,l,e.line.ROOT):(c=k(f[d][0],e.id.SWITCH,b),i.replaceSwitchClass(f[d][0],c,e.line.ROOTS),i.replaceSwitchClass(n,l,e.line.BOTTOM)):i.replaceSwitchClass(n,l,e.line.BOTTOM);g.removeClass(e.line.LINE)}}},replaceIcoClass:function(b,a,c){if(a&&!b.isAjaxing&&(b=a.attr("class"),b!=void 0)){b=b.split("_");switch(c){case e.folder.OPEN:case e.folder.CLOSE:case e.folder.DOCU:b[b.length-1]=c}a.attr("class",b.join("_"))}},replaceSwitchClass:function(b,a,c){if(a){var d=
+a.attr("class");if(d!=void 0){d=d.split("_");switch(c){case e.line.ROOT:case e.line.ROOTS:case e.line.CENTER:case e.line.BOTTOM:case e.line.NOLINE:d[0]=i.makeNodeLineClassEx(b)+c;break;case e.folder.OPEN:case e.folder.CLOSE:case e.folder.DOCU:d[1]=c}a.attr("class",d.join("_"));c!==e.folder.DOCU?a.removeAttr("disabled"):a.attr("disabled","disabled")}}},selectNode:function(b,a,c){c||i.cancelPreSelectedNode(b);k(a,e.id.A,b).addClass(e.node.CURSELECTED);h.addSelectedNode(b,a)},setNodeFontCss:function(b,
+a){var c=k(a,e.id.A,b),d=i.makeNodeFontCss(b,a);d&&c.css(d)},setNodeLineIcos:function(b,a){if(a){var c=k(a,e.id.SWITCH,b),d=k(a,e.id.UL,b),f=k(a,e.id.ICON,b),g=i.makeUlLineClass(b,a);g.length==0?d.removeClass(e.line.LINE):d.addClass(g);c.attr("class",i.makeNodeLineClass(b,a));a.isParent?c.removeAttr("disabled"):c.attr("disabled","disabled");f.removeAttr("style");f.attr("style",i.makeNodeIcoStyle(b,a));f.attr("class",i.makeNodeIcoClass(b,a))}},setNodeName:function(b,a){var c=h.getNodeTitle(b,a),d=
+k(a,e.id.SPAN,b);d.empty();b.view.nameIsHTML?d.html(h.getNodeName(b,a)):d.text(h.getNodeName(b,a));j.apply(b.view.showTitle,[b.treeId,a],b.view.showTitle)&&k(a,e.id.A,b).attr("title",!c?"":c)},setNodeTarget:function(b,a){k(a,e.id.A,b).attr("target",i.makeNodeTarget(a))},setNodeUrl:function(b,a){var c=k(a,e.id.A,b),d=i.makeNodeUrl(b,a);d==null||d.length==0?c.removeAttr("href"):c.attr("href",d)},switchNode:function(b,a){a.open||!j.canAsync(b,a)?i.expandCollapseNode(b,a,!a.open):b.async.enable?i.asyncNode(b,
+a)||i.expandCollapseNode(b,a,!a.open):a&&i.expandCollapseNode(b,a,!a.open)}};p.fn.zTree={consts:{className:{BUTTON:"button",LEVEL:"level",ICO_LOADING:"ico_loading",SWITCH:"switch"},event:{NODECREATED:"ztree_nodeCreated",CLICK:"ztree_click",EXPAND:"ztree_expand",COLLAPSE:"ztree_collapse",ASYNC_SUCCESS:"ztree_async_success",ASYNC_ERROR:"ztree_async_error",REMOVE:"ztree_remove"},id:{A:"_a",ICON:"_ico",SPAN:"_span",SWITCH:"_switch",UL:"_ul"},line:{ROOT:"root",ROOTS:"roots",CENTER:"center",BOTTOM:"bottom",
+NOLINE:"noline",LINE:"line"},folder:{OPEN:"open",CLOSE:"close",DOCU:"docu"},node:{CURSELECTED:"curSelectedNode"}},_z:{tools:j,view:i,event:m,data:h},getZTreeObj:function(b){return(b=h.getZTreeTools(b))?b:null},destroy:function(b){if(b&&b.length>0)i.destroy(h.getSetting(b));else for(var a in r)i.destroy(r[a])},init:function(b,a,c){var d=j.clone(M);p.extend(!0,d,a);d.treeId=b.attr("id");d.treeObj=b;d.treeObj.empty();r[d.treeId]=d;if(typeof document.body.style.maxHeight==="undefined")d.view.expandSpeed=
+"";h.initRoot(d);b=h.getRoot(d);a=d.data.key.children;c=c?j.clone(j.isArray(c)?c:[c]):[];b[a]=d.data.simpleData.enable?h.transformTozTreeFormat(d,c):c;h.initCache(d);m.unbindTree(d);m.bindTree(d);m.unbindEvent(d);m.bindEvent(d);c={setting:d,addNodes:function(a,b,c){function e(){i.addNodes(d,a,h,c==!0)}if(!b)return null;a||(a=null);if(a&&!a.isParent&&d.data.keep.leaf)return null;var h=j.clone(j.isArray(b)?b:[b]);j.canAsync(d,a)?i.asyncNode(d,a,c,e):e();return h},cancelSelectedNode:function(a){i.cancelPreSelectedNode(d,
+a)},destroy:function(){i.destroy(d)},expandAll:function(a){a=!!a;i.expandCollapseSonNode(d,null,a,!0);return a},expandNode:function(a,b,c,e,n){if(!a||!a.isParent)return null;b!==!0&&b!==!1&&(b=!a.open);if((n=!!n)&&b&&j.apply(d.callback.beforeExpand,[d.treeId,a],!0)==!1)return null;else if(n&&!b&&j.apply(d.callback.beforeCollapse,[d.treeId,a],!0)==!1)return null;b&&a.parentTId&&i.expandCollapseParentNode(d,a.getParentNode(),b,!1);if(b===a.open&&!c)return null;h.getRoot(d).expandTriggerFlag=n;if(!j.canAsync(d,
+a)&&c)i.expandCollapseSonNode(d,a,b,!0,function(){if(e!==!1)try{k(a,d).focus().blur()}catch(b){}});else if(a.open=!b,i.switchNode(this.setting,a),e!==!1)try{k(a,d).focus().blur()}catch(m){}return b},getNodes:function(){return h.getNodes(d)},getNodeByParam:function(a,b,c){return!a?null:h.getNodeByParam(d,c?c[d.data.key.children]:h.getNodes(d),a,b)},getNodeByTId:function(a){return h.getNodeCache(d,a)},getNodesByParam:function(a,b,c){return!a?null:h.getNodesByParam(d,c?c[d.data.key.children]:h.getNodes(d),
+a,b)},getNodesByParamFuzzy:function(a,b,c){return!a?null:h.getNodesByParamFuzzy(d,c?c[d.data.key.children]:h.getNodes(d),a,b)},getNodesByFilter:function(a,b,c,e){b=!!b;return!a||typeof a!="function"?b?null:[]:h.getNodesByFilter(d,c?c[d.data.key.children]:h.getNodes(d),a,b,e)},getNodeIndex:function(a){if(!a)return null;for(var b=d.data.key.children,c=a.parentTId?a.getParentNode():h.getRoot(d),e=0,i=c[b].length;e<i;e++)if(c[b][e]==a)return e;return-1},getSelectedNodes:function(){for(var a=[],b=h.getRoot(d).curSelectedList,
+c=0,e=b.length;c<e;c++)a.push(b[c]);return a},isSelectedNode:function(a){return h.isSelectedNode(d,a)},reAsyncChildNodes:function(a,b,c){if(this.setting.async.enable){var j=!a;j&&(a=h.getRoot(d));if(b=="refresh"){for(var b=this.setting.data.key.children,m=0,p=a[b]?a[b].length:0;m<p;m++)h.removeNodeCache(d,a[b][m]);h.removeSelectedNode(d);a[b]=[];j?this.setting.treeObj.empty():k(a,e.id.UL,d).empty()}i.asyncNode(this.setting,j?null:a,!!c)}},refresh:function(){this.setting.treeObj.empty();var a=h.getRoot(d),
+b=a[d.data.key.children];h.initRoot(d);a[d.data.key.children]=b;h.initCache(d);i.createNodes(d,0,a[d.data.key.children])},removeChildNodes:function(a){if(!a)return null;var b=a[d.data.key.children];i.removeChildNodes(d,a);return b?b:null},removeNode:function(a,b){a&&(b=!!b,b&&j.apply(d.callback.beforeRemove,[d.treeId,a],!0)==!1||(i.removeNode(d,a),b&&this.setting.treeObj.trigger(e.event.REMOVE,[d.treeId,a])))},selectNode:function(a,b){if(a&&j.uCanDo(d)){b=d.view.selectedMulti&&b;if(a.parentTId)i.expandCollapseParentNode(d,
+a.getParentNode(),!0,!1,function(){try{k(a,d).focus().blur()}catch(b){}});else try{k(a,d).focus().blur()}catch(c){}i.selectNode(d,a,b)}},transformTozTreeNodes:function(a){return h.transformTozTreeFormat(d,a)},transformToArray:function(a){return h.transformToArrayFormat(d,a)},updateNode:function(a){a&&k(a,d).get(0)&&j.uCanDo(d)&&(i.setNodeName(d,a),i.setNodeTarget(d,a),i.setNodeUrl(d,a),i.setNodeLineIcos(d,a),i.setNodeFontCss(d,a))}};b.treeTools=c;h.setZTreeTools(d,c);b[a]&&b[a].length>0?i.createNodes(d,
+0,b[a]):d.async.enable&&d.async.url&&d.async.url!==""&&i.asyncNode(d);return c}};var N=p.fn.zTree,k=j.$,e=N.consts})(jQuery);
+
+/*
+ * JQuery zTree excheck v3.5.16
+ * http://zTree.me/
+ *
+ * Copyright (c) 2010 Hunter.z
+ *
+ * Licensed same as jquery - MIT License
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * email: hunter.z@263.net
+ * Date: 2014-03-09
+ */
+(function(m){var p,q,r,o={event:{CHECK:"ztree_check"},id:{CHECK:"_check"},checkbox:{STYLE:"checkbox",DEFAULT:"chk",DISABLED:"disable",FALSE:"false",TRUE:"true",FULL:"full",PART:"part",FOCUS:"focus"},radio:{STYLE:"radio",TYPE_ALL:"all",TYPE_LEVEL:"level"}},v={check:{enable:!1,autoCheckTrigger:!1,chkStyle:o.checkbox.STYLE,nocheckInherit:!1,chkDisabledInherit:!1,radioType:o.radio.TYPE_LEVEL,chkboxType:{Y:"ps",N:"ps"}},data:{key:{checked:"checked"}},callback:{beforeCheck:null,onCheck:null}};p=function(c,
+a){if(a.chkDisabled===!0)return!1;var b=f.getSetting(c.data.treeId),d=b.data.key.checked;if(k.apply(b.callback.beforeCheck,[b.treeId,a],!0)==!1)return!0;a[d]=!a[d];e.checkNodeRelation(b,a);d=n(a,j.id.CHECK,b);e.setChkClass(b,d,a);e.repairParentChkClassWithSelf(b,a);b.treeObj.trigger(j.event.CHECK,[c,b.treeId,a]);return!0};q=function(c,a){if(a.chkDisabled===!0)return!1;var b=f.getSetting(c.data.treeId),d=n(a,j.id.CHECK,b);a.check_Focus=!0;e.setChkClass(b,d,a);return!0};r=function(c,a){if(a.chkDisabled===
+!0)return!1;var b=f.getSetting(c.data.treeId),d=n(a,j.id.CHECK,b);a.check_Focus=!1;e.setChkClass(b,d,a);return!0};m.extend(!0,m.fn.zTree.consts,o);m.extend(!0,m.fn.zTree._z,{tools:{},view:{checkNodeRelation:function(c,a){var b,d,h,i=c.data.key.children,l=c.data.key.checked;b=j.radio;if(c.check.chkStyle==b.STYLE){var g=f.getRadioCheckedList(c);if(a[l])if(c.check.radioType==b.TYPE_ALL){for(d=g.length-1;d>=0;d--)b=g[d],b[l]&&b!=a&&(b[l]=!1,g.splice(d,1),e.setChkClass(c,n(b,j.id.CHECK,c),b),b.parentTId!=
+a.parentTId&&e.repairParentChkClassWithSelf(c,b));g.push(a)}else{g=a.parentTId?a.getParentNode():f.getRoot(c);for(d=0,h=g[i].length;d<h;d++)b=g[i][d],b[l]&&b!=a&&(b[l]=!1,e.setChkClass(c,n(b,j.id.CHECK,c),b))}else if(c.check.radioType==b.TYPE_ALL)for(d=0,h=g.length;d<h;d++)if(a==g[d]){g.splice(d,1);break}}else a[l]&&(!a[i]||a[i].length==0||c.check.chkboxType.Y.indexOf("s")>-1)&&e.setSonNodeCheckBox(c,a,!0),!a[l]&&(!a[i]||a[i].length==0||c.check.chkboxType.N.indexOf("s")>-1)&&e.setSonNodeCheckBox(c,
+a,!1),a[l]&&c.check.chkboxType.Y.indexOf("p")>-1&&e.setParentNodeCheckBox(c,a,!0),!a[l]&&c.check.chkboxType.N.indexOf("p")>-1&&e.setParentNodeCheckBox(c,a,!1)},makeChkClass:function(c,a){var b=c.data.key.checked,d=j.checkbox,h=j.radio,i="",i=a.chkDisabled===!0?d.DISABLED:a.halfCheck?d.PART:c.check.chkStyle==h.STYLE?a.check_Child_State<1?d.FULL:d.PART:a[b]?a.check_Child_State===2||a.check_Child_State===-1?d.FULL:d.PART:a.check_Child_State<1?d.FULL:d.PART,b=c.check.chkStyle+"_"+(a[b]?d.TRUE:d.FALSE)+
+"_"+i,b=a.check_Focus&&a.chkDisabled!==!0?b+"_"+d.FOCUS:b;return j.className.BUTTON+" "+d.DEFAULT+" "+b},repairAllChk:function(c,a){if(c.check.enable&&c.check.chkStyle===j.checkbox.STYLE)for(var b=c.data.key.checked,d=c.data.key.children,h=f.getRoot(c),i=0,l=h[d].length;i<l;i++){var g=h[d][i];g.nocheck!==!0&&g.chkDisabled!==!0&&(g[b]=a);e.setSonNodeCheckBox(c,g,a)}},repairChkClass:function(c,a){if(a&&(f.makeChkFlag(c,a),a.nocheck!==!0)){var b=n(a,j.id.CHECK,c);e.setChkClass(c,b,a)}},repairParentChkClass:function(c,
+a){if(a&&a.parentTId){var b=a.getParentNode();e.repairChkClass(c,b);e.repairParentChkClass(c,b)}},repairParentChkClassWithSelf:function(c,a){if(a){var b=c.data.key.children;a[b]&&a[b].length>0?e.repairParentChkClass(c,a[b][0]):e.repairParentChkClass(c,a)}},repairSonChkDisabled:function(c,a,b,d){if(a){var h=c.data.key.children;if(a.chkDisabled!=b)a.chkDisabled=b;e.repairChkClass(c,a);if(a[h]&&d)for(var i=0,l=a[h].length;i<l;i++)e.repairSonChkDisabled(c,a[h][i],b,d)}},repairParentChkDisabled:function(c,
+a,b,d){if(a){if(a.chkDisabled!=b&&d)a.chkDisabled=b;e.repairChkClass(c,a);e.repairParentChkDisabled(c,a.getParentNode(),b,d)}},setChkClass:function(c,a,b){a&&(b.nocheck===!0?a.hide():a.show(),a.removeClass(),a.addClass(e.makeChkClass(c,b)))},setParentNodeCheckBox:function(c,a,b,d){var h=c.data.key.children,i=c.data.key.checked,l=n(a,j.id.CHECK,c);d||(d=a);f.makeChkFlag(c,a);a.nocheck!==!0&&a.chkDisabled!==!0&&(a[i]=b,e.setChkClass(c,l,a),c.check.autoCheckTrigger&&a!=d&&c.treeObj.trigger(j.event.CHECK,
+[null,c.treeId,a]));if(a.parentTId){l=!0;if(!b)for(var h=a.getParentNode()[h],g=0,k=h.length;g<k;g++)if(h[g].nocheck!==!0&&h[g].chkDisabled!==!0&&h[g][i]||(h[g].nocheck===!0||h[g].chkDisabled===!0)&&h[g].check_Child_State>0){l=!1;break}l&&e.setParentNodeCheckBox(c,a.getParentNode(),b,d)}},setSonNodeCheckBox:function(c,a,b,d){if(a){var h=c.data.key.children,i=c.data.key.checked,l=n(a,j.id.CHECK,c);d||(d=a);var g=!1;if(a[h])for(var k=0,m=a[h].length;k<m&&a.chkDisabled!==!0;k++){var o=a[h][k];e.setSonNodeCheckBox(c,
+o,b,d);o.chkDisabled===!0&&(g=!0)}if(a!=f.getRoot(c)&&a.chkDisabled!==!0){g&&a.nocheck!==!0&&f.makeChkFlag(c,a);if(a.nocheck!==!0&&a.chkDisabled!==!0){if(a[i]=b,!g)a.check_Child_State=a[h]&&a[h].length>0?b?2:0:-1}else a.check_Child_State=-1;e.setChkClass(c,l,a);c.check.autoCheckTrigger&&a!=d&&a.nocheck!==!0&&a.chkDisabled!==!0&&c.treeObj.trigger(j.event.CHECK,[null,c.treeId,a])}}}},event:{},data:{getRadioCheckedList:function(c){for(var a=f.getRoot(c).radioCheckedList,b=0,d=a.length;b<d;b++)f.getNodeCache(c,
+a[b].tId)||(a.splice(b,1),b--,d--);return a},getCheckStatus:function(c,a){if(!c.check.enable||a.nocheck||a.chkDisabled)return null;var b=c.data.key.checked;return{checked:a[b],half:a.halfCheck?a.halfCheck:c.check.chkStyle==j.radio.STYLE?a.check_Child_State===2:a[b]?a.check_Child_State>-1&&a.check_Child_State<2:a.check_Child_State>0}},getTreeCheckedNodes:function(c,a,b,d){if(!a)return[];for(var h=c.data.key.children,i=c.data.key.checked,e=b&&c.check.chkStyle==j.radio.STYLE&&c.check.radioType==j.radio.TYPE_ALL,
+d=!d?[]:d,g=0,k=a.length;g<k;g++){if(a[g].nocheck!==!0&&a[g].chkDisabled!==!0&&a[g][i]==b&&(d.push(a[g]),e))break;f.getTreeCheckedNodes(c,a[g][h],b,d);if(e&&d.length>0)break}return d},getTreeChangeCheckedNodes:function(c,a,b){if(!a)return[];for(var d=c.data.key.children,h=c.data.key.checked,b=!b?[]:b,i=0,e=a.length;i<e;i++)a[i].nocheck!==!0&&a[i].chkDisabled!==!0&&a[i][h]!=a[i].checkedOld&&b.push(a[i]),f.getTreeChangeCheckedNodes(c,a[i][d],b);return b},makeChkFlag:function(c,a){if(a){var b=c.data.key.children,
+d=c.data.key.checked,h=-1;if(a[b])for(var i=0,e=a[b].length;i<e;i++){var g=a[b][i],f=-1;if(c.check.chkStyle==j.radio.STYLE)if(f=g.nocheck===!0||g.chkDisabled===!0?g.check_Child_State:g.halfCheck===!0?2:g[d]?2:g.check_Child_State>0?2:0,f==2){h=2;break}else f==0&&(h=0);else if(c.check.chkStyle==j.checkbox.STYLE)if(f=g.nocheck===!0||g.chkDisabled===!0?g.check_Child_State:g.halfCheck===!0?1:g[d]?g.check_Child_State===-1||g.check_Child_State===2?2:1:g.check_Child_State>0?1:0,f===1){h=1;break}else if(f===
+2&&h>-1&&i>0&&f!==h){h=1;break}else if(h===2&&f>-1&&f<2){h=1;break}else f>-1&&(h=f)}a.check_Child_State=h}}}});var m=m.fn.zTree,k=m._z.tools,j=m.consts,e=m._z.view,f=m._z.data,n=k.$;f.exSetting(v);f.addInitBind(function(c){c.treeObj.bind(j.event.CHECK,function(a,b,d,h){a.srcEvent=b;k.apply(c.callback.onCheck,[a,d,h])})});f.addInitUnBind(function(c){c.treeObj.unbind(j.event.CHECK)});f.addInitCache(function(){});f.addInitNode(function(c,a,b,d){if(b){a=c.data.key.checked;typeof b[a]=="string"&&(b[a]=
+k.eqs(b[a],"true"));b[a]=!!b[a];b.checkedOld=b[a];if(typeof b.nocheck=="string")b.nocheck=k.eqs(b.nocheck,"true");b.nocheck=!!b.nocheck||c.check.nocheckInherit&&d&&!!d.nocheck;if(typeof b.chkDisabled=="string")b.chkDisabled=k.eqs(b.chkDisabled,"true");b.chkDisabled=!!b.chkDisabled||c.check.chkDisabledInherit&&d&&!!d.chkDisabled;if(typeof b.halfCheck=="string")b.halfCheck=k.eqs(b.halfCheck,"true");b.halfCheck=!!b.halfCheck;b.check_Child_State=-1;b.check_Focus=!1;b.getCheckStatus=function(){return f.getCheckStatus(c,
+b)};c.check.chkStyle==j.radio.STYLE&&c.check.radioType==j.radio.TYPE_ALL&&b[a]&&f.getRoot(c).radioCheckedList.push(b)}});f.addInitProxy(function(c){var a=c.target,b=f.getSetting(c.data.treeId),d="",h=null,e="",l=null;if(k.eqs(c.type,"mouseover")){if(b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=k.getNodeMainDom(a).id,e="mouseoverCheck"}else if(k.eqs(c.type,"mouseout")){if(b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=
+k.getNodeMainDom(a).id,e="mouseoutCheck"}else if(k.eqs(c.type,"click")&&b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=k.getNodeMainDom(a).id,e="checkNode";if(d.length>0)switch(h=f.getNodeCache(b,d),e){case "checkNode":l=p;break;case "mouseoverCheck":l=q;break;case "mouseoutCheck":l=r}return{stop:e==="checkNode",node:h,nodeEventType:e,nodeEventCallback:l,treeEventType:"",treeEventCallback:null}},!0);f.addInitRoot(function(c){f.getRoot(c).radioCheckedList=[]});
+f.addBeforeA(function(c,a,b){c.check.enable&&(f.makeChkFlag(c,a),b.push("<span ID='",a.tId,j.id.CHECK,"' class='",e.makeChkClass(c,a),"' treeNode",j.id.CHECK,a.nocheck===!0?" style='display:none;'":"","></span>"))});f.addZTreeTools(function(c,a){a.checkNode=function(a,b,c,f){var g=this.setting.data.key.checked;if(a.chkDisabled!==!0&&(b!==!0&&b!==!1&&(b=!a[g]),f=!!f,(a[g]!==b||c)&&!(f&&k.apply(this.setting.callback.beforeCheck,[this.setting.treeId,a],!0)==!1)&&k.uCanDo(this.setting)&&this.setting.check.enable&&
+a.nocheck!==!0))a[g]=b,b=n(a,j.id.CHECK,this.setting),(c||this.setting.check.chkStyle===j.radio.STYLE)&&e.checkNodeRelation(this.setting,a),e.setChkClass(this.setting,b,a),e.repairParentChkClassWithSelf(this.setting,a),f&&this.setting.treeObj.trigger(j.event.CHECK,[null,this.setting.treeId,a])};a.checkAllNodes=function(a){e.repairAllChk(this.setting,!!a)};a.getCheckedNodes=function(a){var b=this.setting.data.key.children;return f.getTreeCheckedNodes(this.setting,f.getRoot(this.setting)[b],a!==!1)};
+a.getChangeCheckedNodes=function(){var a=this.setting.data.key.children;return f.getTreeChangeCheckedNodes(this.setting,f.getRoot(this.setting)[a])};a.setChkDisabled=function(a,b,c,f){b=!!b;c=!!c;e.repairSonChkDisabled(this.setting,a,b,!!f);e.repairParentChkDisabled(this.setting,a.getParentNode(),b,c)};var b=a.updateNode;a.updateNode=function(c,f){b&&b.apply(a,arguments);if(c&&this.setting.check.enable&&n(c,this.setting).get(0)&&k.uCanDo(this.setting)){var i=n(c,j.id.CHECK,this.setting);(f==!0||this.setting.check.chkStyle===
+j.radio.STYLE)&&e.checkNodeRelation(this.setting,c);e.setChkClass(this.setting,i,c);e.repairParentChkClassWithSelf(this.setting,c)}}});var s=e.createNodes;e.createNodes=function(c,a,b,d){s&&s.apply(e,arguments);b&&e.repairParentChkClassWithSelf(c,d)};var t=e.removeNode;e.removeNode=function(c,a){var b=a.getParentNode();t&&t.apply(e,arguments);a&&b&&(e.repairChkClass(c,b),e.repairParentChkClass(c,b))};var u=e.appendNodes;e.appendNodes=function(c,a,b,d,h,i){var j="";u&&(j=u.apply(e,arguments));d&&f.makeChkFlag(c,
+d);return j}})(jQuery);
+
+/*
+ * JQuery zTree exedit v3.5.16
+ * http://zTree.me/
+ *
+ * Copyright (c) 2010 Hunter.z
+ *
+ * Licensed same as jquery - MIT License
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * email: hunter.z@263.net
+ * Date: 2014-03-09
+ */
+(function(w){var I={event:{DRAG:"ztree_drag",DROP:"ztree_drop",RENAME:"ztree_rename",DRAGMOVE:"ztree_dragmove"},id:{EDIT:"_edit",INPUT:"_input",REMOVE:"_remove"},move:{TYPE_INNER:"inner",TYPE_PREV:"prev",TYPE_NEXT:"next"},node:{CURSELECTED_EDIT:"curSelectedNode_Edit",TMPTARGET_TREE:"tmpTargetzTree",TMPTARGET_NODE:"tmpTargetNode"}},x={onHoverOverNode:function(b,a){var c=m.getSetting(b.data.treeId),d=m.getRoot(c);if(d.curHoverNode!=a)x.onHoverOutNode(b);d.curHoverNode=a;f.addHoverDom(c,a)},onHoverOutNode:function(b){var b=
+m.getSetting(b.data.treeId),a=m.getRoot(b);if(a.curHoverNode&&!m.isSelectedNode(b,a.curHoverNode))f.removeTreeDom(b,a.curHoverNode),a.curHoverNode=null},onMousedownNode:function(b,a){function c(b){if(C.dragFlag==0&&Math.abs(N-b.clientX)<e.edit.drag.minMoveSize&&Math.abs(O-b.clientY)<e.edit.drag.minMoveSize)return!0;var a,c,n,k,i;i=e.data.key.children;M.css("cursor","pointer");if(C.dragFlag==0){if(g.apply(e.callback.beforeDrag,[e.treeId,l],!0)==!1)return r(b),!0;for(a=0,c=l.length;a<c;a++){if(a==0)C.dragNodeShowBefore=
+[];n=l[a];n.isParent&&n.open?(f.expandCollapseNode(e,n,!n.open),C.dragNodeShowBefore[n.tId]=!0):C.dragNodeShowBefore[n.tId]=!1}C.dragFlag=1;t.showHoverDom=!1;g.showIfameMask(e,!0);n=!0;k=-1;if(l.length>1){var j=l[0].parentTId?l[0].getParentNode()[i]:m.getNodes(e);i=[];for(a=0,c=j.length;a<c;a++)if(C.dragNodeShowBefore[j[a].tId]!==void 0&&(n&&k>-1&&k+1!==a&&(n=!1),i.push(j[a]),k=a),l.length===i.length){l=i;break}}n&&(H=l[0].getPreNode(),R=l[l.length-1].getNextNode());D=o("<ul class='zTreeDragUL'></ul>",
+e);for(a=0,c=l.length;a<c;a++)n=l[a],n.editNameFlag=!1,f.selectNode(e,n,a>0),f.removeTreeDom(e,n),a>e.edit.drag.maxShowNodeNum-1||(k=o("<li id='"+n.tId+"_tmp'></li>",e),k.append(o(n,d.id.A,e).clone()),k.css("padding","0"),k.children("#"+n.tId+d.id.A).removeClass(d.node.CURSELECTED),D.append(k),a==e.edit.drag.maxShowNodeNum-1&&(k=o("<li id='"+n.tId+"_moretmp'><a> ... </a></li>",e),D.append(k)));D.attr("id",l[0].tId+d.id.UL+"_tmp");D.addClass(e.treeObj.attr("class"));D.appendTo(M);B=o("<span class='tmpzTreeMove_arrow'></span>",
+e);B.attr("id","zTreeMove_arrow_tmp");B.appendTo(M);e.treeObj.trigger(d.event.DRAG,[b,e.treeId,l])}if(C.dragFlag==1){s&&B.attr("id")==b.target.id&&u&&b.clientX+F.scrollLeft()+2>w("#"+u+d.id.A,s).offset().left?(n=w("#"+u+d.id.A,s),b.target=n.length>0?n.get(0):b.target):s&&(s.removeClass(d.node.TMPTARGET_TREE),u&&w("#"+u+d.id.A,s).removeClass(d.node.TMPTARGET_NODE+"_"+d.move.TYPE_PREV).removeClass(d.node.TMPTARGET_NODE+"_"+I.move.TYPE_NEXT).removeClass(d.node.TMPTARGET_NODE+"_"+I.move.TYPE_INNER));
+u=s=null;J=!1;h=e;n=m.getSettings();for(var y in n)if(n[y].treeId&&n[y].edit.enable&&n[y].treeId!=e.treeId&&(b.target.id==n[y].treeId||w(b.target).parents("#"+n[y].treeId).length>0))J=!0,h=n[y];y=F.scrollTop();k=F.scrollLeft();i=h.treeObj.offset();a=h.treeObj.get(0).scrollHeight;n=h.treeObj.get(0).scrollWidth;c=b.clientY+y-i.top;var p=h.treeObj.height()+i.top-b.clientY-y,q=b.clientX+k-i.left,x=h.treeObj.width()+i.left-b.clientX-k;i=c<e.edit.drag.borderMax&&c>e.edit.drag.borderMin;var j=p<e.edit.drag.borderMax&&
+p>e.edit.drag.borderMin,K=q<e.edit.drag.borderMax&&q>e.edit.drag.borderMin,G=x<e.edit.drag.borderMax&&x>e.edit.drag.borderMin,p=c>e.edit.drag.borderMin&&p>e.edit.drag.borderMin&&q>e.edit.drag.borderMin&&x>e.edit.drag.borderMin,q=i&&h.treeObj.scrollTop()<=0,x=j&&h.treeObj.scrollTop()+h.treeObj.height()+10>=a,P=K&&h.treeObj.scrollLeft()<=0,Q=G&&h.treeObj.scrollLeft()+h.treeObj.width()+10>=n;if(b.target&&g.isChildOrSelf(b.target,h.treeId)){for(var E=b.target;E&&E.tagName&&!g.eqs(E.tagName,"li")&&E.id!=
+h.treeId;)E=E.parentNode;var S=!0;for(a=0,c=l.length;a<c;a++)if(n=l[a],E.id===n.tId){S=!1;break}else if(o(n,e).find("#"+E.id).length>0){S=!1;break}if(S&&b.target&&g.isChildOrSelf(b.target,E.id+d.id.A))s=w(E),u=E.id}n=l[0];if(p&&g.isChildOrSelf(b.target,h.treeId)){if(!s&&(b.target.id==h.treeId||q||x||P||Q)&&(J||!J&&n.parentTId))s=h.treeObj;i?h.treeObj.scrollTop(h.treeObj.scrollTop()-10):j&&h.treeObj.scrollTop(h.treeObj.scrollTop()+10);K?h.treeObj.scrollLeft(h.treeObj.scrollLeft()-10):G&&h.treeObj.scrollLeft(h.treeObj.scrollLeft()+
+10);s&&s!=h.treeObj&&s.offset().left<h.treeObj.offset().left&&h.treeObj.scrollLeft(h.treeObj.scrollLeft()+s.offset().left-h.treeObj.offset().left)}D.css({top:b.clientY+y+3+"px",left:b.clientX+k+3+"px"});i=a=0;if(s&&s.attr("id")!=h.treeId){var z=u==null?null:m.getNodeCache(h,u);c=(b.ctrlKey||b.metaKey)&&e.edit.drag.isMove&&e.edit.drag.isCopy||!e.edit.drag.isMove&&e.edit.drag.isCopy;a=!!(H&&u===H.tId);i=!!(R&&u===R.tId);k=n.parentTId&&n.parentTId==u;n=(c||!i)&&g.apply(h.edit.drag.prev,[h.treeId,l,z],
+!!h.edit.drag.prev);a=(c||!a)&&g.apply(h.edit.drag.next,[h.treeId,l,z],!!h.edit.drag.next);G=(c||!k)&&!(h.data.keep.leaf&&!z.isParent)&&g.apply(h.edit.drag.inner,[h.treeId,l,z],!!h.edit.drag.inner);if(!n&&!a&&!G){if(s=null,u="",v=d.move.TYPE_INNER,B.css({display:"none"}),window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null}else{c=w("#"+u+d.id.A,s);i=z.isLastNode?null:w("#"+z.getNextNode().tId+d.id.A,s.next());j=c.offset().top;k=c.offset().left;K=n?G?0.25:a?
+0.5:1:-1;G=a?G?0.75:n?0.5:0:-1;y=(b.clientY+y-j)/c.height();(K==1||y<=K&&y>=-0.2)&&n?(a=1-B.width(),i=j-B.height()/2,v=d.move.TYPE_PREV):(G==0||y>=G&&y<=1.2)&&a?(a=1-B.width(),i=i==null||z.isParent&&z.open?j+c.height()-B.height()/2:i.offset().top-B.height()/2,v=d.move.TYPE_NEXT):(a=5-B.width(),i=j,v=d.move.TYPE_INNER);B.css({display:"block",top:i+"px",left:k+a+"px"});c.addClass(d.node.TMPTARGET_NODE+"_"+v);if(T!=u||U!=v)L=(new Date).getTime();if(z&&z.isParent&&v==d.move.TYPE_INNER&&(y=!0,window.zTreeMoveTimer&&
+window.zTreeMoveTargetNodeTId!==z.tId?(clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null):window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId===z.tId&&(y=!1),y))window.zTreeMoveTimer=setTimeout(function(){v==d.move.TYPE_INNER&&z&&z.isParent&&!z.open&&(new Date).getTime()-L>h.edit.drag.autoOpenTime&&g.apply(h.callback.beforeDragOpen,[h.treeId,z],!0)&&(f.switchNode(h,z),h.edit.drag.autoExpandTrigger&&h.treeObj.trigger(d.event.EXPAND,[h.treeId,z]))},h.edit.drag.autoOpenTime+50),
+window.zTreeMoveTargetNodeTId=z.tId}}else if(v=d.move.TYPE_INNER,s&&g.apply(h.edit.drag.inner,[h.treeId,l,null],!!h.edit.drag.inner)?s.addClass(d.node.TMPTARGET_TREE):s=null,B.css({display:"none"}),window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null;T=u;U=v;e.treeObj.trigger(d.event.DRAGMOVE,[b,e.treeId,l])}return!1}function r(b){if(window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null;U=T=null;F.unbind("mousemove",c);
+F.unbind("mouseup",r);F.unbind("selectstart",k);M.css("cursor","auto");s&&(s.removeClass(d.node.TMPTARGET_TREE),u&&w("#"+u+d.id.A,s).removeClass(d.node.TMPTARGET_NODE+"_"+d.move.TYPE_PREV).removeClass(d.node.TMPTARGET_NODE+"_"+I.move.TYPE_NEXT).removeClass(d.node.TMPTARGET_NODE+"_"+I.move.TYPE_INNER));g.showIfameMask(e,!1);t.showHoverDom=!0;if(C.dragFlag!=0){C.dragFlag=0;var a,i,j;for(a=0,i=l.length;a<i;a++)j=l[a],j.isParent&&C.dragNodeShowBefore[j.tId]&&!j.open&&(f.expandCollapseNode(e,j,!j.open),
+delete C.dragNodeShowBefore[j.tId]);D&&D.remove();B&&B.remove();var p=(b.ctrlKey||b.metaKey)&&e.edit.drag.isMove&&e.edit.drag.isCopy||!e.edit.drag.isMove&&e.edit.drag.isCopy;!p&&s&&u&&l[0].parentTId&&u==l[0].parentTId&&v==d.move.TYPE_INNER&&(s=null);if(s){var q=u==null?null:m.getNodeCache(h,u);if(g.apply(e.callback.beforeDrop,[h.treeId,l,q,v,p],!0)==!1)f.selectNodes(x,l);else{var A=p?g.clone(l):l;a=function(){if(J){if(!p)for(var a=0,c=l.length;a<c;a++)f.removeNode(e,l[a]);if(v==d.move.TYPE_INNER)f.addNodes(h,
+q,A);else if(f.addNodes(h,q.getParentNode(),A),v==d.move.TYPE_PREV)for(a=0,c=A.length;a<c;a++)f.moveNode(h,q,A[a],v,!1);else for(a=-1,c=A.length-1;a<c;c--)f.moveNode(h,q,A[c],v,!1)}else if(p&&v==d.move.TYPE_INNER)f.addNodes(h,q,A);else if(p&&f.addNodes(h,q.getParentNode(),A),v!=d.move.TYPE_NEXT)for(a=0,c=A.length;a<c;a++)f.moveNode(h,q,A[a],v,!1);else for(a=-1,c=A.length-1;a<c;c--)f.moveNode(h,q,A[c],v,!1);f.selectNodes(h,A);o(A[0],e).focus().blur();e.treeObj.trigger(d.event.DROP,[b,h.treeId,A,q,
+v,p])};v==d.move.TYPE_INNER&&g.canAsync(h,q)?f.asyncNode(h,q,!1,a):a()}}else f.selectNodes(x,l),e.treeObj.trigger(d.event.DROP,[b,e.treeId,l,null,null,null])}}function k(){return!1}var i,j,e=m.getSetting(b.data.treeId),C=m.getRoot(e),t=m.getRoots();if(b.button==2||!e.edit.enable||!e.edit.drag.isCopy&&!e.edit.drag.isMove)return!0;var p=b.target,q=m.getRoot(e).curSelectedList,l=[];if(m.isSelectedNode(e,a))for(i=0,j=q.length;i<j;i++){if(q[i].editNameFlag&&g.eqs(p.tagName,"input")&&p.getAttribute("treeNode"+
+d.id.INPUT)!==null)return!0;l.push(q[i]);if(l[0].parentTId!==q[i].parentTId){l=[a];break}}else l=[a];f.editNodeBlur=!0;f.cancelCurEditNode(e);var F=w(e.treeObj.get(0).ownerDocument),M=w(e.treeObj.get(0).ownerDocument.body),D,B,s,J=!1,h=e,x=e,H,R,T=null,U=null,u=null,v=d.move.TYPE_INNER,N=b.clientX,O=b.clientY,L=(new Date).getTime();g.uCanDo(e)&&F.bind("mousemove",c);F.bind("mouseup",r);F.bind("selectstart",k);b.preventDefault&&b.preventDefault();return!0}};w.extend(!0,w.fn.zTree.consts,I);w.extend(!0,
+w.fn.zTree._z,{tools:{getAbs:function(b){b=b.getBoundingClientRect();return[b.left+(document.body.scrollLeft+document.documentElement.scrollLeft),b.top+(document.body.scrollTop+document.documentElement.scrollTop)]},inputFocus:function(b){b.get(0)&&(b.focus(),g.setCursorPosition(b.get(0),b.val().length))},inputSelect:function(b){b.get(0)&&(b.focus(),b.select())},setCursorPosition:function(b,a){if(b.setSelectionRange)b.focus(),b.setSelectionRange(a,a);else if(b.createTextRange){var c=b.createTextRange();
+c.collapse(!0);c.moveEnd("character",a);c.moveStart("character",a);c.select()}},showIfameMask:function(b,a){for(var c=m.getRoot(b);c.dragMaskList.length>0;)c.dragMaskList[0].remove(),c.dragMaskList.shift();if(a)for(var d=o("iframe",b),f=0,i=d.length;f<i;f++){var j=d.get(f),e=g.getAbs(j),j=o("<div id='zTreeMask_"+f+"' class='zTreeMask' style='top:"+e[1]+"px; left:"+e[0]+"px; width:"+j.offsetWidth+"px; height:"+j.offsetHeight+"px;'></div>",b);j.appendTo(o("body",b));c.dragMaskList.push(j)}}},view:{addEditBtn:function(b,
+a){if(!(a.editNameFlag||o(a,d.id.EDIT,b).length>0)&&g.apply(b.edit.showRenameBtn,[b.treeId,a],b.edit.showRenameBtn)){var c=o(a,d.id.A,b),r="<span class='"+d.className.BUTTON+" edit' id='"+a.tId+d.id.EDIT+"' title='"+g.apply(b.edit.renameTitle,[b.treeId,a],b.edit.renameTitle)+"' treeNode"+d.id.EDIT+" style='display:none;'></span>";c.append(r);o(a,d.id.EDIT,b).bind("click",function(){if(!g.uCanDo(b)||g.apply(b.callback.beforeEditName,[b.treeId,a],!0)==!1)return!1;f.editNode(b,a);return!1}).show()}},
+addRemoveBtn:function(b,a){if(!(a.editNameFlag||o(a,d.id.REMOVE,b).length>0)&&g.apply(b.edit.showRemoveBtn,[b.treeId,a],b.edit.showRemoveBtn)){var c=o(a,d.id.A,b),r="<span class='"+d.className.BUTTON+" remove' id='"+a.tId+d.id.REMOVE+"' title='"+g.apply(b.edit.removeTitle,[b.treeId,a],b.edit.removeTitle)+"' treeNode"+d.id.REMOVE+" style='display:none;'></span>";c.append(r);o(a,d.id.REMOVE,b).bind("click",function(){if(!g.uCanDo(b)||g.apply(b.callback.beforeRemove,[b.treeId,a],!0)==!1)return!1;f.removeNode(b,
+a);b.treeObj.trigger(d.event.REMOVE,[b.treeId,a]);return!1}).bind("mousedown",function(){return!0}).show()}},addHoverDom:function(b,a){if(m.getRoots().showHoverDom)a.isHover=!0,b.edit.enable&&(f.addEditBtn(b,a),f.addRemoveBtn(b,a)),g.apply(b.view.addHoverDom,[b.treeId,a])},cancelCurEditNode:function(b,a,c){var r=m.getRoot(b),k=b.data.key.name,i=r.curEditNode;if(i){var j=r.curEditInput,a=a?a:c?i[k]:j.val();if(g.apply(b.callback.beforeRename,[b.treeId,i,a,c],!0)===!1)return!1;else i[k]=a,b.treeObj.trigger(d.event.RENAME,
+[b.treeId,i,c]);o(i,d.id.A,b).removeClass(d.node.CURSELECTED_EDIT);j.unbind();f.setNodeName(b,i);i.editNameFlag=!1;r.curEditNode=null;r.curEditInput=null;f.selectNode(b,i,!1)}return r.noSelection=!0},editNode:function(b,a){var c=m.getRoot(b);f.editNodeBlur=!1;if(m.isSelectedNode(b,a)&&c.curEditNode==a&&a.editNameFlag)setTimeout(function(){g.inputFocus(c.curEditInput)},0);else{var r=b.data.key.name;a.editNameFlag=!0;f.removeTreeDom(b,a);f.cancelCurEditNode(b);f.selectNode(b,a,!1);o(a,d.id.SPAN,b).html("<input type=text class='rename' id='"+
+a.tId+d.id.INPUT+"' treeNode"+d.id.INPUT+" >");var k=o(a,d.id.INPUT,b);k.attr("value",a[r]);b.edit.editNameSelectAll?g.inputSelect(k):g.inputFocus(k);k.bind("blur",function(){f.editNodeBlur||f.cancelCurEditNode(b)}).bind("keydown",function(a){a.keyCode=="13"?(f.editNodeBlur=!0,f.cancelCurEditNode(b)):a.keyCode=="27"&&f.cancelCurEditNode(b,null,!0)}).bind("click",function(){return!1}).bind("dblclick",function(){return!1});o(a,d.id.A,b).addClass(d.node.CURSELECTED_EDIT);c.curEditInput=k;c.noSelection=
+!1;c.curEditNode=a}},moveNode:function(b,a,c,r,k,i){var j=m.getRoot(b),e=b.data.key.children;if(a!=c&&(!b.data.keep.leaf||!a||a.isParent||r!=d.move.TYPE_INNER)){var g=c.parentTId?c.getParentNode():j,t=a===null||a==j;t&&a===null&&(a=j);if(t)r=d.move.TYPE_INNER;j=a.parentTId?a.getParentNode():j;if(r!=d.move.TYPE_PREV&&r!=d.move.TYPE_NEXT)r=d.move.TYPE_INNER;if(r==d.move.TYPE_INNER)if(t)c.parentTId=null;else{if(!a.isParent)a.isParent=!0,a.open=!!a.open,f.setNodeLineIcos(b,a);c.parentTId=a.tId}var p;
+t?p=t=b.treeObj:(!i&&r==d.move.TYPE_INNER?f.expandCollapseNode(b,a,!0,!1):i||f.expandCollapseNode(b,a.getParentNode(),!0,!1),t=o(a,b),p=o(a,d.id.UL,b),t.get(0)&&!p.get(0)&&(p=[],f.makeUlHtml(b,a,p,""),t.append(p.join(""))),p=o(a,d.id.UL,b));var q=o(c,b);q.get(0)?t.get(0)||q.remove():q=f.appendNodes(b,c.level,[c],null,!1,!0).join("");p.get(0)&&r==d.move.TYPE_INNER?p.append(q):t.get(0)&&r==d.move.TYPE_PREV?t.before(q):t.get(0)&&r==d.move.TYPE_NEXT&&t.after(q);var l=-1,w=0,x=null,t=null,D=c.level;if(c.isFirstNode){if(l=
+0,g[e].length>1)x=g[e][1],x.isFirstNode=!0}else if(c.isLastNode)l=g[e].length-1,x=g[e][l-1],x.isLastNode=!0;else for(p=0,q=g[e].length;p<q;p++)if(g[e][p].tId==c.tId){l=p;break}l>=0&&g[e].splice(l,1);if(r!=d.move.TYPE_INNER)for(p=0,q=j[e].length;p<q;p++)j[e][p].tId==a.tId&&(w=p);if(r==d.move.TYPE_INNER){a[e]||(a[e]=[]);if(a[e].length>0)t=a[e][a[e].length-1],t.isLastNode=!1;a[e].splice(a[e].length,0,c);c.isLastNode=!0;c.isFirstNode=a[e].length==1}else a.isFirstNode&&r==d.move.TYPE_PREV?(j[e].splice(w,
+0,c),t=a,t.isFirstNode=!1,c.parentTId=a.parentTId,c.isFirstNode=!0,c.isLastNode=!1):a.isLastNode&&r==d.move.TYPE_NEXT?(j[e].splice(w+1,0,c),t=a,t.isLastNode=!1,c.parentTId=a.parentTId,c.isFirstNode=!1,c.isLastNode=!0):(r==d.move.TYPE_PREV?j[e].splice(w,0,c):j[e].splice(w+1,0,c),c.parentTId=a.parentTId,c.isFirstNode=!1,c.isLastNode=!1);m.fixPIdKeyValue(b,c);m.setSonNodeLevel(b,c.getParentNode(),c);f.setNodeLineIcos(b,c);f.repairNodeLevelClass(b,c,D);!b.data.keep.parent&&g[e].length<1?(g.isParent=!1,
+g.open=!1,a=o(g,d.id.UL,b),r=o(g,d.id.SWITCH,b),e=o(g,d.id.ICON,b),f.replaceSwitchClass(g,r,d.folder.DOCU),f.replaceIcoClass(g,e,d.folder.DOCU),a.css("display","none")):x&&f.setNodeLineIcos(b,x);t&&f.setNodeLineIcos(b,t);b.check&&b.check.enable&&f.repairChkClass&&(f.repairChkClass(b,g),f.repairParentChkClassWithSelf(b,g),g!=c.parent&&f.repairParentChkClassWithSelf(b,c));i||f.expandCollapseParentNode(b,c.getParentNode(),!0,k)}},removeEditBtn:function(b,a){o(a,d.id.EDIT,b).unbind().remove()},removeRemoveBtn:function(b,
+a){o(a,d.id.REMOVE,b).unbind().remove()},removeTreeDom:function(b,a){a.isHover=!1;f.removeEditBtn(b,a);f.removeRemoveBtn(b,a);g.apply(b.view.removeHoverDom,[b.treeId,a])},repairNodeLevelClass:function(b,a,c){if(c!==a.level){var f=o(a,b),g=o(a,d.id.A,b),b=o(a,d.id.UL,b),c=d.className.LEVEL+c,a=d.className.LEVEL+a.level;f.removeClass(c);f.addClass(a);g.removeClass(c);g.addClass(a);b.removeClass(c);b.addClass(a)}},selectNodes:function(b,a){for(var c=0,d=a.length;c<d;c++)f.selectNode(b,a[c],c>0)}},event:{},
+data:{setSonNodeLevel:function(b,a,c){if(c){var d=b.data.key.children;c.level=a?a.level+1:0;if(c[d])for(var a=0,f=c[d].length;a<f;a++)c[d][a]&&m.setSonNodeLevel(b,c,c[d][a])}}}});var H=w.fn.zTree,g=H._z.tools,d=H.consts,f=H._z.view,m=H._z.data,o=g.$;m.exSetting({edit:{enable:!1,editNameSelectAll:!1,showRemoveBtn:!0,showRenameBtn:!0,removeTitle:"remove",renameTitle:"rename",drag:{autoExpandTrigger:!1,isCopy:!0,isMove:!0,prev:!0,next:!0,inner:!0,minMoveSize:5,borderMax:10,borderMin:-5,maxShowNodeNum:5,
+autoOpenTime:500}},view:{addHoverDom:null,removeHoverDom:null},callback:{beforeDrag:null,beforeDragOpen:null,beforeDrop:null,beforeEditName:null,beforeRename:null,onDrag:null,onDragMove:null,onDrop:null,onRename:null}});m.addInitBind(function(b){var a=b.treeObj,c=d.event;a.bind(c.RENAME,function(a,c,d,f){g.apply(b.callback.onRename,[a,c,d,f])});a.bind(c.DRAG,function(a,c,d,f){g.apply(b.callback.onDrag,[c,d,f])});a.bind(c.DRAGMOVE,function(a,c,d,f){g.apply(b.callback.onDragMove,[c,d,f])});a.bind(c.DROP,
+function(a,c,d,f,e,m,o){g.apply(b.callback.onDrop,[c,d,f,e,m,o])})});m.addInitUnBind(function(b){var b=b.treeObj,a=d.event;b.unbind(a.RENAME);b.unbind(a.DRAG);b.unbind(a.DRAGMOVE);b.unbind(a.DROP)});m.addInitCache(function(){});m.addInitNode(function(b,a,c){if(c)c.isHover=!1,c.editNameFlag=!1});m.addInitProxy(function(b){var a=b.target,c=m.getSetting(b.data.treeId),f=b.relatedTarget,k="",i=null,j="",e=null,o=null;if(g.eqs(b.type,"mouseover")){if(o=g.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+d.id.A}]))k=
+g.getNodeMainDom(o).id,j="hoverOverNode"}else if(g.eqs(b.type,"mouseout"))o=g.getMDom(c,f,[{tagName:"a",attrName:"treeNode"+d.id.A}]),o||(k="remove",j="hoverOutNode");else if(g.eqs(b.type,"mousedown")&&(o=g.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+d.id.A}])))k=g.getNodeMainDom(o).id,j="mousedownNode";if(k.length>0)switch(i=m.getNodeCache(c,k),j){case "mousedownNode":e=x.onMousedownNode;break;case "hoverOverNode":e=x.onHoverOverNode;break;case "hoverOutNode":e=x.onHoverOutNode}return{stop:!1,
+node:i,nodeEventType:j,nodeEventCallback:e,treeEventType:"",treeEventCallback:null}});m.addInitRoot(function(b){var b=m.getRoot(b),a=m.getRoots();b.curEditNode=null;b.curEditInput=null;b.curHoverNode=null;b.dragFlag=0;b.dragNodeShowBefore=[];b.dragMaskList=[];a.showHoverDom=!0});m.addZTreeTools(function(b,a){a.cancelEditName=function(a){m.getRoot(this.setting).curEditNode&&f.cancelCurEditNode(this.setting,a?a:null,!0)};a.copyNode=function(a,b,k,i){if(!b)return null;if(a&&!a.isParent&&this.setting.data.keep.leaf&&
+k===d.move.TYPE_INNER)return null;var j=this,e=g.clone(b);if(!a)a=null,k=d.move.TYPE_INNER;k==d.move.TYPE_INNER?(b=function(){f.addNodes(j.setting,a,[e],i)},g.canAsync(this.setting,a)?f.asyncNode(this.setting,a,i,b):b()):(f.addNodes(this.setting,a.parentNode,[e],i),f.moveNode(this.setting,a,e,k,!1,i));return e};a.editName=function(a){a&&a.tId&&a===m.getNodeCache(this.setting,a.tId)&&(a.parentTId&&f.expandCollapseParentNode(this.setting,a.getParentNode(),!0),f.editNode(this.setting,a))};a.moveNode=
+function(a,b,k,i){function j(){f.moveNode(e.setting,a,b,k,!1,i)}if(!b)return b;if(a&&!a.isParent&&this.setting.data.keep.leaf&&k===d.move.TYPE_INNER)return null;else if(a&&(b.parentTId==a.tId&&k==d.move.TYPE_INNER||o(b,this.setting).find("#"+a.tId).length>0))return null;else a||(a=null);var e=this;g.canAsync(this.setting,a)&&k===d.move.TYPE_INNER?f.asyncNode(this.setting,a,i,j):j();return b};a.setEditable=function(a){this.setting.edit.enable=a;return this.refresh()}});var N=f.cancelPreSelectedNode;
+f.cancelPreSelectedNode=function(b,a){for(var c=m.getRoot(b).curSelectedList,d=0,g=c.length;d<g;d++)if(!a||a===c[d])if(f.removeTreeDom(b,c[d]),a)break;N&&N.apply(f,arguments)};var O=f.createNodes;f.createNodes=function(b,a,c,d){O&&O.apply(f,arguments);c&&f.repairParentChkClassWithSelf&&f.repairParentChkClassWithSelf(b,d)};var V=f.makeNodeUrl;f.makeNodeUrl=function(b,a){return b.edit.enable?null:V.apply(f,arguments)};var L=f.removeNode;f.removeNode=function(b,a){var c=m.getRoot(b);if(c.curEditNode===
+a)c.curEditNode=null;L&&L.apply(f,arguments)};var P=f.selectNode;f.selectNode=function(b,a,c){var d=m.getRoot(b);if(m.isSelectedNode(b,a)&&d.curEditNode==a&&a.editNameFlag)return!1;P&&P.apply(f,arguments);f.addHoverDom(b,a);return!0};var Q=g.uCanDo;g.uCanDo=function(b,a){var c=m.getRoot(b);if(a&&(g.eqs(a.type,"mouseover")||g.eqs(a.type,"mouseout")||g.eqs(a.type,"mousedown")||g.eqs(a.type,"mouseup")))return!0;if(c.curEditNode)f.editNodeBlur=!1,c.curEditInput.focus();return!c.curEditNode&&(Q?Q.apply(f,
+arguments):!0)}})(jQuery);
+
diff --git a/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.core.js b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.core.js
new file mode 100644
index 0000000..7dd93c6
--- /dev/null
+++ b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.core.js
@@ -0,0 +1,1684 @@
+/*
+ * JQuery zTree core v3.5.16
+ * http://zTree.me/
+ *
+ * Copyright (c) 2010 Hunter.z
+ *
+ * Licensed same as jquery - MIT License
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * email: hunter.z@263.net
+ * Date: 2014-03-09
+ */
+(function($){
+ var settings = {}, roots = {}, caches = {},
+ //default consts of core
+ _consts = {
+ className: {
+ BUTTON: "button",
+ LEVEL: "level",
+ ICO_LOADING: "ico_loading",
+ SWITCH: "switch"
+ },
+ event: {
+ NODECREATED: "ztree_nodeCreated",
+ CLICK: "ztree_click",
+ EXPAND: "ztree_expand",
+ COLLAPSE: "ztree_collapse",
+ ASYNC_SUCCESS: "ztree_async_success",
+ ASYNC_ERROR: "ztree_async_error",
+ REMOVE: "ztree_remove"
+ },
+ id: {
+ A: "_a",
+ ICON: "_ico",
+ SPAN: "_span",
+ SWITCH: "_switch",
+ UL: "_ul"
+ },
+ line: {
+ ROOT: "root",
+ ROOTS: "roots",
+ CENTER: "center",
+ BOTTOM: "bottom",
+ NOLINE: "noline",
+ LINE: "line"
+ },
+ folder: {
+ OPEN: "open",
+ CLOSE: "close",
+ DOCU: "docu"
+ },
+ node: {
+ CURSELECTED: "curSelectedNode"
+ }
+ },
+ //default setting of core
+ _setting = {
+ treeId: "",
+ treeObj: null,
+ view: {
+ addDiyDom: null,
+ autoCancelSelected: true,
+ dblClickExpand: true,
+ expandSpeed: "fast",
+ fontCss: {},
+ nameIsHTML: false,
+ selectedMulti: true,
+ showIcon: true,
+ showLine: true,
+ showTitle: true,
+ txtSelectedEnable: false
+ },
+ data: {
+ key: {
+ children: "children",
+ name: "name",
+ title: "",
+ url: "url"
+ },
+ simpleData: {
+ enable: false,
+ idKey: "id",
+ pIdKey: "pId",
+ rootPId: null
+ },
+ keep: {
+ parent: false,
+ leaf: false
+ }
+ },
+ async: {
+ enable: false,
+ contentType: "application/x-www-form-urlencoded",
+ type: "post",
+ dataType: "text",
+ url: "",
+ autoParam: [],
+ otherParam: [],
+ dataFilter: null
+ },
+ callback: {
+ beforeAsync:null,
+ beforeClick:null,
+ beforeDblClick:null,
+ beforeRightClick:null,
+ beforeMouseDown:null,
+ beforeMouseUp:null,
+ beforeExpand:null,
+ beforeCollapse:null,
+ beforeRemove:null,
+
+ onAsyncError:null,
+ onAsyncSuccess:null,
+ onNodeCreated:null,
+ onClick:null,
+ onDblClick:null,
+ onRightClick:null,
+ onMouseDown:null,
+ onMouseUp:null,
+ onExpand:null,
+ onCollapse:null,
+ onRemove:null
+ }
+ },
+ //default root of core
+ //zTree use root to save full data
+ _initRoot = function (setting) {
+ var r = data.getRoot(setting);
+ if (!r) {
+ r = {};
+ data.setRoot(setting, r);
+ }
+ r[setting.data.key.children] = [];
+ r.expandTriggerFlag = false;
+ r.curSelectedList = [];
+ r.noSelection = true;
+ r.createdNodes = [];
+ r.zId = 0;
+ r._ver = (new Date()).getTime();
+ },
+ //default cache of core
+ _initCache = function(setting) {
+ var c = data.getCache(setting);
+ if (!c) {
+ c = {};
+ data.setCache(setting, c);
+ }
+ c.nodes = [];
+ c.doms = [];
+ },
+ //default bindEvent of core
+ _bindEvent = function(setting) {
+ var o = setting.treeObj,
+ c = consts.event;
+ o.bind(c.NODECREATED, function (event, treeId, node) {
+ tools.apply(setting.callback.onNodeCreated, [event, treeId, node]);
+ });
+
+ o.bind(c.CLICK, function (event, srcEvent, treeId, node, clickFlag) {
+ tools.apply(setting.callback.onClick, [srcEvent, treeId, node, clickFlag]);
+ });
+
+ o.bind(c.EXPAND, function (event, treeId, node) {
+ tools.apply(setting.callback.onExpand, [event, treeId, node]);
+ });
+
+ o.bind(c.COLLAPSE, function (event, treeId, node) {
+ tools.apply(setting.callback.onCollapse, [event, treeId, node]);
+ });
+
+ o.bind(c.ASYNC_SUCCESS, function (event, treeId, node, msg) {
+ tools.apply(setting.callback.onAsyncSuccess, [event, treeId, node, msg]);
+ });
+
+ o.bind(c.ASYNC_ERROR, function (event, treeId, node, XMLHttpRequest, textStatus, errorThrown) {
+ tools.apply(setting.callback.onAsyncError, [event, treeId, node, XMLHttpRequest, textStatus, errorThrown]);
+ });
+
+ o.bind(c.REMOVE, function (event, treeId, treeNode) {
+ tools.apply(setting.callback.onRemove, [event, treeId, treeNode]);
+ });
+ },
+ _unbindEvent = function(setting) {
+ var o = setting.treeObj,
+ c = consts.event;
+ o.unbind(c.NODECREATED)
+ .unbind(c.CLICK)
+ .unbind(c.EXPAND)
+ .unbind(c.COLLAPSE)
+ .unbind(c.ASYNC_SUCCESS)
+ .unbind(c.ASYNC_ERROR)
+ .unbind(c.REMOVE);
+ },
+ //default event proxy of core
+ _eventProxy = function(event) {
+ var target = event.target,
+ setting = data.getSetting(event.data.treeId),
+ tId = "", node = null,
+ nodeEventType = "", treeEventType = "",
+ nodeEventCallback = null, treeEventCallback = null,
+ tmp = null;
+
+ if (tools.eqs(event.type, "mousedown")) {
+ treeEventType = "mousedown";
+ } else if (tools.eqs(event.type, "mouseup")) {
+ treeEventType = "mouseup";
+ } else if (tools.eqs(event.type, "contextmenu")) {
+ treeEventType = "contextmenu";
+ } else if (tools.eqs(event.type, "click")) {
+ if (tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.SWITCH) !== null) {
+ tId = tools.getNodeMainDom(target).id;
+ nodeEventType = "switchNode";
+ } else {
+ tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
+ if (tmp) {
+ tId = tools.getNodeMainDom(tmp).id;
+ nodeEventType = "clickNode";
+ }
+ }
+ } else if (tools.eqs(event.type, "dblclick")) {
+ treeEventType = "dblclick";
+ tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
+ if (tmp) {
+ tId = tools.getNodeMainDom(tmp).id;
+ nodeEventType = "switchNode";
+ }
+ }
+ if (treeEventType.length > 0 && tId.length == 0) {
+ tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
+ if (tmp) {tId = tools.getNodeMainDom(tmp).id;}
+ }
+ // event to node
+ if (tId.length>0) {
+ node = data.getNodeCache(setting, tId);
+ switch (nodeEventType) {
+ case "switchNode" :
+ if (!node.isParent) {
+ nodeEventType = "";
+ } else if (tools.eqs(event.type, "click")
+ || (tools.eqs(event.type, "dblclick") && tools.apply(setting.view.dblClickExpand, [setting.treeId, node], setting.view.dblClickExpand))) {
+ nodeEventCallback = handler.onSwitchNode;
+ } else {
+ nodeEventType = "";
+ }
+ break;
+ case "clickNode" :
+ nodeEventCallback = handler.onClickNode;
+ break;
+ }
+ }
+ // event to zTree
+ switch (treeEventType) {
+ case "mousedown" :
+ treeEventCallback = handler.onZTreeMousedown;
+ break;
+ case "mouseup" :
+ treeEventCallback = handler.onZTreeMouseup;
+ break;
+ case "dblclick" :
+ treeEventCallback = handler.onZTreeDblclick;
+ break;
+ case "contextmenu" :
+ treeEventCallback = handler.onZTreeContextmenu;
+ break;
+ }
+ var proxyResult = {
+ stop: false,
+ node: node,
+ nodeEventType: nodeEventType,
+ nodeEventCallback: nodeEventCallback,
+ treeEventType: treeEventType,
+ treeEventCallback: treeEventCallback
+ };
+ return proxyResult
+ },
+ //default init node of core
+ _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {
+ if (!n) return;
+ var r = data.getRoot(setting),
+ childKey = setting.data.key.children;
+ n.level = level;
+ n.tId = setting.treeId + "_" + (++r.zId);
+ n.parentTId = parentNode ? parentNode.tId : null;
+ n.open = (typeof n.open == "string") ? tools.eqs(n.open, "true") : !!n.open;
+ if (n[childKey] && n[childKey].length > 0) {
+ n.isParent = true;
+ n.zAsync = true;
+ } else {
+ n.isParent = (typeof n.isParent == "string") ? tools.eqs(n.isParent, "true") : !!n.isParent;
+ n.open = (n.isParent && !setting.async.enable) ? n.open : false;
+ n.zAsync = !n.isParent;
+ }
+ n.isFirstNode = isFirstNode;
+ n.isLastNode = isLastNode;
+ n.getParentNode = function() {return data.getNodeCache(setting, n.parentTId);};
+ n.getPreNode = function() {return data.getPreNode(setting, n);};
+ n.getNextNode = function() {return data.getNextNode(setting, n);};
+ n.isAjaxing = false;
+ data.fixPIdKeyValue(setting, n);
+ },
+ _init = {
+ bind: [_bindEvent],
+ unbind: [_unbindEvent],
+ caches: [_initCache],
+ nodes: [_initNode],
+ proxys: [_eventProxy],
+ roots: [_initRoot],
+ beforeA: [],
+ afterA: [],
+ innerBeforeA: [],
+ innerAfterA: [],
+ zTreeTools: []
+ },
+ //method of operate data
+ data = {
+ addNodeCache: function(setting, node) {
+ data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = node;
+ },
+ getNodeCacheId: function(tId) {
+ return tId.substring(tId.lastIndexOf("_")+1);
+ },
+ addAfterA: function(afterA) {
+ _init.afterA.push(afterA);
+ },
+ addBeforeA: function(beforeA) {
+ _init.beforeA.push(beforeA);
+ },
+ addInnerAfterA: function(innerAfterA) {
+ _init.innerAfterA.push(innerAfterA);
+ },
+ addInnerBeforeA: function(innerBeforeA) {
+ _init.innerBeforeA.push(innerBeforeA);
+ },
+ addInitBind: function(bindEvent) {
+ _init.bind.push(bindEvent);
+ },
+ addInitUnBind: function(unbindEvent) {
+ _init.unbind.push(unbindEvent);
+ },
+ addInitCache: function(initCache) {
+ _init.caches.push(initCache);
+ },
+ addInitNode: function(initNode) {
+ _init.nodes.push(initNode);
+ },
+ addInitProxy: function(initProxy, isFirst) {
+ if (!!isFirst) {
+ _init.proxys.splice(0,0,initProxy);
+ } else {
+ _init.proxys.push(initProxy);
+ }
+ },
+ addInitRoot: function(initRoot) {
+ _init.roots.push(initRoot);
+ },
+ addNodesData: function(setting, parentNode, nodes) {
+ var childKey = setting.data.key.children;
+ if (!parentNode[childKey]) parentNode[childKey] = [];
+ if (parentNode[childKey].length > 0) {
+ parentNode[childKey][parentNode[childKey].length - 1].isLastNode = false;
+ view.setNodeLineIcos(setting, parentNode[childKey][parentNode[childKey].length - 1]);
+ }
+ parentNode.isParent = true;
+ parentNode[childKey] = parentNode[childKey].concat(nodes);
+ },
+ addSelectedNode: function(setting, node) {
+ var root = data.getRoot(setting);
+ if (!data.isSelectedNode(setting, node)) {
+ root.curSelectedList.push(node);
+ }
+ },
+ addCreatedNode: function(setting, node) {
+ if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) {
+ var root = data.getRoot(setting);
+ root.createdNodes.push(node);
+ }
+ },
+ addZTreeTools: function(zTreeTools) {
+ _init.zTreeTools.push(zTreeTools);
+ },
+ exSetting: function(s) {
+ $.extend(true, _setting, s);
+ },
+ fixPIdKeyValue: function(setting, node) {
+ if (setting.data.simpleData.enable) {
+ node[setting.data.simpleData.pIdKey] = node.parentTId ? node.getParentNode()[setting.data.simpleData.idKey] : setting.data.simpleData.rootPId;
+ }
+ },
+ getAfterA: function(setting, node, array) {
+ for (var i=0, j=_init.afterA.length; i<j; i++) {
+ _init.afterA[i].apply(this, arguments);
+ }
+ },
+ getBeforeA: function(setting, node, array) {
+ for (var i=0, j=_init.beforeA.length; i<j; i++) {
+ _init.beforeA[i].apply(this, arguments);
+ }
+ },
+ getInnerAfterA: function(setting, node, array) {
+ for (var i=0, j=_init.innerAfterA.length; i<j; i++) {
+ _init.innerAfterA[i].apply(this, arguments);
+ }
+ },
+ getInnerBeforeA: function(setting, node, array) {
+ for (var i=0, j=_init.innerBeforeA.length; i<j; i++) {
+ _init.innerBeforeA[i].apply(this, arguments);
+ }
+ },
+ getCache: function(setting) {
+ return caches[setting.treeId];
+ },
+ getNextNode: function(setting, node) {
+ if (!node) return null;
+ var childKey = setting.data.key.children,
+ p = node.parentTId ? node.getParentNode() : data.getRoot(setting);
+ for (var i=0, l=p[childKey].length-1; i<=l; i++) {
+ if (p[childKey][i] === node) {
+ return (i==l ? null : p[childKey][i+1]);
+ }
+ }
+ return null;
+ },
+ getNodeByParam: function(setting, nodes, key, value) {
+ if (!nodes || !key) return null;
+ var childKey = setting.data.key.children;
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ if (nodes[i][key] == value) {
+ return nodes[i];
+ }
+ var tmp = data.getNodeByParam(setting, nodes[i][childKey], key, value);
+ if (tmp) return tmp;
+ }
+ return null;
+ },
+ getNodeCache: function(setting, tId) {
+ if (!tId) return null;
+ var n = caches[setting.treeId].nodes[data.getNodeCacheId(tId)];
+ return n ? n : null;
+ },
+ getNodeName: function(setting, node) {
+ var nameKey = setting.data.key.name;
+ return "" + node[nameKey];
+ },
+ getNodeTitle: function(setting, node) {
+ var t = setting.data.key.title === "" ? setting.data.key.name : setting.data.key.title;
+ return "" + node[t];
+ },
+ getNodes: function(setting) {
+ return data.getRoot(setting)[setting.data.key.children];
+ },
+ getNodesByParam: function(setting, nodes, key, value) {
+ if (!nodes || !key) return [];
+ var childKey = setting.data.key.children,
+ result = [];
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ if (nodes[i][key] == value) {
+ result.push(nodes[i]);
+ }
+ result = result.concat(data.getNodesByParam(setting, nodes[i][childKey], key, value));
+ }
+ return result;
+ },
+ getNodesByParamFuzzy: function(setting, nodes, key, value) {
+ if (!nodes || !key) return [];
+ var childKey = setting.data.key.children,
+ result = [];
+ value = value.toLowerCase();
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ if (typeof nodes[i][key] == "string" && nodes[i][key].toLowerCase().indexOf(value)>-1) {
+ result.push(nodes[i]);
+ }
+ result = result.concat(data.getNodesByParamFuzzy(setting, nodes[i][childKey], key, value));
+ }
+ return result;
+ },
+ getNodesByFilter: function(setting, nodes, filter, isSingle, invokeParam) {
+ if (!nodes) return (isSingle ? null : []);
+ var childKey = setting.data.key.children,
+ result = isSingle ? null : [];
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ if (tools.apply(filter, [nodes[i], invokeParam], false)) {
+ if (isSingle) {return nodes[i];}
+ result.push(nodes[i]);
+ }
+ var tmpResult = data.getNodesByFilter(setting, nodes[i][childKey], filter, isSingle, invokeParam);
+ if (isSingle && !!tmpResult) {return tmpResult;}
+ result = isSingle ? tmpResult : result.concat(tmpResult);
+ }
+ return result;
+ },
+ getPreNode: function(setting, node) {
+ if (!node) return null;
+ var childKey = setting.data.key.children,
+ p = node.parentTId ? node.getParentNode() : data.getRoot(setting);
+ for (var i=0, l=p[childKey].length; i<l; i++) {
+ if (p[childKey][i] === node) {
+ return (i==0 ? null : p[childKey][i-1]);
+ }
+ }
+ return null;
+ },
+ getRoot: function(setting) {
+ return setting ? roots[setting.treeId] : null;
+ },
+ getRoots: function() {
+ return roots;
+ },
+ getSetting: function(treeId) {
+ return settings[treeId];
+ },
+ getSettings: function() {
+ return settings;
+ },
+ getZTreeTools: function(treeId) {
+ var r = this.getRoot(this.getSetting(treeId));
+ return r ? r.treeTools : null;
+ },
+ initCache: function(setting) {
+ for (var i=0, j=_init.caches.length; i<j; i++) {
+ _init.caches[i].apply(this, arguments);
+ }
+ },
+ initNode: function(setting, level, node, parentNode, preNode, nextNode) {
+ for (var i=0, j=_init.nodes.length; i<j; i++) {
+ _init.nodes[i].apply(this, arguments);
+ }
+ },
+ initRoot: function(setting) {
+ for (var i=0, j=_init.roots.length; i<j; i++) {
+ _init.roots[i].apply(this, arguments);
+ }
+ },
+ isSelectedNode: function(setting, node) {
+ var root = data.getRoot(setting);
+ for (var i=0, j=root.curSelectedList.length; i<j; i++) {
+ if(node === root.curSelectedList[i]) return true;
+ }
+ return false;
+ },
+ removeNodeCache: function(setting, node) {
+ var childKey = setting.data.key.children;
+ if (node[childKey]) {
+ for (var i=0, l=node[childKey].length; i<l; i++) {
+ arguments.callee(setting, node[childKey][i]);
+ }
+ }
+ data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = null;
+ },
+ removeSelectedNode: function(setting, node) {
+ var root = data.getRoot(setting);
+ for (var i=0, j=root.curSelectedList.length; i<j; i++) {
+ if(node === root.curSelectedList[i] || !data.getNodeCache(setting, root.curSelectedList[i].tId)) {
+ root.curSelectedList.splice(i, 1);
+ i--;j--;
+ }
+ }
+ },
+ setCache: function(setting, cache) {
+ caches[setting.treeId] = cache;
+ },
+ setRoot: function(setting, root) {
+ roots[setting.treeId] = root;
+ },
+ setZTreeTools: function(setting, zTreeTools) {
+ for (var i=0, j=_init.zTreeTools.length; i<j; i++) {
+ _init.zTreeTools[i].apply(this, arguments);
+ }
+ },
+ transformToArrayFormat: function (setting, nodes) {
+ if (!nodes) return [];
+ var childKey = setting.data.key.children,
+ r = [];
+ if (tools.isArray(nodes)) {
+ for (var i=0, l=nodes.length; i<l; i++) {
+ r.push(nodes[i]);
+ if (nodes[i][childKey])
+ r = r.concat(data.transformToArrayFormat(setting, nodes[i][childKey]));
+ }
+ } else {
+ r.push(nodes);
+ if (nodes[childKey])
+ r = r.concat(data.transformToArrayFormat(setting, nodes[childKey]));
+ }
+ return r;
+ },
+ transformTozTreeFormat: function(setting, sNodes) {
+ var i,l,
+ key = setting.data.simpleData.idKey,
+ parentKey = setting.data.simpleData.pIdKey,
+ childKey = setting.data.key.children;
+ if (!key || key=="" || !sNodes) return [];
+
+ if (tools.isArray(sNodes)) {
+ var r = [];
+ var tmpMap = [];
+ for (i=0, l=sNodes.length; i<l; i++) {
+ tmpMap[sNodes[i][key]] = sNodes[i];
+ }
+ for (i=0, l=sNodes.length; i<l; i++) {
+ if (tmpMap[sNodes[i][parentKey]] && sNodes[i][key] != sNodes[i][parentKey]) {
+ if (!tmpMap[sNodes[i][parentKey]][childKey])
+ tmpMap[sNodes[i][parentKey]][childKey] = [];
+ tmpMap[sNodes[i][parentKey]][childKey].push(sNodes[i]);
+ } else {
+ r.push(sNodes[i]);
+ }
+ }
+ return r;
+ }else {
+ return [sNodes];
+ }
+ }
+ },
+ //method of event proxy
+ event = {
+ bindEvent: function(setting) {
+ for (var i=0, j=_init.bind.length; i<j; i++) {
+ _init.bind[i].apply(this, arguments);
+ }
+ },
+ unbindEvent: function(setting) {
+ for (var i=0, j=_init.unbind.length; i<j; i++) {
+ _init.unbind[i].apply(this, arguments);
+ }
+ },
+ bindTree: function(setting) {
+ var eventParam = {
+ treeId: setting.treeId
+ },
+ o = setting.treeObj;
+ if (!setting.view.txtSelectedEnable) {
+ // for can't select text
+ o.bind('selectstart', function(e){
+ var node
+ var n = e.originalEvent.srcElement.nodeName.toLowerCase();
+ return (n === "input" || n === "textarea" );
+ }).css({
+ "-moz-user-select":"-moz-none"
+ });
+ }
+ o.bind('click', eventParam, event.proxy);
+ o.bind('dblclick', eventParam, event.proxy);
+ o.bind('mouseover', eventParam, event.proxy);
+ o.bind('mouseout', eventParam, event.proxy);
+ o.bind('mousedown', eventParam, event.proxy);
+ o.bind('mouseup', eventParam, event.proxy);
+ o.bind('contextmenu', eventParam, event.proxy);
+ },
+ unbindTree: function(setting) {
+ var o = setting.treeObj;
+ o.unbind('click', event.proxy)
+ .unbind('dblclick', event.proxy)
+ .unbind('mouseover', event.proxy)
+ .unbind('mouseout', event.proxy)
+ .unbind('mousedown', event.proxy)
+ .unbind('mouseup', event.proxy)
+ .unbind('contextmenu', event.proxy);
+ },
+ doProxy: function(e) {
+ var results = [];
+ for (var i=0, j=_init.proxys.length; i<j; i++) {
+ var proxyResult = _init.proxys[i].apply(this, arguments);
+ results.push(proxyResult);
+ if (proxyResult.stop) {
+ break;
+ }
+ }
+ return results;
+ },
+ proxy: function(e) {
+ var setting = data.getSetting(e.data.treeId);
+ if (!tools.uCanDo(setting, e)) return true;
+ var results = event.doProxy(e),
+ r = true, x = false;
+ for (var i=0, l=results.length; i<l; i++) {
+ var proxyResult = results[i];
+ if (proxyResult.nodeEventCallback) {
+ x = true;
+ r = proxyResult.nodeEventCallback.apply(proxyResult, [e, proxyResult.node]) && r;
+ }
+ if (proxyResult.treeEventCallback) {
+ x = true;
+ r = proxyResult.treeEventCallback.apply(proxyResult, [e, proxyResult.node]) && r;
+ }
+ }
+ return r;
+ }
+ },
+ //method of event handler
+ handler = {
+ onSwitchNode: function (event, node) {
+ var setting = data.getSetting(event.data.treeId);
+ if (node.open) {
+ if (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false) return true;
+ data.getRoot(setting).expandTriggerFlag = true;
+ view.switchNode(setting, node);
+ } else {
+ if (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false) return true;
+ data.getRoot(setting).expandTriggerFlag = true;
+ view.switchNode(setting, node);
+ }
+ return true;
+ },
+ onClickNode: function (event, node) {
+ var setting = data.getSetting(event.data.treeId),
+ clickFlag = ( (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey)) && data.isSelectedNode(setting, node)) ? 0 : (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey) && setting.view.selectedMulti) ? 2 : 1;
+ if (tools.apply(setting.callback.beforeClick, [setting.treeId, node, clickFlag], true) == false) return true;
+ if (clickFlag === 0) {
+ view.cancelPreSelectedNode(setting, node);
+ } else {
+ view.selectNode(setting, node, clickFlag === 2);
+ }
+ setting.treeObj.trigger(consts.event.CLICK, [event, setting.treeId, node, clickFlag]);
+ return true;
+ },
+ onZTreeMousedown: function(event, node) {
+ var setting = data.getSetting(event.data.treeId);
+ if (tools.apply(setting.callback.beforeMouseDown, [setting.treeId, node], true)) {
+ tools.apply(setting.callback.onMouseDown, [event, setting.treeId, node]);
+ }
+ return true;
+ },
+ onZTreeMouseup: function(event, node) {
+ var setting = data.getSetting(event.data.treeId);
+ if (tools.apply(setting.callback.beforeMouseUp, [setting.treeId, node], true)) {
+ tools.apply(setting.callback.onMouseUp, [event, setting.treeId, node]);
+ }
+ return true;
+ },
+ onZTreeDblclick: function(event, node) {
+ var setting = data.getSetting(event.data.treeId);
+ if (tools.apply(setting.callback.beforeDblClick, [setting.treeId, node], true)) {
+ tools.apply(setting.callback.onDblClick, [event, setting.treeId, node]);
+ }
+ return true;
+ },
+ onZTreeContextmenu: function(event, node) {
+ var setting = data.getSetting(event.data.treeId);
+ if (tools.apply(setting.callback.beforeRightClick, [setting.treeId, node], true)) {
+ tools.apply(setting.callback.onRightClick, [event, setting.treeId, node]);
+ }
+ return (typeof setting.callback.onRightClick) != "function";
+ }
+ },
+ //method of tools for zTree
+ tools = {
+ apply: function(fun, param, defaultValue) {
+ if ((typeof fun) == "function") {
+ return fun.apply(zt, param?param:[]);
+ }
+ return defaultValue;
+ },
+ canAsync: function(setting, node) {
+ var childKey = setting.data.key.children;
+ return (setting.async.enable && node && node.isParent && !(node.zAsync || (node[childKey] && node[childKey].length > 0)));
+ },
+ clone: function (obj){
+ if (obj === null) return null;
+ var o = tools.isArray(obj) ? [] : {};
+ for(var i in obj){
+ o[i] = (obj[i] instanceof Date) ? new Date(obj[i].getTime()) : (typeof obj[i] === "object" ? arguments.callee(obj[i]) : obj[i]);
+ }
+ return o;
+ },
+ eqs: function(str1, str2) {
+ return str1.toLowerCase() === str2.toLowerCase();
+ },
+ isArray: function(arr) {
+ return Object.prototype.toString.apply(arr) === "[object Array]";
+ },
+ $: function(node, exp, setting) {
+ if (!!exp && typeof exp != "string") {
+ setting = exp;
+ exp = "";
+ }
+ if (typeof node == "string") {
+ return $(node, setting ? setting.treeObj.get(0).ownerDocument : null);
+ } else {
+ return $("#" + node.tId + exp, setting ? setting.treeObj : null);
+ }
+ },
+ getMDom: function (setting, curDom, targetExpr) {
+ if (!curDom) return null;
+ while (curDom && curDom.id !== setting.treeId) {
+ for (var i=0, l=targetExpr.length; curDom.tagName && i<l; i++) {
+ if (tools.eqs(curDom.tagName, targetExpr[i].tagName) && curDom.getAttribute(targetExpr[i].attrName) !== null) {
+ return curDom;
+ }
+ }
+ curDom = curDom.parentNode;
+ }
+ return null;
+ },
+ getNodeMainDom:function(target) {
+ return ($(target).parent("li").get(0) || $(target).parentsUntil("li").parent().get(0));
+ },
+ isChildOrSelf: function(dom, parentId) {
+ return ( $(dom).closest("#" + parentId).length> 0 );
+ },
+ uCanDo: function(setting, e) {
+ return true;
+ }
+ },
+ //method of operate ztree dom
+ view = {
+ addNodes: function(setting, parentNode, newNodes, isSilent) {
+ if (setting.data.keep.leaf && parentNode && !parentNode.isParent) {
+ return;
+ }
+ if (!tools.isArray(newNodes)) {
+ newNodes = [newNodes];
+ }
+ if (setting.data.simpleData.enable) {
+ newNodes = data.transformTozTreeFormat(setting, newNodes);
+ }
+ if (parentNode) {
+ var target_switchObj = $$(parentNode, consts.id.SWITCH, setting),
+ target_icoObj = $$(parentNode, consts.id.ICON, setting),
+ target_ulObj = $$(parentNode, consts.id.UL, setting);
+
+ if (!parentNode.open) {
+ view.replaceSwitchClass(parentNode, target_switchObj, consts.folder.CLOSE);
+ view.replaceIcoClass(parentNode, target_icoObj, consts.folder.CLOSE);
+ parentNode.open = false;
+ target_ulObj.css({
+ "display": "none"
+ });
+ }
+
+ data.addNodesData(setting, parentNode, newNodes);
+ view.createNodes(setting, parentNode.level + 1, newNodes, parentNode);
+ if (!isSilent) {
+ view.expandCollapseParentNode(setting, parentNode, true);
+ }
+ } else {
+ data.addNodesData(setting, data.getRoot(setting), newNodes);
+ view.createNodes(setting, 0, newNodes, null);
+ }
+ },
+ appendNodes: function(setting, level, nodes, parentNode, initFlag, openFlag) {
+ if (!nodes) return [];
+ var html = [],
+ childKey = setting.data.key.children;
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ var node = nodes[i];
+ if (initFlag) {
+ var tmpPNode = (parentNode) ? parentNode: data.getRoot(setting),
+ tmpPChild = tmpPNode[childKey],
+ isFirstNode = ((tmpPChild.length == nodes.length) && (i == 0)),
+ isLastNode = (i == (nodes.length - 1));
+ data.initNode(setting, level, node, parentNode, isFirstNode, isLastNode, openFlag);
+ data.addNodeCache(setting, node);
+ }
+
+ var childHtml = [];
+ if (node[childKey] && node[childKey].length > 0) {
+ //make child html first, because checkType
+ childHtml = view.appendNodes(setting, level + 1, node[childKey], node, initFlag, openFlag && node.open);
+ }
+ if (openFlag) {
+
+ view.makeDOMNodeMainBefore(html, setting, node);
+ view.makeDOMNodeLine(html, setting, node);
+ data.getBeforeA(setting, node, html);
+ view.makeDOMNodeNameBefore(html, setting, node);
+ data.getInnerBeforeA(setting, node, html);
+ view.makeDOMNodeIcon(html, setting, node);
+ data.getInnerAfterA(setting, node, html);
+ view.makeDOMNodeNameAfter(html, setting, node);
+ data.getAfterA(setting, node, html);
+ if (node.isParent && node.open) {
+ view.makeUlHtml(setting, node, html, childHtml.join(''));
+ }
+ view.makeDOMNodeMainAfter(html, setting, node);
+ data.addCreatedNode(setting, node);
+ }
+ }
+ return html;
+ },
+ appendParentULDom: function(setting, node) {
+ var html = [],
+ nObj = $$(node, setting);
+ if (!nObj.get(0) && !!node.parentTId) {
+ view.appendParentULDom(setting, node.getParentNode());
+ nObj = $$(node, setting);
+ }
+ var ulObj = $$(node, consts.id.UL, setting);
+ if (ulObj.get(0)) {
+ ulObj.remove();
+ }
+ var childKey = setting.data.key.children,
+ childHtml = view.appendNodes(setting, node.level+1, node[childKey], node, false, true);
+ view.makeUlHtml(setting, node, html, childHtml.join(''));
+ nObj.append(html.join(''));
+ },
+ asyncNode: function(setting, node, isSilent, callback) {
+ var i, l;
+ if (node && !node.isParent) {
+ tools.apply(callback);
+ return false;
+ } else if (node && node.isAjaxing) {
+ return false;
+ } else if (tools.apply(setting.callback.beforeAsync, [setting.treeId, node], true) == false) {
+ tools.apply(callback);
+ return false;
+ }
+ if (node) {
+ node.isAjaxing = true;
+ var icoObj = $$(node, consts.id.ICON, setting);
+ icoObj.attr({"style":"", "class":consts.className.BUTTON + " " + consts.className.ICO_LOADING});
+ }
+
+ var tmpParam = {};
+ for (i = 0, l = setting.async.autoParam.length; node && i < l; i++) {
+ var pKey = setting.async.autoParam[i].split("="), spKey = pKey;
+ if (pKey.length>1) {
+ spKey = pKey[1];
+ pKey = pKey[0];
+ }
+ tmpParam[spKey] = node[pKey];
+ }
+ if (tools.isArray(setting.async.otherParam)) {
+ for (i = 0, l = setting.async.otherParam.length; i < l; i += 2) {
+ tmpParam[setting.async.otherParam[i]] = setting.async.otherParam[i + 1];
+ }
+ } else {
+ for (var p in setting.async.otherParam) {
+ tmpParam[p] = setting.async.otherParam[p];
+ }
+ }
+
+ var _tmpV = data.getRoot(setting)._ver;
+ $.ajax({
+ contentType: setting.async.contentType,
+ type: setting.async.type,
+ url: tools.apply(setting.async.url, [setting.treeId, node], setting.async.url),
+ data: tmpParam,
+ dataType: setting.async.dataType,
+ success: function(msg) {
+ if (_tmpV != data.getRoot(setting)._ver) {
+ return;
+ }
+ var newNodes = [];
+ try {
+ if (!msg || msg.length == 0) {
+ newNodes = [];
+ } else if (typeof msg == "string") {
+ newNodes = eval("(" + msg + ")");
+ } else {
+ newNodes = msg;
+ }
+ } catch(err) {
+ newNodes = msg;
+ }
+
+ if (node) {
+ node.isAjaxing = null;
+ node.zAsync = true;
+ }
+ view.setNodeLineIcos(setting, node);
+ if (newNodes && newNodes !== "") {
+ newNodes = tools.apply(setting.async.dataFilter, [setting.treeId, node, newNodes], newNodes);
+ view.addNodes(setting, node, !!newNodes ? tools.clone(newNodes) : [], !!isSilent);
+ } else {
+ view.addNodes(setting, node, [], !!isSilent);
+ }
+ setting.treeObj.trigger(consts.event.ASYNC_SUCCESS, [setting.treeId, node, msg]);
+ tools.apply(callback);
+ },
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
+ if (_tmpV != data.getRoot(setting)._ver) {
+ return;
+ }
+ if (node) node.isAjaxing = null;
+ view.setNodeLineIcos(setting, node);
+ setting.treeObj.trigger(consts.event.ASYNC_ERROR, [setting.treeId, node, XMLHttpRequest, textStatus, errorThrown]);
+ }
+ });
+ return true;
+ },
+ cancelPreSelectedNode: function (setting, node) {
+ var list = data.getRoot(setting).curSelectedList;
+ for (var i=0, j=list.length-1; j>=i; j--) {
+ if (!node || node === list[j]) {
+ $$(list[j], consts.id.A, setting).removeClass(consts.node.CURSELECTED);
+ if (node) {
+ data.removeSelectedNode(setting, node);
+ break;
+ }
+ }
+ }
+ if (!node) data.getRoot(setting).curSelectedList = [];
+ },
+ createNodeCallback: function(setting) {
+ if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) {
+ var root = data.getRoot(setting);
+ while (root.createdNodes.length>0) {
+ var node = root.createdNodes.shift();
+ tools.apply(setting.view.addDiyDom, [setting.treeId, node]);
+ if (!!setting.callback.onNodeCreated) {
+ setting.treeObj.trigger(consts.event.NODECREATED, [setting.treeId, node]);
+ }
+ }
+ }
+ },
+ createNodes: function(setting, level, nodes, parentNode) {
+ if (!nodes || nodes.length == 0) return;
+ var root = data.getRoot(setting),
+ childKey = setting.data.key.children,
+ openFlag = !parentNode || parentNode.open || !!$$(parentNode[childKey][0], setting).get(0);
+ root.createdNodes = [];
+ var zTreeHtml = view.appendNodes(setting, level, nodes, parentNode, true, openFlag);
+ if (!parentNode) {
+ setting.treeObj.append(zTreeHtml.join(''));
+ } else {
+ var ulObj = $$(parentNode, consts.id.UL, setting);
+ if (ulObj.get(0)) {
+ ulObj.append(zTreeHtml.join(''));
+ }
+ }
+ view.createNodeCallback(setting);
+ },
+ destroy: function(setting) {
+ if (!setting) return;
+ data.initCache(setting);
+ data.initRoot(setting);
+ event.unbindTree(setting);
+ event.unbindEvent(setting);
+ setting.treeObj.empty();
+ delete settings[setting.treeId];
+ },
+ expandCollapseNode: function(setting, node, expandFlag, animateFlag, callback) {
+ var root = data.getRoot(setting),
+ childKey = setting.data.key.children;
+ if (!node) {
+ tools.apply(callback, []);
+ return;
+ }
+ if (root.expandTriggerFlag) {
+ var _callback = callback;
+ callback = function(){
+ if (_callback) _callback();
+ if (node.open) {
+ setting.treeObj.trigger(consts.event.EXPAND, [setting.treeId, node]);
+ } else {
+ setting.treeObj.trigger(consts.event.COLLAPSE, [setting.treeId, node]);
+ }
+ };
+ root.expandTriggerFlag = false;
+ }
+ if (!node.open && node.isParent && ((!$$(node, consts.id.UL, setting).get(0)) || (node[childKey] && node[childKey].length>0 && !$$(node[childKey][0], setting).get(0)))) {
+ view.appendParentULDom(setting, node);
+ view.createNodeCallback(setting);
+ }
+ if (node.open == expandFlag) {
+ tools.apply(callback, []);
+ return;
+ }
+ var ulObj = $$(node, consts.id.UL, setting),
+ switchObj = $$(node, consts.id.SWITCH, setting),
+ icoObj = $$(node, consts.id.ICON, setting);
+
+ if (node.isParent) {
+ node.open = !node.open;
+ if (node.iconOpen && node.iconClose) {
+ icoObj.attr("style", view.makeNodeIcoStyle(setting, node));
+ }
+
+ if (node.open) {
+ view.replaceSwitchClass(node, switchObj, consts.folder.OPEN);
+ view.replaceIcoClass(node, icoObj, consts.folder.OPEN);
+ if (animateFlag == false || setting.view.expandSpeed == "") {
+ ulObj.show();
+ tools.apply(callback, []);
+ } else {
+ if (node[childKey] && node[childKey].length > 0) {
+ ulObj.slideDown(setting.view.expandSpeed, callback);
+ } else {
+ ulObj.show();
+ tools.apply(callback, []);
+ }
+ }
+ } else {
+ view.replaceSwitchClass(node, switchObj, consts.folder.CLOSE);
+ view.replaceIcoClass(node, icoObj, consts.folder.CLOSE);
+ if (animateFlag == false || setting.view.expandSpeed == "" || !(node[childKey] && node[childKey].length > 0)) {
+ ulObj.hide();
+ tools.apply(callback, []);
+ } else {
+ ulObj.slideUp(setting.view.expandSpeed, callback);
+ }
+ }
+ } else {
+ tools.apply(callback, []);
+ }
+ },
+ expandCollapseParentNode: function(setting, node, expandFlag, animateFlag, callback) {
+ if (!node) return;
+ if (!node.parentTId) {
+ view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback);
+ return;
+ } else {
+ view.expandCollapseNode(setting, node, expandFlag, animateFlag);
+ }
+ if (node.parentTId) {
+ view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, animateFlag, callback);
+ }
+ },
+ expandCollapseSonNode: function(setting, node, expandFlag, animateFlag, callback) {
+ var root = data.getRoot(setting),
+ childKey = setting.data.key.children,
+ treeNodes = (node) ? node[childKey]: root[childKey],
+ selfAnimateSign = (node) ? false : animateFlag,
+ expandTriggerFlag = data.getRoot(setting).expandTriggerFlag;
+ data.getRoot(setting).expandTriggerFlag = false;
+ if (treeNodes) {
+ for (var i = 0, l = treeNodes.length; i < l; i++) {
+ if (treeNodes[i]) view.expandCollapseSonNode(setting, treeNodes[i], expandFlag, selfAnimateSign);
+ }
+ }
+ data.getRoot(setting).expandTriggerFlag = expandTriggerFlag;
+ view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback );
+ },
+ makeDOMNodeIcon: function(html, setting, node) {
+ var nameStr = data.getNodeName(setting, node),
+ name = setting.view.nameIsHTML ? nameStr : nameStr.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
+ html.push("<span id='", node.tId, consts.id.ICON,
+ "' title='' treeNode", consts.id.ICON," class='", view.makeNodeIcoClass(setting, node),
+ "' style='", view.makeNodeIcoStyle(setting, node), "'></span><span id='", node.tId, consts.id.SPAN,
+ "'>",name,"</span>");
+ },
+ makeDOMNodeLine: function(html, setting, node) {
+ html.push("<span id='", node.tId, consts.id.SWITCH, "' title='' class='", view.makeNodeLineClass(setting, node), "' treeNode", consts.id.SWITCH,"></span>");
+ },
+ makeDOMNodeMainAfter: function(html, setting, node) {
+ html.push("</li>");
+ },
+ makeDOMNodeMainBefore: function(html, setting, node) {
+ html.push("<li id='", node.tId, "' class='", consts.className.LEVEL, node.level,"' tabindex='0' hidefocus='true' treenode>");
+ },
+ makeDOMNodeNameAfter: function(html, setting, node) {
+ html.push("</a>");
+ },
+ makeDOMNodeNameBefore: function(html, setting, node) {
+ var title = data.getNodeTitle(setting, node),
+ url = view.makeNodeUrl(setting, node),
+ fontcss = view.makeNodeFontCss(setting, node),
+ fontStyle = [];
+ for (var f in fontcss) {
+ fontStyle.push(f, ":", fontcss[f], ";");
+ }
+ html.push("<a id='", node.tId, consts.id.A, "' class='", consts.className.LEVEL, node.level,"' treeNode", consts.id.A," onclick=\"", (node.click || ''),
+ "\" ", ((url != null && url.length > 0) ? "href='" + url + "'" : ""), " target='",view.makeNodeTarget(node),"' style='", fontStyle.join(''),
+ "'");
+ if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle) && title) {html.push("title='", title.replace(/'/g,"&#39;").replace(/</g,'&lt;').replace(/>/g,'&gt;'),"'");}
+ html.push(">");
+ },
+ makeNodeFontCss: function(setting, node) {
+ var fontCss = tools.apply(setting.view.fontCss, [setting.treeId, node], setting.view.fontCss);
+ return (fontCss && ((typeof fontCss) != "function")) ? fontCss : {};
+ },
+ makeNodeIcoClass: function(setting, node) {
+ var icoCss = ["ico"];
+ if (!node.isAjaxing) {
+ icoCss[0] = (node.iconSkin ? node.iconSkin + "_" : "") + icoCss[0];
+ if (node.isParent) {
+ icoCss.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE);
+ } else {
+ icoCss.push(consts.folder.DOCU);
+ }
+ }
+ return consts.className.BUTTON + " " + icoCss.join('_');
+ },
+ makeNodeIcoStyle: function(setting, node) {
+ var icoStyle = [];
+ if (!node.isAjaxing) {
+ var icon = (node.isParent && node.iconOpen && node.iconClose) ? (node.open ? node.iconOpen : node.iconClose) : node.icon;
+ if (icon) icoStyle.push("background:url(", icon, ") 0 0 no-repeat;");
+ if (setting.view.showIcon == false || !tools.apply(setting.view.showIcon, [setting.treeId, node], true)) {
+ icoStyle.push("width:0px;height:0px;");
+ }
+ }
+ return icoStyle.join('');
+ },
+ makeNodeLineClass: function(setting, node) {
+ var lineClass = [];
+ if (setting.view.showLine) {
+ if (node.level == 0 && node.isFirstNode && node.isLastNode) {
+ lineClass.push(consts.line.ROOT);
+ } else if (node.level == 0 && node.isFirstNode) {
+ lineClass.push(consts.line.ROOTS);
+ } else if (node.isLastNode) {
+ lineClass.push(consts.line.BOTTOM);
+ } else {
+ lineClass.push(consts.line.CENTER);
+ }
+ } else {
+ lineClass.push(consts.line.NOLINE);
+ }
+ if (node.isParent) {
+ lineClass.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE);
+ } else {
+ lineClass.push(consts.folder.DOCU);
+ }
+ return view.makeNodeLineClassEx(node) + lineClass.join('_');
+ },
+ makeNodeLineClassEx: function(node) {
+ return consts.className.BUTTON + " " + consts.className.LEVEL + node.level + " " + consts.className.SWITCH + " ";
+ },
+ makeNodeTarget: function(node) {
+ return (node.target || "_blank");
+ },
+ makeNodeUrl: function(setting, node) {
+ var urlKey = setting.data.key.url;
+ return node[urlKey] ? node[urlKey] : null;
+ },
+ makeUlHtml: function(setting, node, html, content) {
+ html.push("<ul id='", node.tId, consts.id.UL, "' class='", consts.className.LEVEL, node.level, " ", view.makeUlLineClass(setting, node), "' style='display:", (node.open ? "block": "none"),"'>");
+ html.push(content);
+ html.push("</ul>");
+ },
+ makeUlLineClass: function(setting, node) {
+ return ((setting.view.showLine && !node.isLastNode) ? consts.line.LINE : "");
+ },
+ removeChildNodes: function(setting, node) {
+ if (!node) return;
+ var childKey = setting.data.key.children,
+ nodes = node[childKey];
+ if (!nodes) return;
+
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ data.removeNodeCache(setting, nodes[i]);
+ }
+ data.removeSelectedNode(setting);
+ delete node[childKey];
+
+ if (!setting.data.keep.parent) {
+ node.isParent = false;
+ node.open = false;
+ var tmp_switchObj = $$(node, consts.id.SWITCH, setting),
+ tmp_icoObj = $$(node, consts.id.ICON, setting);
+ view.replaceSwitchClass(node, tmp_switchObj, consts.folder.DOCU);
+ view.replaceIcoClass(node, tmp_icoObj, consts.folder.DOCU);
+ $$(node, consts.id.UL, setting).remove();
+ } else {
+ $$(node, consts.id.UL, setting).empty();
+ }
+ },
+ setFirstNode: function(setting, parentNode) {
+ var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
+ if ( childLength > 0) {
+ parentNode[childKey][0].isFirstNode = true;
+ }
+ },
+ setLastNode: function(setting, parentNode) {
+ var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
+ if ( childLength > 0) {
+ parentNode[childKey][childLength - 1].isLastNode = true;
+ }
+ },
+ removeNode: function(setting, node) {
+ var root = data.getRoot(setting),
+ childKey = setting.data.key.children,
+ parentNode = (node.parentTId) ? node.getParentNode() : root;
+
+ node.isFirstNode = false;
+ node.isLastNode = false;
+ node.getPreNode = function() {return null;};
+ node.getNextNode = function() {return null;};
+
+ if (!data.getNodeCache(setting, node.tId)) {
+ return;
+ }
+
+ $$(node, setting).remove();
+ data.removeNodeCache(setting, node);
+ data.removeSelectedNode(setting, node);
+
+ for (var i = 0, l = parentNode[childKey].length; i < l; i++) {
+ if (parentNode[childKey][i].tId == node.tId) {
+ parentNode[childKey].splice(i, 1);
+ break;
+ }
+ }
+ view.setFirstNode(setting, parentNode);
+ view.setLastNode(setting, parentNode);
+
+ var tmp_ulObj,tmp_switchObj,tmp_icoObj,
+ childLength = parentNode[childKey].length;
+
+ //repair nodes old parent
+ if (!setting.data.keep.parent && childLength == 0) {
+ //old parentNode has no child nodes
+ parentNode.isParent = false;
+ parentNode.open = false;
+ tmp_ulObj = $$(parentNode, consts.id.UL, setting);
+ tmp_switchObj = $$(parentNode, consts.id.SWITCH, setting);
+ tmp_icoObj = $$(parentNode, consts.id.ICON, setting);
+ view.replaceSwitchClass(parentNode, tmp_switchObj, consts.folder.DOCU);
+ view.replaceIcoClass(parentNode, tmp_icoObj, consts.folder.DOCU);
+ tmp_ulObj.css("display", "none");
+
+ } else if (setting.view.showLine && childLength > 0) {
+ //old parentNode has child nodes
+ var newLast = parentNode[childKey][childLength - 1];
+ tmp_ulObj = $$(newLast, consts.id.UL, setting);
+ tmp_switchObj = $$(newLast, consts.id.SWITCH, setting);
+ tmp_icoObj = $$(newLast, consts.id.ICON, setting);
+ if (parentNode == root) {
+ if (parentNode[childKey].length == 1) {
+ //node was root, and ztree has only one root after move node
+ view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.ROOT);
+ } else {
+ var tmp_first_switchObj = $$(parentNode[childKey][0], consts.id.SWITCH, setting);
+ view.replaceSwitchClass(parentNode[childKey][0], tmp_first_switchObj, consts.line.ROOTS);
+ view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM);
+ }
+ } else {
+ view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM);
+ }
+ tmp_ulObj.removeClass(consts.line.LINE);
+ }
+ },
+ replaceIcoClass: function(node, obj, newName) {
+ if (!obj || node.isAjaxing) return;
+ var tmpName = obj.attr("class");
+ if (tmpName == undefined) return;
+ var tmpList = tmpName.split("_");
+ switch (newName) {
+ case consts.folder.OPEN:
+ case consts.folder.CLOSE:
+ case consts.folder.DOCU:
+ tmpList[tmpList.length-1] = newName;
+ break;
+ }
+ obj.attr("class", tmpList.join("_"));
+ },
+ replaceSwitchClass: function(node, obj, newName) {
+ if (!obj) return;
+ var tmpName = obj.attr("class");
+ if (tmpName == undefined) return;
+ var tmpList = tmpName.split("_");
+ switch (newName) {
+ case consts.line.ROOT:
+ case consts.line.ROOTS:
+ case consts.line.CENTER:
+ case consts.line.BOTTOM:
+ case consts.line.NOLINE:
+ tmpList[0] = view.makeNodeLineClassEx(node) + newName;
+ break;
+ case consts.folder.OPEN:
+ case consts.folder.CLOSE:
+ case consts.folder.DOCU:
+ tmpList[1] = newName;
+ break;
+ }
+ obj.attr("class", tmpList.join("_"));
+ if (newName !== consts.folder.DOCU) {
+ obj.removeAttr("disabled");
+ } else {
+ obj.attr("disabled", "disabled");
+ }
+ },
+ selectNode: function(setting, node, addFlag) {
+ if (!addFlag) {
+ view.cancelPreSelectedNode(setting);
+ }
+ $$(node, consts.id.A, setting).addClass(consts.node.CURSELECTED);
+ data.addSelectedNode(setting, node);
+ },
+ setNodeFontCss: function(setting, treeNode) {
+ var aObj = $$(treeNode, consts.id.A, setting),
+ fontCss = view.makeNodeFontCss(setting, treeNode);
+ if (fontCss) {
+ aObj.css(fontCss);
+ }
+ },
+ setNodeLineIcos: function(setting, node) {
+ if (!node) return;
+ var switchObj = $$(node, consts.id.SWITCH, setting),
+ ulObj = $$(node, consts.id.UL, setting),
+ icoObj = $$(node, consts.id.ICON, setting),
+ ulLine = view.makeUlLineClass(setting, node);
+ if (ulLine.length==0) {
+ ulObj.removeClass(consts.line.LINE);
+ } else {
+ ulObj.addClass(ulLine);
+ }
+ switchObj.attr("class", view.makeNodeLineClass(setting, node));
+ if (node.isParent) {
+ switchObj.removeAttr("disabled");
+ } else {
+ switchObj.attr("disabled", "disabled");
+ }
+ icoObj.removeAttr("style");
+ icoObj.attr("style", view.makeNodeIcoStyle(setting, node));
+ icoObj.attr("class", view.makeNodeIcoClass(setting, node));
+ },
+ setNodeName: function(setting, node) {
+ var title = data.getNodeTitle(setting, node),
+ nObj = $$(node, consts.id.SPAN, setting);
+ nObj.empty();
+ if (setting.view.nameIsHTML) {
+ nObj.html(data.getNodeName(setting, node));
+ } else {
+ nObj.text(data.getNodeName(setting, node));
+ }
+ if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle)) {
+ var aObj = $$(node, consts.id.A, setting);
+ aObj.attr("title", !title ? "" : title);
+ }
+ },
+ setNodeTarget: function(setting, node) {
+ var aObj = $$(node, consts.id.A, setting);
+ aObj.attr("target", view.makeNodeTarget(node));
+ },
+ setNodeUrl: function(setting, node) {
+ var aObj = $$(node, consts.id.A, setting),
+ url = view.makeNodeUrl(setting, node);
+ if (url == null || url.length == 0) {
+ aObj.removeAttr("href");
+ } else {
+ aObj.attr("href", url);
+ }
+ },
+ switchNode: function(setting, node) {
+ if (node.open || !tools.canAsync(setting, node)) {
+ view.expandCollapseNode(setting, node, !node.open);
+ } else if (setting.async.enable) {
+ if (!view.asyncNode(setting, node)) {
+ view.expandCollapseNode(setting, node, !node.open);
+ return;
+ }
+ } else if (node) {
+ view.expandCollapseNode(setting, node, !node.open);
+ }
+ }
+ };
+ // zTree defind
+ $.fn.zTree = {
+ consts : _consts,
+ _z : {
+ tools: tools,
+ view: view,
+ event: event,
+ data: data
+ },
+ getZTreeObj: function(treeId) {
+ var o = data.getZTreeTools(treeId);
+ return o ? o : null;
+ },
+ destroy: function(treeId) {
+ if (!!treeId && treeId.length > 0) {
+ view.destroy(data.getSetting(treeId));
+ } else {
+ for(var s in settings) {
+ view.destroy(settings[s]);
+ }
+ }
+ },
+ init: function(obj, zSetting, zNodes) {
+ var setting = tools.clone(_setting);
+ $.extend(true, setting, zSetting);
+ setting.treeId = obj.attr("id");
+ setting.treeObj = obj;
+ setting.treeObj.empty();
+ settings[setting.treeId] = setting;
+ //For some older browser,(e.g., ie6)
+ if(typeof document.body.style.maxHeight === "undefined") {
+ setting.view.expandSpeed = "";
+ }
+ data.initRoot(setting);
+ var root = data.getRoot(setting),
+ childKey = setting.data.key.children;
+ zNodes = zNodes ? tools.clone(tools.isArray(zNodes)? zNodes : [zNodes]) : [];
+ if (setting.data.simpleData.enable) {
+ root[childKey] = data.transformTozTreeFormat(setting, zNodes);
+ } else {
+ root[childKey] = zNodes;
+ }
+
+ data.initCache(setting);
+ event.unbindTree(setting);
+ event.bindTree(setting);
+ event.unbindEvent(setting);
+ event.bindEvent(setting);
+
+ var zTreeTools = {
+ setting : setting,
+ addNodes : function(parentNode, newNodes, isSilent) {
+ if (!newNodes) return null;
+ if (!parentNode) parentNode = null;
+ if (parentNode && !parentNode.isParent && setting.data.keep.leaf) return null;
+ var xNewNodes = tools.clone(tools.isArray(newNodes)? newNodes: [newNodes]);
+ function addCallback() {
+ view.addNodes(setting, parentNode, xNewNodes, (isSilent==true));
+ }
+
+ if (tools.canAsync(setting, parentNode)) {
+ view.asyncNode(setting, parentNode, isSilent, addCallback);
+ } else {
+ addCallback();
+ }
+ return xNewNodes;
+ },
+ cancelSelectedNode : function(node) {
+ view.cancelPreSelectedNode(setting, node);
+ },
+ destroy : function() {
+ view.destroy(setting);
+ },
+ expandAll : function(expandFlag) {
+ expandFlag = !!expandFlag;
+ view.expandCollapseSonNode(setting, null, expandFlag, true);
+ return expandFlag;
+ },
+ expandNode : function(node, expandFlag, sonSign, focus, callbackFlag) {
+ if (!node || !node.isParent) return null;
+ if (expandFlag !== true && expandFlag !== false) {
+ expandFlag = !node.open;
+ }
+ callbackFlag = !!callbackFlag;
+
+ if (callbackFlag && expandFlag && (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false)) {
+ return null;
+ } else if (callbackFlag && !expandFlag && (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false)) {
+ return null;
+ }
+ if (expandFlag && node.parentTId) {
+ view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, false);
+ }
+ if (expandFlag === node.open && !sonSign) {
+ return null;
+ }
+
+ data.getRoot(setting).expandTriggerFlag = callbackFlag;
+ if (!tools.canAsync(setting, node) && sonSign) {
+ view.expandCollapseSonNode(setting, node, expandFlag, true, function() {
+ if (focus !== false) {try{$$(node, setting).focus().blur();}catch(e){}}
+ });
+ } else {
+ node.open = !expandFlag;
+ view.switchNode(this.setting, node);
+ if (focus !== false) {try{$$(node, setting).focus().blur();}catch(e){}}
+ }
+ return expandFlag;
+ },
+ getNodes : function() {
+ return data.getNodes(setting);
+ },
+ getNodeByParam : function(key, value, parentNode) {
+ if (!key) return null;
+ return data.getNodeByParam(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value);
+ },
+ getNodeByTId : function(tId) {
+ return data.getNodeCache(setting, tId);
+ },
+ getNodesByParam : function(key, value, parentNode) {
+ if (!key) return null;
+ return data.getNodesByParam(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value);
+ },
+ getNodesByParamFuzzy : function(key, value, parentNode) {
+ if (!key) return null;
+ return data.getNodesByParamFuzzy(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value);
+ },
+ getNodesByFilter: function(filter, isSingle, parentNode, invokeParam) {
+ isSingle = !!isSingle;
+ if (!filter || (typeof filter != "function")) return (isSingle ? null : []);
+ return data.getNodesByFilter(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), filter, isSingle, invokeParam);
+ },
+ getNodeIndex : function(node) {
+ if (!node) return null;
+ var childKey = setting.data.key.children,
+ parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting);
+ for (var i=0, l = parentNode[childKey].length; i < l; i++) {
+ if (parentNode[childKey][i] == node) return i;
+ }
+ return -1;
+ },
+ getSelectedNodes : function() {
+ var r = [], list = data.getRoot(setting).curSelectedList;
+ for (var i=0, l=list.length; i<l; i++) {
+ r.push(list[i]);
+ }
+ return r;
+ },
+ isSelectedNode : function(node) {
+ return data.isSelectedNode(setting, node);
+ },
+ reAsyncChildNodes : function(parentNode, reloadType, isSilent) {
+ if (!this.setting.async.enable) return;
+ var isRoot = !parentNode;
+ if (isRoot) {
+ parentNode = data.getRoot(setting);
+ }
+ if (reloadType=="refresh") {
+ var childKey = this.setting.data.key.children;
+ for (var i = 0, l = parentNode[childKey] ? parentNode[childKey].length : 0; i < l; i++) {
+ data.removeNodeCache(setting, parentNode[childKey][i]);
+ }
+ data.removeSelectedNode(setting);
+ parentNode[childKey] = [];
+ if (isRoot) {
+ this.setting.treeObj.empty();
+ } else {
+ var ulObj = $$(parentNode, consts.id.UL, setting);
+ ulObj.empty();
+ }
+ }
+ view.asyncNode(this.setting, isRoot? null:parentNode, !!isSilent);
+ },
+ refresh : function() {
+ this.setting.treeObj.empty();
+ var root = data.getRoot(setting),
+ nodes = root[setting.data.key.children]
+ data.initRoot(setting);
+ root[setting.data.key.children] = nodes
+ data.initCache(setting);
+ view.createNodes(setting, 0, root[setting.data.key.children]);
+ },
+ removeChildNodes : function(node) {
+ if (!node) return null;
+ var childKey = setting.data.key.children,
+ nodes = node[childKey];
+ view.removeChildNodes(setting, node);
+ return nodes ? nodes : null;
+ },
+ removeNode : function(node, callbackFlag) {
+ if (!node) return;
+ callbackFlag = !!callbackFlag;
+ if (callbackFlag && tools.apply(setting.callback.beforeRemove, [setting.treeId, node], true) == false) return;
+ view.removeNode(setting, node);
+ if (callbackFlag) {
+ this.setting.treeObj.trigger(consts.event.REMOVE, [setting.treeId, node]);
+ }
+ },
+ selectNode : function(node, addFlag) {
+ if (!node) return;
+ if (tools.uCanDo(setting)) {
+ addFlag = setting.view.selectedMulti && addFlag;
+ if (node.parentTId) {
+ view.expandCollapseParentNode(setting, node.getParentNode(), true, false, function() {
+ try{$$(node, setting).focus().blur();}catch(e){}
+ });
+ } else {
+ try{$$(node, setting).focus().blur();}catch(e){}
+ }
+ view.selectNode(setting, node, addFlag);
+ }
+ },
+ transformTozTreeNodes : function(simpleNodes) {
+ return data.transformTozTreeFormat(setting, simpleNodes);
+ },
+ transformToArray : function(nodes) {
+ return data.transformToArrayFormat(setting, nodes);
+ },
+ updateNode : function(node, checkTypeFlag) {
+ if (!node) return;
+ var nObj = $$(node, setting);
+ if (nObj.get(0) && tools.uCanDo(setting)) {
+ view.setNodeName(setting, node);
+ view.setNodeTarget(setting, node);
+ view.setNodeUrl(setting, node);
+ view.setNodeLineIcos(setting, node);
+ view.setNodeFontCss(setting, node);
+ }
+ }
+ }
+ root.treeTools = zTreeTools;
+ data.setZTreeTools(setting, zTreeTools);
+
+ if (root[childKey] && root[childKey].length > 0) {
+ view.createNodes(setting, 0, root[childKey]);
+ } else if (setting.async.enable && setting.async.url && setting.async.url !== '') {
+ view.asyncNode(setting);
+ }
+ return zTreeTools;
+ }
+ };
+
+ var zt = $.fn.zTree,
+ $$ = tools.$,
+ consts = zt.consts;
+})(jQuery); \ No newline at end of file
diff --git a/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.core.min.js b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.core.min.js
new file mode 100644
index 0000000..705bdb4
--- /dev/null
+++ b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.core.min.js
@@ -0,0 +1,69 @@
+/*
+ * JQuery zTree core v3.5.16
+ * http://zTree.me/
+ *
+ * Copyright (c) 2010 Hunter.z
+ *
+ * Licensed same as jquery - MIT License
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * email: hunter.z@263.net
+ * Date: 2014-03-09
+ */
+(function(p){var G,H,I,J,K,L,r={},u={},v={},M={treeId:"",treeObj:null,view:{addDiyDom:null,autoCancelSelected:!0,dblClickExpand:!0,expandSpeed:"fast",fontCss:{},nameIsHTML:!1,selectedMulti:!0,showIcon:!0,showLine:!0,showTitle:!0,txtSelectedEnable:!1},data:{key:{children:"children",name:"name",title:"",url:"url"},simpleData:{enable:!1,idKey:"id",pIdKey:"pId",rootPId:null},keep:{parent:!1,leaf:!1}},async:{enable:!1,contentType:"application/x-www-form-urlencoded",type:"post",dataType:"text",url:"",autoParam:[],
+otherParam:[],dataFilter:null},callback:{beforeAsync:null,beforeClick:null,beforeDblClick:null,beforeRightClick:null,beforeMouseDown:null,beforeMouseUp:null,beforeExpand:null,beforeCollapse:null,beforeRemove:null,onAsyncError:null,onAsyncSuccess:null,onNodeCreated:null,onClick:null,onDblClick:null,onRightClick:null,onMouseDown:null,onMouseUp:null,onExpand:null,onCollapse:null,onRemove:null}},w=[function(b){var a=b.treeObj,c=e.event;a.bind(c.NODECREATED,function(a,c,g){j.apply(b.callback.onNodeCreated,
+[a,c,g])});a.bind(c.CLICK,function(a,c,g,l,h){j.apply(b.callback.onClick,[c,g,l,h])});a.bind(c.EXPAND,function(a,c,g){j.apply(b.callback.onExpand,[a,c,g])});a.bind(c.COLLAPSE,function(a,c,g){j.apply(b.callback.onCollapse,[a,c,g])});a.bind(c.ASYNC_SUCCESS,function(a,c,g,l){j.apply(b.callback.onAsyncSuccess,[a,c,g,l])});a.bind(c.ASYNC_ERROR,function(a,c,g,l,h,e){j.apply(b.callback.onAsyncError,[a,c,g,l,h,e])});a.bind(c.REMOVE,function(a,c,g){j.apply(b.callback.onRemove,[a,c,g])})}],x=[function(b){var a=
+e.event;b.treeObj.unbind(a.NODECREATED).unbind(a.CLICK).unbind(a.EXPAND).unbind(a.COLLAPSE).unbind(a.ASYNC_SUCCESS).unbind(a.ASYNC_ERROR).unbind(a.REMOVE)}],y=[function(b){var a=h.getCache(b);a||(a={},h.setCache(b,a));a.nodes=[];a.doms=[]}],z=[function(b,a,c,d,f,g){if(c){var l=h.getRoot(b),e=b.data.key.children;c.level=a;c.tId=b.treeId+"_"+ ++l.zId;c.parentTId=d?d.tId:null;c.open=typeof c.open=="string"?j.eqs(c.open,"true"):!!c.open;c[e]&&c[e].length>0?(c.isParent=!0,c.zAsync=!0):(c.isParent=typeof c.isParent==
+"string"?j.eqs(c.isParent,"true"):!!c.isParent,c.open=c.isParent&&!b.async.enable?c.open:!1,c.zAsync=!c.isParent);c.isFirstNode=f;c.isLastNode=g;c.getParentNode=function(){return h.getNodeCache(b,c.parentTId)};c.getPreNode=function(){return h.getPreNode(b,c)};c.getNextNode=function(){return h.getNextNode(b,c)};c.isAjaxing=!1;h.fixPIdKeyValue(b,c)}}],s=[function(b){var a=b.target,c=h.getSetting(b.data.treeId),d="",f=null,g="",l="",i=null,n=null,k=null;if(j.eqs(b.type,"mousedown"))l="mousedown";else if(j.eqs(b.type,
+"mouseup"))l="mouseup";else if(j.eqs(b.type,"contextmenu"))l="contextmenu";else if(j.eqs(b.type,"click"))if(j.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+e.id.SWITCH)!==null)d=j.getNodeMainDom(a).id,g="switchNode";else{if(k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+e.id.A}]))d=j.getNodeMainDom(k).id,g="clickNode"}else if(j.eqs(b.type,"dblclick")&&(l="dblclick",k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+e.id.A}])))d=j.getNodeMainDom(k).id,g="switchNode";if(l.length>0&&d.length==0&&
+(k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+e.id.A}])))d=j.getNodeMainDom(k).id;if(d.length>0)switch(f=h.getNodeCache(c,d),g){case "switchNode":f.isParent?j.eqs(b.type,"click")||j.eqs(b.type,"dblclick")&&j.apply(c.view.dblClickExpand,[c.treeId,f],c.view.dblClickExpand)?i=G:g="":g="";break;case "clickNode":i=H}switch(l){case "mousedown":n=I;break;case "mouseup":n=J;break;case "dblclick":n=K;break;case "contextmenu":n=L}return{stop:!1,node:f,nodeEventType:g,nodeEventCallback:i,treeEventType:l,
+treeEventCallback:n}}],A=[function(b){var a=h.getRoot(b);a||(a={},h.setRoot(b,a));a[b.data.key.children]=[];a.expandTriggerFlag=!1;a.curSelectedList=[];a.noSelection=!0;a.createdNodes=[];a.zId=0;a._ver=(new Date).getTime()}],B=[],C=[],D=[],E=[],F=[],h={addNodeCache:function(b,a){h.getCache(b).nodes[h.getNodeCacheId(a.tId)]=a},getNodeCacheId:function(b){return b.substring(b.lastIndexOf("_")+1)},addAfterA:function(b){C.push(b)},addBeforeA:function(b){B.push(b)},addInnerAfterA:function(b){E.push(b)},
+addInnerBeforeA:function(b){D.push(b)},addInitBind:function(b){w.push(b)},addInitUnBind:function(b){x.push(b)},addInitCache:function(b){y.push(b)},addInitNode:function(b){z.push(b)},addInitProxy:function(b,a){a?s.splice(0,0,b):s.push(b)},addInitRoot:function(b){A.push(b)},addNodesData:function(b,a,c){var d=b.data.key.children;a[d]||(a[d]=[]);if(a[d].length>0)a[d][a[d].length-1].isLastNode=!1,i.setNodeLineIcos(b,a[d][a[d].length-1]);a.isParent=!0;a[d]=a[d].concat(c)},addSelectedNode:function(b,a){var c=
+h.getRoot(b);h.isSelectedNode(b,a)||c.curSelectedList.push(a)},addCreatedNode:function(b,a){(b.callback.onNodeCreated||b.view.addDiyDom)&&h.getRoot(b).createdNodes.push(a)},addZTreeTools:function(b){F.push(b)},exSetting:function(b){p.extend(!0,M,b)},fixPIdKeyValue:function(b,a){b.data.simpleData.enable&&(a[b.data.simpleData.pIdKey]=a.parentTId?a.getParentNode()[b.data.simpleData.idKey]:b.data.simpleData.rootPId)},getAfterA:function(b,a,c){for(var d=0,f=C.length;d<f;d++)C[d].apply(this,arguments)},
+getBeforeA:function(b,a,c){for(var d=0,f=B.length;d<f;d++)B[d].apply(this,arguments)},getInnerAfterA:function(b,a,c){for(var d=0,f=E.length;d<f;d++)E[d].apply(this,arguments)},getInnerBeforeA:function(b,a,c){for(var d=0,f=D.length;d<f;d++)D[d].apply(this,arguments)},getCache:function(b){return v[b.treeId]},getNextNode:function(b,a){if(!a)return null;for(var c=b.data.key.children,d=a.parentTId?a.getParentNode():h.getRoot(b),f=0,g=d[c].length-1;f<=g;f++)if(d[c][f]===a)return f==g?null:d[c][f+1];return null},
+getNodeByParam:function(b,a,c,d){if(!a||!c)return null;for(var f=b.data.key.children,g=0,l=a.length;g<l;g++){if(a[g][c]==d)return a[g];var e=h.getNodeByParam(b,a[g][f],c,d);if(e)return e}return null},getNodeCache:function(b,a){if(!a)return null;var c=v[b.treeId].nodes[h.getNodeCacheId(a)];return c?c:null},getNodeName:function(b,a){return""+a[b.data.key.name]},getNodeTitle:function(b,a){return""+a[b.data.key.title===""?b.data.key.name:b.data.key.title]},getNodes:function(b){return h.getRoot(b)[b.data.key.children]},
+getNodesByParam:function(b,a,c,d){if(!a||!c)return[];for(var f=b.data.key.children,g=[],l=0,e=a.length;l<e;l++)a[l][c]==d&&g.push(a[l]),g=g.concat(h.getNodesByParam(b,a[l][f],c,d));return g},getNodesByParamFuzzy:function(b,a,c,d){if(!a||!c)return[];for(var f=b.data.key.children,g=[],d=d.toLowerCase(),l=0,e=a.length;l<e;l++)typeof a[l][c]=="string"&&a[l][c].toLowerCase().indexOf(d)>-1&&g.push(a[l]),g=g.concat(h.getNodesByParamFuzzy(b,a[l][f],c,d));return g},getNodesByFilter:function(b,a,c,d,f){if(!a)return d?
+null:[];for(var g=b.data.key.children,e=d?null:[],i=0,n=a.length;i<n;i++){if(j.apply(c,[a[i],f],!1)){if(d)return a[i];e.push(a[i])}var k=h.getNodesByFilter(b,a[i][g],c,d,f);if(d&&k)return k;e=d?k:e.concat(k)}return e},getPreNode:function(b,a){if(!a)return null;for(var c=b.data.key.children,d=a.parentTId?a.getParentNode():h.getRoot(b),f=0,g=d[c].length;f<g;f++)if(d[c][f]===a)return f==0?null:d[c][f-1];return null},getRoot:function(b){return b?u[b.treeId]:null},getRoots:function(){return u},getSetting:function(b){return r[b]},
+getSettings:function(){return r},getZTreeTools:function(b){return(b=this.getRoot(this.getSetting(b)))?b.treeTools:null},initCache:function(b){for(var a=0,c=y.length;a<c;a++)y[a].apply(this,arguments)},initNode:function(b,a,c,d,f,g){for(var e=0,h=z.length;e<h;e++)z[e].apply(this,arguments)},initRoot:function(b){for(var a=0,c=A.length;a<c;a++)A[a].apply(this,arguments)},isSelectedNode:function(b,a){for(var c=h.getRoot(b),d=0,f=c.curSelectedList.length;d<f;d++)if(a===c.curSelectedList[d])return!0;return!1},
+removeNodeCache:function(b,a){var c=b.data.key.children;if(a[c])for(var d=0,f=a[c].length;d<f;d++)arguments.callee(b,a[c][d]);h.getCache(b).nodes[h.getNodeCacheId(a.tId)]=null},removeSelectedNode:function(b,a){for(var c=h.getRoot(b),d=0,f=c.curSelectedList.length;d<f;d++)if(a===c.curSelectedList[d]||!h.getNodeCache(b,c.curSelectedList[d].tId))c.curSelectedList.splice(d,1),d--,f--},setCache:function(b,a){v[b.treeId]=a},setRoot:function(b,a){u[b.treeId]=a},setZTreeTools:function(b,a){for(var c=0,d=
+F.length;c<d;c++)F[c].apply(this,arguments)},transformToArrayFormat:function(b,a){if(!a)return[];var c=b.data.key.children,d=[];if(j.isArray(a))for(var f=0,g=a.length;f<g;f++)d.push(a[f]),a[f][c]&&(d=d.concat(h.transformToArrayFormat(b,a[f][c])));else d.push(a),a[c]&&(d=d.concat(h.transformToArrayFormat(b,a[c])));return d},transformTozTreeFormat:function(b,a){var c,d,f=b.data.simpleData.idKey,g=b.data.simpleData.pIdKey,e=b.data.key.children;if(!f||f==""||!a)return[];if(j.isArray(a)){var h=[],i=[];
+for(c=0,d=a.length;c<d;c++)i[a[c][f]]=a[c];for(c=0,d=a.length;c<d;c++)i[a[c][g]]&&a[c][f]!=a[c][g]?(i[a[c][g]][e]||(i[a[c][g]][e]=[]),i[a[c][g]][e].push(a[c])):h.push(a[c]);return h}else return[a]}},m={bindEvent:function(b){for(var a=0,c=w.length;a<c;a++)w[a].apply(this,arguments)},unbindEvent:function(b){for(var a=0,c=x.length;a<c;a++)x[a].apply(this,arguments)},bindTree:function(b){var a={treeId:b.treeId},c=b.treeObj;b.view.txtSelectedEnable||c.bind("selectstart",function(a){a=a.originalEvent.srcElement.nodeName.toLowerCase();
+return a==="input"||a==="textarea"}).css({"-moz-user-select":"-moz-none"});c.bind("click",a,m.proxy);c.bind("dblclick",a,m.proxy);c.bind("mouseover",a,m.proxy);c.bind("mouseout",a,m.proxy);c.bind("mousedown",a,m.proxy);c.bind("mouseup",a,m.proxy);c.bind("contextmenu",a,m.proxy)},unbindTree:function(b){b.treeObj.unbind("click",m.proxy).unbind("dblclick",m.proxy).unbind("mouseover",m.proxy).unbind("mouseout",m.proxy).unbind("mousedown",m.proxy).unbind("mouseup",m.proxy).unbind("contextmenu",m.proxy)},
+doProxy:function(b){for(var a=[],c=0,d=s.length;c<d;c++){var f=s[c].apply(this,arguments);a.push(f);if(f.stop)break}return a},proxy:function(b){var a=h.getSetting(b.data.treeId);if(!j.uCanDo(a,b))return!0;for(var a=m.doProxy(b),c=!0,d=0,f=a.length;d<f;d++){var g=a[d];g.nodeEventCallback&&(c=g.nodeEventCallback.apply(g,[b,g.node])&&c);g.treeEventCallback&&(c=g.treeEventCallback.apply(g,[b,g.node])&&c)}return c}};G=function(b,a){var c=h.getSetting(b.data.treeId);if(a.open){if(j.apply(c.callback.beforeCollapse,
+[c.treeId,a],!0)==!1)return!0}else if(j.apply(c.callback.beforeExpand,[c.treeId,a],!0)==!1)return!0;h.getRoot(c).expandTriggerFlag=!0;i.switchNode(c,a);return!0};H=function(b,a){var c=h.getSetting(b.data.treeId),d=c.view.autoCancelSelected&&(b.ctrlKey||b.metaKey)&&h.isSelectedNode(c,a)?0:c.view.autoCancelSelected&&(b.ctrlKey||b.metaKey)&&c.view.selectedMulti?2:1;if(j.apply(c.callback.beforeClick,[c.treeId,a,d],!0)==!1)return!0;d===0?i.cancelPreSelectedNode(c,a):i.selectNode(c,a,d===2);c.treeObj.trigger(e.event.CLICK,
+[b,c.treeId,a,d]);return!0};I=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeMouseDown,[c.treeId,a],!0)&&j.apply(c.callback.onMouseDown,[b,c.treeId,a]);return!0};J=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeMouseUp,[c.treeId,a],!0)&&j.apply(c.callback.onMouseUp,[b,c.treeId,a]);return!0};K=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeDblClick,[c.treeId,a],!0)&&j.apply(c.callback.onDblClick,[b,c.treeId,a]);return!0};
+L=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeRightClick,[c.treeId,a],!0)&&j.apply(c.callback.onRightClick,[b,c.treeId,a]);return typeof c.callback.onRightClick!="function"};var j={apply:function(b,a,c){return typeof b=="function"?b.apply(N,a?a:[]):c},canAsync:function(b,a){var c=b.data.key.children;return b.async.enable&&a&&a.isParent&&!(a.zAsync||a[c]&&a[c].length>0)},clone:function(b){if(b===null)return null;var a=j.isArray(b)?[]:{},c;for(c in b)a[c]=b[c]instanceof
+Date?new Date(b[c].getTime()):typeof b[c]==="object"?arguments.callee(b[c]):b[c];return a},eqs:function(b,a){return b.toLowerCase()===a.toLowerCase()},isArray:function(b){return Object.prototype.toString.apply(b)==="[object Array]"},$:function(b,a,c){a&&typeof a!="string"&&(c=a,a="");return typeof b=="string"?p(b,c?c.treeObj.get(0).ownerDocument:null):p("#"+b.tId+a,c?c.treeObj:null)},getMDom:function(b,a,c){if(!a)return null;for(;a&&a.id!==b.treeId;){for(var d=0,f=c.length;a.tagName&&d<f;d++)if(j.eqs(a.tagName,
+c[d].tagName)&&a.getAttribute(c[d].attrName)!==null)return a;a=a.parentNode}return null},getNodeMainDom:function(b){return p(b).parent("li").get(0)||p(b).parentsUntil("li").parent().get(0)},isChildOrSelf:function(b,a){return p(b).closest("#"+a).length>0},uCanDo:function(){return!0}},i={addNodes:function(b,a,c,d){if(!b.data.keep.leaf||!a||a.isParent)if(j.isArray(c)||(c=[c]),b.data.simpleData.enable&&(c=h.transformTozTreeFormat(b,c)),a){var f=k(a,e.id.SWITCH,b),g=k(a,e.id.ICON,b),l=k(a,e.id.UL,b);if(!a.open)i.replaceSwitchClass(a,
+f,e.folder.CLOSE),i.replaceIcoClass(a,g,e.folder.CLOSE),a.open=!1,l.css({display:"none"});h.addNodesData(b,a,c);i.createNodes(b,a.level+1,c,a);d||i.expandCollapseParentNode(b,a,!0)}else h.addNodesData(b,h.getRoot(b),c),i.createNodes(b,0,c,null)},appendNodes:function(b,a,c,d,f,g){if(!c)return[];for(var e=[],j=b.data.key.children,k=0,m=c.length;k<m;k++){var o=c[k];if(f){var t=(d?d:h.getRoot(b))[j].length==c.length&&k==0;h.initNode(b,a,o,d,t,k==c.length-1,g);h.addNodeCache(b,o)}t=[];o[j]&&o[j].length>
+0&&(t=i.appendNodes(b,a+1,o[j],o,f,g&&o.open));g&&(i.makeDOMNodeMainBefore(e,b,o),i.makeDOMNodeLine(e,b,o),h.getBeforeA(b,o,e),i.makeDOMNodeNameBefore(e,b,o),h.getInnerBeforeA(b,o,e),i.makeDOMNodeIcon(e,b,o),h.getInnerAfterA(b,o,e),i.makeDOMNodeNameAfter(e,b,o),h.getAfterA(b,o,e),o.isParent&&o.open&&i.makeUlHtml(b,o,e,t.join("")),i.makeDOMNodeMainAfter(e,b,o),h.addCreatedNode(b,o))}return e},appendParentULDom:function(b,a){var c=[],d=k(a,b);!d.get(0)&&a.parentTId&&(i.appendParentULDom(b,a.getParentNode()),
+d=k(a,b));var f=k(a,e.id.UL,b);f.get(0)&&f.remove();f=i.appendNodes(b,a.level+1,a[b.data.key.children],a,!1,!0);i.makeUlHtml(b,a,c,f.join(""));d.append(c.join(""))},asyncNode:function(b,a,c,d){var f,g;if(a&&!a.isParent)return j.apply(d),!1;else if(a&&a.isAjaxing)return!1;else if(j.apply(b.callback.beforeAsync,[b.treeId,a],!0)==!1)return j.apply(d),!1;if(a)a.isAjaxing=!0,k(a,e.id.ICON,b).attr({style:"","class":e.className.BUTTON+" "+e.className.ICO_LOADING});var l={};for(f=0,g=b.async.autoParam.length;a&&
+f<g;f++){var q=b.async.autoParam[f].split("="),n=q;q.length>1&&(n=q[1],q=q[0]);l[n]=a[q]}if(j.isArray(b.async.otherParam))for(f=0,g=b.async.otherParam.length;f<g;f+=2)l[b.async.otherParam[f]]=b.async.otherParam[f+1];else for(var m in b.async.otherParam)l[m]=b.async.otherParam[m];var o=h.getRoot(b)._ver;p.ajax({contentType:b.async.contentType,type:b.async.type,url:j.apply(b.async.url,[b.treeId,a],b.async.url),data:l,dataType:b.async.dataType,success:function(f){if(o==h.getRoot(b)._ver){var g=[];try{g=
+!f||f.length==0?[]:typeof f=="string"?eval("("+f+")"):f}catch(l){g=f}if(a)a.isAjaxing=null,a.zAsync=!0;i.setNodeLineIcos(b,a);g&&g!==""?(g=j.apply(b.async.dataFilter,[b.treeId,a,g],g),i.addNodes(b,a,g?j.clone(g):[],!!c)):i.addNodes(b,a,[],!!c);b.treeObj.trigger(e.event.ASYNC_SUCCESS,[b.treeId,a,f]);j.apply(d)}},error:function(c,d,f){if(o==h.getRoot(b)._ver){if(a)a.isAjaxing=null;i.setNodeLineIcos(b,a);b.treeObj.trigger(e.event.ASYNC_ERROR,[b.treeId,a,c,d,f])}}});return!0},cancelPreSelectedNode:function(b,
+a){for(var c=h.getRoot(b).curSelectedList,d=c.length-1;d>=0;d--)if(!a||a===c[d])if(k(c[d],e.id.A,b).removeClass(e.node.CURSELECTED),a){h.removeSelectedNode(b,a);break}if(!a)h.getRoot(b).curSelectedList=[]},createNodeCallback:function(b){if(b.callback.onNodeCreated||b.view.addDiyDom)for(var a=h.getRoot(b);a.createdNodes.length>0;){var c=a.createdNodes.shift();j.apply(b.view.addDiyDom,[b.treeId,c]);b.callback.onNodeCreated&&b.treeObj.trigger(e.event.NODECREATED,[b.treeId,c])}},createNodes:function(b,
+a,c,d){if(c&&c.length!=0){var f=h.getRoot(b),g=b.data.key.children,g=!d||d.open||!!k(d[g][0],b).get(0);f.createdNodes=[];a=i.appendNodes(b,a,c,d,!0,g);d?(d=k(d,e.id.UL,b),d.get(0)&&d.append(a.join(""))):b.treeObj.append(a.join(""));i.createNodeCallback(b)}},destroy:function(b){b&&(h.initCache(b),h.initRoot(b),m.unbindTree(b),m.unbindEvent(b),b.treeObj.empty(),delete r[b.treeId])},expandCollapseNode:function(b,a,c,d,f){var g=h.getRoot(b),l=b.data.key.children;if(a){if(g.expandTriggerFlag){var q=f,
+f=function(){q&&q();a.open?b.treeObj.trigger(e.event.EXPAND,[b.treeId,a]):b.treeObj.trigger(e.event.COLLAPSE,[b.treeId,a])};g.expandTriggerFlag=!1}if(!a.open&&a.isParent&&(!k(a,e.id.UL,b).get(0)||a[l]&&a[l].length>0&&!k(a[l][0],b).get(0)))i.appendParentULDom(b,a),i.createNodeCallback(b);if(a.open==c)j.apply(f,[]);else{var c=k(a,e.id.UL,b),g=k(a,e.id.SWITCH,b),n=k(a,e.id.ICON,b);a.isParent?(a.open=!a.open,a.iconOpen&&a.iconClose&&n.attr("style",i.makeNodeIcoStyle(b,a)),a.open?(i.replaceSwitchClass(a,
+g,e.folder.OPEN),i.replaceIcoClass(a,n,e.folder.OPEN),d==!1||b.view.expandSpeed==""?(c.show(),j.apply(f,[])):a[l]&&a[l].length>0?c.slideDown(b.view.expandSpeed,f):(c.show(),j.apply(f,[]))):(i.replaceSwitchClass(a,g,e.folder.CLOSE),i.replaceIcoClass(a,n,e.folder.CLOSE),d==!1||b.view.expandSpeed==""||!(a[l]&&a[l].length>0)?(c.hide(),j.apply(f,[])):c.slideUp(b.view.expandSpeed,f))):j.apply(f,[])}}else j.apply(f,[])},expandCollapseParentNode:function(b,a,c,d,f){a&&(a.parentTId?(i.expandCollapseNode(b,
+a,c,d),a.parentTId&&i.expandCollapseParentNode(b,a.getParentNode(),c,d,f)):i.expandCollapseNode(b,a,c,d,f))},expandCollapseSonNode:function(b,a,c,d,f){var g=h.getRoot(b),e=b.data.key.children,g=a?a[e]:g[e],e=a?!1:d,j=h.getRoot(b).expandTriggerFlag;h.getRoot(b).expandTriggerFlag=!1;if(g)for(var k=0,m=g.length;k<m;k++)g[k]&&i.expandCollapseSonNode(b,g[k],c,e);h.getRoot(b).expandTriggerFlag=j;i.expandCollapseNode(b,a,c,d,f)},makeDOMNodeIcon:function(b,a,c){var d=h.getNodeName(a,c),d=a.view.nameIsHTML?
+d:d.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");b.push("<span id='",c.tId,e.id.ICON,"' title='' treeNode",e.id.ICON," class='",i.makeNodeIcoClass(a,c),"' style='",i.makeNodeIcoStyle(a,c),"'></span><span id='",c.tId,e.id.SPAN,"'>",d,"</span>")},makeDOMNodeLine:function(b,a,c){b.push("<span id='",c.tId,e.id.SWITCH,"' title='' class='",i.makeNodeLineClass(a,c),"' treeNode",e.id.SWITCH,"></span>")},makeDOMNodeMainAfter:function(b){b.push("</li>")},makeDOMNodeMainBefore:function(b,
+a,c){b.push("<li id='",c.tId,"' class='",e.className.LEVEL,c.level,"' tabindex='0' hidefocus='true' treenode>")},makeDOMNodeNameAfter:function(b){b.push("</a>")},makeDOMNodeNameBefore:function(b,a,c){var d=h.getNodeTitle(a,c),f=i.makeNodeUrl(a,c),g=i.makeNodeFontCss(a,c),l=[],k;for(k in g)l.push(k,":",g[k],";");b.push("<a id='",c.tId,e.id.A,"' class='",e.className.LEVEL,c.level,"' treeNode",e.id.A,' onclick="',c.click||"",'" ',f!=null&&f.length>0?"href='"+f+"'":""," target='",i.makeNodeTarget(c),
+"' style='",l.join(""),"'");j.apply(a.view.showTitle,[a.treeId,c],a.view.showTitle)&&d&&b.push("title='",d.replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),"'");b.push(">")},makeNodeFontCss:function(b,a){var c=j.apply(b.view.fontCss,[b.treeId,a],b.view.fontCss);return c&&typeof c!="function"?c:{}},makeNodeIcoClass:function(b,a){var c=["ico"];a.isAjaxing||(c[0]=(a.iconSkin?a.iconSkin+"_":"")+c[0],a.isParent?c.push(a.open?e.folder.OPEN:e.folder.CLOSE):c.push(e.folder.DOCU));return e.className.BUTTON+
+" "+c.join("_")},makeNodeIcoStyle:function(b,a){var c=[];if(!a.isAjaxing){var d=a.isParent&&a.iconOpen&&a.iconClose?a.open?a.iconOpen:a.iconClose:a.icon;d&&c.push("background:url(",d,") 0 0 no-repeat;");(b.view.showIcon==!1||!j.apply(b.view.showIcon,[b.treeId,a],!0))&&c.push("width:0px;height:0px;")}return c.join("")},makeNodeLineClass:function(b,a){var c=[];b.view.showLine?a.level==0&&a.isFirstNode&&a.isLastNode?c.push(e.line.ROOT):a.level==0&&a.isFirstNode?c.push(e.line.ROOTS):a.isLastNode?c.push(e.line.BOTTOM):
+c.push(e.line.CENTER):c.push(e.line.NOLINE);a.isParent?c.push(a.open?e.folder.OPEN:e.folder.CLOSE):c.push(e.folder.DOCU);return i.makeNodeLineClassEx(a)+c.join("_")},makeNodeLineClassEx:function(b){return e.className.BUTTON+" "+e.className.LEVEL+b.level+" "+e.className.SWITCH+" "},makeNodeTarget:function(b){return b.target||"_blank"},makeNodeUrl:function(b,a){var c=b.data.key.url;return a[c]?a[c]:null},makeUlHtml:function(b,a,c,d){c.push("<ul id='",a.tId,e.id.UL,"' class='",e.className.LEVEL,a.level,
+" ",i.makeUlLineClass(b,a),"' style='display:",a.open?"block":"none","'>");c.push(d);c.push("</ul>")},makeUlLineClass:function(b,a){return b.view.showLine&&!a.isLastNode?e.line.LINE:""},removeChildNodes:function(b,a){if(a){var c=b.data.key.children,d=a[c];if(d){for(var f=0,g=d.length;f<g;f++)h.removeNodeCache(b,d[f]);h.removeSelectedNode(b);delete a[c];b.data.keep.parent?k(a,e.id.UL,b).empty():(a.isParent=!1,a.open=!1,c=k(a,e.id.SWITCH,b),d=k(a,e.id.ICON,b),i.replaceSwitchClass(a,c,e.folder.DOCU),
+i.replaceIcoClass(a,d,e.folder.DOCU),k(a,e.id.UL,b).remove())}}},setFirstNode:function(b,a){var c=b.data.key.children;if(a[c].length>0)a[c][0].isFirstNode=!0},setLastNode:function(b,a){var c=b.data.key.children,d=a[c].length;if(d>0)a[c][d-1].isLastNode=!0},removeNode:function(b,a){var c=h.getRoot(b),d=b.data.key.children,f=a.parentTId?a.getParentNode():c;a.isFirstNode=!1;a.isLastNode=!1;a.getPreNode=function(){return null};a.getNextNode=function(){return null};if(h.getNodeCache(b,a.tId)){k(a,b).remove();
+h.removeNodeCache(b,a);h.removeSelectedNode(b,a);for(var g=0,l=f[d].length;g<l;g++)if(f[d][g].tId==a.tId){f[d].splice(g,1);break}i.setFirstNode(b,f);i.setLastNode(b,f);var j,g=f[d].length;if(!b.data.keep.parent&&g==0)f.isParent=!1,f.open=!1,g=k(f,e.id.UL,b),l=k(f,e.id.SWITCH,b),j=k(f,e.id.ICON,b),i.replaceSwitchClass(f,l,e.folder.DOCU),i.replaceIcoClass(f,j,e.folder.DOCU),g.css("display","none");else if(b.view.showLine&&g>0){var n=f[d][g-1],g=k(n,e.id.UL,b),l=k(n,e.id.SWITCH,b);j=k(n,e.id.ICON,b);
+f==c?f[d].length==1?i.replaceSwitchClass(n,l,e.line.ROOT):(c=k(f[d][0],e.id.SWITCH,b),i.replaceSwitchClass(f[d][0],c,e.line.ROOTS),i.replaceSwitchClass(n,l,e.line.BOTTOM)):i.replaceSwitchClass(n,l,e.line.BOTTOM);g.removeClass(e.line.LINE)}}},replaceIcoClass:function(b,a,c){if(a&&!b.isAjaxing&&(b=a.attr("class"),b!=void 0)){b=b.split("_");switch(c){case e.folder.OPEN:case e.folder.CLOSE:case e.folder.DOCU:b[b.length-1]=c}a.attr("class",b.join("_"))}},replaceSwitchClass:function(b,a,c){if(a){var d=
+a.attr("class");if(d!=void 0){d=d.split("_");switch(c){case e.line.ROOT:case e.line.ROOTS:case e.line.CENTER:case e.line.BOTTOM:case e.line.NOLINE:d[0]=i.makeNodeLineClassEx(b)+c;break;case e.folder.OPEN:case e.folder.CLOSE:case e.folder.DOCU:d[1]=c}a.attr("class",d.join("_"));c!==e.folder.DOCU?a.removeAttr("disabled"):a.attr("disabled","disabled")}}},selectNode:function(b,a,c){c||i.cancelPreSelectedNode(b);k(a,e.id.A,b).addClass(e.node.CURSELECTED);h.addSelectedNode(b,a)},setNodeFontCss:function(b,
+a){var c=k(a,e.id.A,b),d=i.makeNodeFontCss(b,a);d&&c.css(d)},setNodeLineIcos:function(b,a){if(a){var c=k(a,e.id.SWITCH,b),d=k(a,e.id.UL,b),f=k(a,e.id.ICON,b),g=i.makeUlLineClass(b,a);g.length==0?d.removeClass(e.line.LINE):d.addClass(g);c.attr("class",i.makeNodeLineClass(b,a));a.isParent?c.removeAttr("disabled"):c.attr("disabled","disabled");f.removeAttr("style");f.attr("style",i.makeNodeIcoStyle(b,a));f.attr("class",i.makeNodeIcoClass(b,a))}},setNodeName:function(b,a){var c=h.getNodeTitle(b,a),d=
+k(a,e.id.SPAN,b);d.empty();b.view.nameIsHTML?d.html(h.getNodeName(b,a)):d.text(h.getNodeName(b,a));j.apply(b.view.showTitle,[b.treeId,a],b.view.showTitle)&&k(a,e.id.A,b).attr("title",!c?"":c)},setNodeTarget:function(b,a){k(a,e.id.A,b).attr("target",i.makeNodeTarget(a))},setNodeUrl:function(b,a){var c=k(a,e.id.A,b),d=i.makeNodeUrl(b,a);d==null||d.length==0?c.removeAttr("href"):c.attr("href",d)},switchNode:function(b,a){a.open||!j.canAsync(b,a)?i.expandCollapseNode(b,a,!a.open):b.async.enable?i.asyncNode(b,
+a)||i.expandCollapseNode(b,a,!a.open):a&&i.expandCollapseNode(b,a,!a.open)}};p.fn.zTree={consts:{className:{BUTTON:"button",LEVEL:"level",ICO_LOADING:"ico_loading",SWITCH:"switch"},event:{NODECREATED:"ztree_nodeCreated",CLICK:"ztree_click",EXPAND:"ztree_expand",COLLAPSE:"ztree_collapse",ASYNC_SUCCESS:"ztree_async_success",ASYNC_ERROR:"ztree_async_error",REMOVE:"ztree_remove"},id:{A:"_a",ICON:"_ico",SPAN:"_span",SWITCH:"_switch",UL:"_ul"},line:{ROOT:"root",ROOTS:"roots",CENTER:"center",BOTTOM:"bottom",
+NOLINE:"noline",LINE:"line"},folder:{OPEN:"open",CLOSE:"close",DOCU:"docu"},node:{CURSELECTED:"curSelectedNode"}},_z:{tools:j,view:i,event:m,data:h},getZTreeObj:function(b){return(b=h.getZTreeTools(b))?b:null},destroy:function(b){if(b&&b.length>0)i.destroy(h.getSetting(b));else for(var a in r)i.destroy(r[a])},init:function(b,a,c){var d=j.clone(M);p.extend(!0,d,a);d.treeId=b.attr("id");d.treeObj=b;d.treeObj.empty();r[d.treeId]=d;if(typeof document.body.style.maxHeight==="undefined")d.view.expandSpeed=
+"";h.initRoot(d);b=h.getRoot(d);a=d.data.key.children;c=c?j.clone(j.isArray(c)?c:[c]):[];b[a]=d.data.simpleData.enable?h.transformTozTreeFormat(d,c):c;h.initCache(d);m.unbindTree(d);m.bindTree(d);m.unbindEvent(d);m.bindEvent(d);c={setting:d,addNodes:function(a,b,c){function e(){i.addNodes(d,a,h,c==!0)}if(!b)return null;a||(a=null);if(a&&!a.isParent&&d.data.keep.leaf)return null;var h=j.clone(j.isArray(b)?b:[b]);j.canAsync(d,a)?i.asyncNode(d,a,c,e):e();return h},cancelSelectedNode:function(a){i.cancelPreSelectedNode(d,
+a)},destroy:function(){i.destroy(d)},expandAll:function(a){a=!!a;i.expandCollapseSonNode(d,null,a,!0);return a},expandNode:function(a,b,c,e,n){if(!a||!a.isParent)return null;b!==!0&&b!==!1&&(b=!a.open);if((n=!!n)&&b&&j.apply(d.callback.beforeExpand,[d.treeId,a],!0)==!1)return null;else if(n&&!b&&j.apply(d.callback.beforeCollapse,[d.treeId,a],!0)==!1)return null;b&&a.parentTId&&i.expandCollapseParentNode(d,a.getParentNode(),b,!1);if(b===a.open&&!c)return null;h.getRoot(d).expandTriggerFlag=n;if(!j.canAsync(d,
+a)&&c)i.expandCollapseSonNode(d,a,b,!0,function(){if(e!==!1)try{k(a,d).focus().blur()}catch(b){}});else if(a.open=!b,i.switchNode(this.setting,a),e!==!1)try{k(a,d).focus().blur()}catch(m){}return b},getNodes:function(){return h.getNodes(d)},getNodeByParam:function(a,b,c){return!a?null:h.getNodeByParam(d,c?c[d.data.key.children]:h.getNodes(d),a,b)},getNodeByTId:function(a){return h.getNodeCache(d,a)},getNodesByParam:function(a,b,c){return!a?null:h.getNodesByParam(d,c?c[d.data.key.children]:h.getNodes(d),
+a,b)},getNodesByParamFuzzy:function(a,b,c){return!a?null:h.getNodesByParamFuzzy(d,c?c[d.data.key.children]:h.getNodes(d),a,b)},getNodesByFilter:function(a,b,c,e){b=!!b;return!a||typeof a!="function"?b?null:[]:h.getNodesByFilter(d,c?c[d.data.key.children]:h.getNodes(d),a,b,e)},getNodeIndex:function(a){if(!a)return null;for(var b=d.data.key.children,c=a.parentTId?a.getParentNode():h.getRoot(d),e=0,i=c[b].length;e<i;e++)if(c[b][e]==a)return e;return-1},getSelectedNodes:function(){for(var a=[],b=h.getRoot(d).curSelectedList,
+c=0,e=b.length;c<e;c++)a.push(b[c]);return a},isSelectedNode:function(a){return h.isSelectedNode(d,a)},reAsyncChildNodes:function(a,b,c){if(this.setting.async.enable){var j=!a;j&&(a=h.getRoot(d));if(b=="refresh"){for(var b=this.setting.data.key.children,m=0,p=a[b]?a[b].length:0;m<p;m++)h.removeNodeCache(d,a[b][m]);h.removeSelectedNode(d);a[b]=[];j?this.setting.treeObj.empty():k(a,e.id.UL,d).empty()}i.asyncNode(this.setting,j?null:a,!!c)}},refresh:function(){this.setting.treeObj.empty();var a=h.getRoot(d),
+b=a[d.data.key.children];h.initRoot(d);a[d.data.key.children]=b;h.initCache(d);i.createNodes(d,0,a[d.data.key.children])},removeChildNodes:function(a){if(!a)return null;var b=a[d.data.key.children];i.removeChildNodes(d,a);return b?b:null},removeNode:function(a,b){a&&(b=!!b,b&&j.apply(d.callback.beforeRemove,[d.treeId,a],!0)==!1||(i.removeNode(d,a),b&&this.setting.treeObj.trigger(e.event.REMOVE,[d.treeId,a])))},selectNode:function(a,b){if(a&&j.uCanDo(d)){b=d.view.selectedMulti&&b;if(a.parentTId)i.expandCollapseParentNode(d,
+a.getParentNode(),!0,!1,function(){try{k(a,d).focus().blur()}catch(b){}});else try{k(a,d).focus().blur()}catch(c){}i.selectNode(d,a,b)}},transformTozTreeNodes:function(a){return h.transformTozTreeFormat(d,a)},transformToArray:function(a){return h.transformToArrayFormat(d,a)},updateNode:function(a){a&&k(a,d).get(0)&&j.uCanDo(d)&&(i.setNodeName(d,a),i.setNodeTarget(d,a),i.setNodeUrl(d,a),i.setNodeLineIcos(d,a),i.setNodeFontCss(d,a))}};b.treeTools=c;h.setZTreeTools(d,c);b[a]&&b[a].length>0?i.createNodes(d,
+0,b[a]):d.async.enable&&d.async.url&&d.async.url!==""&&i.asyncNode(d);return c}};var N=p.fn.zTree,k=j.$,e=N.consts})(jQuery);
diff --git a/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.excheck.js b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.excheck.js
new file mode 100644
index 0000000..1374c52
--- /dev/null
+++ b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.excheck.js
@@ -0,0 +1,629 @@
+/*
+ * JQuery zTree excheck v3.5.16
+ * http://zTree.me/
+ *
+ * Copyright (c) 2010 Hunter.z
+ *
+ * Licensed same as jquery - MIT License
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * email: hunter.z@263.net
+ * Date: 2014-03-09
+ */
+(function($){
+ //default consts of excheck
+ var _consts = {
+ event: {
+ CHECK: "ztree_check"
+ },
+ id: {
+ CHECK: "_check"
+ },
+ checkbox: {
+ STYLE: "checkbox",
+ DEFAULT: "chk",
+ DISABLED: "disable",
+ FALSE: "false",
+ TRUE: "true",
+ FULL: "full",
+ PART: "part",
+ FOCUS: "focus"
+ },
+ radio: {
+ STYLE: "radio",
+ TYPE_ALL: "all",
+ TYPE_LEVEL: "level"
+ }
+ },
+ //default setting of excheck
+ _setting = {
+ check: {
+ enable: false,
+ autoCheckTrigger: false,
+ chkStyle: _consts.checkbox.STYLE,
+ nocheckInherit: false,
+ chkDisabledInherit: false,
+ radioType: _consts.radio.TYPE_LEVEL,
+ chkboxType: {
+ "Y": "ps",
+ "N": "ps"
+ }
+ },
+ data: {
+ key: {
+ checked: "checked"
+ }
+ },
+ callback: {
+ beforeCheck:null,
+ onCheck:null
+ }
+ },
+ //default root of excheck
+ _initRoot = function (setting) {
+ var r = data.getRoot(setting);
+ r.radioCheckedList = [];
+ },
+ //default cache of excheck
+ _initCache = function(treeId) {},
+ //default bind event of excheck
+ _bindEvent = function(setting) {
+ var o = setting.treeObj,
+ c = consts.event;
+ o.bind(c.CHECK, function (event, srcEvent, treeId, node) {
+ event.srcEvent = srcEvent;
+ tools.apply(setting.callback.onCheck, [event, treeId, node]);
+ });
+ },
+ _unbindEvent = function(setting) {
+ var o = setting.treeObj,
+ c = consts.event;
+ o.unbind(c.CHECK);
+ },
+ //default event proxy of excheck
+ _eventProxy = function(e) {
+ var target = e.target,
+ setting = data.getSetting(e.data.treeId),
+ tId = "", node = null,
+ nodeEventType = "", treeEventType = "",
+ nodeEventCallback = null, treeEventCallback = null;
+
+ if (tools.eqs(e.type, "mouseover")) {
+ if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) {
+ tId = tools.getNodeMainDom(target).id;
+ nodeEventType = "mouseoverCheck";
+ }
+ } else if (tools.eqs(e.type, "mouseout")) {
+ if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) {
+ tId = tools.getNodeMainDom(target).id;
+ nodeEventType = "mouseoutCheck";
+ }
+ } else if (tools.eqs(e.type, "click")) {
+ if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) {
+ tId = tools.getNodeMainDom(target).id;
+ nodeEventType = "checkNode";
+ }
+ }
+ if (tId.length>0) {
+ node = data.getNodeCache(setting, tId);
+ switch (nodeEventType) {
+ case "checkNode" :
+ nodeEventCallback = _handler.onCheckNode;
+ break;
+ case "mouseoverCheck" :
+ nodeEventCallback = _handler.onMouseoverCheck;
+ break;
+ case "mouseoutCheck" :
+ nodeEventCallback = _handler.onMouseoutCheck;
+ break;
+ }
+ }
+ var proxyResult = {
+ stop: nodeEventType === "checkNode",
+ node: node,
+ nodeEventType: nodeEventType,
+ nodeEventCallback: nodeEventCallback,
+ treeEventType: treeEventType,
+ treeEventCallback: treeEventCallback
+ };
+ return proxyResult
+ },
+ //default init node of excheck
+ _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {
+ if (!n) return;
+ var checkedKey = setting.data.key.checked;
+ if (typeof n[checkedKey] == "string") n[checkedKey] = tools.eqs(n[checkedKey], "true");
+ n[checkedKey] = !!n[checkedKey];
+ n.checkedOld = n[checkedKey];
+ if (typeof n.nocheck == "string") n.nocheck = tools.eqs(n.nocheck, "true");
+ n.nocheck = !!n.nocheck || (setting.check.nocheckInherit && parentNode && !!parentNode.nocheck);
+ if (typeof n.chkDisabled == "string") n.chkDisabled = tools.eqs(n.chkDisabled, "true");
+ n.chkDisabled = !!n.chkDisabled || (setting.check.chkDisabledInherit && parentNode && !!parentNode.chkDisabled);
+ if (typeof n.halfCheck == "string") n.halfCheck = tools.eqs(n.halfCheck, "true");
+ n.halfCheck = !!n.halfCheck;
+ n.check_Child_State = -1;
+ n.check_Focus = false;
+ n.getCheckStatus = function() {return data.getCheckStatus(setting, n);};
+
+ if (setting.check.chkStyle == consts.radio.STYLE && setting.check.radioType == consts.radio.TYPE_ALL && n[checkedKey] ) {
+ var r = data.getRoot(setting);
+ r.radioCheckedList.push(n);
+ }
+ },
+ //add dom for check
+ _beforeA = function(setting, node, html) {
+ var checkedKey = setting.data.key.checked;
+ if (setting.check.enable) {
+ data.makeChkFlag(setting, node);
+ html.push("<span ID='", node.tId, consts.id.CHECK, "' class='", view.makeChkClass(setting, node), "' treeNode", consts.id.CHECK, (node.nocheck === true?" style='display:none;'":""),"></span>");
+ }
+ },
+ //update zTreeObj, add method of check
+ _zTreeTools = function(setting, zTreeTools) {
+ zTreeTools.checkNode = function(node, checked, checkTypeFlag, callbackFlag) {
+ var checkedKey = this.setting.data.key.checked;
+ if (node.chkDisabled === true) return;
+ if (checked !== true && checked !== false) {
+ checked = !node[checkedKey];
+ }
+ callbackFlag = !!callbackFlag;
+
+ if (node[checkedKey] === checked && !checkTypeFlag) {
+ return;
+ } else if (callbackFlag && tools.apply(this.setting.callback.beforeCheck, [this.setting.treeId, node], true) == false) {
+ return;
+ }
+ if (tools.uCanDo(this.setting) && this.setting.check.enable && node.nocheck !== true) {
+ node[checkedKey] = checked;
+ var checkObj = $$(node, consts.id.CHECK, this.setting);
+ if (checkTypeFlag || this.setting.check.chkStyle === consts.radio.STYLE) view.checkNodeRelation(this.setting, node);
+ view.setChkClass(this.setting, checkObj, node);
+ view.repairParentChkClassWithSelf(this.setting, node);
+ if (callbackFlag) {
+ this.setting.treeObj.trigger(consts.event.CHECK, [null, this.setting.treeId, node]);
+ }
+ }
+ }
+
+ zTreeTools.checkAllNodes = function(checked) {
+ view.repairAllChk(this.setting, !!checked);
+ }
+
+ zTreeTools.getCheckedNodes = function(checked) {
+ var childKey = this.setting.data.key.children;
+ checked = (checked !== false);
+ return data.getTreeCheckedNodes(this.setting, data.getRoot(this.setting)[childKey], checked);
+ }
+
+ zTreeTools.getChangeCheckedNodes = function() {
+ var childKey = this.setting.data.key.children;
+ return data.getTreeChangeCheckedNodes(this.setting, data.getRoot(this.setting)[childKey]);
+ }
+
+ zTreeTools.setChkDisabled = function(node, disabled, inheritParent, inheritChildren) {
+ disabled = !!disabled;
+ inheritParent = !!inheritParent;
+ inheritChildren = !!inheritChildren;
+ view.repairSonChkDisabled(this.setting, node, disabled, inheritChildren);
+ view.repairParentChkDisabled(this.setting, node.getParentNode(), disabled, inheritParent);
+ }
+
+ var _updateNode = zTreeTools.updateNode;
+ zTreeTools.updateNode = function(node, checkTypeFlag) {
+ if (_updateNode) _updateNode.apply(zTreeTools, arguments);
+ if (!node || !this.setting.check.enable) return;
+ var nObj = $$(node, this.setting);
+ if (nObj.get(0) && tools.uCanDo(this.setting)) {
+ var checkObj = $$(node, consts.id.CHECK, this.setting);
+ if (checkTypeFlag == true || this.setting.check.chkStyle === consts.radio.STYLE) view.checkNodeRelation(this.setting, node);
+ view.setChkClass(this.setting, checkObj, node);
+ view.repairParentChkClassWithSelf(this.setting, node);
+ }
+ }
+ },
+ //method of operate data
+ _data = {
+ getRadioCheckedList: function(setting) {
+ var checkedList = data.getRoot(setting).radioCheckedList;
+ for (var i=0, j=checkedList.length; i<j; i++) {
+ if(!data.getNodeCache(setting, checkedList[i].tId)) {
+ checkedList.splice(i, 1);
+ i--; j--;
+ }
+ }
+ return checkedList;
+ },
+ getCheckStatus: function(setting, node) {
+ if (!setting.check.enable || node.nocheck || node.chkDisabled) return null;
+ var checkedKey = setting.data.key.checked,
+ r = {
+ checked: node[checkedKey],
+ half: node.halfCheck ? node.halfCheck : (setting.check.chkStyle == consts.radio.STYLE ? (node.check_Child_State === 2) : (node[checkedKey] ? (node.check_Child_State > -1 && node.check_Child_State < 2) : (node.check_Child_State > 0)))
+ };
+ return r;
+ },
+ getTreeCheckedNodes: function(setting, nodes, checked, results) {
+ if (!nodes) return [];
+ var childKey = setting.data.key.children,
+ checkedKey = setting.data.key.checked,
+ onlyOne = (checked && setting.check.chkStyle == consts.radio.STYLE && setting.check.radioType == consts.radio.TYPE_ALL);
+ results = !results ? [] : results;
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ if (nodes[i].nocheck !== true && nodes[i].chkDisabled !== true && nodes[i][checkedKey] == checked) {
+ results.push(nodes[i]);
+ if(onlyOne) {
+ break;
+ }
+ }
+ data.getTreeCheckedNodes(setting, nodes[i][childKey], checked, results);
+ if(onlyOne && results.length > 0) {
+ break;
+ }
+ }
+ return results;
+ },
+ getTreeChangeCheckedNodes: function(setting, nodes, results) {
+ if (!nodes) return [];
+ var childKey = setting.data.key.children,
+ checkedKey = setting.data.key.checked;
+ results = !results ? [] : results;
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ if (nodes[i].nocheck !== true && nodes[i].chkDisabled !== true && nodes[i][checkedKey] != nodes[i].checkedOld) {
+ results.push(nodes[i]);
+ }
+ data.getTreeChangeCheckedNodes(setting, nodes[i][childKey], results);
+ }
+ return results;
+ },
+ makeChkFlag: function(setting, node) {
+ if (!node) return;
+ var childKey = setting.data.key.children,
+ checkedKey = setting.data.key.checked,
+ chkFlag = -1;
+ if (node[childKey]) {
+ for (var i = 0, l = node[childKey].length; i < l; i++) {
+ var cNode = node[childKey][i];
+ var tmp = -1;
+ if (setting.check.chkStyle == consts.radio.STYLE) {
+ if (cNode.nocheck === true || cNode.chkDisabled === true) {
+ tmp = cNode.check_Child_State;
+ } else if (cNode.halfCheck === true) {
+ tmp = 2;
+ } else if (cNode[checkedKey]) {
+ tmp = 2;
+ } else {
+ tmp = cNode.check_Child_State > 0 ? 2:0;
+ }
+ if (tmp == 2) {
+ chkFlag = 2; break;
+ } else if (tmp == 0){
+ chkFlag = 0;
+ }
+ } else if (setting.check.chkStyle == consts.checkbox.STYLE) {
+ if (cNode.nocheck === true || cNode.chkDisabled === true) {
+ tmp = cNode.check_Child_State;
+ } else if (cNode.halfCheck === true) {
+ tmp = 1;
+ } else if (cNode[checkedKey] ) {
+ tmp = (cNode.check_Child_State === -1 || cNode.check_Child_State === 2) ? 2 : 1;
+ } else {
+ tmp = (cNode.check_Child_State > 0) ? 1 : 0;
+ }
+ if (tmp === 1) {
+ chkFlag = 1; break;
+ } else if (tmp === 2 && chkFlag > -1 && i > 0 && tmp !== chkFlag) {
+ chkFlag = 1; break;
+ } else if (chkFlag === 2 && tmp > -1 && tmp < 2) {
+ chkFlag = 1; break;
+ } else if (tmp > -1) {
+ chkFlag = tmp;
+ }
+ }
+ }
+ }
+ node.check_Child_State = chkFlag;
+ }
+ },
+ //method of event proxy
+ _event = {
+
+ },
+ //method of event handler
+ _handler = {
+ onCheckNode: function (event, node) {
+ if (node.chkDisabled === true) return false;
+ var setting = data.getSetting(event.data.treeId),
+ checkedKey = setting.data.key.checked;
+ if (tools.apply(setting.callback.beforeCheck, [setting.treeId, node], true) == false) return true;
+ node[checkedKey] = !node[checkedKey];
+ view.checkNodeRelation(setting, node);
+ var checkObj = $$(node, consts.id.CHECK, setting);
+ view.setChkClass(setting, checkObj, node);
+ view.repairParentChkClassWithSelf(setting, node);
+ setting.treeObj.trigger(consts.event.CHECK, [event, setting.treeId, node]);
+ return true;
+ },
+ onMouseoverCheck: function(event, node) {
+ if (node.chkDisabled === true) return false;
+ var setting = data.getSetting(event.data.treeId),
+ checkObj = $$(node, consts.id.CHECK, setting);
+ node.check_Focus = true;
+ view.setChkClass(setting, checkObj, node);
+ return true;
+ },
+ onMouseoutCheck: function(event, node) {
+ if (node.chkDisabled === true) return false;
+ var setting = data.getSetting(event.data.treeId),
+ checkObj = $$(node, consts.id.CHECK, setting);
+ node.check_Focus = false;
+ view.setChkClass(setting, checkObj, node);
+ return true;
+ }
+ },
+ //method of tools for zTree
+ _tools = {
+
+ },
+ //method of operate ztree dom
+ _view = {
+ checkNodeRelation: function(setting, node) {
+ var pNode, i, l,
+ childKey = setting.data.key.children,
+ checkedKey = setting.data.key.checked,
+ r = consts.radio;
+ if (setting.check.chkStyle == r.STYLE) {
+ var checkedList = data.getRadioCheckedList(setting);
+ if (node[checkedKey]) {
+ if (setting.check.radioType == r.TYPE_ALL) {
+ for (i = checkedList.length-1; i >= 0; i--) {
+ pNode = checkedList[i];
+ if (pNode[checkedKey] && pNode != node) {
+ pNode[checkedKey] = false;
+ checkedList.splice(i, 1);
+
+ view.setChkClass(setting, $$(pNode, consts.id.CHECK, setting), pNode);
+ if (pNode.parentTId != node.parentTId) {
+ view.repairParentChkClassWithSelf(setting, pNode);
+ }
+ }
+ }
+ checkedList.push(node);
+ } else {
+ var parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting);
+ for (i = 0, l = parentNode[childKey].length; i < l; i++) {
+ pNode = parentNode[childKey][i];
+ if (pNode[checkedKey] && pNode != node) {
+ pNode[checkedKey] = false;
+ view.setChkClass(setting, $$(pNode, consts.id.CHECK, setting), pNode);
+ }
+ }
+ }
+ } else if (setting.check.radioType == r.TYPE_ALL) {
+ for (i = 0, l = checkedList.length; i < l; i++) {
+ if (node == checkedList[i]) {
+ checkedList.splice(i, 1);
+ break;
+ }
+ }
+ }
+
+ } else {
+ if (node[checkedKey] && (!node[childKey] || node[childKey].length==0 || setting.check.chkboxType.Y.indexOf("s") > -1)) {
+ view.setSonNodeCheckBox(setting, node, true);
+ }
+ if (!node[checkedKey] && (!node[childKey] || node[childKey].length==0 || setting.check.chkboxType.N.indexOf("s") > -1)) {
+ view.setSonNodeCheckBox(setting, node, false);
+ }
+ if (node[checkedKey] && setting.check.chkboxType.Y.indexOf("p") > -1) {
+ view.setParentNodeCheckBox(setting, node, true);
+ }
+ if (!node[checkedKey] && setting.check.chkboxType.N.indexOf("p") > -1) {
+ view.setParentNodeCheckBox(setting, node, false);
+ }
+ }
+ },
+ makeChkClass: function(setting, node) {
+ var checkedKey = setting.data.key.checked,
+ c = consts.checkbox, r = consts.radio,
+ fullStyle = "";
+ if (node.chkDisabled === true) {
+ fullStyle = c.DISABLED;
+ } else if (node.halfCheck) {
+ fullStyle = c.PART;
+ } else if (setting.check.chkStyle == r.STYLE) {
+ fullStyle = (node.check_Child_State < 1)? c.FULL:c.PART;
+ } else {
+ fullStyle = node[checkedKey] ? ((node.check_Child_State === 2 || node.check_Child_State === -1) ? c.FULL:c.PART) : ((node.check_Child_State < 1)? c.FULL:c.PART);
+ }
+ var chkName = setting.check.chkStyle + "_" + (node[checkedKey] ? c.TRUE : c.FALSE) + "_" + fullStyle;
+ chkName = (node.check_Focus && node.chkDisabled !== true) ? chkName + "_" + c.FOCUS : chkName;
+ return consts.className.BUTTON + " " + c.DEFAULT + " " + chkName;
+ },
+ repairAllChk: function(setting, checked) {
+ if (setting.check.enable && setting.check.chkStyle === consts.checkbox.STYLE) {
+ var checkedKey = setting.data.key.checked,
+ childKey = setting.data.key.children,
+ root = data.getRoot(setting);
+ for (var i = 0, l = root[childKey].length; i<l ; i++) {
+ var node = root[childKey][i];
+ if (node.nocheck !== true && node.chkDisabled !== true) {
+ node[checkedKey] = checked;
+ }
+ view.setSonNodeCheckBox(setting, node, checked);
+ }
+ }
+ },
+ repairChkClass: function(setting, node) {
+ if (!node) return;
+ data.makeChkFlag(setting, node);
+ if (node.nocheck !== true) {
+ var checkObj = $$(node, consts.id.CHECK, setting);
+ view.setChkClass(setting, checkObj, node);
+ }
+ },
+ repairParentChkClass: function(setting, node) {
+ if (!node || !node.parentTId) return;
+ var pNode = node.getParentNode();
+ view.repairChkClass(setting, pNode);
+ view.repairParentChkClass(setting, pNode);
+ },
+ repairParentChkClassWithSelf: function(setting, node) {
+ if (!node) return;
+ var childKey = setting.data.key.children;
+ if (node[childKey] && node[childKey].length > 0) {
+ view.repairParentChkClass(setting, node[childKey][0]);
+ } else {
+ view.repairParentChkClass(setting, node);
+ }
+ },
+ repairSonChkDisabled: function(setting, node, chkDisabled, inherit) {
+ if (!node) return;
+ var childKey = setting.data.key.children;
+ if (node.chkDisabled != chkDisabled) {
+ node.chkDisabled = chkDisabled;
+ }
+ view.repairChkClass(setting, node);
+ if (node[childKey] && inherit) {
+ for (var i = 0, l = node[childKey].length; i < l; i++) {
+ var sNode = node[childKey][i];
+ view.repairSonChkDisabled(setting, sNode, chkDisabled, inherit);
+ }
+ }
+ },
+ repairParentChkDisabled: function(setting, node, chkDisabled, inherit) {
+ if (!node) return;
+ if (node.chkDisabled != chkDisabled && inherit) {
+ node.chkDisabled = chkDisabled;
+ }
+ view.repairChkClass(setting, node);
+ view.repairParentChkDisabled(setting, node.getParentNode(), chkDisabled, inherit);
+ },
+ setChkClass: function(setting, obj, node) {
+ if (!obj) return;
+ if (node.nocheck === true) {
+ obj.hide();
+ } else {
+ obj.show();
+ }
+ obj.removeClass();
+ obj.addClass(view.makeChkClass(setting, node));
+ },
+ setParentNodeCheckBox: function(setting, node, value, srcNode) {
+ var childKey = setting.data.key.children,
+ checkedKey = setting.data.key.checked,
+ checkObj = $$(node, consts.id.CHECK, setting);
+ if (!srcNode) srcNode = node;
+ data.makeChkFlag(setting, node);
+ if (node.nocheck !== true && node.chkDisabled !== true) {
+ node[checkedKey] = value;
+ view.setChkClass(setting, checkObj, node);
+ if (setting.check.autoCheckTrigger && node != srcNode) {
+ setting.treeObj.trigger(consts.event.CHECK, [null, setting.treeId, node]);
+ }
+ }
+ if (node.parentTId) {
+ var pSign = true;
+ if (!value) {
+ var pNodes = node.getParentNode()[childKey];
+ for (var i = 0, l = pNodes.length; i < l; i++) {
+ if ((pNodes[i].nocheck !== true && pNodes[i].chkDisabled !== true && pNodes[i][checkedKey])
+ || ((pNodes[i].nocheck === true || pNodes[i].chkDisabled === true) && pNodes[i].check_Child_State > 0)) {
+ pSign = false;
+ break;
+ }
+ }
+ }
+ if (pSign) {
+ view.setParentNodeCheckBox(setting, node.getParentNode(), value, srcNode);
+ }
+ }
+ },
+ setSonNodeCheckBox: function(setting, node, value, srcNode) {
+ if (!node) return;
+ var childKey = setting.data.key.children,
+ checkedKey = setting.data.key.checked,
+ checkObj = $$(node, consts.id.CHECK, setting);
+ if (!srcNode) srcNode = node;
+
+ var hasDisable = false;
+ if (node[childKey]) {
+ for (var i = 0, l = node[childKey].length; i < l && node.chkDisabled !== true; i++) {
+ var sNode = node[childKey][i];
+ view.setSonNodeCheckBox(setting, sNode, value, srcNode);
+ if (sNode.chkDisabled === true) hasDisable = true;
+ }
+ }
+
+ if (node != data.getRoot(setting) && node.chkDisabled !== true) {
+ if (hasDisable && node.nocheck !== true) {
+ data.makeChkFlag(setting, node);
+ }
+ if (node.nocheck !== true && node.chkDisabled !== true) {
+ node[checkedKey] = value;
+ if (!hasDisable) node.check_Child_State = (node[childKey] && node[childKey].length > 0) ? (value ? 2 : 0) : -1;
+ } else {
+ node.check_Child_State = -1;
+ }
+ view.setChkClass(setting, checkObj, node);
+ if (setting.check.autoCheckTrigger && node != srcNode && node.nocheck !== true && node.chkDisabled !== true) {
+ setting.treeObj.trigger(consts.event.CHECK, [null, setting.treeId, node]);
+ }
+ }
+
+ }
+ },
+
+ _z = {
+ tools: _tools,
+ view: _view,
+ event: _event,
+ data: _data
+ };
+ $.extend(true, $.fn.zTree.consts, _consts);
+ $.extend(true, $.fn.zTree._z, _z);
+
+ var zt = $.fn.zTree,
+ tools = zt._z.tools,
+ consts = zt.consts,
+ view = zt._z.view,
+ data = zt._z.data,
+ event = zt._z.event,
+ $$ = tools.$;
+
+ data.exSetting(_setting);
+ data.addInitBind(_bindEvent);
+ data.addInitUnBind(_unbindEvent);
+ data.addInitCache(_initCache);
+ data.addInitNode(_initNode);
+ data.addInitProxy(_eventProxy, true);
+ data.addInitRoot(_initRoot);
+ data.addBeforeA(_beforeA);
+ data.addZTreeTools(_zTreeTools);
+
+ var _createNodes = view.createNodes;
+ view.createNodes = function(setting, level, nodes, parentNode) {
+ if (_createNodes) _createNodes.apply(view, arguments);
+ if (!nodes) return;
+ view.repairParentChkClassWithSelf(setting, parentNode);
+ }
+ var _removeNode = view.removeNode;
+ view.removeNode = function(setting, node) {
+ var parentNode = node.getParentNode();
+ if (_removeNode) _removeNode.apply(view, arguments);
+ if (!node || !parentNode) return;
+ view.repairChkClass(setting, parentNode);
+ view.repairParentChkClass(setting, parentNode);
+ }
+
+ var _appendNodes = view.appendNodes;
+ view.appendNodes = function(setting, level, nodes, parentNode, initFlag, openFlag) {
+ var html = "";
+ if (_appendNodes) {
+ html = _appendNodes.apply(view, arguments);
+ }
+ if (parentNode) {
+ data.makeChkFlag(setting, parentNode);
+ }
+ return html;
+ }
+})(jQuery); \ No newline at end of file
diff --git a/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.excheck.min.js b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.excheck.min.js
new file mode 100644
index 0000000..9c56f46
--- /dev/null
+++ b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.excheck.min.js
@@ -0,0 +1,34 @@
+/*
+ * JQuery zTree excheck v3.5.16
+ * http://zTree.me/
+ *
+ * Copyright (c) 2010 Hunter.z
+ *
+ * Licensed same as jquery - MIT License
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * email: hunter.z@263.net
+ * Date: 2014-03-09
+ */
+(function(m){var p,q,r,o={event:{CHECK:"ztree_check"},id:{CHECK:"_check"},checkbox:{STYLE:"checkbox",DEFAULT:"chk",DISABLED:"disable",FALSE:"false",TRUE:"true",FULL:"full",PART:"part",FOCUS:"focus"},radio:{STYLE:"radio",TYPE_ALL:"all",TYPE_LEVEL:"level"}},v={check:{enable:!1,autoCheckTrigger:!1,chkStyle:o.checkbox.STYLE,nocheckInherit:!1,chkDisabledInherit:!1,radioType:o.radio.TYPE_LEVEL,chkboxType:{Y:"ps",N:"ps"}},data:{key:{checked:"checked"}},callback:{beforeCheck:null,onCheck:null}};p=function(c,
+a){if(a.chkDisabled===!0)return!1;var b=f.getSetting(c.data.treeId),d=b.data.key.checked;if(k.apply(b.callback.beforeCheck,[b.treeId,a],!0)==!1)return!0;a[d]=!a[d];e.checkNodeRelation(b,a);d=n(a,j.id.CHECK,b);e.setChkClass(b,d,a);e.repairParentChkClassWithSelf(b,a);b.treeObj.trigger(j.event.CHECK,[c,b.treeId,a]);return!0};q=function(c,a){if(a.chkDisabled===!0)return!1;var b=f.getSetting(c.data.treeId),d=n(a,j.id.CHECK,b);a.check_Focus=!0;e.setChkClass(b,d,a);return!0};r=function(c,a){if(a.chkDisabled===
+!0)return!1;var b=f.getSetting(c.data.treeId),d=n(a,j.id.CHECK,b);a.check_Focus=!1;e.setChkClass(b,d,a);return!0};m.extend(!0,m.fn.zTree.consts,o);m.extend(!0,m.fn.zTree._z,{tools:{},view:{checkNodeRelation:function(c,a){var b,d,h,i=c.data.key.children,l=c.data.key.checked;b=j.radio;if(c.check.chkStyle==b.STYLE){var g=f.getRadioCheckedList(c);if(a[l])if(c.check.radioType==b.TYPE_ALL){for(d=g.length-1;d>=0;d--)b=g[d],b[l]&&b!=a&&(b[l]=!1,g.splice(d,1),e.setChkClass(c,n(b,j.id.CHECK,c),b),b.parentTId!=
+a.parentTId&&e.repairParentChkClassWithSelf(c,b));g.push(a)}else{g=a.parentTId?a.getParentNode():f.getRoot(c);for(d=0,h=g[i].length;d<h;d++)b=g[i][d],b[l]&&b!=a&&(b[l]=!1,e.setChkClass(c,n(b,j.id.CHECK,c),b))}else if(c.check.radioType==b.TYPE_ALL)for(d=0,h=g.length;d<h;d++)if(a==g[d]){g.splice(d,1);break}}else a[l]&&(!a[i]||a[i].length==0||c.check.chkboxType.Y.indexOf("s")>-1)&&e.setSonNodeCheckBox(c,a,!0),!a[l]&&(!a[i]||a[i].length==0||c.check.chkboxType.N.indexOf("s")>-1)&&e.setSonNodeCheckBox(c,
+a,!1),a[l]&&c.check.chkboxType.Y.indexOf("p")>-1&&e.setParentNodeCheckBox(c,a,!0),!a[l]&&c.check.chkboxType.N.indexOf("p")>-1&&e.setParentNodeCheckBox(c,a,!1)},makeChkClass:function(c,a){var b=c.data.key.checked,d=j.checkbox,h=j.radio,i="",i=a.chkDisabled===!0?d.DISABLED:a.halfCheck?d.PART:c.check.chkStyle==h.STYLE?a.check_Child_State<1?d.FULL:d.PART:a[b]?a.check_Child_State===2||a.check_Child_State===-1?d.FULL:d.PART:a.check_Child_State<1?d.FULL:d.PART,b=c.check.chkStyle+"_"+(a[b]?d.TRUE:d.FALSE)+
+"_"+i,b=a.check_Focus&&a.chkDisabled!==!0?b+"_"+d.FOCUS:b;return j.className.BUTTON+" "+d.DEFAULT+" "+b},repairAllChk:function(c,a){if(c.check.enable&&c.check.chkStyle===j.checkbox.STYLE)for(var b=c.data.key.checked,d=c.data.key.children,h=f.getRoot(c),i=0,l=h[d].length;i<l;i++){var g=h[d][i];g.nocheck!==!0&&g.chkDisabled!==!0&&(g[b]=a);e.setSonNodeCheckBox(c,g,a)}},repairChkClass:function(c,a){if(a&&(f.makeChkFlag(c,a),a.nocheck!==!0)){var b=n(a,j.id.CHECK,c);e.setChkClass(c,b,a)}},repairParentChkClass:function(c,
+a){if(a&&a.parentTId){var b=a.getParentNode();e.repairChkClass(c,b);e.repairParentChkClass(c,b)}},repairParentChkClassWithSelf:function(c,a){if(a){var b=c.data.key.children;a[b]&&a[b].length>0?e.repairParentChkClass(c,a[b][0]):e.repairParentChkClass(c,a)}},repairSonChkDisabled:function(c,a,b,d){if(a){var h=c.data.key.children;if(a.chkDisabled!=b)a.chkDisabled=b;e.repairChkClass(c,a);if(a[h]&&d)for(var i=0,l=a[h].length;i<l;i++)e.repairSonChkDisabled(c,a[h][i],b,d)}},repairParentChkDisabled:function(c,
+a,b,d){if(a){if(a.chkDisabled!=b&&d)a.chkDisabled=b;e.repairChkClass(c,a);e.repairParentChkDisabled(c,a.getParentNode(),b,d)}},setChkClass:function(c,a,b){a&&(b.nocheck===!0?a.hide():a.show(),a.removeClass(),a.addClass(e.makeChkClass(c,b)))},setParentNodeCheckBox:function(c,a,b,d){var h=c.data.key.children,i=c.data.key.checked,l=n(a,j.id.CHECK,c);d||(d=a);f.makeChkFlag(c,a);a.nocheck!==!0&&a.chkDisabled!==!0&&(a[i]=b,e.setChkClass(c,l,a),c.check.autoCheckTrigger&&a!=d&&c.treeObj.trigger(j.event.CHECK,
+[null,c.treeId,a]));if(a.parentTId){l=!0;if(!b)for(var h=a.getParentNode()[h],g=0,k=h.length;g<k;g++)if(h[g].nocheck!==!0&&h[g].chkDisabled!==!0&&h[g][i]||(h[g].nocheck===!0||h[g].chkDisabled===!0)&&h[g].check_Child_State>0){l=!1;break}l&&e.setParentNodeCheckBox(c,a.getParentNode(),b,d)}},setSonNodeCheckBox:function(c,a,b,d){if(a){var h=c.data.key.children,i=c.data.key.checked,l=n(a,j.id.CHECK,c);d||(d=a);var g=!1;if(a[h])for(var k=0,m=a[h].length;k<m&&a.chkDisabled!==!0;k++){var o=a[h][k];e.setSonNodeCheckBox(c,
+o,b,d);o.chkDisabled===!0&&(g=!0)}if(a!=f.getRoot(c)&&a.chkDisabled!==!0){g&&a.nocheck!==!0&&f.makeChkFlag(c,a);if(a.nocheck!==!0&&a.chkDisabled!==!0){if(a[i]=b,!g)a.check_Child_State=a[h]&&a[h].length>0?b?2:0:-1}else a.check_Child_State=-1;e.setChkClass(c,l,a);c.check.autoCheckTrigger&&a!=d&&a.nocheck!==!0&&a.chkDisabled!==!0&&c.treeObj.trigger(j.event.CHECK,[null,c.treeId,a])}}}},event:{},data:{getRadioCheckedList:function(c){for(var a=f.getRoot(c).radioCheckedList,b=0,d=a.length;b<d;b++)f.getNodeCache(c,
+a[b].tId)||(a.splice(b,1),b--,d--);return a},getCheckStatus:function(c,a){if(!c.check.enable||a.nocheck||a.chkDisabled)return null;var b=c.data.key.checked;return{checked:a[b],half:a.halfCheck?a.halfCheck:c.check.chkStyle==j.radio.STYLE?a.check_Child_State===2:a[b]?a.check_Child_State>-1&&a.check_Child_State<2:a.check_Child_State>0}},getTreeCheckedNodes:function(c,a,b,d){if(!a)return[];for(var h=c.data.key.children,i=c.data.key.checked,e=b&&c.check.chkStyle==j.radio.STYLE&&c.check.radioType==j.radio.TYPE_ALL,
+d=!d?[]:d,g=0,k=a.length;g<k;g++){if(a[g].nocheck!==!0&&a[g].chkDisabled!==!0&&a[g][i]==b&&(d.push(a[g]),e))break;f.getTreeCheckedNodes(c,a[g][h],b,d);if(e&&d.length>0)break}return d},getTreeChangeCheckedNodes:function(c,a,b){if(!a)return[];for(var d=c.data.key.children,h=c.data.key.checked,b=!b?[]:b,i=0,e=a.length;i<e;i++)a[i].nocheck!==!0&&a[i].chkDisabled!==!0&&a[i][h]!=a[i].checkedOld&&b.push(a[i]),f.getTreeChangeCheckedNodes(c,a[i][d],b);return b},makeChkFlag:function(c,a){if(a){var b=c.data.key.children,
+d=c.data.key.checked,h=-1;if(a[b])for(var i=0,e=a[b].length;i<e;i++){var g=a[b][i],f=-1;if(c.check.chkStyle==j.radio.STYLE)if(f=g.nocheck===!0||g.chkDisabled===!0?g.check_Child_State:g.halfCheck===!0?2:g[d]?2:g.check_Child_State>0?2:0,f==2){h=2;break}else f==0&&(h=0);else if(c.check.chkStyle==j.checkbox.STYLE)if(f=g.nocheck===!0||g.chkDisabled===!0?g.check_Child_State:g.halfCheck===!0?1:g[d]?g.check_Child_State===-1||g.check_Child_State===2?2:1:g.check_Child_State>0?1:0,f===1){h=1;break}else if(f===
+2&&h>-1&&i>0&&f!==h){h=1;break}else if(h===2&&f>-1&&f<2){h=1;break}else f>-1&&(h=f)}a.check_Child_State=h}}}});var m=m.fn.zTree,k=m._z.tools,j=m.consts,e=m._z.view,f=m._z.data,n=k.$;f.exSetting(v);f.addInitBind(function(c){c.treeObj.bind(j.event.CHECK,function(a,b,d,h){a.srcEvent=b;k.apply(c.callback.onCheck,[a,d,h])})});f.addInitUnBind(function(c){c.treeObj.unbind(j.event.CHECK)});f.addInitCache(function(){});f.addInitNode(function(c,a,b,d){if(b){a=c.data.key.checked;typeof b[a]=="string"&&(b[a]=
+k.eqs(b[a],"true"));b[a]=!!b[a];b.checkedOld=b[a];if(typeof b.nocheck=="string")b.nocheck=k.eqs(b.nocheck,"true");b.nocheck=!!b.nocheck||c.check.nocheckInherit&&d&&!!d.nocheck;if(typeof b.chkDisabled=="string")b.chkDisabled=k.eqs(b.chkDisabled,"true");b.chkDisabled=!!b.chkDisabled||c.check.chkDisabledInherit&&d&&!!d.chkDisabled;if(typeof b.halfCheck=="string")b.halfCheck=k.eqs(b.halfCheck,"true");b.halfCheck=!!b.halfCheck;b.check_Child_State=-1;b.check_Focus=!1;b.getCheckStatus=function(){return f.getCheckStatus(c,
+b)};c.check.chkStyle==j.radio.STYLE&&c.check.radioType==j.radio.TYPE_ALL&&b[a]&&f.getRoot(c).radioCheckedList.push(b)}});f.addInitProxy(function(c){var a=c.target,b=f.getSetting(c.data.treeId),d="",h=null,e="",l=null;if(k.eqs(c.type,"mouseover")){if(b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=k.getNodeMainDom(a).id,e="mouseoverCheck"}else if(k.eqs(c.type,"mouseout")){if(b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=
+k.getNodeMainDom(a).id,e="mouseoutCheck"}else if(k.eqs(c.type,"click")&&b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=k.getNodeMainDom(a).id,e="checkNode";if(d.length>0)switch(h=f.getNodeCache(b,d),e){case "checkNode":l=p;break;case "mouseoverCheck":l=q;break;case "mouseoutCheck":l=r}return{stop:e==="checkNode",node:h,nodeEventType:e,nodeEventCallback:l,treeEventType:"",treeEventCallback:null}},!0);f.addInitRoot(function(c){f.getRoot(c).radioCheckedList=[]});
+f.addBeforeA(function(c,a,b){c.check.enable&&(f.makeChkFlag(c,a),b.push("<span ID='",a.tId,j.id.CHECK,"' class='",e.makeChkClass(c,a),"' treeNode",j.id.CHECK,a.nocheck===!0?" style='display:none;'":"","></span>"))});f.addZTreeTools(function(c,a){a.checkNode=function(a,b,c,f){var g=this.setting.data.key.checked;if(a.chkDisabled!==!0&&(b!==!0&&b!==!1&&(b=!a[g]),f=!!f,(a[g]!==b||c)&&!(f&&k.apply(this.setting.callback.beforeCheck,[this.setting.treeId,a],!0)==!1)&&k.uCanDo(this.setting)&&this.setting.check.enable&&
+a.nocheck!==!0))a[g]=b,b=n(a,j.id.CHECK,this.setting),(c||this.setting.check.chkStyle===j.radio.STYLE)&&e.checkNodeRelation(this.setting,a),e.setChkClass(this.setting,b,a),e.repairParentChkClassWithSelf(this.setting,a),f&&this.setting.treeObj.trigger(j.event.CHECK,[null,this.setting.treeId,a])};a.checkAllNodes=function(a){e.repairAllChk(this.setting,!!a)};a.getCheckedNodes=function(a){var b=this.setting.data.key.children;return f.getTreeCheckedNodes(this.setting,f.getRoot(this.setting)[b],a!==!1)};
+a.getChangeCheckedNodes=function(){var a=this.setting.data.key.children;return f.getTreeChangeCheckedNodes(this.setting,f.getRoot(this.setting)[a])};a.setChkDisabled=function(a,b,c,f){b=!!b;c=!!c;e.repairSonChkDisabled(this.setting,a,b,!!f);e.repairParentChkDisabled(this.setting,a.getParentNode(),b,c)};var b=a.updateNode;a.updateNode=function(c,f){b&&b.apply(a,arguments);if(c&&this.setting.check.enable&&n(c,this.setting).get(0)&&k.uCanDo(this.setting)){var i=n(c,j.id.CHECK,this.setting);(f==!0||this.setting.check.chkStyle===
+j.radio.STYLE)&&e.checkNodeRelation(this.setting,c);e.setChkClass(this.setting,i,c);e.repairParentChkClassWithSelf(this.setting,c)}}});var s=e.createNodes;e.createNodes=function(c,a,b,d){s&&s.apply(e,arguments);b&&e.repairParentChkClassWithSelf(c,d)};var t=e.removeNode;e.removeNode=function(c,a){var b=a.getParentNode();t&&t.apply(e,arguments);a&&b&&(e.repairChkClass(c,b),e.repairParentChkClass(c,b))};var u=e.appendNodes;e.appendNodes=function(c,a,b,d,h,i){var j="";u&&(j=u.apply(e,arguments));d&&f.makeChkFlag(c,
+d);return j}})(jQuery);
diff --git a/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exedit.js b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exedit.js
new file mode 100644
index 0000000..70a2093
--- /dev/null
+++ b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exedit.js
@@ -0,0 +1,1191 @@
+/*
+ * JQuery zTree exedit v3.5.16
+ * http://zTree.me/
+ *
+ * Copyright (c) 2010 Hunter.z
+ *
+ * Licensed same as jquery - MIT License
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * email: hunter.z@263.net
+ * Date: 2014-03-09
+ */
+(function($){
+ //default consts of exedit
+ var _consts = {
+ event: {
+ DRAG: "ztree_drag",
+ DROP: "ztree_drop",
+ RENAME: "ztree_rename",
+ DRAGMOVE:"ztree_dragmove"
+ },
+ id: {
+ EDIT: "_edit",
+ INPUT: "_input",
+ REMOVE: "_remove"
+ },
+ move: {
+ TYPE_INNER: "inner",
+ TYPE_PREV: "prev",
+ TYPE_NEXT: "next"
+ },
+ node: {
+ CURSELECTED_EDIT: "curSelectedNode_Edit",
+ TMPTARGET_TREE: "tmpTargetzTree",
+ TMPTARGET_NODE: "tmpTargetNode"
+ }
+ },
+ //default setting of exedit
+ _setting = {
+ edit: {
+ enable: false,
+ editNameSelectAll: false,
+ showRemoveBtn: true,
+ showRenameBtn: true,
+ removeTitle: "remove",
+ renameTitle: "rename",
+ drag: {
+ autoExpandTrigger: false,
+ isCopy: true,
+ isMove: true,
+ prev: true,
+ next: true,
+ inner: true,
+ minMoveSize: 5,
+ borderMax: 10,
+ borderMin: -5,
+ maxShowNodeNum: 5,
+ autoOpenTime: 500
+ }
+ },
+ view: {
+ addHoverDom: null,
+ removeHoverDom: null
+ },
+ callback: {
+ beforeDrag:null,
+ beforeDragOpen:null,
+ beforeDrop:null,
+ beforeEditName:null,
+ beforeRename:null,
+ onDrag:null,
+ onDragMove:null,
+ onDrop:null,
+ onRename:null
+ }
+ },
+ //default root of exedit
+ _initRoot = function (setting) {
+ var r = data.getRoot(setting), rs = data.getRoots();
+ r.curEditNode = null;
+ r.curEditInput = null;
+ r.curHoverNode = null;
+ r.dragFlag = 0;
+ r.dragNodeShowBefore = [];
+ r.dragMaskList = new Array();
+ rs.showHoverDom = true;
+ },
+ //default cache of exedit
+ _initCache = function(treeId) {},
+ //default bind event of exedit
+ _bindEvent = function(setting) {
+ var o = setting.treeObj;
+ var c = consts.event;
+ o.bind(c.RENAME, function (event, treeId, treeNode, isCancel) {
+ tools.apply(setting.callback.onRename, [event, treeId, treeNode, isCancel]);
+ });
+
+ o.bind(c.DRAG, function (event, srcEvent, treeId, treeNodes) {
+ tools.apply(setting.callback.onDrag, [srcEvent, treeId, treeNodes]);
+ });
+
+ o.bind(c.DRAGMOVE,function(event, srcEvent, treeId, treeNodes){
+ tools.apply(setting.callback.onDragMove,[srcEvent, treeId, treeNodes]);
+ });
+
+ o.bind(c.DROP, function (event, srcEvent, treeId, treeNodes, targetNode, moveType, isCopy) {
+ tools.apply(setting.callback.onDrop, [srcEvent, treeId, treeNodes, targetNode, moveType, isCopy]);
+ });
+ },
+ _unbindEvent = function(setting) {
+ var o = setting.treeObj;
+ var c = consts.event;
+ o.unbind(c.RENAME);
+ o.unbind(c.DRAG);
+ o.unbind(c.DRAGMOVE);
+ o.unbind(c.DROP);
+ },
+ //default event proxy of exedit
+ _eventProxy = function(e) {
+ var target = e.target,
+ setting = data.getSetting(e.data.treeId),
+ relatedTarget = e.relatedTarget,
+ tId = "", node = null,
+ nodeEventType = "", treeEventType = "",
+ nodeEventCallback = null, treeEventCallback = null,
+ tmp = null;
+
+ if (tools.eqs(e.type, "mouseover")) {
+ tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
+ if (tmp) {
+ tId = tools.getNodeMainDom(tmp).id;
+ nodeEventType = "hoverOverNode";
+ }
+ } else if (tools.eqs(e.type, "mouseout")) {
+ tmp = tools.getMDom(setting, relatedTarget, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
+ if (!tmp) {
+ tId = "remove";
+ nodeEventType = "hoverOutNode";
+ }
+ } else if (tools.eqs(e.type, "mousedown")) {
+ tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
+ if (tmp) {
+ tId = tools.getNodeMainDom(tmp).id;
+ nodeEventType = "mousedownNode";
+ }
+ }
+ if (tId.length>0) {
+ node = data.getNodeCache(setting, tId);
+ switch (nodeEventType) {
+ case "mousedownNode" :
+ nodeEventCallback = _handler.onMousedownNode;
+ break;
+ case "hoverOverNode" :
+ nodeEventCallback = _handler.onHoverOverNode;
+ break;
+ case "hoverOutNode" :
+ nodeEventCallback = _handler.onHoverOutNode;
+ break;
+ }
+ }
+ var proxyResult = {
+ stop: false,
+ node: node,
+ nodeEventType: nodeEventType,
+ nodeEventCallback: nodeEventCallback,
+ treeEventType: treeEventType,
+ treeEventCallback: treeEventCallback
+ };
+ return proxyResult
+ },
+ //default init node of exedit
+ _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {
+ if (!n) return;
+ n.isHover = false;
+ n.editNameFlag = false;
+ },
+ //update zTreeObj, add method of edit
+ _zTreeTools = function(setting, zTreeTools) {
+ zTreeTools.cancelEditName = function(newName) {
+ var root = data.getRoot(this.setting);
+ if (!root.curEditNode) return;
+ view.cancelCurEditNode(this.setting, newName?newName:null, true);
+ }
+ zTreeTools.copyNode = function(targetNode, node, moveType, isSilent) {
+ if (!node) return null;
+ if (targetNode && !targetNode.isParent && this.setting.data.keep.leaf && moveType === consts.move.TYPE_INNER) return null;
+ var _this = this,
+ newNode = tools.clone(node);
+ if (!targetNode) {
+ targetNode = null;
+ moveType = consts.move.TYPE_INNER;
+ }
+ if (moveType == consts.move.TYPE_INNER) {
+ function copyCallback() {
+ view.addNodes(_this.setting, targetNode, [newNode], isSilent);
+ }
+
+ if (tools.canAsync(this.setting, targetNode)) {
+ view.asyncNode(this.setting, targetNode, isSilent, copyCallback);
+ } else {
+ copyCallback();
+ }
+ } else {
+ view.addNodes(this.setting, targetNode.parentNode, [newNode], isSilent);
+ view.moveNode(this.setting, targetNode, newNode, moveType, false, isSilent);
+ }
+ return newNode;
+ }
+ zTreeTools.editName = function(node) {
+ if (!node || !node.tId || node !== data.getNodeCache(this.setting, node.tId)) return;
+ if (node.parentTId) view.expandCollapseParentNode(this.setting, node.getParentNode(), true);
+ view.editNode(this.setting, node)
+ }
+ zTreeTools.moveNode = function(targetNode, node, moveType, isSilent) {
+ if (!node) return node;
+ if (targetNode && !targetNode.isParent && this.setting.data.keep.leaf && moveType === consts.move.TYPE_INNER) {
+ return null;
+ } else if (targetNode && ((node.parentTId == targetNode.tId && moveType == consts.move.TYPE_INNER) || $$(node, this.setting).find("#" + targetNode.tId).length > 0)) {
+ return null;
+ } else if (!targetNode) {
+ targetNode = null;
+ }
+ var _this = this;
+ function moveCallback() {
+ view.moveNode(_this.setting, targetNode, node, moveType, false, isSilent);
+ }
+ if (tools.canAsync(this.setting, targetNode) && moveType === consts.move.TYPE_INNER) {
+ view.asyncNode(this.setting, targetNode, isSilent, moveCallback);
+ } else {
+ moveCallback();
+ }
+ return node;
+ }
+ zTreeTools.setEditable = function(editable) {
+ this.setting.edit.enable = editable;
+ return this.refresh();
+ }
+ },
+ //method of operate data
+ _data = {
+ setSonNodeLevel: function(setting, parentNode, node) {
+ if (!node) return;
+ var childKey = setting.data.key.children;
+ node.level = (parentNode)? parentNode.level + 1 : 0;
+ if (!node[childKey]) return;
+ for (var i = 0, l = node[childKey].length; i < l; i++) {
+ if (node[childKey][i]) data.setSonNodeLevel(setting, node, node[childKey][i]);
+ }
+ }
+ },
+ //method of event proxy
+ _event = {
+
+ },
+ //method of event handler
+ _handler = {
+ onHoverOverNode: function(event, node) {
+ var setting = data.getSetting(event.data.treeId),
+ root = data.getRoot(setting);
+ if (root.curHoverNode != node) {
+ _handler.onHoverOutNode(event);
+ }
+ root.curHoverNode = node;
+ view.addHoverDom(setting, node);
+ },
+ onHoverOutNode: function(event, node) {
+ var setting = data.getSetting(event.data.treeId),
+ root = data.getRoot(setting);
+ if (root.curHoverNode && !data.isSelectedNode(setting, root.curHoverNode)) {
+ view.removeTreeDom(setting, root.curHoverNode);
+ root.curHoverNode = null;
+ }
+ },
+ onMousedownNode: function(eventMouseDown, _node) {
+ var i,l,
+ setting = data.getSetting(eventMouseDown.data.treeId),
+ root = data.getRoot(setting), roots = data.getRoots();
+ //right click can't drag & drop
+ if (eventMouseDown.button == 2 || !setting.edit.enable || (!setting.edit.drag.isCopy && !setting.edit.drag.isMove)) return true;
+
+ //input of edit node name can't drag & drop
+ var target = eventMouseDown.target,
+ _nodes = data.getRoot(setting).curSelectedList,
+ nodes = [];
+ if (!data.isSelectedNode(setting, _node)) {
+ nodes = [_node];
+ } else {
+ for (i=0, l=_nodes.length; i<l; i++) {
+ if (_nodes[i].editNameFlag && tools.eqs(target.tagName, "input") && target.getAttribute("treeNode"+consts.id.INPUT) !== null) {
+ return true;
+ }
+ nodes.push(_nodes[i]);
+ if (nodes[0].parentTId !== _nodes[i].parentTId) {
+ nodes = [_node];
+ break;
+ }
+ }
+ }
+
+ view.editNodeBlur = true;
+ view.cancelCurEditNode(setting);
+
+ var doc = $(setting.treeObj.get(0).ownerDocument),
+ body = $(setting.treeObj.get(0).ownerDocument.body), curNode, tmpArrow, tmpTarget,
+ isOtherTree = false,
+ targetSetting = setting,
+ sourceSetting = setting,
+ preNode, nextNode,
+ preTmpTargetNodeId = null,
+ preTmpMoveType = null,
+ tmpTargetNodeId = null,
+ moveType = consts.move.TYPE_INNER,
+ mouseDownX = eventMouseDown.clientX,
+ mouseDownY = eventMouseDown.clientY,
+ startTime = (new Date()).getTime();
+
+ if (tools.uCanDo(setting)) {
+ doc.bind("mousemove", _docMouseMove);
+ }
+ function _docMouseMove(event) {
+ //avoid start drag after click node
+ if (root.dragFlag == 0 && Math.abs(mouseDownX - event.clientX) < setting.edit.drag.minMoveSize
+ && Math.abs(mouseDownY - event.clientY) < setting.edit.drag.minMoveSize) {
+ return true;
+ }
+ var i, l, tmpNode, tmpDom, tmpNodes,
+ childKey = setting.data.key.children;
+ body.css("cursor", "pointer");
+
+ if (root.dragFlag == 0) {
+ if (tools.apply(setting.callback.beforeDrag, [setting.treeId, nodes], true) == false) {
+ _docMouseUp(event);
+ return true;
+ }
+
+ for (i=0, l=nodes.length; i<l; i++) {
+ if (i==0) {
+ root.dragNodeShowBefore = [];
+ }
+ tmpNode = nodes[i];
+ if (tmpNode.isParent && tmpNode.open) {
+ view.expandCollapseNode(setting, tmpNode, !tmpNode.open);
+ root.dragNodeShowBefore[tmpNode.tId] = true;
+ } else {
+ root.dragNodeShowBefore[tmpNode.tId] = false;
+ }
+ }
+
+ root.dragFlag = 1;
+ roots.showHoverDom = false;
+ tools.showIfameMask(setting, true);
+
+ //sort
+ var isOrder = true, lastIndex = -1;
+ if (nodes.length>1) {
+ var pNodes = nodes[0].parentTId ? nodes[0].getParentNode()[childKey] : data.getNodes(setting);
+ tmpNodes = [];
+ for (i=0, l=pNodes.length; i<l; i++) {
+ if (root.dragNodeShowBefore[pNodes[i].tId] !== undefined) {
+ if (isOrder && lastIndex > -1 && (lastIndex+1) !== i) {
+ isOrder = false;
+ }
+ tmpNodes.push(pNodes[i]);
+ lastIndex = i;
+ }
+ if (nodes.length === tmpNodes.length) {
+ nodes = tmpNodes;
+ break;
+ }
+ }
+ }
+ if (isOrder) {
+ preNode = nodes[0].getPreNode();
+ nextNode = nodes[nodes.length-1].getNextNode();
+ }
+
+ //set node in selected
+ curNode = $$("<ul class='zTreeDragUL'></ul>", setting);
+ for (i=0, l=nodes.length; i<l; i++) {
+ tmpNode = nodes[i];
+ tmpNode.editNameFlag = false;
+ view.selectNode(setting, tmpNode, i>0);
+ view.removeTreeDom(setting, tmpNode);
+
+ if (i > setting.edit.drag.maxShowNodeNum-1) {
+ continue;
+ }
+
+ tmpDom = $$("<li id='"+ tmpNode.tId +"_tmp'></li>", setting);
+ tmpDom.append($$(tmpNode, consts.id.A, setting).clone());
+ tmpDom.css("padding", "0");
+ tmpDom.children("#" + tmpNode.tId + consts.id.A).removeClass(consts.node.CURSELECTED);
+ curNode.append(tmpDom);
+ if (i == setting.edit.drag.maxShowNodeNum-1) {
+ tmpDom = $$("<li id='"+ tmpNode.tId +"_moretmp'><a> ... </a></li>", setting);
+ curNode.append(tmpDom);
+ }
+ }
+ curNode.attr("id", nodes[0].tId + consts.id.UL + "_tmp");
+ curNode.addClass(setting.treeObj.attr("class"));
+ curNode.appendTo(body);
+
+ tmpArrow = $$("<span class='tmpzTreeMove_arrow'></span>", setting);
+ tmpArrow.attr("id", "zTreeMove_arrow_tmp");
+ tmpArrow.appendTo(body);
+
+ setting.treeObj.trigger(consts.event.DRAG, [event, setting.treeId, nodes]);
+ }
+
+ if (root.dragFlag == 1) {
+ if (tmpTarget && tmpArrow.attr("id") == event.target.id && tmpTargetNodeId && (event.clientX + doc.scrollLeft()+2) > ($("#" + tmpTargetNodeId + consts.id.A, tmpTarget).offset().left)) {
+ var xT = $("#" + tmpTargetNodeId + consts.id.A, tmpTarget);
+ event.target = (xT.length > 0) ? xT.get(0) : event.target;
+ } else if (tmpTarget) {
+ tmpTarget.removeClass(consts.node.TMPTARGET_TREE);
+ if (tmpTargetNodeId) $("#" + tmpTargetNodeId + consts.id.A, tmpTarget).removeClass(consts.node.TMPTARGET_NODE + "_" + consts.move.TYPE_PREV)
+ .removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_NEXT).removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_INNER);
+ }
+ tmpTarget = null;
+ tmpTargetNodeId = null;
+
+ //judge drag & drop in multi ztree
+ isOtherTree = false;
+ targetSetting = setting;
+ var settings = data.getSettings();
+ for (var s in settings) {
+ if (settings[s].treeId && settings[s].edit.enable && settings[s].treeId != setting.treeId
+ && (event.target.id == settings[s].treeId || $(event.target).parents("#" + settings[s].treeId).length>0)) {
+ isOtherTree = true;
+ targetSetting = settings[s];
+ }
+ }
+
+ var docScrollTop = doc.scrollTop(),
+ docScrollLeft = doc.scrollLeft(),
+ treeOffset = targetSetting.treeObj.offset(),
+ scrollHeight = targetSetting.treeObj.get(0).scrollHeight,
+ scrollWidth = targetSetting.treeObj.get(0).scrollWidth,
+ dTop = (event.clientY + docScrollTop - treeOffset.top),
+ dBottom = (targetSetting.treeObj.height() + treeOffset.top - event.clientY - docScrollTop),
+ dLeft = (event.clientX + docScrollLeft - treeOffset.left),
+ dRight = (targetSetting.treeObj.width() + treeOffset.left - event.clientX - docScrollLeft),
+ isTop = (dTop < setting.edit.drag.borderMax && dTop > setting.edit.drag.borderMin),
+ isBottom = (dBottom < setting.edit.drag.borderMax && dBottom > setting.edit.drag.borderMin),
+ isLeft = (dLeft < setting.edit.drag.borderMax && dLeft > setting.edit.drag.borderMin),
+ isRight = (dRight < setting.edit.drag.borderMax && dRight > setting.edit.drag.borderMin),
+ isTreeInner = dTop > setting.edit.drag.borderMin && dBottom > setting.edit.drag.borderMin && dLeft > setting.edit.drag.borderMin && dRight > setting.edit.drag.borderMin,
+ isTreeTop = (isTop && targetSetting.treeObj.scrollTop() <= 0),
+ isTreeBottom = (isBottom && (targetSetting.treeObj.scrollTop() + targetSetting.treeObj.height()+10) >= scrollHeight),
+ isTreeLeft = (isLeft && targetSetting.treeObj.scrollLeft() <= 0),
+ isTreeRight = (isRight && (targetSetting.treeObj.scrollLeft() + targetSetting.treeObj.width()+10) >= scrollWidth);
+
+ if (event.target && tools.isChildOrSelf(event.target, targetSetting.treeId)) {
+ //get node <li> dom
+ var targetObj = event.target;
+ while (targetObj && targetObj.tagName && !tools.eqs(targetObj.tagName, "li") && targetObj.id != targetSetting.treeId) {
+ targetObj = targetObj.parentNode;
+ }
+
+ var canMove = true;
+ //don't move to self or children of self
+ for (i=0, l=nodes.length; i<l; i++) {
+ tmpNode = nodes[i];
+ if (targetObj.id === tmpNode.tId) {
+ canMove = false;
+ break;
+ } else if ($$(tmpNode, setting).find("#" + targetObj.id).length > 0) {
+ canMove = false;
+ break;
+ }
+ }
+ if (canMove && event.target && tools.isChildOrSelf(event.target, targetObj.id + consts.id.A)) {
+ tmpTarget = $(targetObj);
+ tmpTargetNodeId = targetObj.id;
+ }
+ }
+
+ //the mouse must be in zTree
+ tmpNode = nodes[0];
+ if (isTreeInner && tools.isChildOrSelf(event.target, targetSetting.treeId)) {
+ //judge mouse move in root of ztree
+ if (!tmpTarget && (event.target.id == targetSetting.treeId || isTreeTop || isTreeBottom || isTreeLeft || isTreeRight) && (isOtherTree || (!isOtherTree && tmpNode.parentTId))) {
+ tmpTarget = targetSetting.treeObj;
+ }
+ //auto scroll top
+ if (isTop) {
+ targetSetting.treeObj.scrollTop(targetSetting.treeObj.scrollTop()-10);
+ } else if (isBottom) {
+ targetSetting.treeObj.scrollTop(targetSetting.treeObj.scrollTop()+10);
+ }
+ if (isLeft) {
+ targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()-10);
+ } else if (isRight) {
+ targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()+10);
+ }
+ //auto scroll left
+ if (tmpTarget && tmpTarget != targetSetting.treeObj && tmpTarget.offset().left < targetSetting.treeObj.offset().left) {
+ targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()+ tmpTarget.offset().left - targetSetting.treeObj.offset().left);
+ }
+ }
+
+ curNode.css({
+ "top": (event.clientY + docScrollTop + 3) + "px",
+ "left": (event.clientX + docScrollLeft + 3) + "px"
+ });
+
+ var dX = 0;
+ var dY = 0;
+ if (tmpTarget && tmpTarget.attr("id")!=targetSetting.treeId) {
+ var tmpTargetNode = tmpTargetNodeId == null ? null: data.getNodeCache(targetSetting, tmpTargetNodeId),
+ isCopy = ((event.ctrlKey || event.metaKey) && setting.edit.drag.isMove && setting.edit.drag.isCopy) || (!setting.edit.drag.isMove && setting.edit.drag.isCopy),
+ isPrev = !!(preNode && tmpTargetNodeId === preNode.tId),
+ isNext = !!(nextNode && tmpTargetNodeId === nextNode.tId),
+ isInner = (tmpNode.parentTId && tmpNode.parentTId == tmpTargetNodeId),
+ canPrev = (isCopy || !isNext) && tools.apply(targetSetting.edit.drag.prev, [targetSetting.treeId, nodes, tmpTargetNode], !!targetSetting.edit.drag.prev),
+ canNext = (isCopy || !isPrev) && tools.apply(targetSetting.edit.drag.next, [targetSetting.treeId, nodes, tmpTargetNode], !!targetSetting.edit.drag.next),
+ canInner = (isCopy || !isInner) && !(targetSetting.data.keep.leaf && !tmpTargetNode.isParent) && tools.apply(targetSetting.edit.drag.inner, [targetSetting.treeId, nodes, tmpTargetNode], !!targetSetting.edit.drag.inner);
+ if (!canPrev && !canNext && !canInner) {
+ tmpTarget = null;
+ tmpTargetNodeId = "";
+ moveType = consts.move.TYPE_INNER;
+ tmpArrow.css({
+ "display":"none"
+ });
+ if (window.zTreeMoveTimer) {
+ clearTimeout(window.zTreeMoveTimer);
+ window.zTreeMoveTargetNodeTId = null
+ }
+ } else {
+ var tmpTargetA = $("#" + tmpTargetNodeId + consts.id.A, tmpTarget),
+ tmpNextA = tmpTargetNode.isLastNode ? null : $("#" + tmpTargetNode.getNextNode().tId + consts.id.A, tmpTarget.next()),
+ tmpTop = tmpTargetA.offset().top,
+ tmpLeft = tmpTargetA.offset().left,
+ prevPercent = canPrev ? (canInner ? 0.25 : (canNext ? 0.5 : 1) ) : -1,
+ nextPercent = canNext ? (canInner ? 0.75 : (canPrev ? 0.5 : 0) ) : -1,
+ dY_percent = (event.clientY + docScrollTop - tmpTop)/tmpTargetA.height();
+ if ((prevPercent==1 ||dY_percent<=prevPercent && dY_percent>=-.2) && canPrev) {
+ dX = 1 - tmpArrow.width();
+ dY = tmpTop - tmpArrow.height()/2;
+ moveType = consts.move.TYPE_PREV;
+ } else if ((nextPercent==0 || dY_percent>=nextPercent && dY_percent<=1.2) && canNext) {
+ dX = 1 - tmpArrow.width();
+ dY = (tmpNextA == null || (tmpTargetNode.isParent && tmpTargetNode.open)) ? (tmpTop + tmpTargetA.height() - tmpArrow.height()/2) : (tmpNextA.offset().top - tmpArrow.height()/2);
+ moveType = consts.move.TYPE_NEXT;
+ }else {
+ dX = 5 - tmpArrow.width();
+ dY = tmpTop;
+ moveType = consts.move.TYPE_INNER;
+ }
+ tmpArrow.css({
+ "display":"block",
+ "top": dY + "px",
+ "left": (tmpLeft + dX) + "px"
+ });
+ tmpTargetA.addClass(consts.node.TMPTARGET_NODE + "_" + moveType);
+
+ if (preTmpTargetNodeId != tmpTargetNodeId || preTmpMoveType != moveType) {
+ startTime = (new Date()).getTime();
+ }
+ if (tmpTargetNode && tmpTargetNode.isParent && moveType == consts.move.TYPE_INNER) {
+ var startTimer = true;
+ if (window.zTreeMoveTimer && window.zTreeMoveTargetNodeTId !== tmpTargetNode.tId) {
+ clearTimeout(window.zTreeMoveTimer);
+ window.zTreeMoveTargetNodeTId = null;
+ }else if (window.zTreeMoveTimer && window.zTreeMoveTargetNodeTId === tmpTargetNode.tId) {
+ startTimer = false;
+ }
+ if (startTimer) {
+ window.zTreeMoveTimer = setTimeout(function() {
+ if (moveType != consts.move.TYPE_INNER) return;
+ if (tmpTargetNode && tmpTargetNode.isParent && !tmpTargetNode.open && (new Date()).getTime() - startTime > targetSetting.edit.drag.autoOpenTime
+ && tools.apply(targetSetting.callback.beforeDragOpen, [targetSetting.treeId, tmpTargetNode], true)) {
+ view.switchNode(targetSetting, tmpTargetNode);
+ if (targetSetting.edit.drag.autoExpandTrigger) {
+ targetSetting.treeObj.trigger(consts.event.EXPAND, [targetSetting.treeId, tmpTargetNode]);
+ }
+ }
+ }, targetSetting.edit.drag.autoOpenTime+50);
+ window.zTreeMoveTargetNodeTId = tmpTargetNode.tId;
+ }
+ }
+ }
+ } else {
+ moveType = consts.move.TYPE_INNER;
+ if (tmpTarget && tools.apply(targetSetting.edit.drag.inner, [targetSetting.treeId, nodes, null], !!targetSetting.edit.drag.inner)) {
+ tmpTarget.addClass(consts.node.TMPTARGET_TREE);
+ } else {
+ tmpTarget = null;
+ }
+ tmpArrow.css({
+ "display":"none"
+ });
+ if (window.zTreeMoveTimer) {
+ clearTimeout(window.zTreeMoveTimer);
+ window.zTreeMoveTargetNodeTId = null;
+ }
+ }
+ preTmpTargetNodeId = tmpTargetNodeId;
+ preTmpMoveType = moveType;
+
+ setting.treeObj.trigger(consts.event.DRAGMOVE, [event, setting.treeId, nodes]);
+ }
+ return false;
+ }
+
+ doc.bind("mouseup", _docMouseUp);
+ function _docMouseUp(event) {
+ if (window.zTreeMoveTimer) {
+ clearTimeout(window.zTreeMoveTimer);
+ window.zTreeMoveTargetNodeTId = null;
+ }
+ preTmpTargetNodeId = null;
+ preTmpMoveType = null;
+ doc.unbind("mousemove", _docMouseMove);
+ doc.unbind("mouseup", _docMouseUp);
+ doc.unbind("selectstart", _docSelect);
+ body.css("cursor", "auto");
+ if (tmpTarget) {
+ tmpTarget.removeClass(consts.node.TMPTARGET_TREE);
+ if (tmpTargetNodeId) $("#" + tmpTargetNodeId + consts.id.A, tmpTarget).removeClass(consts.node.TMPTARGET_NODE + "_" + consts.move.TYPE_PREV)
+ .removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_NEXT).removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_INNER);
+ }
+ tools.showIfameMask(setting, false);
+
+ roots.showHoverDom = true;
+ if (root.dragFlag == 0) return;
+ root.dragFlag = 0;
+
+ var i, l, tmpNode;
+ for (i=0, l=nodes.length; i<l; i++) {
+ tmpNode = nodes[i];
+ if (tmpNode.isParent && root.dragNodeShowBefore[tmpNode.tId] && !tmpNode.open) {
+ view.expandCollapseNode(setting, tmpNode, !tmpNode.open);
+ delete root.dragNodeShowBefore[tmpNode.tId];
+ }
+ }
+
+ if (curNode) curNode.remove();
+ if (tmpArrow) tmpArrow.remove();
+
+ var isCopy = ((event.ctrlKey || event.metaKey) && setting.edit.drag.isMove && setting.edit.drag.isCopy) || (!setting.edit.drag.isMove && setting.edit.drag.isCopy);
+ if (!isCopy && tmpTarget && tmpTargetNodeId && nodes[0].parentTId && tmpTargetNodeId==nodes[0].parentTId && moveType == consts.move.TYPE_INNER) {
+ tmpTarget = null;
+ }
+ if (tmpTarget) {
+ var dragTargetNode = tmpTargetNodeId == null ? null: data.getNodeCache(targetSetting, tmpTargetNodeId);
+ if (tools.apply(setting.callback.beforeDrop, [targetSetting.treeId, nodes, dragTargetNode, moveType, isCopy], true) == false) {
+ view.selectNodes(sourceSetting, nodes);
+ return;
+ }
+ var newNodes = isCopy ? tools.clone(nodes) : nodes;
+
+ function dropCallback() {
+ if (isOtherTree) {
+ if (!isCopy) {
+ for(var i=0, l=nodes.length; i<l; i++) {
+ view.removeNode(setting, nodes[i]);
+ }
+ }
+ if (moveType == consts.move.TYPE_INNER) {
+ view.addNodes(targetSetting, dragTargetNode, newNodes);
+ } else {
+ view.addNodes(targetSetting, dragTargetNode.getParentNode(), newNodes);
+ if (moveType == consts.move.TYPE_PREV) {
+ for (i=0, l=newNodes.length; i<l; i++) {
+ view.moveNode(targetSetting, dragTargetNode, newNodes[i], moveType, false);
+ }
+ } else {
+ for (i=-1, l=newNodes.length-1; i<l; l--) {
+ view.moveNode(targetSetting, dragTargetNode, newNodes[l], moveType, false);
+ }
+ }
+ }
+ } else {
+ if (isCopy && moveType == consts.move.TYPE_INNER) {
+ view.addNodes(targetSetting, dragTargetNode, newNodes);
+ } else {
+ if (isCopy) {
+ view.addNodes(targetSetting, dragTargetNode.getParentNode(), newNodes);
+ }
+ if (moveType != consts.move.TYPE_NEXT) {
+ for (i=0, l=newNodes.length; i<l; i++) {
+ view.moveNode(targetSetting, dragTargetNode, newNodes[i], moveType, false);
+ }
+ } else {
+ for (i=-1, l=newNodes.length-1; i<l; l--) {
+ view.moveNode(targetSetting, dragTargetNode, newNodes[l], moveType, false);
+ }
+ }
+ }
+ }
+ view.selectNodes(targetSetting, newNodes);
+ $$(newNodes[0], setting).focus().blur();
+
+ setting.treeObj.trigger(consts.event.DROP, [event, targetSetting.treeId, newNodes, dragTargetNode, moveType, isCopy]);
+ }
+
+ if (moveType == consts.move.TYPE_INNER && tools.canAsync(targetSetting, dragTargetNode)) {
+ view.asyncNode(targetSetting, dragTargetNode, false, dropCallback);
+ } else {
+ dropCallback();
+ }
+
+ } else {
+ view.selectNodes(sourceSetting, nodes);
+ setting.treeObj.trigger(consts.event.DROP, [event, setting.treeId, nodes, null, null, null]);
+ }
+ }
+
+ doc.bind("selectstart", _docSelect);
+ function _docSelect() {
+ return false;
+ }
+
+ //Avoid FireFox's Bug
+ //If zTree Div CSS set 'overflow', so drag node outside of zTree, and event.target is error.
+ if(eventMouseDown.preventDefault) {
+ eventMouseDown.preventDefault();
+ }
+ return true;
+ }
+ },
+ //method of tools for zTree
+ _tools = {
+ getAbs: function (obj) {
+ var oRect = obj.getBoundingClientRect(),
+ scrollTop = document.body.scrollTop+document.documentElement.scrollTop,
+ scrollLeft = document.body.scrollLeft+document.documentElement.scrollLeft;
+ return [oRect.left+scrollLeft,oRect.top+scrollTop];
+ },
+ inputFocus: function(inputObj) {
+ if (inputObj.get(0)) {
+ inputObj.focus();
+ tools.setCursorPosition(inputObj.get(0), inputObj.val().length);
+ }
+ },
+ inputSelect: function(inputObj) {
+ if (inputObj.get(0)) {
+ inputObj.focus();
+ inputObj.select();
+ }
+ },
+ setCursorPosition: function(obj, pos){
+ if(obj.setSelectionRange) {
+ obj.focus();
+ obj.setSelectionRange(pos,pos);
+ } else if (obj.createTextRange) {
+ var range = obj.createTextRange();
+ range.collapse(true);
+ range.moveEnd('character', pos);
+ range.moveStart('character', pos);
+ range.select();
+ }
+ },
+ showIfameMask: function(setting, showSign) {
+ var root = data.getRoot(setting);
+ //clear full mask
+ while (root.dragMaskList.length > 0) {
+ root.dragMaskList[0].remove();
+ root.dragMaskList.shift();
+ }
+ if (showSign) {
+ //show mask
+ var iframeList = $$("iframe", setting);
+ for (var i = 0, l = iframeList.length; i < l; i++) {
+ var obj = iframeList.get(i),
+ r = tools.getAbs(obj),
+ dragMask = $$("<div id='zTreeMask_" + i + "' class='zTreeMask' style='top:" + r[1] + "px; left:" + r[0] + "px; width:" + obj.offsetWidth + "px; height:" + obj.offsetHeight + "px;'></div>", setting);
+ dragMask.appendTo($$("body", setting));
+ root.dragMaskList.push(dragMask);
+ }
+ }
+ }
+ },
+ //method of operate ztree dom
+ _view = {
+ addEditBtn: function(setting, node) {
+ if (node.editNameFlag || $$(node, consts.id.EDIT, setting).length > 0) {
+ return;
+ }
+ if (!tools.apply(setting.edit.showRenameBtn, [setting.treeId, node], setting.edit.showRenameBtn)) {
+ return;
+ }
+ var aObj = $$(node, consts.id.A, setting),
+ editStr = "<span class='" + consts.className.BUTTON + " edit' id='" + node.tId + consts.id.EDIT + "' title='"+tools.apply(setting.edit.renameTitle, [setting.treeId, node], setting.edit.renameTitle)+"' treeNode"+consts.id.EDIT+" style='display:none;'></span>";
+ aObj.append(editStr);
+
+ $$(node, consts.id.EDIT, setting).bind('click',
+ function() {
+ if (!tools.uCanDo(setting) || tools.apply(setting.callback.beforeEditName, [setting.treeId, node], true) == false) return false;
+ view.editNode(setting, node);
+ return false;
+ }
+ ).show();
+ },
+ addRemoveBtn: function(setting, node) {
+ if (node.editNameFlag || $$(node, consts.id.REMOVE, setting).length > 0) {
+ return;
+ }
+ if (!tools.apply(setting.edit.showRemoveBtn, [setting.treeId, node], setting.edit.showRemoveBtn)) {
+ return;
+ }
+ var aObj = $$(node, consts.id.A, setting),
+ removeStr = "<span class='" + consts.className.BUTTON + " remove' id='" + node.tId + consts.id.REMOVE + "' title='"+tools.apply(setting.edit.removeTitle, [setting.treeId, node], setting.edit.removeTitle)+"' treeNode"+consts.id.REMOVE+" style='display:none;'></span>";
+ aObj.append(removeStr);
+
+ $$(node, consts.id.REMOVE, setting).bind('click',
+ function() {
+ if (!tools.uCanDo(setting) || tools.apply(setting.callback.beforeRemove, [setting.treeId, node], true) == false) return false;
+ view.removeNode(setting, node);
+ setting.treeObj.trigger(consts.event.REMOVE, [setting.treeId, node]);
+ return false;
+ }
+ ).bind('mousedown',
+ function(eventMouseDown) {
+ return true;
+ }
+ ).show();
+ },
+ addHoverDom: function(setting, node) {
+ if (data.getRoots().showHoverDom) {
+ node.isHover = true;
+ if (setting.edit.enable) {
+ view.addEditBtn(setting, node);
+ view.addRemoveBtn(setting, node);
+ }
+ tools.apply(setting.view.addHoverDom, [setting.treeId, node]);
+ }
+ },
+ cancelCurEditNode: function (setting, forceName, isCancel) {
+ var root = data.getRoot(setting),
+ nameKey = setting.data.key.name,
+ node = root.curEditNode;
+
+ if (node) {
+ var inputObj = root.curEditInput,
+ newName = forceName ? forceName:(isCancel ? node[nameKey]: inputObj.val());
+ if (tools.apply(setting.callback.beforeRename, [setting.treeId, node, newName, isCancel], true) === false) {
+ return false;
+ } else {
+ node[nameKey] = newName;
+ setting.treeObj.trigger(consts.event.RENAME, [setting.treeId, node, isCancel]);
+ }
+ var aObj = $$(node, consts.id.A, setting);
+ aObj.removeClass(consts.node.CURSELECTED_EDIT);
+ inputObj.unbind();
+ view.setNodeName(setting, node);
+ node.editNameFlag = false;
+ root.curEditNode = null;
+ root.curEditInput = null;
+ view.selectNode(setting, node, false);
+ }
+ root.noSelection = true;
+ return true;
+ },
+ editNode: function(setting, node) {
+ var root = data.getRoot(setting);
+ view.editNodeBlur = false;
+ if (data.isSelectedNode(setting, node) && root.curEditNode == node && node.editNameFlag) {
+ setTimeout(function() {tools.inputFocus(root.curEditInput);}, 0);
+ return;
+ }
+ var nameKey = setting.data.key.name;
+ node.editNameFlag = true;
+ view.removeTreeDom(setting, node);
+ view.cancelCurEditNode(setting);
+ view.selectNode(setting, node, false);
+ $$(node, consts.id.SPAN, setting).html("<input type=text class='rename' id='" + node.tId + consts.id.INPUT + "' treeNode" + consts.id.INPUT + " >");
+ var inputObj = $$(node, consts.id.INPUT, setting);
+ inputObj.attr("value", node[nameKey]);
+ if (setting.edit.editNameSelectAll) {
+ tools.inputSelect(inputObj);
+ } else {
+ tools.inputFocus(inputObj);
+ }
+
+ inputObj.bind('blur', function(event) {
+ if (!view.editNodeBlur) {
+ view.cancelCurEditNode(setting);
+ }
+ }).bind('keydown', function(event) {
+ if (event.keyCode=="13") {
+ view.editNodeBlur = true;
+ view.cancelCurEditNode(setting);
+ } else if (event.keyCode=="27") {
+ view.cancelCurEditNode(setting, null, true);
+ }
+ }).bind('click', function(event) {
+ return false;
+ }).bind('dblclick', function(event) {
+ return false;
+ });
+
+ $$(node, consts.id.A, setting).addClass(consts.node.CURSELECTED_EDIT);
+ root.curEditInput = inputObj;
+ root.noSelection = false;
+ root.curEditNode = node;
+ },
+ moveNode: function(setting, targetNode, node, moveType, animateFlag, isSilent) {
+ var root = data.getRoot(setting),
+ childKey = setting.data.key.children;
+ if (targetNode == node) return;
+ if (setting.data.keep.leaf && targetNode && !targetNode.isParent && moveType == consts.move.TYPE_INNER) return;
+ var oldParentNode = (node.parentTId ? node.getParentNode(): root),
+ targetNodeIsRoot = (targetNode === null || targetNode == root);
+ if (targetNodeIsRoot && targetNode === null) targetNode = root;
+ if (targetNodeIsRoot) moveType = consts.move.TYPE_INNER;
+ var targetParentNode = (targetNode.parentTId ? targetNode.getParentNode() : root);
+
+ if (moveType != consts.move.TYPE_PREV && moveType != consts.move.TYPE_NEXT) {
+ moveType = consts.move.TYPE_INNER;
+ }
+
+ if (moveType == consts.move.TYPE_INNER) {
+ if (targetNodeIsRoot) {
+ //parentTId of root node is null
+ node.parentTId = null;
+ } else {
+ if (!targetNode.isParent) {
+ targetNode.isParent = true;
+ targetNode.open = !!targetNode.open;
+ view.setNodeLineIcos(setting, targetNode);
+ }
+ node.parentTId = targetNode.tId;
+ }
+ }
+
+ //move node Dom
+ var targetObj, target_ulObj;
+ if (targetNodeIsRoot) {
+ targetObj = setting.treeObj;
+ target_ulObj = targetObj;
+ } else {
+ if (!isSilent && moveType == consts.move.TYPE_INNER) {
+ view.expandCollapseNode(setting, targetNode, true, false);
+ } else if (!isSilent) {
+ view.expandCollapseNode(setting, targetNode.getParentNode(), true, false);
+ }
+ targetObj = $$(targetNode, setting);
+ target_ulObj = $$(targetNode, consts.id.UL, setting);
+ if (!!targetObj.get(0) && !target_ulObj.get(0)) {
+ var ulstr = [];
+ view.makeUlHtml(setting, targetNode, ulstr, '');
+ targetObj.append(ulstr.join(''));
+ }
+ target_ulObj = $$(targetNode, consts.id.UL, setting);
+ }
+ var nodeDom = $$(node, setting);
+ if (!nodeDom.get(0)) {
+ nodeDom = view.appendNodes(setting, node.level, [node], null, false, true).join('');
+ } else if (!targetObj.get(0)) {
+ nodeDom.remove();
+ }
+ if (target_ulObj.get(0) && moveType == consts.move.TYPE_INNER) {
+ target_ulObj.append(nodeDom);
+ } else if (targetObj.get(0) && moveType == consts.move.TYPE_PREV) {
+ targetObj.before(nodeDom);
+ } else if (targetObj.get(0) && moveType == consts.move.TYPE_NEXT) {
+ targetObj.after(nodeDom);
+ }
+
+ //repair the data after move
+ var i,l,
+ tmpSrcIndex = -1,
+ tmpTargetIndex = 0,
+ oldNeighbor = null,
+ newNeighbor = null,
+ oldLevel = node.level;
+ if (node.isFirstNode) {
+ tmpSrcIndex = 0;
+ if (oldParentNode[childKey].length > 1 ) {
+ oldNeighbor = oldParentNode[childKey][1];
+ oldNeighbor.isFirstNode = true;
+ }
+ } else if (node.isLastNode) {
+ tmpSrcIndex = oldParentNode[childKey].length -1;
+ oldNeighbor = oldParentNode[childKey][tmpSrcIndex - 1];
+ oldNeighbor.isLastNode = true;
+ } else {
+ for (i = 0, l = oldParentNode[childKey].length; i < l; i++) {
+ if (oldParentNode[childKey][i].tId == node.tId) {
+ tmpSrcIndex = i;
+ break;
+ }
+ }
+ }
+ if (tmpSrcIndex >= 0) {
+ oldParentNode[childKey].splice(tmpSrcIndex, 1);
+ }
+ if (moveType != consts.move.TYPE_INNER) {
+ for (i = 0, l = targetParentNode[childKey].length; i < l; i++) {
+ if (targetParentNode[childKey][i].tId == targetNode.tId) tmpTargetIndex = i;
+ }
+ }
+ if (moveType == consts.move.TYPE_INNER) {
+ if (!targetNode[childKey]) targetNode[childKey] = new Array();
+ if (targetNode[childKey].length > 0) {
+ newNeighbor = targetNode[childKey][targetNode[childKey].length - 1];
+ newNeighbor.isLastNode = false;
+ }
+ targetNode[childKey].splice(targetNode[childKey].length, 0, node);
+ node.isLastNode = true;
+ node.isFirstNode = (targetNode[childKey].length == 1);
+ } else if (targetNode.isFirstNode && moveType == consts.move.TYPE_PREV) {
+ targetParentNode[childKey].splice(tmpTargetIndex, 0, node);
+ newNeighbor = targetNode;
+ newNeighbor.isFirstNode = false;
+ node.parentTId = targetNode.parentTId;
+ node.isFirstNode = true;
+ node.isLastNode = false;
+
+ } else if (targetNode.isLastNode && moveType == consts.move.TYPE_NEXT) {
+ targetParentNode[childKey].splice(tmpTargetIndex + 1, 0, node);
+ newNeighbor = targetNode;
+ newNeighbor.isLastNode = false;
+ node.parentTId = targetNode.parentTId;
+ node.isFirstNode = false;
+ node.isLastNode = true;
+
+ } else {
+ if (moveType == consts.move.TYPE_PREV) {
+ targetParentNode[childKey].splice(tmpTargetIndex, 0, node);
+ } else {
+ targetParentNode[childKey].splice(tmpTargetIndex + 1, 0, node);
+ }
+ node.parentTId = targetNode.parentTId;
+ node.isFirstNode = false;
+ node.isLastNode = false;
+ }
+ data.fixPIdKeyValue(setting, node);
+ data.setSonNodeLevel(setting, node.getParentNode(), node);
+
+ //repair node what been moved
+ view.setNodeLineIcos(setting, node);
+ view.repairNodeLevelClass(setting, node, oldLevel)
+
+ //repair node's old parentNode dom
+ if (!setting.data.keep.parent && oldParentNode[childKey].length < 1) {
+ //old parentNode has no child nodes
+ oldParentNode.isParent = false;
+ oldParentNode.open = false;
+ var tmp_ulObj = $$(oldParentNode, consts.id.UL, setting),
+ tmp_switchObj = $$(oldParentNode, consts.id.SWITCH, setting),
+ tmp_icoObj = $$(oldParentNode, consts.id.ICON, setting);
+ view.replaceSwitchClass(oldParentNode, tmp_switchObj, consts.folder.DOCU);
+ view.replaceIcoClass(oldParentNode, tmp_icoObj, consts.folder.DOCU);
+ tmp_ulObj.css("display", "none");
+
+ } else if (oldNeighbor) {
+ //old neigbor node
+ view.setNodeLineIcos(setting, oldNeighbor);
+ }
+
+ //new neigbor node
+ if (newNeighbor) {
+ view.setNodeLineIcos(setting, newNeighbor);
+ }
+
+ //repair checkbox / radio
+ if (!!setting.check && setting.check.enable && view.repairChkClass) {
+ view.repairChkClass(setting, oldParentNode);
+ view.repairParentChkClassWithSelf(setting, oldParentNode);
+ if (oldParentNode != node.parent)
+ view.repairParentChkClassWithSelf(setting, node);
+ }
+
+ //expand parents after move
+ if (!isSilent) {
+ view.expandCollapseParentNode(setting, node.getParentNode(), true, animateFlag);
+ }
+ },
+ removeEditBtn: function(setting, node) {
+ $$(node, consts.id.EDIT, setting).unbind().remove();
+ },
+ removeRemoveBtn: function(setting, node) {
+ $$(node, consts.id.REMOVE, setting).unbind().remove();
+ },
+ removeTreeDom: function(setting, node) {
+ node.isHover = false;
+ view.removeEditBtn(setting, node);
+ view.removeRemoveBtn(setting, node);
+ tools.apply(setting.view.removeHoverDom, [setting.treeId, node]);
+ },
+ repairNodeLevelClass: function(setting, node, oldLevel) {
+ if (oldLevel === node.level) return;
+ var liObj = $$(node, setting),
+ aObj = $$(node, consts.id.A, setting),
+ ulObj = $$(node, consts.id.UL, setting),
+ oldClass = consts.className.LEVEL + oldLevel,
+ newClass = consts.className.LEVEL + node.level;
+ liObj.removeClass(oldClass);
+ liObj.addClass(newClass);
+ aObj.removeClass(oldClass);
+ aObj.addClass(newClass);
+ ulObj.removeClass(oldClass);
+ ulObj.addClass(newClass);
+ },
+ selectNodes : function(setting, nodes) {
+ for (var i=0, l=nodes.length; i<l; i++) {
+ view.selectNode(setting, nodes[i], i>0);
+ }
+ }
+ },
+
+ _z = {
+ tools: _tools,
+ view: _view,
+ event: _event,
+ data: _data
+ };
+ $.extend(true, $.fn.zTree.consts, _consts);
+ $.extend(true, $.fn.zTree._z, _z);
+
+ var zt = $.fn.zTree,
+ tools = zt._z.tools,
+ consts = zt.consts,
+ view = zt._z.view,
+ data = zt._z.data,
+ event = zt._z.event,
+ $$ = tools.$;
+
+ data.exSetting(_setting);
+ data.addInitBind(_bindEvent);
+ data.addInitUnBind(_unbindEvent);
+ data.addInitCache(_initCache);
+ data.addInitNode(_initNode);
+ data.addInitProxy(_eventProxy);
+ data.addInitRoot(_initRoot);
+ data.addZTreeTools(_zTreeTools);
+
+ var _cancelPreSelectedNode = view.cancelPreSelectedNode;
+ view.cancelPreSelectedNode = function (setting, node) {
+ var list = data.getRoot(setting).curSelectedList;
+ for (var i=0, j=list.length; i<j; i++) {
+ if (!node || node === list[i]) {
+ view.removeTreeDom(setting, list[i]);
+ if (node) break;
+ }
+ }
+ if (_cancelPreSelectedNode) _cancelPreSelectedNode.apply(view, arguments);
+ }
+
+ var _createNodes = view.createNodes;
+ view.createNodes = function(setting, level, nodes, parentNode) {
+ if (_createNodes) {
+ _createNodes.apply(view, arguments);
+ }
+ if (!nodes) return;
+ if (view.repairParentChkClassWithSelf) {
+ view.repairParentChkClassWithSelf(setting, parentNode);
+ }
+ }
+
+ var _makeNodeUrl = view.makeNodeUrl;
+ view.makeNodeUrl = function(setting, node) {
+ return setting.edit.enable ? null : (_makeNodeUrl.apply(view, arguments));
+ }
+
+ var _removeNode = view.removeNode;
+ view.removeNode = function(setting, node) {
+ var root = data.getRoot(setting);
+ if (root.curEditNode === node) root.curEditNode = null;
+ if (_removeNode) {
+ _removeNode.apply(view, arguments);
+ }
+ }
+
+ var _selectNode = view.selectNode;
+ view.selectNode = function(setting, node, addFlag) {
+ var root = data.getRoot(setting);
+ if (data.isSelectedNode(setting, node) && root.curEditNode == node && node.editNameFlag) {
+ return false;
+ }
+ if (_selectNode) _selectNode.apply(view, arguments);
+ view.addHoverDom(setting, node);
+ return true;
+ }
+
+ var _uCanDo = tools.uCanDo;
+ tools.uCanDo = function(setting, e) {
+ var root = data.getRoot(setting);
+ if (e && (tools.eqs(e.type, "mouseover") || tools.eqs(e.type, "mouseout") || tools.eqs(e.type, "mousedown") || tools.eqs(e.type, "mouseup"))) {
+ return true;
+ }
+ if (root.curEditNode) {
+ view.editNodeBlur = false;
+ root.curEditInput.focus();
+ }
+ return (!root.curEditNode) && (_uCanDo ? _uCanDo.apply(view, arguments) : true);
+ }
+})(jQuery); \ No newline at end of file
diff --git a/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exedit.min.js b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exedit.min.js
new file mode 100644
index 0000000..2e74832
--- /dev/null
+++ b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exedit.min.js
@@ -0,0 +1,53 @@
+/*
+ * JQuery zTree exedit v3.5.16
+ * http://zTree.me/
+ *
+ * Copyright (c) 2010 Hunter.z
+ *
+ * Licensed same as jquery - MIT License
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * email: hunter.z@263.net
+ * Date: 2014-03-09
+ */
+(function(w){var I={event:{DRAG:"ztree_drag",DROP:"ztree_drop",RENAME:"ztree_rename",DRAGMOVE:"ztree_dragmove"},id:{EDIT:"_edit",INPUT:"_input",REMOVE:"_remove"},move:{TYPE_INNER:"inner",TYPE_PREV:"prev",TYPE_NEXT:"next"},node:{CURSELECTED_EDIT:"curSelectedNode_Edit",TMPTARGET_TREE:"tmpTargetzTree",TMPTARGET_NODE:"tmpTargetNode"}},x={onHoverOverNode:function(b,a){var c=m.getSetting(b.data.treeId),d=m.getRoot(c);if(d.curHoverNode!=a)x.onHoverOutNode(b);d.curHoverNode=a;f.addHoverDom(c,a)},onHoverOutNode:function(b){var b=
+m.getSetting(b.data.treeId),a=m.getRoot(b);if(a.curHoverNode&&!m.isSelectedNode(b,a.curHoverNode))f.removeTreeDom(b,a.curHoverNode),a.curHoverNode=null},onMousedownNode:function(b,a){function c(b){if(C.dragFlag==0&&Math.abs(N-b.clientX)<e.edit.drag.minMoveSize&&Math.abs(O-b.clientY)<e.edit.drag.minMoveSize)return!0;var a,c,n,k,i;i=e.data.key.children;M.css("cursor","pointer");if(C.dragFlag==0){if(g.apply(e.callback.beforeDrag,[e.treeId,l],!0)==!1)return r(b),!0;for(a=0,c=l.length;a<c;a++){if(a==0)C.dragNodeShowBefore=
+[];n=l[a];n.isParent&&n.open?(f.expandCollapseNode(e,n,!n.open),C.dragNodeShowBefore[n.tId]=!0):C.dragNodeShowBefore[n.tId]=!1}C.dragFlag=1;t.showHoverDom=!1;g.showIfameMask(e,!0);n=!0;k=-1;if(l.length>1){var j=l[0].parentTId?l[0].getParentNode()[i]:m.getNodes(e);i=[];for(a=0,c=j.length;a<c;a++)if(C.dragNodeShowBefore[j[a].tId]!==void 0&&(n&&k>-1&&k+1!==a&&(n=!1),i.push(j[a]),k=a),l.length===i.length){l=i;break}}n&&(H=l[0].getPreNode(),R=l[l.length-1].getNextNode());D=o("<ul class='zTreeDragUL'></ul>",
+e);for(a=0,c=l.length;a<c;a++)n=l[a],n.editNameFlag=!1,f.selectNode(e,n,a>0),f.removeTreeDom(e,n),a>e.edit.drag.maxShowNodeNum-1||(k=o("<li id='"+n.tId+"_tmp'></li>",e),k.append(o(n,d.id.A,e).clone()),k.css("padding","0"),k.children("#"+n.tId+d.id.A).removeClass(d.node.CURSELECTED),D.append(k),a==e.edit.drag.maxShowNodeNum-1&&(k=o("<li id='"+n.tId+"_moretmp'><a> ... </a></li>",e),D.append(k)));D.attr("id",l[0].tId+d.id.UL+"_tmp");D.addClass(e.treeObj.attr("class"));D.appendTo(M);B=o("<span class='tmpzTreeMove_arrow'></span>",
+e);B.attr("id","zTreeMove_arrow_tmp");B.appendTo(M);e.treeObj.trigger(d.event.DRAG,[b,e.treeId,l])}if(C.dragFlag==1){s&&B.attr("id")==b.target.id&&u&&b.clientX+F.scrollLeft()+2>w("#"+u+d.id.A,s).offset().left?(n=w("#"+u+d.id.A,s),b.target=n.length>0?n.get(0):b.target):s&&(s.removeClass(d.node.TMPTARGET_TREE),u&&w("#"+u+d.id.A,s).removeClass(d.node.TMPTARGET_NODE+"_"+d.move.TYPE_PREV).removeClass(d.node.TMPTARGET_NODE+"_"+I.move.TYPE_NEXT).removeClass(d.node.TMPTARGET_NODE+"_"+I.move.TYPE_INNER));
+u=s=null;J=!1;h=e;n=m.getSettings();for(var y in n)if(n[y].treeId&&n[y].edit.enable&&n[y].treeId!=e.treeId&&(b.target.id==n[y].treeId||w(b.target).parents("#"+n[y].treeId).length>0))J=!0,h=n[y];y=F.scrollTop();k=F.scrollLeft();i=h.treeObj.offset();a=h.treeObj.get(0).scrollHeight;n=h.treeObj.get(0).scrollWidth;c=b.clientY+y-i.top;var p=h.treeObj.height()+i.top-b.clientY-y,q=b.clientX+k-i.left,x=h.treeObj.width()+i.left-b.clientX-k;i=c<e.edit.drag.borderMax&&c>e.edit.drag.borderMin;var j=p<e.edit.drag.borderMax&&
+p>e.edit.drag.borderMin,K=q<e.edit.drag.borderMax&&q>e.edit.drag.borderMin,G=x<e.edit.drag.borderMax&&x>e.edit.drag.borderMin,p=c>e.edit.drag.borderMin&&p>e.edit.drag.borderMin&&q>e.edit.drag.borderMin&&x>e.edit.drag.borderMin,q=i&&h.treeObj.scrollTop()<=0,x=j&&h.treeObj.scrollTop()+h.treeObj.height()+10>=a,P=K&&h.treeObj.scrollLeft()<=0,Q=G&&h.treeObj.scrollLeft()+h.treeObj.width()+10>=n;if(b.target&&g.isChildOrSelf(b.target,h.treeId)){for(var E=b.target;E&&E.tagName&&!g.eqs(E.tagName,"li")&&E.id!=
+h.treeId;)E=E.parentNode;var S=!0;for(a=0,c=l.length;a<c;a++)if(n=l[a],E.id===n.tId){S=!1;break}else if(o(n,e).find("#"+E.id).length>0){S=!1;break}if(S&&b.target&&g.isChildOrSelf(b.target,E.id+d.id.A))s=w(E),u=E.id}n=l[0];if(p&&g.isChildOrSelf(b.target,h.treeId)){if(!s&&(b.target.id==h.treeId||q||x||P||Q)&&(J||!J&&n.parentTId))s=h.treeObj;i?h.treeObj.scrollTop(h.treeObj.scrollTop()-10):j&&h.treeObj.scrollTop(h.treeObj.scrollTop()+10);K?h.treeObj.scrollLeft(h.treeObj.scrollLeft()-10):G&&h.treeObj.scrollLeft(h.treeObj.scrollLeft()+
+10);s&&s!=h.treeObj&&s.offset().left<h.treeObj.offset().left&&h.treeObj.scrollLeft(h.treeObj.scrollLeft()+s.offset().left-h.treeObj.offset().left)}D.css({top:b.clientY+y+3+"px",left:b.clientX+k+3+"px"});i=a=0;if(s&&s.attr("id")!=h.treeId){var z=u==null?null:m.getNodeCache(h,u);c=(b.ctrlKey||b.metaKey)&&e.edit.drag.isMove&&e.edit.drag.isCopy||!e.edit.drag.isMove&&e.edit.drag.isCopy;a=!!(H&&u===H.tId);i=!!(R&&u===R.tId);k=n.parentTId&&n.parentTId==u;n=(c||!i)&&g.apply(h.edit.drag.prev,[h.treeId,l,z],
+!!h.edit.drag.prev);a=(c||!a)&&g.apply(h.edit.drag.next,[h.treeId,l,z],!!h.edit.drag.next);G=(c||!k)&&!(h.data.keep.leaf&&!z.isParent)&&g.apply(h.edit.drag.inner,[h.treeId,l,z],!!h.edit.drag.inner);if(!n&&!a&&!G){if(s=null,u="",v=d.move.TYPE_INNER,B.css({display:"none"}),window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null}else{c=w("#"+u+d.id.A,s);i=z.isLastNode?null:w("#"+z.getNextNode().tId+d.id.A,s.next());j=c.offset().top;k=c.offset().left;K=n?G?0.25:a?
+0.5:1:-1;G=a?G?0.75:n?0.5:0:-1;y=(b.clientY+y-j)/c.height();(K==1||y<=K&&y>=-0.2)&&n?(a=1-B.width(),i=j-B.height()/2,v=d.move.TYPE_PREV):(G==0||y>=G&&y<=1.2)&&a?(a=1-B.width(),i=i==null||z.isParent&&z.open?j+c.height()-B.height()/2:i.offset().top-B.height()/2,v=d.move.TYPE_NEXT):(a=5-B.width(),i=j,v=d.move.TYPE_INNER);B.css({display:"block",top:i+"px",left:k+a+"px"});c.addClass(d.node.TMPTARGET_NODE+"_"+v);if(T!=u||U!=v)L=(new Date).getTime();if(z&&z.isParent&&v==d.move.TYPE_INNER&&(y=!0,window.zTreeMoveTimer&&
+window.zTreeMoveTargetNodeTId!==z.tId?(clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null):window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId===z.tId&&(y=!1),y))window.zTreeMoveTimer=setTimeout(function(){v==d.move.TYPE_INNER&&z&&z.isParent&&!z.open&&(new Date).getTime()-L>h.edit.drag.autoOpenTime&&g.apply(h.callback.beforeDragOpen,[h.treeId,z],!0)&&(f.switchNode(h,z),h.edit.drag.autoExpandTrigger&&h.treeObj.trigger(d.event.EXPAND,[h.treeId,z]))},h.edit.drag.autoOpenTime+50),
+window.zTreeMoveTargetNodeTId=z.tId}}else if(v=d.move.TYPE_INNER,s&&g.apply(h.edit.drag.inner,[h.treeId,l,null],!!h.edit.drag.inner)?s.addClass(d.node.TMPTARGET_TREE):s=null,B.css({display:"none"}),window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null;T=u;U=v;e.treeObj.trigger(d.event.DRAGMOVE,[b,e.treeId,l])}return!1}function r(b){if(window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null;U=T=null;F.unbind("mousemove",c);
+F.unbind("mouseup",r);F.unbind("selectstart",k);M.css("cursor","auto");s&&(s.removeClass(d.node.TMPTARGET_TREE),u&&w("#"+u+d.id.A,s).removeClass(d.node.TMPTARGET_NODE+"_"+d.move.TYPE_PREV).removeClass(d.node.TMPTARGET_NODE+"_"+I.move.TYPE_NEXT).removeClass(d.node.TMPTARGET_NODE+"_"+I.move.TYPE_INNER));g.showIfameMask(e,!1);t.showHoverDom=!0;if(C.dragFlag!=0){C.dragFlag=0;var a,i,j;for(a=0,i=l.length;a<i;a++)j=l[a],j.isParent&&C.dragNodeShowBefore[j.tId]&&!j.open&&(f.expandCollapseNode(e,j,!j.open),
+delete C.dragNodeShowBefore[j.tId]);D&&D.remove();B&&B.remove();var p=(b.ctrlKey||b.metaKey)&&e.edit.drag.isMove&&e.edit.drag.isCopy||!e.edit.drag.isMove&&e.edit.drag.isCopy;!p&&s&&u&&l[0].parentTId&&u==l[0].parentTId&&v==d.move.TYPE_INNER&&(s=null);if(s){var q=u==null?null:m.getNodeCache(h,u);if(g.apply(e.callback.beforeDrop,[h.treeId,l,q,v,p],!0)==!1)f.selectNodes(x,l);else{var A=p?g.clone(l):l;a=function(){if(J){if(!p)for(var a=0,c=l.length;a<c;a++)f.removeNode(e,l[a]);if(v==d.move.TYPE_INNER)f.addNodes(h,
+q,A);else if(f.addNodes(h,q.getParentNode(),A),v==d.move.TYPE_PREV)for(a=0,c=A.length;a<c;a++)f.moveNode(h,q,A[a],v,!1);else for(a=-1,c=A.length-1;a<c;c--)f.moveNode(h,q,A[c],v,!1)}else if(p&&v==d.move.TYPE_INNER)f.addNodes(h,q,A);else if(p&&f.addNodes(h,q.getParentNode(),A),v!=d.move.TYPE_NEXT)for(a=0,c=A.length;a<c;a++)f.moveNode(h,q,A[a],v,!1);else for(a=-1,c=A.length-1;a<c;c--)f.moveNode(h,q,A[c],v,!1);f.selectNodes(h,A);o(A[0],e).focus().blur();e.treeObj.trigger(d.event.DROP,[b,h.treeId,A,q,
+v,p])};v==d.move.TYPE_INNER&&g.canAsync(h,q)?f.asyncNode(h,q,!1,a):a()}}else f.selectNodes(x,l),e.treeObj.trigger(d.event.DROP,[b,e.treeId,l,null,null,null])}}function k(){return!1}var i,j,e=m.getSetting(b.data.treeId),C=m.getRoot(e),t=m.getRoots();if(b.button==2||!e.edit.enable||!e.edit.drag.isCopy&&!e.edit.drag.isMove)return!0;var p=b.target,q=m.getRoot(e).curSelectedList,l=[];if(m.isSelectedNode(e,a))for(i=0,j=q.length;i<j;i++){if(q[i].editNameFlag&&g.eqs(p.tagName,"input")&&p.getAttribute("treeNode"+
+d.id.INPUT)!==null)return!0;l.push(q[i]);if(l[0].parentTId!==q[i].parentTId){l=[a];break}}else l=[a];f.editNodeBlur=!0;f.cancelCurEditNode(e);var F=w(e.treeObj.get(0).ownerDocument),M=w(e.treeObj.get(0).ownerDocument.body),D,B,s,J=!1,h=e,x=e,H,R,T=null,U=null,u=null,v=d.move.TYPE_INNER,N=b.clientX,O=b.clientY,L=(new Date).getTime();g.uCanDo(e)&&F.bind("mousemove",c);F.bind("mouseup",r);F.bind("selectstart",k);b.preventDefault&&b.preventDefault();return!0}};w.extend(!0,w.fn.zTree.consts,I);w.extend(!0,
+w.fn.zTree._z,{tools:{getAbs:function(b){b=b.getBoundingClientRect();return[b.left+(document.body.scrollLeft+document.documentElement.scrollLeft),b.top+(document.body.scrollTop+document.documentElement.scrollTop)]},inputFocus:function(b){b.get(0)&&(b.focus(),g.setCursorPosition(b.get(0),b.val().length))},inputSelect:function(b){b.get(0)&&(b.focus(),b.select())},setCursorPosition:function(b,a){if(b.setSelectionRange)b.focus(),b.setSelectionRange(a,a);else if(b.createTextRange){var c=b.createTextRange();
+c.collapse(!0);c.moveEnd("character",a);c.moveStart("character",a);c.select()}},showIfameMask:function(b,a){for(var c=m.getRoot(b);c.dragMaskList.length>0;)c.dragMaskList[0].remove(),c.dragMaskList.shift();if(a)for(var d=o("iframe",b),f=0,i=d.length;f<i;f++){var j=d.get(f),e=g.getAbs(j),j=o("<div id='zTreeMask_"+f+"' class='zTreeMask' style='top:"+e[1]+"px; left:"+e[0]+"px; width:"+j.offsetWidth+"px; height:"+j.offsetHeight+"px;'></div>",b);j.appendTo(o("body",b));c.dragMaskList.push(j)}}},view:{addEditBtn:function(b,
+a){if(!(a.editNameFlag||o(a,d.id.EDIT,b).length>0)&&g.apply(b.edit.showRenameBtn,[b.treeId,a],b.edit.showRenameBtn)){var c=o(a,d.id.A,b),r="<span class='"+d.className.BUTTON+" edit' id='"+a.tId+d.id.EDIT+"' title='"+g.apply(b.edit.renameTitle,[b.treeId,a],b.edit.renameTitle)+"' treeNode"+d.id.EDIT+" style='display:none;'></span>";c.append(r);o(a,d.id.EDIT,b).bind("click",function(){if(!g.uCanDo(b)||g.apply(b.callback.beforeEditName,[b.treeId,a],!0)==!1)return!1;f.editNode(b,a);return!1}).show()}},
+addRemoveBtn:function(b,a){if(!(a.editNameFlag||o(a,d.id.REMOVE,b).length>0)&&g.apply(b.edit.showRemoveBtn,[b.treeId,a],b.edit.showRemoveBtn)){var c=o(a,d.id.A,b),r="<span class='"+d.className.BUTTON+" remove' id='"+a.tId+d.id.REMOVE+"' title='"+g.apply(b.edit.removeTitle,[b.treeId,a],b.edit.removeTitle)+"' treeNode"+d.id.REMOVE+" style='display:none;'></span>";c.append(r);o(a,d.id.REMOVE,b).bind("click",function(){if(!g.uCanDo(b)||g.apply(b.callback.beforeRemove,[b.treeId,a],!0)==!1)return!1;f.removeNode(b,
+a);b.treeObj.trigger(d.event.REMOVE,[b.treeId,a]);return!1}).bind("mousedown",function(){return!0}).show()}},addHoverDom:function(b,a){if(m.getRoots().showHoverDom)a.isHover=!0,b.edit.enable&&(f.addEditBtn(b,a),f.addRemoveBtn(b,a)),g.apply(b.view.addHoverDom,[b.treeId,a])},cancelCurEditNode:function(b,a,c){var r=m.getRoot(b),k=b.data.key.name,i=r.curEditNode;if(i){var j=r.curEditInput,a=a?a:c?i[k]:j.val();if(g.apply(b.callback.beforeRename,[b.treeId,i,a,c],!0)===!1)return!1;else i[k]=a,b.treeObj.trigger(d.event.RENAME,
+[b.treeId,i,c]);o(i,d.id.A,b).removeClass(d.node.CURSELECTED_EDIT);j.unbind();f.setNodeName(b,i);i.editNameFlag=!1;r.curEditNode=null;r.curEditInput=null;f.selectNode(b,i,!1)}return r.noSelection=!0},editNode:function(b,a){var c=m.getRoot(b);f.editNodeBlur=!1;if(m.isSelectedNode(b,a)&&c.curEditNode==a&&a.editNameFlag)setTimeout(function(){g.inputFocus(c.curEditInput)},0);else{var r=b.data.key.name;a.editNameFlag=!0;f.removeTreeDom(b,a);f.cancelCurEditNode(b);f.selectNode(b,a,!1);o(a,d.id.SPAN,b).html("<input type=text class='rename' id='"+
+a.tId+d.id.INPUT+"' treeNode"+d.id.INPUT+" >");var k=o(a,d.id.INPUT,b);k.attr("value",a[r]);b.edit.editNameSelectAll?g.inputSelect(k):g.inputFocus(k);k.bind("blur",function(){f.editNodeBlur||f.cancelCurEditNode(b)}).bind("keydown",function(a){a.keyCode=="13"?(f.editNodeBlur=!0,f.cancelCurEditNode(b)):a.keyCode=="27"&&f.cancelCurEditNode(b,null,!0)}).bind("click",function(){return!1}).bind("dblclick",function(){return!1});o(a,d.id.A,b).addClass(d.node.CURSELECTED_EDIT);c.curEditInput=k;c.noSelection=
+!1;c.curEditNode=a}},moveNode:function(b,a,c,r,k,i){var j=m.getRoot(b),e=b.data.key.children;if(a!=c&&(!b.data.keep.leaf||!a||a.isParent||r!=d.move.TYPE_INNER)){var g=c.parentTId?c.getParentNode():j,t=a===null||a==j;t&&a===null&&(a=j);if(t)r=d.move.TYPE_INNER;j=a.parentTId?a.getParentNode():j;if(r!=d.move.TYPE_PREV&&r!=d.move.TYPE_NEXT)r=d.move.TYPE_INNER;if(r==d.move.TYPE_INNER)if(t)c.parentTId=null;else{if(!a.isParent)a.isParent=!0,a.open=!!a.open,f.setNodeLineIcos(b,a);c.parentTId=a.tId}var p;
+t?p=t=b.treeObj:(!i&&r==d.move.TYPE_INNER?f.expandCollapseNode(b,a,!0,!1):i||f.expandCollapseNode(b,a.getParentNode(),!0,!1),t=o(a,b),p=o(a,d.id.UL,b),t.get(0)&&!p.get(0)&&(p=[],f.makeUlHtml(b,a,p,""),t.append(p.join(""))),p=o(a,d.id.UL,b));var q=o(c,b);q.get(0)?t.get(0)||q.remove():q=f.appendNodes(b,c.level,[c],null,!1,!0).join("");p.get(0)&&r==d.move.TYPE_INNER?p.append(q):t.get(0)&&r==d.move.TYPE_PREV?t.before(q):t.get(0)&&r==d.move.TYPE_NEXT&&t.after(q);var l=-1,w=0,x=null,t=null,D=c.level;if(c.isFirstNode){if(l=
+0,g[e].length>1)x=g[e][1],x.isFirstNode=!0}else if(c.isLastNode)l=g[e].length-1,x=g[e][l-1],x.isLastNode=!0;else for(p=0,q=g[e].length;p<q;p++)if(g[e][p].tId==c.tId){l=p;break}l>=0&&g[e].splice(l,1);if(r!=d.move.TYPE_INNER)for(p=0,q=j[e].length;p<q;p++)j[e][p].tId==a.tId&&(w=p);if(r==d.move.TYPE_INNER){a[e]||(a[e]=[]);if(a[e].length>0)t=a[e][a[e].length-1],t.isLastNode=!1;a[e].splice(a[e].length,0,c);c.isLastNode=!0;c.isFirstNode=a[e].length==1}else a.isFirstNode&&r==d.move.TYPE_PREV?(j[e].splice(w,
+0,c),t=a,t.isFirstNode=!1,c.parentTId=a.parentTId,c.isFirstNode=!0,c.isLastNode=!1):a.isLastNode&&r==d.move.TYPE_NEXT?(j[e].splice(w+1,0,c),t=a,t.isLastNode=!1,c.parentTId=a.parentTId,c.isFirstNode=!1,c.isLastNode=!0):(r==d.move.TYPE_PREV?j[e].splice(w,0,c):j[e].splice(w+1,0,c),c.parentTId=a.parentTId,c.isFirstNode=!1,c.isLastNode=!1);m.fixPIdKeyValue(b,c);m.setSonNodeLevel(b,c.getParentNode(),c);f.setNodeLineIcos(b,c);f.repairNodeLevelClass(b,c,D);!b.data.keep.parent&&g[e].length<1?(g.isParent=!1,
+g.open=!1,a=o(g,d.id.UL,b),r=o(g,d.id.SWITCH,b),e=o(g,d.id.ICON,b),f.replaceSwitchClass(g,r,d.folder.DOCU),f.replaceIcoClass(g,e,d.folder.DOCU),a.css("display","none")):x&&f.setNodeLineIcos(b,x);t&&f.setNodeLineIcos(b,t);b.check&&b.check.enable&&f.repairChkClass&&(f.repairChkClass(b,g),f.repairParentChkClassWithSelf(b,g),g!=c.parent&&f.repairParentChkClassWithSelf(b,c));i||f.expandCollapseParentNode(b,c.getParentNode(),!0,k)}},removeEditBtn:function(b,a){o(a,d.id.EDIT,b).unbind().remove()},removeRemoveBtn:function(b,
+a){o(a,d.id.REMOVE,b).unbind().remove()},removeTreeDom:function(b,a){a.isHover=!1;f.removeEditBtn(b,a);f.removeRemoveBtn(b,a);g.apply(b.view.removeHoverDom,[b.treeId,a])},repairNodeLevelClass:function(b,a,c){if(c!==a.level){var f=o(a,b),g=o(a,d.id.A,b),b=o(a,d.id.UL,b),c=d.className.LEVEL+c,a=d.className.LEVEL+a.level;f.removeClass(c);f.addClass(a);g.removeClass(c);g.addClass(a);b.removeClass(c);b.addClass(a)}},selectNodes:function(b,a){for(var c=0,d=a.length;c<d;c++)f.selectNode(b,a[c],c>0)}},event:{},
+data:{setSonNodeLevel:function(b,a,c){if(c){var d=b.data.key.children;c.level=a?a.level+1:0;if(c[d])for(var a=0,f=c[d].length;a<f;a++)c[d][a]&&m.setSonNodeLevel(b,c,c[d][a])}}}});var H=w.fn.zTree,g=H._z.tools,d=H.consts,f=H._z.view,m=H._z.data,o=g.$;m.exSetting({edit:{enable:!1,editNameSelectAll:!1,showRemoveBtn:!0,showRenameBtn:!0,removeTitle:"remove",renameTitle:"rename",drag:{autoExpandTrigger:!1,isCopy:!0,isMove:!0,prev:!0,next:!0,inner:!0,minMoveSize:5,borderMax:10,borderMin:-5,maxShowNodeNum:5,
+autoOpenTime:500}},view:{addHoverDom:null,removeHoverDom:null},callback:{beforeDrag:null,beforeDragOpen:null,beforeDrop:null,beforeEditName:null,beforeRename:null,onDrag:null,onDragMove:null,onDrop:null,onRename:null}});m.addInitBind(function(b){var a=b.treeObj,c=d.event;a.bind(c.RENAME,function(a,c,d,f){g.apply(b.callback.onRename,[a,c,d,f])});a.bind(c.DRAG,function(a,c,d,f){g.apply(b.callback.onDrag,[c,d,f])});a.bind(c.DRAGMOVE,function(a,c,d,f){g.apply(b.callback.onDragMove,[c,d,f])});a.bind(c.DROP,
+function(a,c,d,f,e,m,o){g.apply(b.callback.onDrop,[c,d,f,e,m,o])})});m.addInitUnBind(function(b){var b=b.treeObj,a=d.event;b.unbind(a.RENAME);b.unbind(a.DRAG);b.unbind(a.DRAGMOVE);b.unbind(a.DROP)});m.addInitCache(function(){});m.addInitNode(function(b,a,c){if(c)c.isHover=!1,c.editNameFlag=!1});m.addInitProxy(function(b){var a=b.target,c=m.getSetting(b.data.treeId),f=b.relatedTarget,k="",i=null,j="",e=null,o=null;if(g.eqs(b.type,"mouseover")){if(o=g.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+d.id.A}]))k=
+g.getNodeMainDom(o).id,j="hoverOverNode"}else if(g.eqs(b.type,"mouseout"))o=g.getMDom(c,f,[{tagName:"a",attrName:"treeNode"+d.id.A}]),o||(k="remove",j="hoverOutNode");else if(g.eqs(b.type,"mousedown")&&(o=g.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+d.id.A}])))k=g.getNodeMainDom(o).id,j="mousedownNode";if(k.length>0)switch(i=m.getNodeCache(c,k),j){case "mousedownNode":e=x.onMousedownNode;break;case "hoverOverNode":e=x.onHoverOverNode;break;case "hoverOutNode":e=x.onHoverOutNode}return{stop:!1,
+node:i,nodeEventType:j,nodeEventCallback:e,treeEventType:"",treeEventCallback:null}});m.addInitRoot(function(b){var b=m.getRoot(b),a=m.getRoots();b.curEditNode=null;b.curEditInput=null;b.curHoverNode=null;b.dragFlag=0;b.dragNodeShowBefore=[];b.dragMaskList=[];a.showHoverDom=!0});m.addZTreeTools(function(b,a){a.cancelEditName=function(a){m.getRoot(this.setting).curEditNode&&f.cancelCurEditNode(this.setting,a?a:null,!0)};a.copyNode=function(a,b,k,i){if(!b)return null;if(a&&!a.isParent&&this.setting.data.keep.leaf&&
+k===d.move.TYPE_INNER)return null;var j=this,e=g.clone(b);if(!a)a=null,k=d.move.TYPE_INNER;k==d.move.TYPE_INNER?(b=function(){f.addNodes(j.setting,a,[e],i)},g.canAsync(this.setting,a)?f.asyncNode(this.setting,a,i,b):b()):(f.addNodes(this.setting,a.parentNode,[e],i),f.moveNode(this.setting,a,e,k,!1,i));return e};a.editName=function(a){a&&a.tId&&a===m.getNodeCache(this.setting,a.tId)&&(a.parentTId&&f.expandCollapseParentNode(this.setting,a.getParentNode(),!0),f.editNode(this.setting,a))};a.moveNode=
+function(a,b,k,i){function j(){f.moveNode(e.setting,a,b,k,!1,i)}if(!b)return b;if(a&&!a.isParent&&this.setting.data.keep.leaf&&k===d.move.TYPE_INNER)return null;else if(a&&(b.parentTId==a.tId&&k==d.move.TYPE_INNER||o(b,this.setting).find("#"+a.tId).length>0))return null;else a||(a=null);var e=this;g.canAsync(this.setting,a)&&k===d.move.TYPE_INNER?f.asyncNode(this.setting,a,i,j):j();return b};a.setEditable=function(a){this.setting.edit.enable=a;return this.refresh()}});var N=f.cancelPreSelectedNode;
+f.cancelPreSelectedNode=function(b,a){for(var c=m.getRoot(b).curSelectedList,d=0,g=c.length;d<g;d++)if(!a||a===c[d])if(f.removeTreeDom(b,c[d]),a)break;N&&N.apply(f,arguments)};var O=f.createNodes;f.createNodes=function(b,a,c,d){O&&O.apply(f,arguments);c&&f.repairParentChkClassWithSelf&&f.repairParentChkClassWithSelf(b,d)};var V=f.makeNodeUrl;f.makeNodeUrl=function(b,a){return b.edit.enable?null:V.apply(f,arguments)};var L=f.removeNode;f.removeNode=function(b,a){var c=m.getRoot(b);if(c.curEditNode===
+a)c.curEditNode=null;L&&L.apply(f,arguments)};var P=f.selectNode;f.selectNode=function(b,a,c){var d=m.getRoot(b);if(m.isSelectedNode(b,a)&&d.curEditNode==a&&a.editNameFlag)return!1;P&&P.apply(f,arguments);f.addHoverDom(b,a);return!0};var Q=g.uCanDo;g.uCanDo=function(b,a){var c=m.getRoot(b);if(a&&(g.eqs(a.type,"mouseover")||g.eqs(a.type,"mouseout")||g.eqs(a.type,"mousedown")||g.eqs(a.type,"mouseup")))return!0;if(c.curEditNode)f.editNodeBlur=!1,c.curEditInput.focus();return!c.curEditNode&&(Q?Q.apply(f,
+arguments):!0)}})(jQuery);
diff --git a/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exhide.js b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exhide.js
new file mode 100644
index 0000000..05a5bfb
--- /dev/null
+++ b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exhide.js
@@ -0,0 +1,363 @@
+/*
+ * JQuery zTree exHideNodes v3.5.16
+ * http://zTree.me/
+ *
+ * Copyright (c) 2010 Hunter.z
+ *
+ * Licensed same as jquery - MIT License
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * email: hunter.z@263.net
+ * Date: 2014-03-09
+ */
+(function($){
+ //default init node of exLib
+ var _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {
+ if (typeof n.isHidden == "string") n.isHidden = tools.eqs(n.isHidden, "true");
+ n.isHidden = !!n.isHidden;
+ data.initHideForExCheck(setting, n);
+ },
+ //add dom for check
+ _beforeA = function(setting, node, html) {},
+ //update zTreeObj, add method of exLib
+ _zTreeTools = function(setting, zTreeTools) {
+ zTreeTools.showNodes = function(nodes, options) {
+ view.showNodes(setting, nodes, options);
+ }
+ zTreeTools.showNode = function(node, options) {
+ if (!node) {
+ return;
+ }
+ view.showNodes(setting, [node], options);
+ }
+ zTreeTools.hideNodes = function(nodes, options) {
+ view.hideNodes(setting, nodes, options);
+ }
+ zTreeTools.hideNode = function(node, options) {
+ if (!node) {
+ return;
+ }
+ view.hideNodes(setting, [node], options);
+ }
+
+ var _checkNode = zTreeTools.checkNode;
+ if (_checkNode) {
+ zTreeTools.checkNode = function(node, checked, checkTypeFlag, callbackFlag) {
+ if (!!node && !!node.isHidden) {
+ return;
+ }
+ _checkNode.apply(zTreeTools, arguments);
+ }
+ }
+ },
+ //method of operate data
+ _data = {
+ initHideForExCheck: function(setting, n) {
+ if (n.isHidden && setting.check && setting.check.enable) {
+ if(typeof n._nocheck == "undefined") {
+ n._nocheck = !!n.nocheck
+ n.nocheck = true;
+ }
+ n.check_Child_State = -1;
+ if (view.repairParentChkClassWithSelf) {
+ view.repairParentChkClassWithSelf(setting, n);
+ }
+ }
+ },
+ initShowForExCheck: function(setting, n) {
+ if (!n.isHidden && setting.check && setting.check.enable) {
+ if(typeof n._nocheck != "undefined") {
+ n.nocheck = n._nocheck;
+ delete n._nocheck;
+ }
+ if (view.setChkClass) {
+ var checkObj = $$(n, consts.id.CHECK, setting);
+ view.setChkClass(setting, checkObj, n);
+ }
+ if (view.repairParentChkClassWithSelf) {
+ view.repairParentChkClassWithSelf(setting, n);
+ }
+ }
+ }
+ },
+ //method of operate ztree dom
+ _view = {
+ clearOldFirstNode: function(setting, node) {
+ var n = node.getNextNode();
+ while(!!n){
+ if (n.isFirstNode) {
+ n.isFirstNode = false;
+ view.setNodeLineIcos(setting, n);
+ break;
+ }
+ if (n.isLastNode) {
+ break;
+ }
+ n = n.getNextNode();
+ }
+ },
+ clearOldLastNode: function(setting, node) {
+ var n = node.getPreNode();
+ while(!!n){
+ if (n.isLastNode) {
+ n.isLastNode = false;
+ view.setNodeLineIcos(setting, n);
+ break;
+ }
+ if (n.isFirstNode) {
+ break;
+ }
+ n = n.getPreNode();
+ }
+ },
+ makeDOMNodeMainBefore: function(html, setting, node) {
+ html.push("<li ", (node.isHidden ? "style='display:none;' " : ""), "id='", node.tId, "' class='", consts.className.LEVEL, node.level,"' tabindex='0' hidefocus='true' treenode>");
+ },
+ showNode: function(setting, node, options) {
+ node.isHidden = false;
+ data.initShowForExCheck(setting, node);
+ $$(node, setting).show();
+ },
+ showNodes: function(setting, nodes, options) {
+ if (!nodes || nodes.length == 0) {
+ return;
+ }
+ var pList = {}, i, j;
+ for (i=0, j=nodes.length; i<j; i++) {
+ var n = nodes[i];
+ if (!pList[n.parentTId]) {
+ var pn = n.getParentNode();
+ pList[n.parentTId] = (pn === null) ? data.getRoot(setting) : n.getParentNode();
+ }
+ view.showNode(setting, n, options);
+ }
+ for (var tId in pList) {
+ var children = pList[tId][setting.data.key.children];
+ view.setFirstNodeForShow(setting, children);
+ view.setLastNodeForShow(setting, children);
+ }
+ },
+ hideNode: function(setting, node, options) {
+ node.isHidden = true;
+ node.isFirstNode = false;
+ node.isLastNode = false;
+ data.initHideForExCheck(setting, node);
+ view.cancelPreSelectedNode(setting, node);
+ $$(node, setting).hide();
+ },
+ hideNodes: function(setting, nodes, options) {
+ if (!nodes || nodes.length == 0) {
+ return;
+ }
+ var pList = {}, i, j;
+ for (i=0, j=nodes.length; i<j; i++) {
+ var n = nodes[i];
+ if ((n.isFirstNode || n.isLastNode) && !pList[n.parentTId]) {
+ var pn = n.getParentNode();
+ pList[n.parentTId] = (pn === null) ? data.getRoot(setting) : n.getParentNode();
+ }
+ view.hideNode(setting, n, options);
+ }
+ for (var tId in pList) {
+ var children = pList[tId][setting.data.key.children];
+ view.setFirstNodeForHide(setting, children);
+ view.setLastNodeForHide(setting, children);
+ }
+ },
+ setFirstNode: function(setting, parentNode) {
+ var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
+ if (childLength > 0 && !parentNode[childKey][0].isHidden) {
+ parentNode[childKey][0].isFirstNode = true;
+ } else if (childLength > 0) {
+ view.setFirstNodeForHide(setting, parentNode[childKey]);
+ }
+ },
+ setLastNode: function(setting, parentNode) {
+ var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
+ if (childLength > 0 && !parentNode[childKey][0].isHidden) {
+ parentNode[childKey][childLength - 1].isLastNode = true;
+ } else if (childLength > 0) {
+ view.setLastNodeForHide(setting, parentNode[childKey]);
+ }
+ },
+ setFirstNodeForHide: function(setting, nodes) {
+ var n,i,j;
+ for (i=0, j=nodes.length; i<j; i++) {
+ n = nodes[i];
+ if (n.isFirstNode) {
+ break;
+ }
+ if (!n.isHidden && !n.isFirstNode) {
+ n.isFirstNode = true;
+ view.setNodeLineIcos(setting, n);
+ break;
+ } else {
+ n = null;
+ }
+ }
+ return n;
+ },
+ setFirstNodeForShow: function(setting, nodes) {
+ var n,i,j, first, old;
+ for(i=0, j=nodes.length; i<j; i++) {
+ n = nodes[i];
+ if (!first && !n.isHidden && n.isFirstNode) {
+ first = n;
+ break;
+ } else if (!first && !n.isHidden && !n.isFirstNode) {
+ n.isFirstNode = true;
+ first = n;
+ view.setNodeLineIcos(setting, n);
+ } else if (first && n.isFirstNode) {
+ n.isFirstNode = false;
+ old = n;
+ view.setNodeLineIcos(setting, n);
+ break;
+ } else {
+ n = null;
+ }
+ }
+ return {"new":first, "old":old};
+ },
+ setLastNodeForHide: function(setting, nodes) {
+ var n,i;
+ for (i=nodes.length-1; i>=0; i--) {
+ n = nodes[i];
+ if (n.isLastNode) {
+ break;
+ }
+ if (!n.isHidden && !n.isLastNode) {
+ n.isLastNode = true;
+ view.setNodeLineIcos(setting, n);
+ break;
+ } else {
+ n = null;
+ }
+ }
+ return n;
+ },
+ setLastNodeForShow: function(setting, nodes) {
+ var n,i,j, last, old;
+ for (i=nodes.length-1; i>=0; i--) {
+ n = nodes[i];
+ if (!last && !n.isHidden && n.isLastNode) {
+ last = n;
+ break;
+ } else if (!last && !n.isHidden && !n.isLastNode) {
+ n.isLastNode = true;
+ last = n;
+ view.setNodeLineIcos(setting, n);
+ } else if (last && n.isLastNode) {
+ n.isLastNode = false;
+ old = n;
+ view.setNodeLineIcos(setting, n);
+ break;
+ } else {
+ n = null;
+ }
+ }
+ return {"new":last, "old":old};
+ }
+ },
+
+ _z = {
+ view: _view,
+ data: _data
+ };
+ $.extend(true, $.fn.zTree._z, _z);
+
+ var zt = $.fn.zTree,
+ tools = zt._z.tools,
+ consts = zt.consts,
+ view = zt._z.view,
+ data = zt._z.data,
+ event = zt._z.event,
+ $$ = tools.$;
+
+ data.addInitNode(_initNode);
+ data.addBeforeA(_beforeA);
+ data.addZTreeTools(_zTreeTools);
+
+// Override method in core
+ var _dInitNode = data.initNode;
+ data.initNode = function(setting, level, node, parentNode, isFirstNode, isLastNode, openFlag) {
+ var tmpPNode = (parentNode) ? parentNode: data.getRoot(setting),
+ children = tmpPNode[setting.data.key.children];
+ data.tmpHideFirstNode = view.setFirstNodeForHide(setting, children);
+ data.tmpHideLastNode = view.setLastNodeForHide(setting, children);
+ view.setNodeLineIcos(setting, data.tmpHideFirstNode);
+ view.setNodeLineIcos(setting, data.tmpHideLastNode);
+ isFirstNode = (data.tmpHideFirstNode === node);
+ isLastNode = (data.tmpHideLastNode === node);
+ if (_dInitNode) _dInitNode.apply(data, arguments);
+ if (isLastNode) {
+ view.clearOldLastNode(setting, node);
+ }
+ };
+
+ var _makeChkFlag = data.makeChkFlag;
+ if (!!_makeChkFlag) {
+ data.makeChkFlag = function(setting, node) {
+ if (!!node && !!node.isHidden) {
+ return;
+ }
+ _makeChkFlag.apply(data, arguments);
+ }
+ }
+
+ var _getTreeCheckedNodes = data.getTreeCheckedNodes;
+ if (!!_getTreeCheckedNodes) {
+ data.getTreeCheckedNodes = function(setting, nodes, checked, results) {
+ if (!!nodes && nodes.length > 0) {
+ var p = nodes[0].getParentNode();
+ if (!!p && !!p.isHidden) {
+ return [];
+ }
+ }
+ return _getTreeCheckedNodes.apply(data, arguments);
+ }
+ }
+
+ var _getTreeChangeCheckedNodes = data.getTreeChangeCheckedNodes;
+ if (!!_getTreeChangeCheckedNodes) {
+ data.getTreeChangeCheckedNodes = function(setting, nodes, results) {
+ if (!!nodes && nodes.length > 0) {
+ var p = nodes[0].getParentNode();
+ if (!!p && !!p.isHidden) {
+ return [];
+ }
+ }
+ return _getTreeChangeCheckedNodes.apply(data, arguments);
+ }
+ }
+
+ var _expandCollapseSonNode = view.expandCollapseSonNode;
+ if (!!_expandCollapseSonNode) {
+ view.expandCollapseSonNode = function(setting, node, expandFlag, animateFlag, callback) {
+ if (!!node && !!node.isHidden) {
+ return;
+ }
+ _expandCollapseSonNode.apply(view, arguments);
+ }
+ }
+
+ var _setSonNodeCheckBox = view.setSonNodeCheckBox;
+ if (!!_setSonNodeCheckBox) {
+ view.setSonNodeCheckBox = function(setting, node, value, srcNode) {
+ if (!!node && !!node.isHidden) {
+ return;
+ }
+ _setSonNodeCheckBox.apply(view, arguments);
+ }
+ }
+
+ var _repairParentChkClassWithSelf = view.repairParentChkClassWithSelf;
+ if (!!_repairParentChkClassWithSelf) {
+ view.repairParentChkClassWithSelf = function(setting, node) {
+ if (!!node && !!node.isHidden) {
+ return;
+ }
+ _repairParentChkClassWithSelf.apply(view, arguments);
+ }
+ }
+})(jQuery); \ No newline at end of file
diff --git a/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exhide.min.js b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exhide.min.js
new file mode 100644
index 0000000..f1dce5b
--- /dev/null
+++ b/common/src/main/webapp/thirdparty/zTree/js/jquery.ztree.exhide.min.js
@@ -0,0 +1,22 @@
+/*
+ * JQuery zTree exHideNodes v3.5.16
+ * http://zTree.me/
+ *
+ * Copyright (c) 2010 Hunter.z
+ *
+ * Licensed same as jquery - MIT License
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * email: hunter.z@263.net
+ * Date: 2014-03-09
+ */
+(function(i){i.extend(!0,i.fn.zTree._z,{view:{clearOldFirstNode:function(c,a){for(var b=a.getNextNode();b;){if(b.isFirstNode){b.isFirstNode=!1;d.setNodeLineIcos(c,b);break}if(b.isLastNode)break;b=b.getNextNode()}},clearOldLastNode:function(c,a){for(var b=a.getPreNode();b;){if(b.isLastNode){b.isLastNode=!1;d.setNodeLineIcos(c,b);break}if(b.isFirstNode)break;b=b.getPreNode()}},makeDOMNodeMainBefore:function(c,a,b){c.push("<li ",b.isHidden?"style='display:none;' ":"","id='",b.tId,"' class='",l.className.LEVEL,
+b.level,"' tabindex='0' hidefocus='true' treenode>")},showNode:function(c,a){a.isHidden=!1;f.initShowForExCheck(c,a);j(a,c).show()},showNodes:function(c,a,b){if(a&&a.length!=0){var e={},g,k;for(g=0,k=a.length;g<k;g++){var h=a[g];if(!e[h.parentTId]){var i=h.getParentNode();e[h.parentTId]=i===null?f.getRoot(c):h.getParentNode()}d.showNode(c,h,b)}for(var j in e)a=e[j][c.data.key.children],d.setFirstNodeForShow(c,a),d.setLastNodeForShow(c,a)}},hideNode:function(c,a){a.isHidden=!0;a.isFirstNode=!1;a.isLastNode=
+!1;f.initHideForExCheck(c,a);d.cancelPreSelectedNode(c,a);j(a,c).hide()},hideNodes:function(c,a,b){if(a&&a.length!=0){var e={},g,k;for(g=0,k=a.length;g<k;g++){var h=a[g];if((h.isFirstNode||h.isLastNode)&&!e[h.parentTId]){var i=h.getParentNode();e[h.parentTId]=i===null?f.getRoot(c):h.getParentNode()}d.hideNode(c,h,b)}for(var j in e)a=e[j][c.data.key.children],d.setFirstNodeForHide(c,a),d.setLastNodeForHide(c,a)}},setFirstNode:function(c,a){var b=c.data.key.children,e=a[b].length;e>0&&!a[b][0].isHidden?
+a[b][0].isFirstNode=!0:e>0&&d.setFirstNodeForHide(c,a[b])},setLastNode:function(c,a){var b=c.data.key.children,e=a[b].length;e>0&&!a[b][0].isHidden?a[b][e-1].isLastNode=!0:e>0&&d.setLastNodeForHide(c,a[b])},setFirstNodeForHide:function(c,a){var b,e,g;for(e=0,g=a.length;e<g;e++){b=a[e];if(b.isFirstNode)break;if(!b.isHidden&&!b.isFirstNode){b.isFirstNode=!0;d.setNodeLineIcos(c,b);break}else b=null}return b},setFirstNodeForShow:function(c,a){var b,e,g,f,h;for(e=0,g=a.length;e<g;e++)if(b=a[e],!f&&!b.isHidden&&
+b.isFirstNode){f=b;break}else if(!f&&!b.isHidden&&!b.isFirstNode)b.isFirstNode=!0,f=b,d.setNodeLineIcos(c,b);else if(f&&b.isFirstNode){b.isFirstNode=!1;h=b;d.setNodeLineIcos(c,b);break}return{"new":f,old:h}},setLastNodeForHide:function(c,a){var b,e;for(e=a.length-1;e>=0;e--){b=a[e];if(b.isLastNode)break;if(!b.isHidden&&!b.isLastNode){b.isLastNode=!0;d.setNodeLineIcos(c,b);break}else b=null}return b},setLastNodeForShow:function(c,a){var b,e,g,f;for(e=a.length-1;e>=0;e--)if(b=a[e],!g&&!b.isHidden&&
+b.isLastNode){g=b;break}else if(!g&&!b.isHidden&&!b.isLastNode)b.isLastNode=!0,g=b,d.setNodeLineIcos(c,b);else if(g&&b.isLastNode){b.isLastNode=!1;f=b;d.setNodeLineIcos(c,b);break}return{"new":g,old:f}}},data:{initHideForExCheck:function(c,a){if(a.isHidden&&c.check&&c.check.enable){if(typeof a._nocheck=="undefined")a._nocheck=!!a.nocheck,a.nocheck=!0;a.check_Child_State=-1;d.repairParentChkClassWithSelf&&d.repairParentChkClassWithSelf(c,a)}},initShowForExCheck:function(c,a){if(!a.isHidden&&c.check&&
+c.check.enable){if(typeof a._nocheck!="undefined")a.nocheck=a._nocheck,delete a._nocheck;if(d.setChkClass){var b=j(a,l.id.CHECK,c);d.setChkClass(c,b,a)}d.repairParentChkClassWithSelf&&d.repairParentChkClassWithSelf(c,a)}}}});var i=i.fn.zTree,m=i._z.tools,l=i.consts,d=i._z.view,f=i._z.data,j=m.$;f.addInitNode(function(c,a,b){if(typeof b.isHidden=="string")b.isHidden=m.eqs(b.isHidden,"true");b.isHidden=!!b.isHidden;f.initHideForExCheck(c,b)});f.addBeforeA(function(){});f.addZTreeTools(function(c,a){a.showNodes=
+function(a,b){d.showNodes(c,a,b)};a.showNode=function(a,b){a&&d.showNodes(c,[a],b)};a.hideNodes=function(a,b){d.hideNodes(c,a,b)};a.hideNode=function(a,b){a&&d.hideNodes(c,[a],b)};var b=a.checkNode;if(b)a.checkNode=function(c,d,f,h){(!c||!c.isHidden)&&b.apply(a,arguments)}});var n=f.initNode;f.initNode=function(c,a,b,e,g,i,h){var j=(e?e:f.getRoot(c))[c.data.key.children];f.tmpHideFirstNode=d.setFirstNodeForHide(c,j);f.tmpHideLastNode=d.setLastNodeForHide(c,j);d.setNodeLineIcos(c,f.tmpHideFirstNode);
+d.setNodeLineIcos(c,f.tmpHideLastNode);g=f.tmpHideFirstNode===b;i=f.tmpHideLastNode===b;n&&n.apply(f,arguments);i&&d.clearOldLastNode(c,b)};var o=f.makeChkFlag;if(o)f.makeChkFlag=function(c,a){(!a||!a.isHidden)&&o.apply(f,arguments)};var p=f.getTreeCheckedNodes;if(p)f.getTreeCheckedNodes=function(c,a,b,e){if(a&&a.length>0){var d=a[0].getParentNode();if(d&&d.isHidden)return[]}return p.apply(f,arguments)};var q=f.getTreeChangeCheckedNodes;if(q)f.getTreeChangeCheckedNodes=function(c,a,b){if(a&&a.length>
+0){var d=a[0].getParentNode();if(d&&d.isHidden)return[]}return q.apply(f,arguments)};var r=d.expandCollapseSonNode;if(r)d.expandCollapseSonNode=function(c,a,b,e,f){(!a||!a.isHidden)&&r.apply(d,arguments)};var s=d.setSonNodeCheckBox;if(s)d.setSonNodeCheckBox=function(c,a,b,e){(!a||!a.isHidden)&&s.apply(d,arguments)};var t=d.repairParentChkClassWithSelf;if(t)d.repairParentChkClassWithSelf=function(c,a){(!a||!a.isHidden)&&t.apply(d,arguments)}})(jQuery);