sequenceserver 2.0.0.rc8 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sequenceserver might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/bin/sequenceserver +22 -30
- data/lib/sequenceserver/api_errors.rb +5 -1
- data/lib/sequenceserver/blast/constants.rb +1 -1
- data/lib/sequenceserver/blast/hit.rb +5 -16
- data/lib/sequenceserver/blast/job.rb +9 -18
- data/lib/sequenceserver/blast/report.rb +5 -3
- data/lib/sequenceserver/config.rb +4 -1
- data/lib/sequenceserver/database.rb +69 -9
- data/lib/sequenceserver/job.rb +1 -1
- data/lib/sequenceserver/makeblastdb.rb +40 -45
- data/lib/sequenceserver/routes.rb +4 -0
- data/lib/sequenceserver/version.rb +1 -1
- data/lib/sequenceserver.rb +15 -11
- data/public/config.js +143 -142
- data/public/css/fonts.css +23 -22
- data/public/css/grapher.css +598 -594
- data/public/css/sequenceserver.css +86 -24
- data/public/css/sequenceserver.min.css +2 -2
- data/public/js/alignment_exporter.js +14 -14
- data/public/js/databases_tree.js +215 -0
- data/public/js/download_fasta.js +1 -1
- data/public/js/hit.js +6 -2
- data/public/js/hits_overview.js +1 -1
- data/public/js/length_distribution.js +5 -5
- data/public/js/query.js +4 -7
- data/public/js/report.js +12 -24
- data/public/js/search.js +21 -2
- data/public/js/sidebar.js +4 -4
- data/public/js/svgExporter.js +12 -12
- data/public/js/visualisation_helpers.js +4 -5
- data/public/sequenceserver-report.min.js +11 -11
- data/public/sequenceserver-search.min.js +15 -11
- data/public/vendor/github/vakata/jstree@3.3.8/LICENSE-MIT +22 -0
- data/public/vendor/github/vakata/jstree@3.3.8/README.md +663 -0
- data/public/vendor/github/vakata/jstree@3.3.8/bower.json +33 -0
- data/public/vendor/github/vakata/jstree@3.3.8/component.json +28 -0
- data/public/vendor/github/vakata/jstree@3.3.8/composer.json +46 -0
- data/public/vendor/github/vakata/jstree@3.3.8/demo/README.md +2 -0
- data/public/vendor/github/vakata/jstree@3.3.8/demo/basic/index.html +146 -0
- data/public/vendor/github/vakata/jstree@3.3.8/demo/basic/root.json +1 -0
- data/public/vendor/github/vakata/jstree@3.3.8/dist/jstree.js +8612 -0
- data/public/vendor/github/vakata/jstree@3.3.8/dist/jstree.min.js +6 -0
- data/public/vendor/github/vakata/jstree@3.3.8/dist/themes/default/32px.png +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/dist/themes/default/40px.png +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/dist/themes/default/style.css +1102 -0
- data/public/vendor/github/vakata/jstree@3.3.8/dist/themes/default/style.min.css +1 -0
- data/public/vendor/github/vakata/jstree@3.3.8/dist/themes/default/throbber.gif +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/dist/themes/default-dark/32px.png +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/dist/themes/default-dark/40px.png +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/dist/themes/default-dark/style.css +1146 -0
- data/public/vendor/github/vakata/jstree@3.3.8/dist/themes/default-dark/style.min.css +1 -0
- data/public/vendor/github/vakata/jstree@3.3.8/dist/themes/default-dark/throbber.gif +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/gruntfile.js +242 -0
- data/public/vendor/github/vakata/jstree@3.3.8/jstree.jquery.json +28 -0
- data/public/vendor/github/vakata/jstree@3.3.8/package.json +58 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/intro.js +14 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/jstree.changed.js +69 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/jstree.checkbox.js +976 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/jstree.conditionalselect.js +38 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/jstree.contextmenu.js +661 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/jstree.dnd.js +669 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/jstree.js +4931 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/jstree.massload.js +137 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/jstree.search.js +421 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/jstree.sort.js +74 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/jstree.state.js +138 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/jstree.types.js +372 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/jstree.unique.js +164 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/jstree.wholerow.js +122 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/misc.js +656 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/outro.js +1 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/sample.js +93 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/themes/base.less +93 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/themes/default/32px.png +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/themes/default/40px.png +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/themes/default/style.css +1102 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/themes/default/style.less +22 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/themes/default/throbber.gif +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/themes/default-dark/32px.png +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/themes/default-dark/40px.png +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/themes/default-dark/style.css +1146 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/themes/default-dark/style.less +50 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/themes/default-dark/throbber.gif +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/themes/main.less +77 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/themes/mixins.less +104 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/themes/responsive.less +67 -0
- data/public/vendor/github/vakata/jstree@3.3.8/src/vakata-jstree.js +38 -0
- data/public/vendor/github/vakata/jstree@3.3.8/test/unit/index.html +16 -0
- data/public/vendor/github/vakata/jstree@3.3.8/test/unit/libs/qunit.css +244 -0
- data/public/vendor/github/vakata/jstree@3.3.8/test/unit/libs/qunit.js +2212 -0
- data/public/vendor/github/vakata/jstree@3.3.8/test/unit/test.js +11 -0
- data/public/vendor/github/vakata/jstree@3.3.8/test/visual/desktop/index.html +44 -0
- data/public/vendor/github/vakata/jstree@3.3.8/test/visual/mobile/index.html +42 -0
- data/public/vendor/github/vakata/jstree@3.3.8/test/visual/screenshots/desktop/desktop.png +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/test/visual/screenshots/desktop/home.png +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/test/visual/screenshots/mobile/home.png +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8/test/visual/screenshots/mobile/mobile.png +0 -0
- data/public/vendor/github/vakata/jstree@3.3.8.js +3 -0
- data/public/vendor/system-csp-production.js +3 -3
- data/public/vendor/system-csp-production.js.map +1 -1
- data/public/vendor/system-csp-production.src.js +146 -140
- data/public/vendor/system-polyfills.js.map +1 -1
- data/public/vendor/system-polyfills.src.js +1 -0
- data/public/vendor/system.js +3 -3
- data/public/vendor/system.js.map +1 -1
- data/public/vendor/system.src.js +4771 -2383
- data/views/_options.erb +21 -0
- data/views/layout.erb +17 -18
- metadata +102 -43
- data/bin/chromedriver +0 -0
- data/bin/geckodriver +0 -0
- data/public/shims/form-core.js +0 -3
- data/public/shims/form-validation.js +0 -3
- data/public/shims/plugins/jquery.ui.position.js +0 -13
- data/public/shims/styles/shim.css +0 -1
@@ -0,0 +1,656 @@
|
|
1
|
+
/* global jQuery */
|
2
|
+
|
3
|
+
// disable all events
|
4
|
+
(function ($, undefined) {
|
5
|
+
"use strict";
|
6
|
+
$.jstree.plugins.trigger = function (options, parent) {
|
7
|
+
this.init = function (el, options) {
|
8
|
+
// do not forget parent
|
9
|
+
parent.init.call(this, el, options);
|
10
|
+
this._data.trigger.disabled = false;
|
11
|
+
};
|
12
|
+
this.trigger = function (ev, data) {
|
13
|
+
if(!this._data.trigger.disabled) {
|
14
|
+
parent.trigger.call(this, ev, data);
|
15
|
+
}
|
16
|
+
};
|
17
|
+
this.disable_events = function () { this._data.trigger.disabled = true; };
|
18
|
+
this.enable_events = function () { this._data.trigger.disabled = false; };
|
19
|
+
};
|
20
|
+
})(jQuery);
|
21
|
+
|
22
|
+
// mapping
|
23
|
+
(function ($, undefined) {
|
24
|
+
"use strict";
|
25
|
+
// use this if you need any options
|
26
|
+
$.jstree.defaults.mapper = {
|
27
|
+
option_key : "option_value"
|
28
|
+
};
|
29
|
+
$.jstree.plugins.mapper = function () {
|
30
|
+
this._parse_model_from_json = function (d, p, ps) {
|
31
|
+
// d is the node from the server, it will be called recursively for children,
|
32
|
+
// so you do not need to process at once
|
33
|
+
/* // for example
|
34
|
+
for(var i in d) {
|
35
|
+
if(d.hasOwnProperty(i)) {
|
36
|
+
d[i.toLowerCase()] = d[i];
|
37
|
+
}
|
38
|
+
}
|
39
|
+
*/
|
40
|
+
return parent._parse_model_from_json.call(this, d, p, ps);
|
41
|
+
};
|
42
|
+
};
|
43
|
+
})(jQuery);
|
44
|
+
|
45
|
+
// no hover
|
46
|
+
(function ($, undefined) {
|
47
|
+
"use strict";
|
48
|
+
$.jstree.plugins.nohover = function () {
|
49
|
+
this.hover_node = $.noop;
|
50
|
+
};
|
51
|
+
})(jQuery);
|
52
|
+
|
53
|
+
// force multiple select
|
54
|
+
(function ($, undefined) {
|
55
|
+
"use strict";
|
56
|
+
$.jstree.defaults.multiselect = {};
|
57
|
+
$.jstree.plugins.multiselect = function (options, parent) {
|
58
|
+
this.activate_node = function (obj, e) {
|
59
|
+
e.ctrlKey = true;
|
60
|
+
parent.activate_node.call(this, obj, e);
|
61
|
+
};
|
62
|
+
};
|
63
|
+
})(jQuery);
|
64
|
+
|
65
|
+
// real checkboxes
|
66
|
+
(function ($, undefined) {
|
67
|
+
"use strict";
|
68
|
+
|
69
|
+
var inp = document.createElement("INPUT");
|
70
|
+
inp.type = "checkbox";
|
71
|
+
inp.className = "jstree-checkbox jstree-realcheckbox";
|
72
|
+
|
73
|
+
$.jstree.defaults.realcheckboxes = {};
|
74
|
+
|
75
|
+
$.jstree.plugins.realcheckboxes = function (options, parent) {
|
76
|
+
this.bind = function () {
|
77
|
+
parent.bind.call(this);
|
78
|
+
this._data.realcheckboxes.uto = false;
|
79
|
+
this.element
|
80
|
+
.on('changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree ready.jstree loaded.jstree', $.proxy(function () {
|
81
|
+
// only if undetermined is in setting
|
82
|
+
if(this._data.realcheckboxes.uto) { clearTimeout(this._data.realcheckboxes.uto); }
|
83
|
+
this._data.realcheckboxes.uto = setTimeout($.proxy(this._realcheckboxes, this), 50);
|
84
|
+
}, this));
|
85
|
+
};
|
86
|
+
this.redraw_node = function(obj, deep, callback, force_draw) {
|
87
|
+
obj = parent.redraw_node.call(this, obj, deep, callback, force_draw);
|
88
|
+
if(obj) {
|
89
|
+
var i, j, tmp = null, chk = inp.cloneNode(true);
|
90
|
+
for(i = 0, j = obj.childNodes.length; i < j; i++) {
|
91
|
+
if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) {
|
92
|
+
tmp = obj.childNodes[i];
|
93
|
+
break;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
if(tmp) {
|
97
|
+
for(i = 0, j = tmp.childNodes.length; i < j; i++) {
|
98
|
+
if(tmp.childNodes[i] && tmp.childNodes[i].className && tmp.childNodes[i].className.indexOf("jstree-checkbox") !== -1) {
|
99
|
+
tmp = tmp.childNodes[i];
|
100
|
+
break;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
if(tmp && tmp.tagName === "I") {
|
105
|
+
tmp.style.backgroundColor = "transparent";
|
106
|
+
tmp.style.backgroundImage = "none";
|
107
|
+
tmp.appendChild(chk);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
return obj;
|
111
|
+
};
|
112
|
+
this._realcheckboxes = function () {
|
113
|
+
var ts = this.settings.checkbox.tie_selection;
|
114
|
+
console.log(ts);
|
115
|
+
$('.jstree-realcheckbox').each(function () {
|
116
|
+
this.checked = (!ts && this.parentNode.parentNode.className.indexOf("jstree-checked") !== -1) || (ts && this.parentNode.parentNode.className.indexOf('jstree-clicked') !== -1);
|
117
|
+
this.indeterminate = this.parentNode.className.indexOf("jstree-undetermined") !== -1;
|
118
|
+
this.disabled = this.parentNode.parentNode.className.indexOf("disabled") !== -1;
|
119
|
+
});
|
120
|
+
};
|
121
|
+
};
|
122
|
+
})(jQuery);
|
123
|
+
|
124
|
+
// no state
|
125
|
+
(function ($, undefined) {
|
126
|
+
"use strict";
|
127
|
+
$.jstree.plugins.nostate = function () {
|
128
|
+
this.set_state = function (state, callback) {
|
129
|
+
if(callback) { callback.call(this); }
|
130
|
+
this.trigger('set_state');
|
131
|
+
};
|
132
|
+
};
|
133
|
+
})(jQuery);
|
134
|
+
|
135
|
+
// no selected in state
|
136
|
+
(function ($, undefined) {
|
137
|
+
"use strict";
|
138
|
+
$.jstree.plugins.noselectedstate = function (options, parent) {
|
139
|
+
this.get_state = function () {
|
140
|
+
var state = parent.get_state.call(this);
|
141
|
+
delete state.core.selected;
|
142
|
+
return state;
|
143
|
+
};
|
144
|
+
};
|
145
|
+
})(jQuery);
|
146
|
+
|
147
|
+
// additional icon on node (outside of anchor)
|
148
|
+
(function ($, undefined) {
|
149
|
+
"use strict";
|
150
|
+
var img = document.createElement('IMG');
|
151
|
+
//img.src = "http://www.dpcd.vic.gov.au/__data/assets/image/0004/30667/help.gif";
|
152
|
+
img.className = "jstree-questionmark";
|
153
|
+
|
154
|
+
$.jstree.defaults.questionmark = $.noop;
|
155
|
+
$.jstree.plugins.questionmark = function (options, parent) {
|
156
|
+
this.bind = function () {
|
157
|
+
parent.bind.call(this);
|
158
|
+
this.element
|
159
|
+
.on("click.jstree", ".jstree-questionmark", $.proxy(function (e) {
|
160
|
+
e.stopImmediatePropagation();
|
161
|
+
this.settings.questionmark.call(this, this.get_node(e.target));
|
162
|
+
}, this));
|
163
|
+
};
|
164
|
+
this.teardown = function () {
|
165
|
+
if(this.settings.questionmark) {
|
166
|
+
this.element.find(".jstree-questionmark").remove();
|
167
|
+
}
|
168
|
+
parent.teardown.call(this);
|
169
|
+
};
|
170
|
+
this.redraw_node = function(obj, deep, callback, force_draw) {
|
171
|
+
obj = parent.redraw_node.call(this, obj, deep, callback, force_draw);
|
172
|
+
if(obj) {
|
173
|
+
var tmp = img.cloneNode(true);
|
174
|
+
obj.insertBefore(tmp, obj.childNodes[2]);
|
175
|
+
}
|
176
|
+
return obj;
|
177
|
+
};
|
178
|
+
};
|
179
|
+
})(jQuery);
|
180
|
+
|
181
|
+
// auto numbering
|
182
|
+
(function ($, undefined) {
|
183
|
+
"use strict";
|
184
|
+
var span = document.createElement('SPAN');
|
185
|
+
span.className = "jstree-numbering";
|
186
|
+
|
187
|
+
$.jstree.defaults.numbering = {};
|
188
|
+
$.jstree.plugins.numbering = function (options, parent) {
|
189
|
+
this.teardown = function () {
|
190
|
+
if(this.settings.questionmark) {
|
191
|
+
this.element.find(".jstree-numbering").remove();
|
192
|
+
}
|
193
|
+
parent.teardown.call(this);
|
194
|
+
};
|
195
|
+
this.get_number = function (obj) {
|
196
|
+
obj = this.get_node(obj);
|
197
|
+
var ind = $.inArray(obj.id, this.get_node(obj.parent).children) + 1;
|
198
|
+
return obj.parent === '#' ? ind : this.get_number(obj.parent) + '.' + ind;
|
199
|
+
};
|
200
|
+
this.redraw_node = function(obj, deep, callback, force_draw) {
|
201
|
+
var i, j, tmp = null, elm = null, org = this.get_number(obj);
|
202
|
+
obj = parent.redraw_node.call(this, obj, deep, callback, force_draw);
|
203
|
+
if(obj) {
|
204
|
+
for(i = 0, j = obj.childNodes.length; i < j; i++) {
|
205
|
+
if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) {
|
206
|
+
tmp = obj.childNodes[i];
|
207
|
+
break;
|
208
|
+
}
|
209
|
+
}
|
210
|
+
if(tmp) {
|
211
|
+
elm = span.cloneNode(true);
|
212
|
+
elm.innerHTML = org + '. ';
|
213
|
+
tmp.insertBefore(elm, tmp.childNodes[tmp.childNodes.length - 1]);
|
214
|
+
}
|
215
|
+
}
|
216
|
+
return obj;
|
217
|
+
};
|
218
|
+
};
|
219
|
+
})(jQuery);
|
220
|
+
|
221
|
+
// additional icon on node (inside anchor)
|
222
|
+
(function ($, undefined) {
|
223
|
+
"use strict";
|
224
|
+
var _s = document.createElement('SPAN');
|
225
|
+
_s.className = 'fa-stack jstree-stackedicon';
|
226
|
+
var _i = document.createElement('I');
|
227
|
+
_i.className = 'jstree-icon';
|
228
|
+
_i.setAttribute('role', 'presentation');
|
229
|
+
|
230
|
+
$.jstree.plugins.stackedicon = function (options, parent) {
|
231
|
+
this.teardown = function () {
|
232
|
+
this.element.find(".jstree-stackedicon").remove();
|
233
|
+
parent.teardown.call(this);
|
234
|
+
};
|
235
|
+
this.redraw_node = function(obj, deep, is_callback, force_render) {
|
236
|
+
obj = parent.redraw_node.apply(this, arguments);
|
237
|
+
if(obj) {
|
238
|
+
var i, j, tmp = null, icon = null, temp = null;
|
239
|
+
for(i = 0, j = obj.childNodes.length; i < j; i++) {
|
240
|
+
if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) {
|
241
|
+
tmp = obj.childNodes[i];
|
242
|
+
break;
|
243
|
+
}
|
244
|
+
}
|
245
|
+
if(tmp) {
|
246
|
+
if(this._model.data[obj.id].state.icons && this._model.data[obj.id].state.icons.length) {
|
247
|
+
icon = _s.cloneNode(false);
|
248
|
+
for(i = 0, j = this._model.data[obj.id].state.icons.length; i < j; i++) {
|
249
|
+
temp = _i.cloneNode(false);
|
250
|
+
temp.className += ' ' + this._model.data[obj.id].state.icons[i];
|
251
|
+
icon.appendChild(temp);
|
252
|
+
}
|
253
|
+
tmp.insertBefore(icon, tmp.childNodes[0]);
|
254
|
+
}
|
255
|
+
}
|
256
|
+
}
|
257
|
+
return obj;
|
258
|
+
};
|
259
|
+
};
|
260
|
+
})(jQuery);
|
261
|
+
|
262
|
+
// selecting a node opens it
|
263
|
+
(function ($, undefined) {
|
264
|
+
"use strict";
|
265
|
+
$.jstree.plugins.selectopens = function (options, parent) {
|
266
|
+
this.bind = function () {
|
267
|
+
parent.bind.call(this);
|
268
|
+
this.element.on('select_node.jstree', function (e, data) { data.instance.open_node(data.node); });
|
269
|
+
};
|
270
|
+
};
|
271
|
+
})(jQuery);
|
272
|
+
|
273
|
+
// object as data
|
274
|
+
(function ($, undefined) {
|
275
|
+
"use strict";
|
276
|
+
$.jstree.defaults.datamodel = {};
|
277
|
+
$.jstree.plugins.datamodel = function (options, parent) {
|
278
|
+
this.init = function (el, options) {
|
279
|
+
this._data.datamodel = {};
|
280
|
+
parent.init.call(this, el, options);
|
281
|
+
};
|
282
|
+
this._datamodel = function (id, nodes, callback) {
|
283
|
+
var i = 0, j = nodes.length, tmp = [], obj = null;
|
284
|
+
for(; i < j; i++) {
|
285
|
+
this._data.datamodel[nodes[i].getID()] = nodes[i];
|
286
|
+
obj = {
|
287
|
+
id : nodes[i].getID(),
|
288
|
+
text : nodes[i].getText(),
|
289
|
+
children : nodes[i].hasChildren()
|
290
|
+
};
|
291
|
+
if(nodes[i].getExtra) {
|
292
|
+
obj = nodes[i].getExtra(obj); // icon, type
|
293
|
+
}
|
294
|
+
tmp.push(obj);
|
295
|
+
}
|
296
|
+
return this._append_json_data(id, tmp, $.proxy(function (status) {
|
297
|
+
callback.call(this, status);
|
298
|
+
}, this));
|
299
|
+
};
|
300
|
+
this._load_node = function (obj, callback) {
|
301
|
+
var id = obj.id;
|
302
|
+
var nd = obj.id === "#" ? this.settings.core.data : this._data.datamodel[obj.id].getChildren($.proxy(function (nodes) {
|
303
|
+
this._datamodel(id, nodes, callback);
|
304
|
+
}, this));
|
305
|
+
if($.isArray(nd)) {
|
306
|
+
this._datamodel(id, nd, callback);
|
307
|
+
}
|
308
|
+
};
|
309
|
+
};
|
310
|
+
})(jQuery);
|
311
|
+
/*
|
312
|
+
demo of the above
|
313
|
+
function treeNode(val) {
|
314
|
+
var id = ++treeNode.counter;
|
315
|
+
this.getID = function () {
|
316
|
+
return id;
|
317
|
+
};
|
318
|
+
this.getText = function () {
|
319
|
+
return val.toString();
|
320
|
+
};
|
321
|
+
this.getExtra = function (obj) {
|
322
|
+
obj.icon = false;
|
323
|
+
return obj;
|
324
|
+
};
|
325
|
+
this.hasChildren = function () {
|
326
|
+
return true;
|
327
|
+
};
|
328
|
+
this.getChildren = function () {
|
329
|
+
return [
|
330
|
+
new treeNode(Math.pow(val, 2)),
|
331
|
+
new treeNode(Math.sqrt(val)),
|
332
|
+
];
|
333
|
+
};
|
334
|
+
}
|
335
|
+
treeNode.counter = 0;
|
336
|
+
|
337
|
+
$('#jstree').jstree({
|
338
|
+
'core': {
|
339
|
+
'data': [
|
340
|
+
new treeNode(2),
|
341
|
+
new treeNode(3),
|
342
|
+
new treeNode(4),
|
343
|
+
new treeNode(5)
|
344
|
+
]
|
345
|
+
},
|
346
|
+
plugins : ['datamodel']
|
347
|
+
});
|
348
|
+
*/
|
349
|
+
|
350
|
+
// untested sample plugin to keep all nodes in the DOM
|
351
|
+
(function ($, undefined) {
|
352
|
+
"use strict";
|
353
|
+
$.jstree.plugins.dom = function (options, parent) {
|
354
|
+
this.redraw_node = function (node, deep, is_callback, force_render) {
|
355
|
+
return parent.redraw_node.call(this, node, deep, is_callback, true);
|
356
|
+
};
|
357
|
+
this.close_node = function (obj, animation) {
|
358
|
+
var t1, t2, t, d;
|
359
|
+
if($.isArray(obj)) {
|
360
|
+
obj = obj.slice();
|
361
|
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
362
|
+
this.close_node(obj[t1], animation);
|
363
|
+
}
|
364
|
+
return true;
|
365
|
+
}
|
366
|
+
obj = this.get_node(obj);
|
367
|
+
if(!obj || obj.id === $.jstree.root) {
|
368
|
+
return false;
|
369
|
+
}
|
370
|
+
if(this.is_closed(obj)) {
|
371
|
+
return false;
|
372
|
+
}
|
373
|
+
animation = animation === undefined ? this.settings.core.animation : animation;
|
374
|
+
t = this;
|
375
|
+
d = this.get_node(obj, true);
|
376
|
+
if(d.length) {
|
377
|
+
if(!animation) {
|
378
|
+
d[0].className = d[0].className.replace('jstree-open', 'jstree-closed');
|
379
|
+
d.attr("aria-expanded", false);
|
380
|
+
}
|
381
|
+
else {
|
382
|
+
d
|
383
|
+
.children(".jstree-children").attr("style","display:block !important").end()
|
384
|
+
.removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded", false)
|
385
|
+
.children(".jstree-children").stop(true, true).slideUp(animation, function () {
|
386
|
+
this.style.display = "";
|
387
|
+
t.trigger("after_close", { "node" : obj });
|
388
|
+
});
|
389
|
+
}
|
390
|
+
}
|
391
|
+
obj.state.opened = false;
|
392
|
+
this.trigger('close_node',{ "node" : obj });
|
393
|
+
if(!animation || !d.length) {
|
394
|
+
this.trigger("after_close", { "node" : obj });
|
395
|
+
}
|
396
|
+
};
|
397
|
+
};
|
398
|
+
})(jQuery);
|
399
|
+
|
400
|
+
// customize plugin by @Lusito
|
401
|
+
// https://github.com/Lusito/jstree/blob/node-customize/src/jstree-node-customize.js
|
402
|
+
/**
|
403
|
+
* ### Node Customize plugin
|
404
|
+
*
|
405
|
+
* Allows to customize nodes when they are drawn.
|
406
|
+
*/
|
407
|
+
(function (factory) {
|
408
|
+
"use strict";
|
409
|
+
if (typeof define === 'function' && define.amd) {
|
410
|
+
define('jstree.node_customize', ['jquery','jstree'], factory);
|
411
|
+
}
|
412
|
+
else if(typeof exports === 'object') {
|
413
|
+
factory(require('jquery'), require('jstree'));
|
414
|
+
}
|
415
|
+
else {
|
416
|
+
factory(jQuery, jQuery.jstree);
|
417
|
+
}
|
418
|
+
}(function ($, jstree, undefined) {
|
419
|
+
"use strict";
|
420
|
+
|
421
|
+
if($.jstree.plugins.node_customize) { return; }
|
422
|
+
|
423
|
+
/**
|
424
|
+
* the settings object.
|
425
|
+
* key is the attribute name to select the customizer function from switch.
|
426
|
+
* switch is a key => function(el, node) map.
|
427
|
+
* default: function(el, node) will be called if the type could not be mapped
|
428
|
+
* @name $.jstree.defaults.node_customize
|
429
|
+
* @plugin node_customize
|
430
|
+
*/
|
431
|
+
$.jstree.defaults.node_customize = {
|
432
|
+
"key": "type",
|
433
|
+
"switch": {},
|
434
|
+
"default": null
|
435
|
+
};
|
436
|
+
|
437
|
+
$.jstree.plugins.node_customize = function (options, parent) {
|
438
|
+
this.redraw_node = function (obj, deep, callback, force_draw) {
|
439
|
+
var el = parent.redraw_node.apply(this, arguments);
|
440
|
+
if (el) {
|
441
|
+
var node = this.get_node(obj);
|
442
|
+
var cfg = this.settings.node_customize;
|
443
|
+
var key = cfg.key;
|
444
|
+
var type = (node && node.original && node.original[key]);
|
445
|
+
var customizer = (type && cfg.switch[type]) || cfg.default;
|
446
|
+
if(customizer)
|
447
|
+
customizer(el, node);
|
448
|
+
}
|
449
|
+
return el;
|
450
|
+
};
|
451
|
+
}
|
452
|
+
}));
|
453
|
+
|
454
|
+
|
455
|
+
// parentsload plugin by @ashl1
|
456
|
+
/**
|
457
|
+
* ### Parentsload plugin
|
458
|
+
*
|
459
|
+
* Change load_node() functionality in jsTree, to possible load not yes downloaded node with all it parent in a single request (only useful with lazy loading).
|
460
|
+
*
|
461
|
+
* version 1.0.0 (Alexey Shildyakov - ashl1future@gmail.com)
|
462
|
+
* 2015: Compatible with jsTree-3.2.1
|
463
|
+
*/
|
464
|
+
/*globals jQuery, define, exports, require, document */
|
465
|
+
(function (factory) {
|
466
|
+
"use strict";
|
467
|
+
if (typeof define === 'function' && define.amd) {
|
468
|
+
define('jstree.parentsload', ['jquery','jstree'], factory);
|
469
|
+
}
|
470
|
+
else if(typeof exports === 'object') {
|
471
|
+
factory(require('jquery'), require('jstree'));
|
472
|
+
}
|
473
|
+
else {
|
474
|
+
factory(jQuery, jQuery.jstree);
|
475
|
+
}
|
476
|
+
}(function ($, jstree, undefined) {
|
477
|
+
"use strict";
|
478
|
+
|
479
|
+
if($.jstree.plugins.parentsload) { return; }
|
480
|
+
|
481
|
+
/**
|
482
|
+
* parentsload configuration
|
483
|
+
*
|
484
|
+
* The configuration syntax is almost the same as for core.data option. You must set parenstload.data the following:
|
485
|
+
*
|
486
|
+
* parentsload: {
|
487
|
+
* data: function(){} // this function overwrites core data.data options
|
488
|
+
* }
|
489
|
+
*
|
490
|
+
* OR
|
491
|
+
*
|
492
|
+
* parentsload: {
|
493
|
+
* data: {
|
494
|
+
* url: function(node){} OR string,
|
495
|
+
* data: function(node){} OR associative array as json{data} jQuery parameter
|
496
|
+
* }
|
497
|
+
* }
|
498
|
+
*
|
499
|
+
* In last case at least on of 'url' or 'data' must be presented.
|
500
|
+
*
|
501
|
+
* At first, the plugin load_node() detects if the node already downloaded. If is - uses the core.data settings, if not - uses parentsload.data settings
|
502
|
+
* to fetch in one query the specified node and all its parent. The data must be in the first mentioned JSON format with set nested children[].
|
503
|
+
* Each node level should consist of all nodes on the level to properly work with the tree in the future. Otherwise, you must manually call load_node
|
504
|
+
* on every parent node to fetch all children nodes on that level.
|
505
|
+
*
|
506
|
+
* @name $.jstree.defaults.parentsload
|
507
|
+
* @plugin parentsload
|
508
|
+
*/
|
509
|
+
$.jstree.defaults.parentsload = null;
|
510
|
+
$.jstree.plugins.parentsload = function (options, parent) {
|
511
|
+
this.init = function (el, options) {
|
512
|
+
parent.init.call(this, el, options);
|
513
|
+
this.patch_data()
|
514
|
+
};
|
515
|
+
this.patch_data = function(){
|
516
|
+
var parentsloadSettings = this.settings.parentsload;
|
517
|
+
var jsTreeDataSettings = this.settings.core.data;
|
518
|
+
var self = this;
|
519
|
+
|
520
|
+
var callError = function(number, message) {
|
521
|
+
self._data.core.last_error = { 'error' : 'configuration', 'plugin' : 'parentsload', 'id' : 'parentsload_' + number, 'reason' : message, 'data' : JSON.stringify({config: parentsloadSettings}) };
|
522
|
+
self.settings.core.error.call(self, self._data.core.last_error);
|
523
|
+
}
|
524
|
+
|
525
|
+
if(!parentsloadSettings) {
|
526
|
+
callError('01', 'The configuration must be presented')
|
527
|
+
return
|
528
|
+
}
|
529
|
+
parentsloadSettings = parentsloadSettings.data;
|
530
|
+
|
531
|
+
var patchSettingsProperty = function (propertyName) {
|
532
|
+
var property = parentsloadSettings[propertyName],
|
533
|
+
coreProperty = jsTreeDataSettings[propertyName];
|
534
|
+
if (property) {
|
535
|
+
jsTreeDataSettings[propertyName] = function(node) {
|
536
|
+
if (this.get_node(node).parentsload_required) {
|
537
|
+
if ($.isFunction(property)) {
|
538
|
+
return property.call(this, node)
|
539
|
+
} else {// (typeof property === 'string')
|
540
|
+
return property
|
541
|
+
}
|
542
|
+
} else {
|
543
|
+
if ($.isFunction(coreProperty)) {
|
544
|
+
return coreProperty.call(this, node)
|
545
|
+
} else { // (typeof coreProperty === 'string')
|
546
|
+
return coreProperty
|
547
|
+
}
|
548
|
+
}
|
549
|
+
}
|
550
|
+
} /* else {
|
551
|
+
use jstree the same data[propertyName] settings
|
552
|
+
}*/
|
553
|
+
}
|
554
|
+
|
555
|
+
if($.isFunction(parentsloadSettings)) {
|
556
|
+
this.settings.data = parentsloadSettings
|
557
|
+
} else if (typeof parentsloadSettings === 'object') {
|
558
|
+
if (! (parentsloadSettings.url || parentsloadSettings.data)) {
|
559
|
+
callError('02', 'The "data.url" or "data.data" must be presented in configuration')
|
560
|
+
return
|
561
|
+
}
|
562
|
+
patchSettingsProperty('url')
|
563
|
+
patchSettingsProperty('data')
|
564
|
+
|
565
|
+
} else {
|
566
|
+
callError('03', 'The appropriate "data.url" or "data.data" must be presented in configuration')
|
567
|
+
}
|
568
|
+
}
|
569
|
+
|
570
|
+
this.load_node = function (obj, callback) {
|
571
|
+
if($.isArray(obj)) {
|
572
|
+
// FIXME: _load_nodes will not load nodes not presented in the tree
|
573
|
+
this._load_nodes(obj.slice(), callback);
|
574
|
+
return true;
|
575
|
+
}
|
576
|
+
var foundObj = this.get_node(obj);
|
577
|
+
if (foundObj) {
|
578
|
+
return parent.load_node.apply(this, arguments)
|
579
|
+
} else {
|
580
|
+
// node hasn't been loaded
|
581
|
+
var id = obj.id? obj.id: obj;
|
582
|
+
this._model.data[id] = {
|
583
|
+
id : id,
|
584
|
+
parent : '#',
|
585
|
+
parents : [],
|
586
|
+
children : [],
|
587
|
+
children_d : [],
|
588
|
+
state : { loaded : false },
|
589
|
+
li_attr : {},
|
590
|
+
a_attr : {},
|
591
|
+
parentsload_required : true,
|
592
|
+
};
|
593
|
+
return parent.load_node.call(this, obj, function(obj, status){
|
594
|
+
obj.parentsload_required = !status
|
595
|
+
callback.call(this, obj, status)
|
596
|
+
})
|
597
|
+
}
|
598
|
+
}
|
599
|
+
};
|
600
|
+
}));
|
601
|
+
|
602
|
+
// conditional deselect
|
603
|
+
(function (factory) {
|
604
|
+
"use strict";
|
605
|
+
if (typeof define === 'function' && define.amd) {
|
606
|
+
define('jstree.conditionaldeselect', ['jquery','jstree'], factory);
|
607
|
+
}
|
608
|
+
else if(typeof exports === 'object') {
|
609
|
+
factory(require('jquery'), require('jstree'));
|
610
|
+
}
|
611
|
+
else {
|
612
|
+
factory(jQuery, jQuery.jstree);
|
613
|
+
}
|
614
|
+
}(function ($, jstree, undefined) {
|
615
|
+
"use strict";
|
616
|
+
|
617
|
+
if($.jstree.plugins.conditionaldeselect) { return; }
|
618
|
+
$.jstree.defaults.conditionaldeselect = function () { return true; };
|
619
|
+
$.jstree.plugins.conditionaldeselect = function (options, parent) {
|
620
|
+
// own function
|
621
|
+
this.deselect_node = function (obj, supress_event, e) {
|
622
|
+
if(this.settings.conditionaldeselect.call(this, this.get_node(obj), e)) {
|
623
|
+
return parent.deselect_node.call(this, obj, supress_event, e);
|
624
|
+
}
|
625
|
+
};
|
626
|
+
};
|
627
|
+
|
628
|
+
}));
|
629
|
+
|
630
|
+
// conditional close
|
631
|
+
(function (factory) {
|
632
|
+
"use strict";
|
633
|
+
if (typeof define === 'function' && define.amd) {
|
634
|
+
define('jstree.conditionalclose', ['jquery','jstree'], factory);
|
635
|
+
}
|
636
|
+
else if(typeof exports === 'object') {
|
637
|
+
factory(require('jquery'), require('jstree'));
|
638
|
+
}
|
639
|
+
else {
|
640
|
+
factory(jQuery, jQuery.jstree);
|
641
|
+
}
|
642
|
+
}(function ($, jstree, undefined) {
|
643
|
+
"use strict";
|
644
|
+
|
645
|
+
if($.jstree.plugins.conditionalclose) { return; }
|
646
|
+
$.jstree.defaults.conditionalclose = function () { return true; };
|
647
|
+
$.jstree.plugins.conditionalclose = function (options, parent) {
|
648
|
+
// own function
|
649
|
+
this.close_node = function (obj, animation) {
|
650
|
+
if(this.settings.conditionalclose.close.call(this, this.get_node(obj), e)) {
|
651
|
+
return parent.deselect_node.call(this, obj, animation);
|
652
|
+
}
|
653
|
+
};
|
654
|
+
};
|
655
|
+
|
656
|
+
}));
|
@@ -0,0 +1 @@
|
|
1
|
+
}));
|