rztree 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,367 @@
1
+ /*
2
+ * JQuery zTree exHideNodes v3.5.17
3
+ * http://zTree.me/
4
+ *
5
+ * Copyright (c) 2010 Hunter.z
6
+ *
7
+ * Licensed same as jquery - MIT License
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ *
10
+ * email: hunter.z@263.net
11
+ * Date: 2014-05-08
12
+ */
13
+ (function($){
14
+ //default init node of exLib
15
+ var _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {
16
+ if (typeof n.isHidden == "string") n.isHidden = tools.eqs(n.isHidden, "true");
17
+ n.isHidden = !!n.isHidden;
18
+ data.initHideForExCheck(setting, n);
19
+ },
20
+ //add dom for check
21
+ _beforeA = function(setting, node, html) {},
22
+ //update zTreeObj, add method of exLib
23
+ _zTreeTools = function(setting, zTreeTools) {
24
+ zTreeTools.showNodes = function(nodes, options) {
25
+ view.showNodes(setting, nodes, options);
26
+ }
27
+ zTreeTools.showNode = function(node, options) {
28
+ if (!node) {
29
+ return;
30
+ }
31
+ view.showNodes(setting, [node], options);
32
+ }
33
+ zTreeTools.hideNodes = function(nodes, options) {
34
+ view.hideNodes(setting, nodes, options);
35
+ }
36
+ zTreeTools.hideNode = function(node, options) {
37
+ if (!node) {
38
+ return;
39
+ }
40
+ view.hideNodes(setting, [node], options);
41
+ }
42
+
43
+ var _checkNode = zTreeTools.checkNode;
44
+ if (_checkNode) {
45
+ zTreeTools.checkNode = function(node, checked, checkTypeFlag, callbackFlag) {
46
+ if (!!node && !!node.isHidden) {
47
+ return;
48
+ }
49
+ _checkNode.apply(zTreeTools, arguments);
50
+ }
51
+ }
52
+ },
53
+ //method of operate data
54
+ _data = {
55
+ initHideForExCheck: function(setting, n) {
56
+ if (n.isHidden && setting.check && setting.check.enable) {
57
+ if(typeof n._nocheck == "undefined") {
58
+ n._nocheck = !!n.nocheck
59
+ n.nocheck = true;
60
+ }
61
+ n.check_Child_State = -1;
62
+ if (view.repairParentChkClassWithSelf) {
63
+ view.repairParentChkClassWithSelf(setting, n);
64
+ }
65
+ }
66
+ },
67
+ initShowForExCheck: function(setting, n) {
68
+ if (!n.isHidden && setting.check && setting.check.enable) {
69
+ if(typeof n._nocheck != "undefined") {
70
+ n.nocheck = n._nocheck;
71
+ delete n._nocheck;
72
+ }
73
+ if (view.setChkClass) {
74
+ var checkObj = $$(n, consts.id.CHECK, setting);
75
+ view.setChkClass(setting, checkObj, n);
76
+ }
77
+ if (view.repairParentChkClassWithSelf) {
78
+ view.repairParentChkClassWithSelf(setting, n);
79
+ }
80
+ }
81
+ }
82
+ },
83
+ //method of operate ztree dom
84
+ _view = {
85
+ clearOldFirstNode: function(setting, node) {
86
+ var n = node.getNextNode();
87
+ while(!!n){
88
+ if (n.isFirstNode) {
89
+ n.isFirstNode = false;
90
+ view.setNodeLineIcos(setting, n);
91
+ break;
92
+ }
93
+ if (n.isLastNode) {
94
+ break;
95
+ }
96
+ n = n.getNextNode();
97
+ }
98
+ },
99
+ clearOldLastNode: function(setting, node, openFlag) {
100
+ var n = node.getPreNode();
101
+ while(!!n){
102
+ if (n.isLastNode) {
103
+ n.isLastNode = false;
104
+ if (openFlag) {
105
+ view.setNodeLineIcos(setting, n);
106
+ }
107
+ break;
108
+ }
109
+ if (n.isFirstNode) {
110
+ break;
111
+ }
112
+ n = n.getPreNode();
113
+ }
114
+ },
115
+ makeDOMNodeMainBefore: function(html, setting, node) {
116
+ html.push("<li ", (node.isHidden ? "style='display:none;' " : ""), "id='", node.tId, "' class='", consts.className.LEVEL, node.level,"' tabindex='0' hidefocus='true' treenode>");
117
+ },
118
+ showNode: function(setting, node, options) {
119
+ node.isHidden = false;
120
+ data.initShowForExCheck(setting, node);
121
+ $$(node, setting).show();
122
+ },
123
+ showNodes: function(setting, nodes, options) {
124
+ if (!nodes || nodes.length == 0) {
125
+ return;
126
+ }
127
+ var pList = {}, i, j;
128
+ for (i=0, j=nodes.length; i<j; i++) {
129
+ var n = nodes[i];
130
+ if (!pList[n.parentTId]) {
131
+ var pn = n.getParentNode();
132
+ pList[n.parentTId] = (pn === null) ? data.getRoot(setting) : n.getParentNode();
133
+ }
134
+ view.showNode(setting, n, options);
135
+ }
136
+ for (var tId in pList) {
137
+ var children = pList[tId][setting.data.key.children];
138
+ view.setFirstNodeForShow(setting, children);
139
+ view.setLastNodeForShow(setting, children);
140
+ }
141
+ },
142
+ hideNode: function(setting, node, options) {
143
+ node.isHidden = true;
144
+ node.isFirstNode = false;
145
+ node.isLastNode = false;
146
+ data.initHideForExCheck(setting, node);
147
+ view.cancelPreSelectedNode(setting, node);
148
+ $$(node, setting).hide();
149
+ },
150
+ hideNodes: function(setting, nodes, options) {
151
+ if (!nodes || nodes.length == 0) {
152
+ return;
153
+ }
154
+ var pList = {}, i, j;
155
+ for (i=0, j=nodes.length; i<j; i++) {
156
+ var n = nodes[i];
157
+ if ((n.isFirstNode || n.isLastNode) && !pList[n.parentTId]) {
158
+ var pn = n.getParentNode();
159
+ pList[n.parentTId] = (pn === null) ? data.getRoot(setting) : n.getParentNode();
160
+ }
161
+ view.hideNode(setting, n, options);
162
+ }
163
+ for (var tId in pList) {
164
+ var children = pList[tId][setting.data.key.children];
165
+ view.setFirstNodeForHide(setting, children);
166
+ view.setLastNodeForHide(setting, children);
167
+ }
168
+ },
169
+ setFirstNode: function(setting, parentNode) {
170
+ var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
171
+ if (childLength > 0 && !parentNode[childKey][0].isHidden) {
172
+ parentNode[childKey][0].isFirstNode = true;
173
+ } else if (childLength > 0) {
174
+ view.setFirstNodeForHide(setting, parentNode[childKey]);
175
+ }
176
+ },
177
+ setLastNode: function(setting, parentNode) {
178
+ var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
179
+ if (childLength > 0 && !parentNode[childKey][0].isHidden) {
180
+ parentNode[childKey][childLength - 1].isLastNode = true;
181
+ } else if (childLength > 0) {
182
+ view.setLastNodeForHide(setting, parentNode[childKey]);
183
+ }
184
+ },
185
+ setFirstNodeForHide: function(setting, nodes) {
186
+ var n,i,j;
187
+ for (i=0, j=nodes.length; i<j; i++) {
188
+ n = nodes[i];
189
+ if (n.isFirstNode) {
190
+ break;
191
+ }
192
+ if (!n.isHidden && !n.isFirstNode) {
193
+ n.isFirstNode = true;
194
+ view.setNodeLineIcos(setting, n);
195
+ break;
196
+ } else {
197
+ n = null;
198
+ }
199
+ }
200
+ return n;
201
+ },
202
+ setFirstNodeForShow: function(setting, nodes) {
203
+ var n,i,j, first, old;
204
+ for(i=0, j=nodes.length; i<j; i++) {
205
+ n = nodes[i];
206
+ if (!first && !n.isHidden && n.isFirstNode) {
207
+ first = n;
208
+ break;
209
+ } else if (!first && !n.isHidden && !n.isFirstNode) {
210
+ n.isFirstNode = true;
211
+ first = n;
212
+ view.setNodeLineIcos(setting, n);
213
+ } else if (first && n.isFirstNode) {
214
+ n.isFirstNode = false;
215
+ old = n;
216
+ view.setNodeLineIcos(setting, n);
217
+ break;
218
+ } else {
219
+ n = null;
220
+ }
221
+ }
222
+ return {"new":first, "old":old};
223
+ },
224
+ setLastNodeForHide: function(setting, nodes) {
225
+ var n,i;
226
+ for (i=nodes.length-1; i>=0; i--) {
227
+ n = nodes[i];
228
+ if (n.isLastNode) {
229
+ break;
230
+ }
231
+ if (!n.isHidden && !n.isLastNode) {
232
+ n.isLastNode = true;
233
+ view.setNodeLineIcos(setting, n);
234
+ break;
235
+ } else {
236
+ n = null;
237
+ }
238
+ }
239
+ return n;
240
+ },
241
+ setLastNodeForShow: function(setting, nodes) {
242
+ var n,i,j, last, old;
243
+ for (i=nodes.length-1; i>=0; i--) {
244
+ n = nodes[i];
245
+ if (!last && !n.isHidden && n.isLastNode) {
246
+ last = n;
247
+ break;
248
+ } else if (!last && !n.isHidden && !n.isLastNode) {
249
+ n.isLastNode = true;
250
+ last = n;
251
+ view.setNodeLineIcos(setting, n);
252
+ } else if (last && n.isLastNode) {
253
+ n.isLastNode = false;
254
+ old = n;
255
+ view.setNodeLineIcos(setting, n);
256
+ break;
257
+ } else {
258
+ n = null;
259
+ }
260
+ }
261
+ return {"new":last, "old":old};
262
+ }
263
+ },
264
+
265
+ _z = {
266
+ view: _view,
267
+ data: _data
268
+ };
269
+ $.extend(true, $.fn.zTree._z, _z);
270
+
271
+ var zt = $.fn.zTree,
272
+ tools = zt._z.tools,
273
+ consts = zt.consts,
274
+ view = zt._z.view,
275
+ data = zt._z.data,
276
+ event = zt._z.event,
277
+ $$ = tools.$;
278
+
279
+ data.addInitNode(_initNode);
280
+ data.addBeforeA(_beforeA);
281
+ data.addZTreeTools(_zTreeTools);
282
+
283
+ // Override method in core
284
+ var _dInitNode = data.initNode;
285
+ data.initNode = function(setting, level, node, parentNode, isFirstNode, isLastNode, openFlag) {
286
+ var tmpPNode = (parentNode) ? parentNode: data.getRoot(setting),
287
+ children = tmpPNode[setting.data.key.children];
288
+ data.tmpHideFirstNode = view.setFirstNodeForHide(setting, children);
289
+ data.tmpHideLastNode = view.setLastNodeForHide(setting, children);
290
+ if (openFlag) {
291
+ view.setNodeLineIcos(setting, data.tmpHideFirstNode);
292
+ view.setNodeLineIcos(setting, data.tmpHideLastNode);
293
+ }
294
+ isFirstNode = (data.tmpHideFirstNode === node);
295
+ isLastNode = (data.tmpHideLastNode === node);
296
+ if (_dInitNode) _dInitNode.apply(data, arguments);
297
+ if (openFlag && isLastNode) {
298
+ view.clearOldLastNode(setting, node, openFlag);
299
+ }
300
+ };
301
+
302
+ var _makeChkFlag = data.makeChkFlag;
303
+ if (!!_makeChkFlag) {
304
+ data.makeChkFlag = function(setting, node) {
305
+ if (!!node && !!node.isHidden) {
306
+ return;
307
+ }
308
+ _makeChkFlag.apply(data, arguments);
309
+ }
310
+ }
311
+
312
+ var _getTreeCheckedNodes = data.getTreeCheckedNodes;
313
+ if (!!_getTreeCheckedNodes) {
314
+ data.getTreeCheckedNodes = function(setting, nodes, checked, results) {
315
+ if (!!nodes && nodes.length > 0) {
316
+ var p = nodes[0].getParentNode();
317
+ if (!!p && !!p.isHidden) {
318
+ return [];
319
+ }
320
+ }
321
+ return _getTreeCheckedNodes.apply(data, arguments);
322
+ }
323
+ }
324
+
325
+ var _getTreeChangeCheckedNodes = data.getTreeChangeCheckedNodes;
326
+ if (!!_getTreeChangeCheckedNodes) {
327
+ data.getTreeChangeCheckedNodes = function(setting, nodes, results) {
328
+ if (!!nodes && nodes.length > 0) {
329
+ var p = nodes[0].getParentNode();
330
+ if (!!p && !!p.isHidden) {
331
+ return [];
332
+ }
333
+ }
334
+ return _getTreeChangeCheckedNodes.apply(data, arguments);
335
+ }
336
+ }
337
+
338
+ var _expandCollapseSonNode = view.expandCollapseSonNode;
339
+ if (!!_expandCollapseSonNode) {
340
+ view.expandCollapseSonNode = function(setting, node, expandFlag, animateFlag, callback) {
341
+ if (!!node && !!node.isHidden) {
342
+ return;
343
+ }
344
+ _expandCollapseSonNode.apply(view, arguments);
345
+ }
346
+ }
347
+
348
+ var _setSonNodeCheckBox = view.setSonNodeCheckBox;
349
+ if (!!_setSonNodeCheckBox) {
350
+ view.setSonNodeCheckBox = function(setting, node, value, srcNode) {
351
+ if (!!node && !!node.isHidden) {
352
+ return;
353
+ }
354
+ _setSonNodeCheckBox.apply(view, arguments);
355
+ }
356
+ }
357
+
358
+ var _repairParentChkClassWithSelf = view.repairParentChkClassWithSelf;
359
+ if (!!_repairParentChkClassWithSelf) {
360
+ view.repairParentChkClassWithSelf = function(setting, node) {
361
+ if (!!node && !!node.isHidden) {
362
+ return;
363
+ }
364
+ _repairParentChkClassWithSelf.apply(view, arguments);
365
+ }
366
+ }
367
+ })(jQuery);
@@ -0,0 +1,97 @@
1
+ /*-------------------------------------
2
+ zTree Style
3
+
4
+ version: 3.5.17
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(/assets/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("/assets/zTreeStandard.png"); *background-image:url("/assets/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.edit {margin-right:2px; background-position:-110px -48px; vertical-align:top; *vertical-align:middle}
77
+ .ztree li span.button.remove {margin-right:2px; background-position:-110px -64px; vertical-align:top; *vertical-align:middle}
78
+
79
+ .ztree li span.button.ico_loading{margin-right:2px; background:url('/assets/loading.gif') no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
80
+
81
+ ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}
82
+
83
+ span.tmpzTreeMove_arrow {width:16px; height:16px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute;
84
+ background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
85
+ background-position:-110px -80px; background-image:url("/assets/zTreeStandard.png"); *background-image:url("/assets/zTreeStandard.gif")}
86
+
87
+ 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)}
88
+ .zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}
89
+
90
+ /* level style*/
91
+ /*.ztree li span.button.level0 {
92
+ display:none;
93
+ }
94
+ .ztree li ul.level0 {
95
+ padding:0;
96
+ background:none;
97
+ }*/