ztree 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/lib/assets/rails/engine.rb +6 -0
- data/lib/exts/array.rb +33 -0
- data/lib/exts/hash.rb +11 -0
- data/lib/ztree.rb +17 -0
- data/lib/ztree/controller.rb +42 -0
- data/lib/ztree/helpers.rb +54 -0
- data/lib/ztree/railtie.rb +11 -0
- data/lib/ztree/sort_tree.rb +42 -0
- data/vendor/assets/images/diy/1_close.png +0 -0
- data/vendor/assets/images/diy/1_open.png +0 -0
- data/vendor/assets/images/diy/2.png +0 -0
- data/vendor/assets/images/diy/3.png +0 -0
- data/vendor/assets/images/diy/4.png +0 -0
- data/vendor/assets/images/diy/5.png +0 -0
- data/vendor/assets/images/diy/6.png +0 -0
- data/vendor/assets/images/diy/7.png +0 -0
- data/vendor/assets/images/diy/8.png +0 -0
- data/vendor/assets/images/diy/9.png +0 -0
- data/vendor/assets/images/line_conn.gif +0 -0
- data/vendor/assets/images/loading.gif +0 -0
- data/vendor/assets/images/zTreeStandard.gif +0 -0
- data/vendor/assets/images/zTreeStandard.png +0 -0
- data/vendor/assets/javascripts/ztree.js +157 -0
- data/vendor/assets/stylesheets/ztree.css +98 -0
- data/ztree.gemspec +15 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ccb07a9b7f8965bf05a1bc83299278141e67c3b4
|
4
|
+
data.tar.gz: ccf00d5d61a1da7fda1fd9768b4764f8f683905e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a7b21e405fbf48fc507eb17a113d2c66137b44471539849eab8d4de838e6727662cef8c25d8f4ae48def9e60ff9f655df7d0dc3a163a98764e04f4f27314e52f
|
7
|
+
data.tar.gz: 955976670af61e244171df895f49feced19bf059d7e4bba5769d2c9b5ec390a58789fa1f1a9ee49a3ee7360ada79c3657c60abaf7068ad189856488199c024b4
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/*.gem
|
data/lib/exts/array.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class Array
|
3
|
+
def to_ztree_node(*args)
|
4
|
+
opts = args.extract_options!
|
5
|
+
checked_ids = opts[:checked_ids] ? opts[:checked_ids].split(',') : []
|
6
|
+
opts.delete(:checked_ids)
|
7
|
+
self.inject([]) do |nodes, h|
|
8
|
+
ha = {
|
9
|
+
id: h.id,
|
10
|
+
name: h.name,
|
11
|
+
pId: h.parent_id.blank? ? 0 : h.parent_id,
|
12
|
+
open: false
|
13
|
+
}
|
14
|
+
[opts, args].each do |opt|
|
15
|
+
opt.to_h.each do |symb, metd|
|
16
|
+
val = h.respond_to?(metd) ? h.send(metd) : metd
|
17
|
+
ha = ha.merge(symb => val)
|
18
|
+
ha = ha.merge(checked: true) if checked_ids.include?(h.id.to_s)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
nodes << ha
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_h
|
26
|
+
return {} unless self.all? {|a| a.is_a?(Symbol) || a.is_a?(String)}
|
27
|
+
self.inject({}) {|h,a| h[a] = a;h }
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_sorted_nodes
|
31
|
+
self.group_by(&:parent_id).each {|k,v| v.sort_by! &:order_num}.to_a.flatten.select{|c| !c.is_a?Integer}.compact
|
32
|
+
end
|
33
|
+
end
|
data/lib/exts/hash.rb
ADDED
data/lib/ztree.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require "rails"
|
2
|
+
require "exts/hash"
|
3
|
+
require "exts/array"
|
4
|
+
require "assets/rails/engine"
|
5
|
+
require "ztree/sort_tree"
|
6
|
+
require "ztree/controller"
|
7
|
+
require "ztree/helpers"
|
8
|
+
|
9
|
+
module Ztrr
|
10
|
+
autoload :Controller, 'ztree/controller'
|
11
|
+
end
|
12
|
+
|
13
|
+
class ActionController::Base
|
14
|
+
include Ztree::Controller
|
15
|
+
end
|
16
|
+
|
17
|
+
ActiveRecord::Base.send :include, SortTree
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Ztree
|
2
|
+
module Controller
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
def get_tree
|
5
|
+
mo_str = params[:model_name]
|
6
|
+
ztree_name = params[:ztree_name] || 'name'
|
7
|
+
checked_ids = params[:checked_ids] || ''
|
8
|
+
the_model = Object.const_get(mo_str)
|
9
|
+
conditions = ''
|
10
|
+
conditions += "name like '%#{params[:query]}%'" if params[:query]
|
11
|
+
objs = the_model.where(conditions)
|
12
|
+
opts = {
|
13
|
+
name: ztree_name,
|
14
|
+
checked_ids: checked_ids
|
15
|
+
}
|
16
|
+
render text: objs.to_ztree_node(opts).to_json
|
17
|
+
end
|
18
|
+
|
19
|
+
def sort_tree
|
20
|
+
return render text: 'error' unless params[:model_name]
|
21
|
+
mo_str = params[:model_name]
|
22
|
+
the_model = Object.const_get(mo_str)
|
23
|
+
arr = params[:sorted_array]
|
24
|
+
p_id = arr.shift
|
25
|
+
parent = p_id != '0' ? the_model.find(p_id) : the_model
|
26
|
+
parent.update_sorted_numbers(arr)
|
27
|
+
render text: arr
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# module Ztree
|
33
|
+
# class Railtie < Rails::Railtie
|
34
|
+
# initializer "ztree.action_controller" do
|
35
|
+
# ActiveSupport.on_load(:action_controller) do
|
36
|
+
# # include Ztree::Controller
|
37
|
+
# ActionController::Base.send :include, Ztree::Controller
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
# end
|
42
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module ActionView
|
2
|
+
module Helpers
|
3
|
+
|
4
|
+
|
5
|
+
def tree_list(link_title = '', opts = {})
|
6
|
+
id, cls_name = opts[:id] || 'tree-list', opts[:class] || 'menus_ztree ztree small'
|
7
|
+
ul = content_tag :ul, '', {id: id, class: cls_name, style: "width:260px; overflow:auto;"}.merge(opts)
|
8
|
+
init_tree_js(link_title) + content_tag(:div, ul, class: 'ground fl')
|
9
|
+
end
|
10
|
+
|
11
|
+
def ztree_settings(opts = {})
|
12
|
+
default_settings = {
|
13
|
+
view: {
|
14
|
+
addHoverDom: "addHoverDom",
|
15
|
+
removeHoverDom: "removeHoverDom",
|
16
|
+
selectedMulti: false,
|
17
|
+
},
|
18
|
+
check: {
|
19
|
+
#enable: true
|
20
|
+
},
|
21
|
+
edit: {
|
22
|
+
enable: true,
|
23
|
+
editNameSelectAll: true,
|
24
|
+
showRemoveBtn: true,
|
25
|
+
showRenameBtn: true,
|
26
|
+
drag: {
|
27
|
+
isCopy: true,
|
28
|
+
isMove: true,
|
29
|
+
prev: true,
|
30
|
+
inner: false,
|
31
|
+
next: true,
|
32
|
+
}
|
33
|
+
},
|
34
|
+
data: {
|
35
|
+
simpleData: {
|
36
|
+
enable: true
|
37
|
+
}
|
38
|
+
},
|
39
|
+
callback: {
|
40
|
+
beforeDrag: "beforeDrag",
|
41
|
+
beforeDrop: "beforeDrop",
|
42
|
+
beforeEditName: "beforeEditName",
|
43
|
+
beforeRemove: "beforeRemove",
|
44
|
+
onDrop: "onDrop",
|
45
|
+
onRemove: "onRemove",
|
46
|
+
beforeRename: "beforeRename",
|
47
|
+
onRename: "onRename",
|
48
|
+
onClick: "onClick",
|
49
|
+
}
|
50
|
+
}
|
51
|
+
default_settings.merge(opts).to_json.html_safe.delete("\"").gsub("=>",": ")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module SortTree
|
2
|
+
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
module ClassMethods
|
6
|
+
def sorted
|
7
|
+
all_parents.inject([]) do |cs, r|
|
8
|
+
cs << r
|
9
|
+
cs << r.sorted_children
|
10
|
+
end.flatten.uniq
|
11
|
+
end
|
12
|
+
|
13
|
+
def update_sorted_numbers(numbers)
|
14
|
+
numbers.each_with_index {|id, i| self.find(id).update_order(i + 1)}
|
15
|
+
end
|
16
|
+
|
17
|
+
def all_parents
|
18
|
+
all.select {|c| c.has_children? || c.ancestry.nil?}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def sorted_children
|
23
|
+
children.sort_by{|c| c.order_num}
|
24
|
+
end
|
25
|
+
|
26
|
+
def sorted_children_ids
|
27
|
+
sorted_children.inject([]) {|ids, c| ids << c.id} if !children.empty?
|
28
|
+
end
|
29
|
+
|
30
|
+
def update_order_number
|
31
|
+
update_order(parent ? parent.children.size + 1 : 0)
|
32
|
+
end
|
33
|
+
|
34
|
+
def update_order(num)
|
35
|
+
update_attribute(:order_num, num)
|
36
|
+
end
|
37
|
+
|
38
|
+
def update_sorted_numbers(numbers)
|
39
|
+
return false if numbers.size != children.size
|
40
|
+
self.class.update_sorted_numbers(numbers)
|
41
|
+
end
|
42
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,157 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* JQuery zTree core 3.5.13
|
4
|
+
* http://zTree.me/
|
5
|
+
*
|
6
|
+
* Copyright (c) 2010 Hunter.z
|
7
|
+
*
|
8
|
+
* Licensed same as jquery - MIT License
|
9
|
+
* http://www.opensource.org/licenses/mit-license.php
|
10
|
+
*
|
11
|
+
* email: hunter.z@263.net
|
12
|
+
* Date: 2013-06-02
|
13
|
+
*/
|
14
|
+
(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},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:[],
|
15
|
+
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])});
|
16
|
+
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])})}],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)}],
|
17
|
+
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;if(c[e]&&c[e].length>0){if(typeof c.open=="string")c.open=j.eqs(c.open,"true");c.open=!!c.open;c.isParent=!0;c.zAsync=!0}else{c.open=!1;if(typeof c.isParent=="string")c.isParent=j.eqs(c.isParent,"true");c.isParent=!!c.isParent;c.zAsync=!c.isParent}c.isFirstNode=f;c.isLastNode=g;c.getParentNode=
|
18
|
+
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"+
|
19
|
+
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?
|
20
|
+
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=
|
21
|
+
!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)},
|
22
|
+
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)},
|
23
|
+
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=
|
24
|
+
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,
|
25
|
+
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,
|
26
|
+
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},
|
27
|
+
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,
|
28
|
+
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,
|
29
|
+
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,
|
30
|
+
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,
|
31
|
+
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},b=b.treeObj;b.bind("selectstart",function(a){a=a.originalEvent.srcElement.nodeName.toLowerCase();return a==="input"||a==="textarea"}).css({"-moz-user-select":"-moz-none"});b.bind("click",a,m.proxy);b.bind("dblclick",a,m.proxy);b.bind("mouseover",a,m.proxy);b.bind("mouseout",a,m.proxy);b.bind("mousedown",a,m.proxy);b.bind("mouseup",
|
32
|
+
a,m.proxy);b.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,
|
33
|
+
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&&
|
34
|
+
b.ctrlKey&&h.isSelectedNode(c,a)?0:c.view.autoCancelSelected&&b.ctrlKey&&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,
|
35
|
+
[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,
|
36
|
+
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"&&
|
37
|
+
(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)},uCanDo:function(){return!0}},i={addNodes:function(b,a,c,d){if(!b.data.keep.leaf||
|
38
|
+
!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=
|
39
|
+
[],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,
|
40
|
+
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));if(!k(a,e.id.UL,b).get(0)){var 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,
|
41
|
+
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,
|
42
|
+
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==
|
43
|
+
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=
|
44
|
+
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),
|
45
|
+
b.treeObj.empty())},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=
|
46
|
+
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,
|
47
|
+
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=
|
48
|
+
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,"&").replace(/</g,"<").replace(/>/g,">");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",
|
49
|
+
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",
|
50
|
+
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,"'").replace(/</g,"<").replace(/>/g,">"),"'");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+
|
51
|
+
"_":"")+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==
|
52
|
+
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=
|
53
|
+
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?
|
54
|
+
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;
|
55
|
+
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),
|
56
|
+
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-
|
57
|
+
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,
|
58
|
+
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",
|
59
|
+
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||
|
60
|
+
!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"},id:{A:"_a",ICON:"_ico",SPAN:"_span",SWITCH:"_switch",UL:"_ul"},line:{ROOT:"root",
|
61
|
+
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===
|
62
|
+
"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,
|
63
|
+
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,
|
64
|
+
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),
|
65
|
+
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,
|
66
|
+
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),
|
67
|
+
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,
|
68
|
+
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,
|
69
|
+
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);
|
70
|
+
|
71
|
+
/*
|
72
|
+
* JQuery zTree excheck 3.5.13
|
73
|
+
* http://zTree.me/
|
74
|
+
*
|
75
|
+
* Copyright (c) 2010 Hunter.z
|
76
|
+
*
|
77
|
+
* Licensed same as jquery - MIT License
|
78
|
+
* http://www.opensource.org/licenses/mit-license.php
|
79
|
+
*
|
80
|
+
* email: hunter.z@263.net
|
81
|
+
* Date: 2013-06-02
|
82
|
+
*/
|
83
|
+
(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(b,
|
84
|
+
a){if(a.chkDisabled===!0)return!1;var c=f.getSetting(b.data.treeId),d=c.data.key.checked;if(k.apply(c.callback.beforeCheck,[c.treeId,a],!0)==!1)return!0;a[d]=!a[d];e.checkNodeRelation(c,a);d=n(a,j.id.CHECK,c);e.setChkClass(c,d,a);e.repairParentChkClassWithSelf(c,a);c.treeObj.trigger(j.event.CHECK,[b,c.treeId,a]);return!0};q=function(b,a){if(a.chkDisabled===!0)return!1;var c=f.getSetting(b.data.treeId),d=n(a,j.id.CHECK,c);a.check_Focus=!0;e.setChkClass(c,d,a);return!0};r=function(b,a){if(a.chkDisabled===
|
85
|
+
!0)return!1;var c=f.getSetting(b.data.treeId),d=n(a,j.id.CHECK,c);a.check_Focus=!1;e.setChkClass(c,d,a);return!0};m.extend(!0,m.fn.zTree.consts,o);m.extend(!0,m.fn.zTree._z,{tools:{},view:{checkNodeRelation:function(b,a){var c,d,h,i=b.data.key.children,l=b.data.key.checked;c=j.radio;if(b.check.chkStyle==c.STYLE){var g=f.getRadioCheckedList(b);if(a[l])if(b.check.radioType==c.TYPE_ALL){for(d=g.length-1;d>=0;d--)c=g[d],c[l]=!1,g.splice(d,1),e.setChkClass(b,n(c,j.id.CHECK,b),c),c.parentTId!=a.parentTId&&
|
86
|
+
e.repairParentChkClassWithSelf(b,c);g.push(a)}else{g=a.parentTId?a.getParentNode():f.getRoot(b);for(d=0,h=g[i].length;d<h;d++)c=g[i][d],c[l]&&c!=a&&(c[l]=!1,e.setChkClass(b,n(c,j.id.CHECK,b),c))}else if(b.check.radioType==c.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||b.check.chkboxType.Y.indexOf("s")>-1)&&e.setSonNodeCheckBox(b,a,!0),!a[l]&&(!a[i]||a[i].length==0||b.check.chkboxType.N.indexOf("s")>-1)&&e.setSonNodeCheckBox(b,a,!1),a[l]&&
|
87
|
+
b.check.chkboxType.Y.indexOf("p")>-1&&e.setParentNodeCheckBox(b,a,!0),!a[l]&&b.check.chkboxType.N.indexOf("p")>-1&&e.setParentNodeCheckBox(b,a,!1)},makeChkClass:function(b,a){var c=b.data.key.checked,d=j.checkbox,h=j.radio,i="",i=a.chkDisabled===!0?d.DISABLED:a.halfCheck?d.PART:b.check.chkStyle==h.STYLE?a.check_Child_State<1?d.FULL:d.PART:a[c]?a.check_Child_State===2||a.check_Child_State===-1?d.FULL:d.PART:a.check_Child_State<1?d.FULL:d.PART,c=b.check.chkStyle+"_"+(a[c]?d.TRUE:d.FALSE)+"_"+i,c=a.check_Focus&&
|
88
|
+
a.chkDisabled!==!0?c+"_"+d.FOCUS:c;return j.className.BUTTON+" "+d.DEFAULT+" "+c},repairAllChk:function(b,a){if(b.check.enable&&b.check.chkStyle===j.checkbox.STYLE)for(var c=b.data.key.checked,d=b.data.key.children,h=f.getRoot(b),i=0,l=h[d].length;i<l;i++){var g=h[d][i];g.nocheck!==!0&&g.chkDisabled!==!0&&(g[c]=a);e.setSonNodeCheckBox(b,g,a)}},repairChkClass:function(b,a){if(a&&(f.makeChkFlag(b,a),a.nocheck!==!0)){var c=n(a,j.id.CHECK,b);e.setChkClass(b,c,a)}},repairParentChkClass:function(b,a){if(a&&
|
89
|
+
a.parentTId){var c=a.getParentNode();e.repairChkClass(b,c);e.repairParentChkClass(b,c)}},repairParentChkClassWithSelf:function(b,a){if(a){var c=b.data.key.children;a[c]&&a[c].length>0?e.repairParentChkClass(b,a[c][0]):e.repairParentChkClass(b,a)}},repairSonChkDisabled:function(b,a,c,d){if(a){var h=b.data.key.children;if(a.chkDisabled!=c)a.chkDisabled=c;e.repairChkClass(b,a);if(a[h]&&d)for(var i=0,l=a[h].length;i<l;i++)e.repairSonChkDisabled(b,a[h][i],c,d)}},repairParentChkDisabled:function(b,a,c,
|
90
|
+
d){if(a){if(a.chkDisabled!=c&&d)a.chkDisabled=c;e.repairChkClass(b,a);e.repairParentChkDisabled(b,a.getParentNode(),c,d)}},setChkClass:function(b,a,c){a&&(c.nocheck===!0?a.hide():a.show(),a.removeClass(),a.addClass(e.makeChkClass(b,c)))},setParentNodeCheckBox:function(b,a,c,d){var h=b.data.key.children,i=b.data.key.checked,l=n(a,j.id.CHECK,b);d||(d=a);f.makeChkFlag(b,a);a.nocheck!==!0&&a.chkDisabled!==!0&&(a[i]=c,e.setChkClass(b,l,a),b.check.autoCheckTrigger&&a!=d&&b.treeObj.trigger(j.event.CHECK,
|
91
|
+
[null,b.treeId,a]));if(a.parentTId){l=!0;if(!c)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(b,a.getParentNode(),c,d)}},setSonNodeCheckBox:function(b,a,c,d){if(a){var h=b.data.key.children,i=b.data.key.checked,l=n(a,j.id.CHECK,b);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(b,
|
92
|
+
o,c,d);o.chkDisabled===!0&&(g=!0)}if(a!=f.getRoot(b)&&a.chkDisabled!==!0){g&&a.nocheck!==!0&&f.makeChkFlag(b,a);if(a.nocheck!==!0&&a.chkDisabled!==!0){if(a[i]=c,!g)a.check_Child_State=a[h]&&a[h].length>0?c?2:0:-1}else a.check_Child_State=-1;e.setChkClass(b,l,a);b.check.autoCheckTrigger&&a!=d&&a.nocheck!==!0&&a.chkDisabled!==!0&&b.treeObj.trigger(j.event.CHECK,[null,b.treeId,a])}}}},event:{},data:{getRadioCheckedList:function(b){for(var a=f.getRoot(b).radioCheckedList,c=0,d=a.length;c<d;c++)f.getNodeCache(b,
|
93
|
+
a[c].tId)||(a.splice(c,1),c--,d--);return a},getCheckStatus:function(b,a){if(!b.check.enable||a.nocheck||a.chkDisabled)return null;var c=b.data.key.checked;return{checked:a[c],half:a.halfCheck?a.halfCheck:b.check.chkStyle==j.radio.STYLE?a.check_Child_State===2:a[c]?a.check_Child_State>-1&&a.check_Child_State<2:a.check_Child_State>0}},getTreeCheckedNodes:function(b,a,c,d){if(!a)return[];for(var h=b.data.key.children,i=b.data.key.checked,e=c&&b.check.chkStyle==j.radio.STYLE&&b.check.radioType==j.radio.TYPE_ALL,
|
94
|
+
d=!d?[]:d,g=0,k=a.length;g<k;g++){if(a[g].nocheck!==!0&&a[g].chkDisabled!==!0&&a[g][i]==c&&(d.push(a[g]),e))break;f.getTreeCheckedNodes(b,a[g][h],c,d);if(e&&d.length>0)break}return d},getTreeChangeCheckedNodes:function(b,a,c){if(!a)return[];for(var d=b.data.key.children,h=b.data.key.checked,c=!c?[]:c,i=0,e=a.length;i<e;i++)a[i].nocheck!==!0&&a[i].chkDisabled!==!0&&a[i][h]!=a[i].checkedOld&&c.push(a[i]),f.getTreeChangeCheckedNodes(b,a[i][d],c);return c},makeChkFlag:function(b,a){if(a){var c=b.data.key.children,
|
95
|
+
d=b.data.key.checked,h=-1;if(a[c])for(var i=0,e=a[c].length;i<e;i++){var g=a[c][i],f=-1;if(b.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(b.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===
|
96
|
+
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(b){b.treeObj.bind(j.event.CHECK,function(a,c,d,h){k.apply(b.callback.onCheck,[c?c:a,d,h])})});f.addInitUnBind(function(b){b.treeObj.unbind(j.event.CHECK)});f.addInitCache(function(){});f.addInitNode(function(b,a,c,d){if(c){a=b.data.key.checked;typeof c[a]=="string"&&(c[a]=k.eqs(c[a],
|
97
|
+
"true"));c[a]=!!c[a];c.checkedOld=c[a];if(typeof c.nocheck=="string")c.nocheck=k.eqs(c.nocheck,"true");c.nocheck=!!c.nocheck||b.check.nocheckInherit&&d&&!!d.nocheck;if(typeof c.chkDisabled=="string")c.chkDisabled=k.eqs(c.chkDisabled,"true");c.chkDisabled=!!c.chkDisabled||b.check.chkDisabledInherit&&d&&!!d.chkDisabled;if(typeof c.halfCheck=="string")c.halfCheck=k.eqs(c.halfCheck,"true");c.halfCheck=!!c.halfCheck;c.check_Child_State=-1;c.check_Focus=!1;c.getCheckStatus=function(){return f.getCheckStatus(b,
|
98
|
+
c)};b.check.chkStyle==j.radio.STYLE&&b.check.radioType==j.radio.TYPE_ALL&&c[a]&&f.getRoot(b).radioCheckedList.push(c)}});f.addInitProxy(function(b){var a=b.target,c=f.getSetting(b.data.treeId),d="",h=null,e="",l=null;if(k.eqs(b.type,"mouseover")){if(c.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(b.type,"mouseout")){if(c.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=
|
99
|
+
k.getNodeMainDom(a).id,e="mouseoutCheck"}else if(k.eqs(b.type,"click")&&c.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(c,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(b){f.getRoot(b).radioCheckedList=[]});
|
100
|
+
f.addBeforeA(function(b,a,c){b.check.enable&&(f.makeChkFlag(b,a),c.push("<span ID='",a.tId,j.id.CHECK,"' class='",e.makeChkClass(b,a),"' treeNode",j.id.CHECK,a.nocheck===!0?" style='display:none;'":"","></span>"))});f.addZTreeTools(function(b,a){a.checkNode=function(a,c,i,f){var g=b.data.key.checked;if(a.chkDisabled!==!0&&(c!==!0&&c!==!1&&(c=!a[g]),f=!!f,(a[g]!==c||i)&&!(f&&k.apply(this.setting.callback.beforeCheck,[b.treeId,a],!0)==!1)&&k.uCanDo(this.setting)&&b.check.enable&&a.nocheck!==!0))a[g]=
|
101
|
+
c,c=n(a,j.id.CHECK,b),(i||b.check.chkStyle===j.radio.STYLE)&&e.checkNodeRelation(b,a),e.setChkClass(b,c,a),e.repairParentChkClassWithSelf(b,a),f&&b.treeObj.trigger(j.event.CHECK,[null,b.treeId,a])};a.checkAllNodes=function(a){e.repairAllChk(b,!!a)};a.getCheckedNodes=function(a){var c=b.data.key.children;return f.getTreeCheckedNodes(b,f.getRoot(b)[c],a!==!1)};a.getChangeCheckedNodes=function(){var a=b.data.key.children;return f.getTreeChangeCheckedNodes(b,f.getRoot(b)[a])};a.setChkDisabled=function(a,
|
102
|
+
c,f,j){c=!!c;f=!!f;e.repairSonChkDisabled(b,a,c,!!j);e.repairParentChkDisabled(b,a.getParentNode(),c,f)};var c=a.updateNode;a.updateNode=function(d,f){c&&c.apply(a,arguments);if(d&&b.check.enable&&n(d,b).get(0)&&k.uCanDo(b)){var i=n(d,j.id.CHECK,b);(f==!0||b.check.chkStyle===j.radio.STYLE)&&e.checkNodeRelation(b,d);e.setChkClass(b,i,d);e.repairParentChkClassWithSelf(b,d)}}});var s=e.createNodes;e.createNodes=function(b,a,c,d){s&&s.apply(e,arguments);c&&e.repairParentChkClassWithSelf(b,d)};var t=e.removeNode;
|
103
|
+
e.removeNode=function(b,a){var c=a.getParentNode();t&&t.apply(e,arguments);a&&c&&(e.repairChkClass(b,c),e.repairParentChkClass(b,c))};var u=e.appendNodes;e.appendNodes=function(b,a,c,d,h,i){var j="";u&&(j=u.apply(e,arguments));d&&f.makeChkFlag(b,d);return j}})(jQuery);
|
104
|
+
|
105
|
+
/*
|
106
|
+
* JQuery zTree exedit 3.5.13
|
107
|
+
* http://zTree.me/
|
108
|
+
*
|
109
|
+
* Copyright (c) 2010 Hunter.z
|
110
|
+
*
|
111
|
+
* Licensed same as jquery - MIT License
|
112
|
+
* http://www.opensource.org/licenses/mit-license.php
|
113
|
+
*
|
114
|
+
* email: hunter.z@263.net
|
115
|
+
* Date: 2013-06-02
|
116
|
+
*/
|
117
|
+
(function(u){var H={event:{DRAG:"ztree_drag",DROP:"ztree_drop",REMOVE:"ztree_remove",RENAME:"ztree_rename"},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=
|
118
|
+
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(A.dragFlag==0&&Math.abs(M-b.clientX)<e.edit.drag.minMoveSize&&Math.abs(N-b.clientY)<e.edit.drag.minMoveSize)return!0;var a,c,g,j,k;k=e.data.key.children;L.css("cursor","pointer");if(A.dragFlag==0){if(h.apply(e.callback.beforeDrag,[e.treeId,l],!0)==!1)return n(b),!0;for(a=0,c=l.length;a<c;a++){if(a==0)A.dragNodeShowBefore=
|
119
|
+
[];g=l[a];g.isParent&&g.open?(f.expandCollapseNode(e,g,!g.open),A.dragNodeShowBefore[g.tId]=!0):A.dragNodeShowBefore[g.tId]=!1}A.dragFlag=1;t.showHoverDom=!1;h.showIfameMask(e,!0);g=!0;j=-1;if(l.length>1){var s=l[0].parentTId?l[0].getParentNode()[k]:m.getNodes(e);k=[];for(a=0,c=s.length;a<c;a++)if(A.dragNodeShowBefore[s[a].tId]!==void 0&&(g&&j>-1&&j+1!==a&&(g=!1),k.push(s[a]),j=a),l.length===k.length){l=k;break}}g&&(G=l[0].getPreNode(),Q=l[l.length-1].getNextNode());C=o("<ul class='zTreeDragUL'></ul>",
|
120
|
+
e);for(a=0,c=l.length;a<c;a++)if(g=l[a],g.editNameFlag=!1,f.selectNode(e,g,a>0),f.removeTreeDom(e,g),j=o("<li id='"+g.tId+"_tmp'></li>",e),j.append(o(g,d.id.A,e).clone()),j.css("padding","0"),j.children("#"+g.tId+d.id.A).removeClass(d.node.CURSELECTED),C.append(j),a==e.edit.drag.maxShowNodeNum-1){j=o("<li id='"+g.tId+"_moretmp'><a> ... </a></li>",e);C.append(j);break}C.attr("id",l[0].tId+d.id.UL+"_tmp");C.addClass(e.treeObj.attr("class"));C.appendTo(L);z=o("<span class='tmpzTreeMove_arrow'></span>",
|
121
|
+
e);z.attr("id","zTreeMove_arrow_tmp");z.appendTo(L);e.treeObj.trigger(d.event.DRAG,[b,e.treeId,l])}if(A.dragFlag==1){r&&z.attr("id")==b.target.id&&v&&b.clientX+E.scrollLeft()+2>u("#"+v+d.id.A,r).offset().left?(g=u("#"+v+d.id.A,r),b.target=g.length>0?g.get(0):b.target):r&&(r.removeClass(d.node.TMPTARGET_TREE),v&&u("#"+v+d.id.A,r).removeClass(d.node.TMPTARGET_NODE+"_"+d.move.TYPE_PREV).removeClass(d.node.TMPTARGET_NODE+"_"+H.move.TYPE_NEXT).removeClass(d.node.TMPTARGET_NODE+"_"+H.move.TYPE_INNER));
|
122
|
+
v=r=null;I=!1;i=e;g=m.getSettings();for(var D in g)if(g[D].treeId&&g[D].edit.enable&&g[D].treeId!=e.treeId&&(b.target.id==g[D].treeId||u(b.target).parents("#"+g[D].treeId).length>0))I=!0,i=g[D];D=E.scrollTop();j=E.scrollLeft();k=i.treeObj.offset();a=i.treeObj.get(0).scrollHeight;g=i.treeObj.get(0).scrollWidth;c=b.clientY+D-k.top;var p=i.treeObj.height()+k.top-b.clientY-D,q=b.clientX+j-k.left,x=i.treeObj.width()+k.left-b.clientX-j;k=c<e.edit.drag.borderMax&&c>e.edit.drag.borderMin;var s=p<e.edit.drag.borderMax&&
|
123
|
+
p>e.edit.drag.borderMin,J=q<e.edit.drag.borderMax&&q>e.edit.drag.borderMin,F=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=k&&i.treeObj.scrollTop()<=0,x=s&&i.treeObj.scrollTop()+i.treeObj.height()+10>=a,O=J&&i.treeObj.scrollLeft()<=0,P=F&&i.treeObj.scrollLeft()+i.treeObj.width()+10>=g;if(b.target.id&&i.treeObj.find("#"+b.target.id).length>0){for(var B=b.target;B&&B.tagName&&!h.eqs(B.tagName,"li")&&
|
124
|
+
B.id!=i.treeId;)B=B.parentNode;var R=!0;for(a=0,c=l.length;a<c;a++)if(g=l[a],B.id===g.tId){R=!1;break}else if(o(g,e).find("#"+B.id).length>0){R=!1;break}if(R&&b.target.id&&(b.target.id==B.id+d.id.A||u(b.target).parents("#"+B.id+d.id.A).length>0))r=u(B),v=B.id}g=l[0];if(p&&(b.target.id==i.treeId||u(b.target).parents("#"+i.treeId).length>0)){if(!r&&(b.target.id==i.treeId||q||x||O||P)&&(I||!I&&g.parentTId))r=i.treeObj;k?i.treeObj.scrollTop(i.treeObj.scrollTop()-10):s&&i.treeObj.scrollTop(i.treeObj.scrollTop()+
|
125
|
+
10);J?i.treeObj.scrollLeft(i.treeObj.scrollLeft()-10):F&&i.treeObj.scrollLeft(i.treeObj.scrollLeft()+10);r&&r!=i.treeObj&&r.offset().left<i.treeObj.offset().left&&i.treeObj.scrollLeft(i.treeObj.scrollLeft()+r.offset().left-i.treeObj.offset().left)}C.css({top:b.clientY+D+3+"px",left:b.clientX+j+3+"px"});k=a=0;if(r&&r.attr("id")!=i.treeId){var y=v==null?null:m.getNodeCache(i,v);c=b.ctrlKey&&e.edit.drag.isMove&&e.edit.drag.isCopy||!e.edit.drag.isMove&&e.edit.drag.isCopy;a=!!(G&&v===G.tId);k=!!(Q&&v===
|
126
|
+
Q.tId);j=g.parentTId&&g.parentTId==v;g=(c||!k)&&h.apply(i.edit.drag.prev,[i.treeId,l,y],!!i.edit.drag.prev);a=(c||!a)&&h.apply(i.edit.drag.next,[i.treeId,l,y],!!i.edit.drag.next);F=(c||!j)&&!(i.data.keep.leaf&&!y.isParent)&&h.apply(i.edit.drag.inner,[i.treeId,l,y],!!i.edit.drag.inner);if(!g&&!a&&!F){if(r=null,v="",w=d.move.TYPE_INNER,z.css({display:"none"}),window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null}else{c=u("#"+v+d.id.A,r);k=y.isLastNode?null:u("#"+
|
127
|
+
y.getNextNode().tId+d.id.A,r.next());s=c.offset().top;j=c.offset().left;J=g?F?0.25:a?0.5:1:-1;F=a?F?0.75:g?0.5:0:-1;b=(b.clientY+D-s)/c.height();(J==1||b<=J&&b>=-0.2)&&g?(a=1-z.width(),k=s-z.height()/2,w=d.move.TYPE_PREV):(F==0||b>=F&&b<=1.2)&&a?(a=1-z.width(),k=k==null||y.isParent&&y.open?s+c.height()-z.height()/2:k.offset().top-z.height()/2,w=d.move.TYPE_NEXT):(a=5-z.width(),k=s,w=d.move.TYPE_INNER);z.css({display:"block",top:k+"px",left:j+a+"px"});c.addClass(d.node.TMPTARGET_NODE+"_"+w);if(S!=
|
128
|
+
v||T!=w)K=(new Date).getTime();if(y&&y.isParent&&w==d.move.TYPE_INNER&&(b=!0,window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId!==y.tId?(clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null):window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId===y.tId&&(b=!1),b))window.zTreeMoveTimer=setTimeout(function(){w==d.move.TYPE_INNER&&y&&y.isParent&&!y.open&&(new Date).getTime()-K>i.edit.drag.autoOpenTime&&h.apply(i.callback.beforeDragOpen,[i.treeId,y],!0)&&(f.switchNode(i,y),i.edit.drag.autoExpandTrigger&&
|
129
|
+
i.treeObj.trigger(d.event.EXPAND,[i.treeId,y]))},i.edit.drag.autoOpenTime+50),window.zTreeMoveTargetNodeTId=y.tId}}else if(w=d.move.TYPE_INNER,r&&h.apply(i.edit.drag.inner,[i.treeId,l,null],!!i.edit.drag.inner)?r.addClass(d.node.TMPTARGET_TREE):r=null,z.css({display:"none"}),window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null;S=v;T=w}return!1}function n(b){if(window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null;T=S=null;
|
130
|
+
E.unbind("mousemove",c);E.unbind("mouseup",n);E.unbind("selectstart",g);L.css("cursor","auto");r&&(r.removeClass(d.node.TMPTARGET_TREE),v&&u("#"+v+d.id.A,r).removeClass(d.node.TMPTARGET_NODE+"_"+d.move.TYPE_PREV).removeClass(d.node.TMPTARGET_NODE+"_"+H.move.TYPE_NEXT).removeClass(d.node.TMPTARGET_NODE+"_"+H.move.TYPE_INNER));h.showIfameMask(e,!1);t.showHoverDom=!0;if(A.dragFlag!=0){A.dragFlag=0;var a,k,j;for(a=0,k=l.length;a<k;a++)j=l[a],j.isParent&&A.dragNodeShowBefore[j.tId]&&!j.open&&(f.expandCollapseNode(e,
|
131
|
+
j,!j.open),delete A.dragNodeShowBefore[j.tId]);C&&C.remove();z&&z.remove();var p=b.ctrlKey&&e.edit.drag.isMove&&e.edit.drag.isCopy||!e.edit.drag.isMove&&e.edit.drag.isCopy;!p&&r&&v&&l[0].parentTId&&v==l[0].parentTId&&w==d.move.TYPE_INNER&&(r=null);if(r){var q=v==null?null:m.getNodeCache(i,v);if(h.apply(e.callback.beforeDrop,[i.treeId,l,q,w,p],!0)==!1)f.selectNodes(x,l);else{var s=p?h.clone(l):l;a=function(){if(I){if(!p)for(var a=0,c=l.length;a<c;a++)f.removeNode(e,l[a]);if(w==d.move.TYPE_INNER)f.addNodes(i,
|
132
|
+
q,s);else if(f.addNodes(i,q.getParentNode(),s),w==d.move.TYPE_PREV)for(a=0,c=s.length;a<c;a++)f.moveNode(i,q,s[a],w,!1);else for(a=-1,c=s.length-1;a<c;c--)f.moveNode(i,q,s[c],w,!1)}else if(p&&w==d.move.TYPE_INNER)f.addNodes(i,q,s);else if(p&&f.addNodes(i,q.getParentNode(),s),w!=d.move.TYPE_NEXT)for(a=0,c=s.length;a<c;a++)f.moveNode(i,q,s[a],w,!1);else for(a=-1,c=s.length-1;a<c;c--)f.moveNode(i,q,s[c],w,!1);f.selectNodes(i,s);o(s[0],e).focus().blur();e.treeObj.trigger(d.event.DROP,[b,i.treeId,s,q,
|
133
|
+
w,p])};w==d.move.TYPE_INNER&&h.canAsync(i,q)?f.asyncNode(i,q,!1,a):a()}}else f.selectNodes(x,l),e.treeObj.trigger(d.event.DROP,[b,e.treeId,l,null,null,null])}}function g(){return!1}var k,j,e=m.getSetting(b.data.treeId),A=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(k=0,j=q.length;k<j;k++){if(q[k].editNameFlag&&h.eqs(p.tagName,"input")&&p.getAttribute("treeNode"+
|
134
|
+
d.id.INPUT)!==null)return!0;l.push(q[k]);if(l[0].parentTId!==q[k].parentTId){l=[a];break}}else l=[a];f.editNodeBlur=!0;f.cancelCurEditNode(e);var E=u(e.treeObj.get(0).ownerDocument),L=u(e.treeObj.get(0).ownerDocument.body),C,z,r,I=!1,i=e,x=e,G,Q,S=null,T=null,v=null,w=d.move.TYPE_INNER,M=b.clientX,N=b.clientY,K=(new Date).getTime();h.uCanDo(e)&&E.bind("mousemove",c);E.bind("mouseup",n);E.bind("selectstart",g);b.preventDefault&&b.preventDefault();return!0}};u.extend(!0,u.fn.zTree.consts,H);u.extend(!0,
|
135
|
+
u.fn.zTree._z,{tools:{getAbs:function(b){b=b.getBoundingClientRect();return[b.left,b.top]},inputFocus:function(b){b.get(0)&&(b.focus(),h.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=
|
136
|
+
m.getRoot(b);c.dragMaskList.length>0;)c.dragMaskList[0].remove(),c.dragMaskList.shift();if(a)for(var d=o("iframe",b),g=0,f=d.length;g<f;g++){var j=d.get(g),e=h.getAbs(j),j=o("<div id='zTreeMask_"+g+"' class='zTreeMask' style='top:"+e[1]+"px; left:"+e[0]+"px; width:"+j.offsetWidth+"px; height:"+j.offsetHeight+"px;'></div>",b);j.appendTo(body);c.dragMaskList.push(j)}}},view:{addEditBtn:function(b,a){if(!(a.editNameFlag||o(a,d.id.EDIT,b).length>0)&&h.apply(b.edit.showRenameBtn,[b.treeId,a],b.edit.showRenameBtn)){var c=
|
137
|
+
o(a,d.id.A,b),n="<span class='"+d.className.BUTTON+" edit' id='"+a.tId+d.id.EDIT+"' title='"+h.apply(b.edit.renameTitle,[b.treeId,a],b.edit.renameTitle)+"' treeNode"+d.id.EDIT+" style='display:none;'></span>";c.append(n);o(a,d.id.EDIT,b).bind("click",function(){if(!h.uCanDo(b)||h.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)&&h.apply(b.edit.showRemoveBtn,[b.treeId,a],b.edit.showRemoveBtn)){var c=
|
138
|
+
o(a,d.id.A,b),n="<span class='"+d.className.BUTTON+" remove' id='"+a.tId+d.id.REMOVE+"' title='"+h.apply(b.edit.removeTitle,[b.treeId,a],b.edit.removeTitle)+"' treeNode"+d.id.REMOVE+" style='display:none;'></span>";c.append(n);o(a,d.id.REMOVE,b).bind("click",function(){if(!h.uCanDo(b)||h.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=
|
139
|
+
!0,b.edit.enable&&(f.addEditBtn(b,a),f.addRemoveBtn(b,a)),h.apply(b.view.addHoverDom,[b.treeId,a])},cancelCurEditNode:function(b,a){var c=m.getRoot(b),n=b.data.key.name,g=c.curEditNode;if(g){var k=c.curEditInput,j=a?a:k.val(),e=!!a;if(h.apply(b.callback.beforeRename,[b.treeId,g,j,e],!0)===!1)return!1;else g[n]=j?j:k.val(),b.treeObj.trigger(d.event.RENAME,[b.treeId,g,e]);o(g,d.id.A,b).removeClass(d.node.CURSELECTED_EDIT);k.unbind();f.setNodeName(b,g);g.editNameFlag=!1;c.curEditNode=null;c.curEditInput=
|
140
|
+
null;f.selectNode(b,g,!1)}return c.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(){h.inputFocus(c.curEditInput)},0);else{var n=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 g=o(a,d.id.INPUT,b);g.attr("value",a[n]);b.edit.editNameSelectAll?
|
141
|
+
h.inputSelect(g):h.inputFocus(g);g.bind("blur",function(){f.editNodeBlur||f.cancelCurEditNode(b)}).bind("keydown",function(c){c.keyCode=="13"?(f.editNodeBlur=!0,f.cancelCurEditNode(b)):c.keyCode=="27"&&f.cancelCurEditNode(b,a[n])}).bind("click",function(){return!1}).bind("dblclick",function(){return!1});o(a,d.id.A,b).addClass(d.node.CURSELECTED_EDIT);c.curEditInput=g;c.noSelection=!1;c.curEditNode=a}},moveNode:function(b,a,c,n,g,k){var j=m.getRoot(b),e=b.data.key.children;if(a!=c&&(!b.data.keep.leaf||
|
142
|
+
!a||a.isParent||n!=d.move.TYPE_INNER)){var h=c.parentTId?c.getParentNode():j,t=a===null||a==j;t&&a===null&&(a=j);if(t)n=d.move.TYPE_INNER;j=a.parentTId?a.getParentNode():j;if(n!=d.move.TYPE_PREV&&n!=d.move.TYPE_NEXT)n=d.move.TYPE_INNER;if(n==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:(!k&&n==d.move.TYPE_INNER?f.expandCollapseNode(b,a,!0,!1):k||f.expandCollapseNode(b,a.getParentNode(),!0,!1),
|
143
|
+
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)&&n==d.move.TYPE_INNER?p.append(q):t.get(0)&&n==d.move.TYPE_PREV?t.before(q):t.get(0)&&n==d.move.TYPE_NEXT&&t.after(q);var l=-1,u=0,x=null,t=null,C=c.level;if(c.isFirstNode){if(l=0,h[e].length>1)x=h[e][1],x.isFirstNode=!0}else if(c.isLastNode)l=h[e].length-1,x=h[e][l-1],x.isLastNode=
|
144
|
+
!0;else for(p=0,q=h[e].length;p<q;p++)if(h[e][p].tId==c.tId){l=p;break}l>=0&&h[e].splice(l,1);if(n!=d.move.TYPE_INNER)for(p=0,q=j[e].length;p<q;p++)j[e][p].tId==a.tId&&(u=p);if(n==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&&n==d.move.TYPE_PREV?(j[e].splice(u,0,c),t=a,t.isFirstNode=!1,c.parentTId=a.parentTId,c.isFirstNode=!0,c.isLastNode=!1):a.isLastNode&&n==d.move.TYPE_NEXT?
|
145
|
+
(j[e].splice(u+1,0,c),t=a,t.isLastNode=!1,c.parentTId=a.parentTId,c.isFirstNode=!1,c.isLastNode=!0):(n==d.move.TYPE_PREV?j[e].splice(u,0,c):j[e].splice(u+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,C);!b.data.keep.parent&&h[e].length<1?(h.isParent=!1,h.open=!1,a=o(h,d.id.UL,b),n=o(h,d.id.SWITCH,b),e=o(h,d.id.ICON,b),f.replaceSwitchClass(h,n,d.folder.DOCU),f.replaceIcoClass(h,
|
146
|
+
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,h),f.repairParentChkClassWithSelf(b,h),h!=c.parent&&f.repairParentChkClassWithSelf(b,c));k||f.expandCollapseParentNode(b,c.getParentNode(),!0,g)}},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,
|
147
|
+
a);h.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,g=c[d].length;a<
|
148
|
+
g;a++)c[d][a]&&m.setSonNodeLevel(b,c,c[d][a])}}}});var G=u.fn.zTree,h=G._z.tools,d=G.consts,f=G._z.view,m=G._z.data,o=h.$;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,
|
149
|
+
beforeEditName:null,beforeRename:null,onDrag: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){h.apply(b.callback.onRename,[a,c,d,f])});a.bind(c.REMOVE,function(a,c,d){h.apply(b.callback.onRemove,[a,c,d])});a.bind(c.DRAG,function(a,c,d,f){h.apply(b.callback.onDrag,[c,d,f])});a.bind(c.DROP,function(a,c,d,f,e,m,o){h.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);
|
150
|
+
b.unbind(a.REMOVE);b.unbind(a.DRAG);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,g="",k=null,j="",e=null,o=null;if(h.eqs(b.type,"mouseover")){if(o=h.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+d.id.A}]))g=h.getNodeMainDom(o).id,j="hoverOverNode"}else if(h.eqs(b.type,"mouseout"))o=h.getMDom(c,f,[{tagName:"a",attrName:"treeNode"+d.id.A}]),
|
151
|
+
o||(g="remove",j="hoverOutNode");else if(h.eqs(b.type,"mousedown")&&(o=h.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+d.id.A}])))g=h.getNodeMainDom(o).id,j="mousedownNode";if(g.length>0)switch(k=m.getNodeCache(c,g),j){case "mousedownNode":e=x.onMousedownNode;break;case "hoverOverNode":e=x.onHoverOverNode;break;case "hoverOutNode":e=x.onHoverOutNode}return{stop:!1,node:k,nodeEventType:j,nodeEventCallback:e,treeEventType:"",treeEventCallback:null}});m.addInitRoot(function(b){var b=m.getRoot(b),a=m.getRoots();
|
152
|
+
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){var d=m.getRoot(b),g=b.data.key.name,h=d.curEditNode;d.curEditNode&&f.cancelCurEditNode(b,a?a:h[g])};a.copyNode=function(a,n,g,k){if(!n)return null;if(a&&!a.isParent&&b.data.keep.leaf&&g===d.move.TYPE_INNER)return null;var j=h.clone(n);if(!a)a=null,g=d.move.TYPE_INNER;g==d.move.TYPE_INNER?(n=function(){f.addNodes(b,
|
153
|
+
a,[j],k)},h.canAsync(b,a)?f.asyncNode(b,a,k,n):n()):(f.addNodes(b,a.parentNode,[j],k),f.moveNode(b,a,j,g,!1,k));return j};a.editName=function(a){a&&a.tId&&a===m.getNodeCache(b,a.tId)&&(a.parentTId&&f.expandCollapseParentNode(b,a.getParentNode(),!0),f.editNode(b,a))};a.moveNode=function(a,n,g,k){function j(){f.moveNode(b,a,n,g,!1,k)}if(!n)return n;if(a&&!a.isParent&&b.data.keep.leaf&&g===d.move.TYPE_INNER)return null;else if(a&&(n.parentTId==a.tId&&g==d.move.TYPE_INNER||o(n,b).find("#"+a.tId).length>
|
154
|
+
0))return null;else a||(a=null);h.canAsync(b,a)&&g===d.move.TYPE_INNER?f.asyncNode(b,a,k,j):j();return n};a.setEditable=function(a){b.edit.enable=a;return this.refresh()}});var M=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;M&&M.apply(f,arguments)};var N=f.createNodes;f.createNodes=function(b,a,c,d){N&&N.apply(f,arguments);c&&f.repairParentChkClassWithSelf&&f.repairParentChkClassWithSelf(b,
|
155
|
+
d)};var U=f.makeNodeUrl;f.makeNodeUrl=function(b,a){return b.edit.enable?null:U.apply(f,arguments)};var K=f.removeNode;f.removeNode=function(b,a){var c=m.getRoot(b);if(c.curEditNode===a)c.curEditNode=null;K&&K.apply(f,arguments)};var O=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;O&&O.apply(f,arguments);f.addHoverDom(b,a);return!0};var P=h.uCanDo;h.uCanDo=function(b,a){var c=m.getRoot(b);return a&&(h.eqs(a.type,"mouseover")||
|
156
|
+
h.eqs(a.type,"mouseout")||h.eqs(a.type,"mousedown")||h.eqs(a.type,"mouseup"))?!0:!c.curEditNode&&(P?P.apply(f,arguments):!0)}})(jQuery);
|
157
|
+
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/*-------------------------------------
|
2
|
+
zTree Style
|
3
|
+
|
4
|
+
version: 3.4
|
5
|
+
author: Hunter.z
|
6
|
+
email: hunter.z@263.net
|
7
|
+
website: http://code.google.com/p/jquerytree/
|
8
|
+
|
9
|
+
-------------------------------------*/
|
10
|
+
|
11
|
+
.ztree * {padding:0; margin:0; font-size:12px; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif}
|
12
|
+
.ztree {margin:0; padding:5px; color:#333}
|
13
|
+
.ztree li{padding:0; margin:0; list-style:none; line-height:14px; text-align:left; white-space:nowrap; outline:0}
|
14
|
+
.ztree li ul{ margin:0; padding:0 0 0 18px}
|
15
|
+
.ztree li ul.line{ background:url(line_conn.gif) 0 0 repeat-y;}
|
16
|
+
|
17
|
+
.ztree li a {padding:1px 3px 0 0; margin:0; cursor:pointer; height:17px; color:#333; background-color: transparent;
|
18
|
+
text-decoration:none; vertical-align:top; display: inline-block}
|
19
|
+
.ztree li a:hover {text-decoration:underline}
|
20
|
+
.ztree li a.curSelectedNode {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;}
|
21
|
+
.ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;}
|
22
|
+
.ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#316AC5; color:white; height:16px; border:1px #316AC5 solid;
|
23
|
+
opacity:0.8; filter:alpha(opacity=80)}
|
24
|
+
.ztree li a.tmpTargetNode_prev {}
|
25
|
+
.ztree li a.tmpTargetNode_next {}
|
26
|
+
.ztree li a input.rename {height:14px; width:80px; padding:0; margin:0;
|
27
|
+
font-size:12px; border:1px #7EC4CC solid; *border:0px}
|
28
|
+
.ztree li span {line-height:16px; margin-right:2px}
|
29
|
+
.ztree li span.button {line-height:0; margin:0; width:16px; height:16px; display: inline-block; vertical-align:middle;
|
30
|
+
border:0 none; cursor: pointer;outline:none;
|
31
|
+
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
|
32
|
+
background-image:url("zTreeStandard.png"); *background-image:url("zTreeStandard.gif")}
|
33
|
+
|
34
|
+
.ztree li span.button.chk {width:13px; height:13px; margin:0 3px 0 0; cursor: auto}
|
35
|
+
.ztree li span.button.chk.checkbox_false_full {background-position:0 0}
|
36
|
+
.ztree li span.button.chk.checkbox_false_full_focus {background-position:0 -14px}
|
37
|
+
.ztree li span.button.chk.checkbox_false_part {background-position:0 -28px}
|
38
|
+
.ztree li span.button.chk.checkbox_false_part_focus {background-position:0 -42px}
|
39
|
+
.ztree li span.button.chk.checkbox_false_disable {background-position:0 -56px}
|
40
|
+
.ztree li span.button.chk.checkbox_true_full {background-position:-14px 0}
|
41
|
+
.ztree li span.button.chk.checkbox_true_full_focus {background-position:-14px -14px}
|
42
|
+
.ztree li span.button.chk.checkbox_true_part {background-position:-14px -28px}
|
43
|
+
.ztree li span.button.chk.checkbox_true_part_focus {background-position:-14px -42px}
|
44
|
+
.ztree li span.button.chk.checkbox_true_disable {background-position:-14px -56px}
|
45
|
+
.ztree li span.button.chk.radio_false_full {background-position:-28px 0}
|
46
|
+
.ztree li span.button.chk.radio_false_full_focus {background-position:-28px -14px}
|
47
|
+
.ztree li span.button.chk.radio_false_part {background-position:-28px -28px}
|
48
|
+
.ztree li span.button.chk.radio_false_part_focus {background-position:-28px -42px}
|
49
|
+
.ztree li span.button.chk.radio_false_disable {background-position:-28px -56px}
|
50
|
+
.ztree li span.button.chk.radio_true_full {background-position:-42px 0}
|
51
|
+
.ztree li span.button.chk.radio_true_full_focus {background-position:-42px -14px}
|
52
|
+
.ztree li span.button.chk.radio_true_part {background-position:-42px -28px}
|
53
|
+
.ztree li span.button.chk.radio_true_part_focus {background-position:-42px -42px}
|
54
|
+
.ztree li span.button.chk.radio_true_disable {background-position:-42px -56px}
|
55
|
+
|
56
|
+
.ztree li span.button.switch {width:18px; height:18px}
|
57
|
+
.ztree li span.button.root_open{background-position:-92px -54px}
|
58
|
+
.ztree li span.button.root_close{background-position:-74px -54px}
|
59
|
+
.ztree li span.button.roots_open{background-position:-92px 0}
|
60
|
+
.ztree li span.button.roots_close{background-position:-74px 0}
|
61
|
+
.ztree li span.button.center_open{background-position:-92px -18px}
|
62
|
+
.ztree li span.button.center_close{background-position:-74px -18px}
|
63
|
+
.ztree li span.button.bottom_open{background-position:-92px -36px}
|
64
|
+
.ztree li span.button.bottom_close{background-position:-74px -36px}
|
65
|
+
.ztree li span.button.noline_open{background-position:-92px -72px}
|
66
|
+
.ztree li span.button.noline_close{background-position:-74px -72px}
|
67
|
+
.ztree li span.button.root_docu{ background:none;}
|
68
|
+
.ztree li span.button.roots_docu{background-position:-56px 0}
|
69
|
+
.ztree li span.button.center_docu{background-position:-56px -18px}
|
70
|
+
.ztree li span.button.bottom_docu{background-position:-56px -36px}
|
71
|
+
.ztree li span.button.noline_docu{ background:none;}
|
72
|
+
|
73
|
+
.ztree li span.button.ico_open{margin-right:2px; background-position:-110px -16px; vertical-align:top; *vertical-align:middle}
|
74
|
+
.ztree li span.button.ico_close{margin-right:2px; background-position:-110px 0; vertical-align:top; *vertical-align:middle}
|
75
|
+
.ztree li span.button.ico_docu{margin-right:2px; background-position:-110px -32px; vertical-align:top; *vertical-align:middle}
|
76
|
+
.ztree li span.button.add {margin-right:2px; background-position:-144px 0; vertical-align:top; *vertical-align:middle}
|
77
|
+
.ztree li span.button.edit {margin-right:2px; background-position:-110px -48px; vertical-align:top; *vertical-align:middle}
|
78
|
+
.ztree li span.button.remove {margin-right:2px; background-position:-110px -64px; vertical-align:top; *vertical-align:middle}
|
79
|
+
|
80
|
+
.ztree li span.button.ico_loading{margin-right:2px; background:url(loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
|
81
|
+
|
82
|
+
ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}
|
83
|
+
|
84
|
+
span.tmpzTreeMove_arrow {width:16px; height:16px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute;
|
85
|
+
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
|
86
|
+
background-position:-110px -80px; background-image:url("zTreeStandard.png"); *background-image:url("zTreeStandard.gif")}
|
87
|
+
|
88
|
+
ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)}
|
89
|
+
.zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}
|
90
|
+
|
91
|
+
/* level style*/
|
92
|
+
/*.ztree li span.button.level0 {
|
93
|
+
display:none;
|
94
|
+
}
|
95
|
+
.ztree li ul.level0 {
|
96
|
+
padding:0;
|
97
|
+
background:none;
|
98
|
+
}*/
|
data/ztree.gemspec
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'ztree'
|
5
|
+
s.version = '0.0.4'
|
6
|
+
s.authors = ['Zhimeng Sun']
|
7
|
+
s.email = ['zhimengSun@gmail.com']
|
8
|
+
s.homepage = 'https://github.com/zhimengSun/ztree'
|
9
|
+
s.summary = 'ztree for rails'
|
10
|
+
s.description = 'ztree for rails, Extractive common action and helper'
|
11
|
+
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
|
14
|
+
s.add_dependency "jquery-rails"
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ztree
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Zhimeng Sun
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jquery-rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: ztree for rails, Extractive common action and helper
|
28
|
+
email:
|
29
|
+
- zhimengSun@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- .gitignore
|
35
|
+
- lib/assets/rails/engine.rb
|
36
|
+
- lib/exts/array.rb
|
37
|
+
- lib/exts/hash.rb
|
38
|
+
- lib/ztree.rb
|
39
|
+
- lib/ztree/controller.rb
|
40
|
+
- lib/ztree/helpers.rb
|
41
|
+
- lib/ztree/railtie.rb
|
42
|
+
- lib/ztree/sort_tree.rb
|
43
|
+
- vendor/assets/images/diy/1_close.png
|
44
|
+
- vendor/assets/images/diy/1_open.png
|
45
|
+
- vendor/assets/images/diy/2.png
|
46
|
+
- vendor/assets/images/diy/3.png
|
47
|
+
- vendor/assets/images/diy/4.png
|
48
|
+
- vendor/assets/images/diy/5.png
|
49
|
+
- vendor/assets/images/diy/6.png
|
50
|
+
- vendor/assets/images/diy/7.png
|
51
|
+
- vendor/assets/images/diy/8.png
|
52
|
+
- vendor/assets/images/diy/9.png
|
53
|
+
- vendor/assets/images/line_conn.gif
|
54
|
+
- vendor/assets/images/loading.gif
|
55
|
+
- vendor/assets/images/zTreeStandard.gif
|
56
|
+
- vendor/assets/images/zTreeStandard.png
|
57
|
+
- vendor/assets/javascripts/ztree.js
|
58
|
+
- vendor/assets/stylesheets/ztree.css
|
59
|
+
- ztree.gemspec
|
60
|
+
homepage: https://github.com/zhimengSun/ztree
|
61
|
+
licenses: []
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.0.3
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: ztree for rails
|
83
|
+
test_files: []
|
84
|
+
has_rdoc:
|