ruote-kit 2.2.0.3 → 2.3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +28 -1
- data/CREDITS.txt +8 -2
- data/LICENSE.txt +1 -1
- data/Rakefile +21 -9
- data/lib/ruote-kit.rb +13 -4
- data/lib/ruote-kit/core_ext.rb +15 -0
- data/lib/ruote-kit/helpers/json_helpers.rb +22 -7
- data/lib/ruote-kit/helpers/link_helpers.rb +9 -7
- data/lib/ruote-kit/helpers/pagination_helpers.rb +1 -2
- data/lib/ruote-kit/helpers/render_helpers.rb +1 -1
- data/lib/ruote-kit/public/_ruote/images/favicon.png +0 -0
- data/lib/ruote-kit/public/_ruote/images/{ruote_buttons.png → ruote-buttons.png} +0 -0
- data/lib/ruote-kit/public/_ruote/images/ruote.png +0 -0
- data/lib/ruote-kit/public/_ruote/javascripts/foolbox-all.min.js +3 -0
- data/lib/ruote-kit/public/_ruote/javascripts/jquery-1.9.1.min.js +5 -0
- data/lib/ruote-kit/public/_ruote/javascripts/rk.js +68 -17
- data/lib/ruote-kit/public/_ruote/javascripts/ruote-fluo-all.min.js +3 -0
- data/lib/ruote-kit/public/_ruote/stylesheets/rk.css +82 -12
- data/lib/ruote-kit/public/_ruote/stylesheets/ruote-buttons.png +0 -0
- data/lib/ruote-kit/public/_ruote/stylesheets/ruote-fluo-editor.css +9 -6
- data/lib/ruote-kit/public/_ruote/stylesheets/ruote-fluo.css +62 -0
- data/lib/ruote-kit/resources/errors.rb +8 -3
- data/lib/ruote-kit/resources/expressions.rb +38 -35
- data/lib/ruote-kit/resources/participants.rb +1 -1
- data/lib/ruote-kit/resources/processes.rb +61 -4
- data/lib/ruote-kit/resources/workitems.rb +4 -4
- data/lib/ruote-kit/version.rb +1 -1
- data/lib/ruote-kit/views/_pagination.html.haml +2 -2
- data/lib/ruote-kit/views/_tree_editor.html.haml +63 -30
- data/lib/ruote-kit/views/error.html.haml +50 -9
- data/lib/ruote-kit/views/errors.html.haml +1 -1
- data/lib/ruote-kit/views/expression.html.haml +83 -33
- data/lib/ruote-kit/views/expressions.html.haml +23 -8
- data/lib/ruote-kit/views/http_error.html.haml +9 -2
- data/lib/ruote-kit/views/layout.html.haml +14 -13
- data/lib/ruote-kit/views/process.html.haml +75 -20
- data/lib/ruote-kit/views/processes.html.haml +9 -3
- data/lib/ruote-kit/views/processes_new.html.haml +19 -2
- data/lib/ruote-kit/views/schedules.html.haml +2 -2
- data/lib/ruote-kit/views/workitem.html.haml +17 -6
- data/ruote-kit.gemspec +9 -7
- data/spec/cases/orphan_workitem_spec.rb +141 -0
- data/spec/core_ext_spec.rb +19 -0
- data/spec/resources/errors_spec.rb +182 -156
- data/spec/resources/expressions_spec.rb +497 -379
- data/spec/resources/index_spec.rb +5 -5
- data/spec/resources/participants_spec.rb +64 -75
- data/spec/resources/processes_spec.rb +396 -277
- data/spec/resources/schedules_spec.rb +92 -76
- data/spec/resources/workitems_spec.rb +352 -343
- data/spec/ruote-kit_configure_spec.rb +41 -13
- data/spec/spec_helper.rb +6 -8
- data/spec/support/link_helper.rb +11 -0
- data/spec/webapp_helpers_spec.rb +29 -23
- metadata +161 -180
- data/README.rdoc +0 -313
- data/lib/ruote-kit/public/_ruote/images/favicon.ico +0 -0
- data/lib/ruote-kit/public/_ruote/javascripts/jquery-1.4.2.min.js +0 -154
- data/lib/ruote-kit/public/_ruote/javascripts/ruote-fluo-editor.js +0 -548
- data/lib/ruote-kit/public/_ruote/javascripts/ruote-fluo.js +0 -1118
@@ -1,548 +0,0 @@
|
|
1
|
-
|
2
|
-
/*
|
3
|
-
* Ruote - open source ruby workflow engine
|
4
|
-
* (c) 2005-2010 John Mettraux
|
5
|
-
*
|
6
|
-
* Ruote is freely distributable under the terms of the MIT license.
|
7
|
-
* For details, see the ruote web site: http://ruote.rubyforge.org
|
8
|
-
*
|
9
|
-
* This piece of hack was created during the RubyKaigi2008,
|
10
|
-
* between Tsukuba and Akihabara.
|
11
|
-
*/
|
12
|
-
|
13
|
-
//var flow = [ 'process-definition', { 'name': 'toto', 'revision': '1.0' }, [
|
14
|
-
// [ 'sequence', {}, [
|
15
|
-
// [ 'participant', { 'ref': 'alpha' }, [] ],
|
16
|
-
// [ 'bravo', {}, [] ]
|
17
|
-
// ]]
|
18
|
-
// ]
|
19
|
-
//]
|
20
|
-
|
21
|
-
try {
|
22
|
-
HTMLElement.prototype.firstChildOfClass = function (className) {
|
23
|
-
for (var i=0; i < this.childNodes.length; i++) {
|
24
|
-
var c = this.childNodes[i];
|
25
|
-
if (c.className == className) return c;
|
26
|
-
}
|
27
|
-
return null;
|
28
|
-
}
|
29
|
-
} catch (e) {
|
30
|
-
// when testing via spidermonkey
|
31
|
-
}
|
32
|
-
|
33
|
-
String.prototype.tstrip = function () {
|
34
|
-
var s = this;
|
35
|
-
while (s.charAt(0) == ' ') s = s.substring(1);
|
36
|
-
while (s.charAt(s.length - 1) == ' ') s = s.substring(0, s.length - 1);
|
37
|
-
return s;
|
38
|
-
}
|
39
|
-
|
40
|
-
var FluoEditor = function () {
|
41
|
-
|
42
|
-
var TEXTS = {
|
43
|
-
add_child_expression: 'add a child expression',
|
44
|
-
cut_expression: 'cut expression',
|
45
|
-
moveup_expression: 'move expression up',
|
46
|
-
movedown_expression: 'move expression down',
|
47
|
-
paste_expression: 'paste expression here'
|
48
|
-
};
|
49
|
-
|
50
|
-
// it's easy to override this var to let FluoEditor point to another root
|
51
|
-
//
|
52
|
-
// FluoEditor.imageRoot = 'http://my.image.server.exmaple.com/img'
|
53
|
-
//
|
54
|
-
var imageRoot = '/images';
|
55
|
-
|
56
|
-
var Attributes = function() {
|
57
|
-
|
58
|
-
function tryParse (s) {
|
59
|
-
try { return JSON.parse(s); } catch (e) {}
|
60
|
-
return undefined;
|
61
|
-
}
|
62
|
-
|
63
|
-
function parse (s) {
|
64
|
-
|
65
|
-
s = s.tstrip();
|
66
|
-
|
67
|
-
var r = tryParse("{" + s + "}");
|
68
|
-
if (r != undefined) return r;
|
69
|
-
|
70
|
-
var head = undefined;
|
71
|
-
var tail = undefined;
|
72
|
-
|
73
|
-
var m = s.match(/^([^",]+)(.*)$/)
|
74
|
-
if (m) {
|
75
|
-
r = tryParse(m[1]);
|
76
|
-
if (r != undefined) head = r;
|
77
|
-
else head = tryParse('"' + m[1] + '"');
|
78
|
-
tail = m[2];
|
79
|
-
}
|
80
|
-
else {
|
81
|
-
for (var i = 1; i <= s.length; i++) {
|
82
|
-
r = tryParse(s.slice(0, i));
|
83
|
-
if (r != undefined) {
|
84
|
-
head = r;
|
85
|
-
break;
|
86
|
-
}
|
87
|
-
}
|
88
|
-
tail = s.slice(i);
|
89
|
-
}
|
90
|
-
|
91
|
-
var h = {};
|
92
|
-
h[head] = null;
|
93
|
-
m = tail.match(/^[ ,]*(.*)$/);
|
94
|
-
var hh = tryParse("{" + m[1] + "}");
|
95
|
-
for (var k in hh) { h[k] = hh[k]; }
|
96
|
-
|
97
|
-
return h;
|
98
|
-
}
|
99
|
-
|
100
|
-
return { parse: parse };
|
101
|
-
}();
|
102
|
-
|
103
|
-
var ExpressionHead = function () {
|
104
|
-
|
105
|
-
function createButton (rfeClass, tooltip, callback) {
|
106
|
-
|
107
|
-
var i = document.createElement('a');
|
108
|
-
i.callback = callback;
|
109
|
-
i.className = 'rfe_button ' + rfeClass;
|
110
|
-
i.setAttribute('href', '');
|
111
|
-
i.setAttribute('title', tooltip);
|
112
|
-
i.setAttribute('onclick', 'this.callback(); return false;');
|
113
|
-
return i;
|
114
|
-
}
|
115
|
-
|
116
|
-
function addHeadButtons (expdiv) {
|
117
|
-
|
118
|
-
var outOpacity = 0.0;
|
119
|
-
|
120
|
-
var buttons = document.createElement('span');
|
121
|
-
buttons.className = 'rfe_buttons';
|
122
|
-
buttons.style.opacity = outOpacity;
|
123
|
-
|
124
|
-
var root = findRfeRoot(expdiv);
|
125
|
-
|
126
|
-
expdiv.onmouseover = function () {
|
127
|
-
buttons.style.opacity = 1.0;
|
128
|
-
if (root.onOver) root.onOver(computeExpId(expdiv.parentNode));
|
129
|
-
};
|
130
|
-
expdiv.onmouseout = function () {
|
131
|
-
buttons.style.opacity = outOpacity;
|
132
|
-
if (root.onOver) root.onOver(null);
|
133
|
-
};
|
134
|
-
|
135
|
-
buttons.appendChild(createButton(
|
136
|
-
'rfe_add',
|
137
|
-
FluoEditor.TEXTS.add_child_expression,
|
138
|
-
function () {
|
139
|
-
FluoEditor.addExpression(expdiv.parentNode, [ '---', {}, [] ]);
|
140
|
-
}));
|
141
|
-
|
142
|
-
if (expdiv.parentNode.parentNode != root) {
|
143
|
-
|
144
|
-
buttons.appendChild(createButton(
|
145
|
-
'rfe_cut',
|
146
|
-
FluoEditor.TEXTS.cut_expression,
|
147
|
-
function () {
|
148
|
-
FluoEditor.removeExpression(expdiv.parentNode);
|
149
|
-
}));
|
150
|
-
buttons.appendChild(createButton(
|
151
|
-
'rfe_moveup',
|
152
|
-
FluoEditor.TEXTS.moveup_expression,
|
153
|
-
function () {
|
154
|
-
FluoEditor.moveExpression(expdiv.parentNode, -1);
|
155
|
-
buttons.style.opacity = outOpacity;
|
156
|
-
}));
|
157
|
-
buttons.appendChild(createButton(
|
158
|
-
'rfe_movedown',
|
159
|
-
FluoEditor.TEXTS.movedown_expression,
|
160
|
-
function () {
|
161
|
-
FluoEditor.moveExpression(expdiv.parentNode, +1);
|
162
|
-
buttons.style.opacity = outOpacity;
|
163
|
-
}));
|
164
|
-
buttons.appendChild(createButton(
|
165
|
-
'rfe_paste',
|
166
|
-
FluoEditor.TEXTS.paste_expression,
|
167
|
-
function () {
|
168
|
-
var clip = document._rfe_clipboard;
|
169
|
-
if (clip) FluoEditor.insertExpression(expdiv.parentNode, clip);
|
170
|
-
}));
|
171
|
-
}
|
172
|
-
|
173
|
-
expdiv.appendChild(buttons);
|
174
|
-
}
|
175
|
-
|
176
|
-
var headPattern = /^(\S+)(.*)$/;
|
177
|
-
|
178
|
-
function renderAttributes (h) {
|
179
|
-
|
180
|
-
//var keys = [];
|
181
|
-
//for (var k in h) keys.push(k);
|
182
|
-
//keys = keys.sort();
|
183
|
-
//s = '';
|
184
|
-
//for (var i = 0; i < keys.length; i++) {
|
185
|
-
// var k = keys[i];
|
186
|
-
// s += k;
|
187
|
-
// var v = JSON.stringify(h[k]);
|
188
|
-
// if (v != 'null') s += (': ' + v);
|
189
|
-
// s += ', ';
|
190
|
-
//}
|
191
|
-
//if (s.length > 1) s = s.substring(0, s.length - 2);
|
192
|
-
//return s;
|
193
|
-
|
194
|
-
var a = [];
|
195
|
-
|
196
|
-
for (var k in h) {
|
197
|
-
var v = h[k];
|
198
|
-
if (v == null) {
|
199
|
-
a.push(JSON.stringify(k));
|
200
|
-
break;
|
201
|
-
}
|
202
|
-
}
|
203
|
-
for (var k in h) {
|
204
|
-
var v = h[k];
|
205
|
-
if (v == null) continue;
|
206
|
-
a.push(JSON.stringify(k) + ': ' + JSON.stringify(v));
|
207
|
-
}
|
208
|
-
|
209
|
-
return a.join(', ');
|
210
|
-
}
|
211
|
-
|
212
|
-
return {
|
213
|
-
|
214
|
-
render: function (node, exp) {
|
215
|
-
|
216
|
-
var expname = exp[0];
|
217
|
-
|
218
|
-
var text = '';
|
219
|
-
if ((typeof exp[2][0]) == 'string') text = exp[2].shift();
|
220
|
-
|
221
|
-
var atts = renderAttributes(exp[1]);
|
222
|
-
|
223
|
-
var d = document.createElement('div');
|
224
|
-
d.setAttribute('class', 'rfe_exp');
|
225
|
-
node.appendChild(d);
|
226
|
-
|
227
|
-
var sen = document.createElement('span');
|
228
|
-
sen.setAttribute('class', 'rfe_exp_span rfe_expression_name');
|
229
|
-
sen.appendChild(document.createTextNode(expname));
|
230
|
-
d.appendChild(sen);
|
231
|
-
|
232
|
-
var sea = document.createElement('span');
|
233
|
-
sea.setAttribute('class', 'rfe_exp_span rfe_expression_atts');
|
234
|
-
sea.appendChild(document.createTextNode(' ' + atts));
|
235
|
-
d.appendChild(sea);
|
236
|
-
|
237
|
-
addHeadButtons(d);
|
238
|
-
|
239
|
-
var onblur = function () {
|
240
|
-
|
241
|
-
var p = d.parentNode;
|
242
|
-
var d2 = ExpressionHead.render(p, ExpressionHead.parse(this.value));
|
243
|
-
p.replaceChild(d2, d);
|
244
|
-
|
245
|
-
triggerChange(p); // trigger onChange()...
|
246
|
-
};
|
247
|
-
|
248
|
-
// blurring on "enter"
|
249
|
-
//
|
250
|
-
var onkeyup = function (evt) {
|
251
|
-
|
252
|
-
var e = evt || window.event;
|
253
|
-
var c = e.charCode || e.keyCode;
|
254
|
-
if (c == 13) this.blur();
|
255
|
-
|
256
|
-
return false;
|
257
|
-
}
|
258
|
-
|
259
|
-
// preventing propagation of "enter"
|
260
|
-
//
|
261
|
-
var onkeypress = function (evt) {
|
262
|
-
|
263
|
-
var e = evt || window.event;
|
264
|
-
var c = e.charCode || e.keyCode;
|
265
|
-
|
266
|
-
return (c != 13);
|
267
|
-
}
|
268
|
-
|
269
|
-
var onclick = function () {
|
270
|
-
d.removeChild(sen);
|
271
|
-
var input = document.createElement('input');
|
272
|
-
input.setAttribute('type', 'text');
|
273
|
-
input.value = expname + ' ' + atts;
|
274
|
-
if (text != '') input.value = expname + ' ' + text + ' ' + atts;
|
275
|
-
d.replaceChild(input, sea);
|
276
|
-
input.onblur = onblur;
|
277
|
-
input.onkeyup = onkeyup;
|
278
|
-
input.onkeypress = onkeypress;
|
279
|
-
input.focus();
|
280
|
-
};
|
281
|
-
|
282
|
-
sen.onclick = onclick;
|
283
|
-
sea.onclick = onclick;
|
284
|
-
|
285
|
-
return d;
|
286
|
-
},
|
287
|
-
|
288
|
-
parse: function (s) {
|
289
|
-
|
290
|
-
var m = s.match(headPattern);
|
291
|
-
|
292
|
-
if (m == null) return [ '---', {}, [] ];
|
293
|
-
|
294
|
-
var attributes = Attributes.parse(m[2]);
|
295
|
-
|
296
|
-
return [ m[1], attributes, [] ];
|
297
|
-
},
|
298
|
-
|
299
|
-
toExp: function (node) {
|
300
|
-
|
301
|
-
node = node.firstChild;
|
302
|
-
|
303
|
-
var name = node.childNodes[0].firstChild.nodeValue;
|
304
|
-
var atts = node.childNodes[1].firstChild.nodeValue;
|
305
|
-
|
306
|
-
atts = Attributes.parse(atts);
|
307
|
-
|
308
|
-
var children = [];
|
309
|
-
|
310
|
-
return [ name, atts, children ];
|
311
|
-
}
|
312
|
-
};
|
313
|
-
}();
|
314
|
-
|
315
|
-
function asJson (node) {
|
316
|
-
|
317
|
-
if ((typeof node) == 'string')
|
318
|
-
node = document.getElementById(node);
|
319
|
-
|
320
|
-
return JSON.stringify(toTree(node));
|
321
|
-
}
|
322
|
-
|
323
|
-
function renderEnding (node, exp) {
|
324
|
-
|
325
|
-
var ending = document.createElement('div');
|
326
|
-
ending.className = 'rfe_text';
|
327
|
-
if (exp[2].length > 0) ending.appendChild(document.createTextNode('end'));
|
328
|
-
node.appendChild(ending);
|
329
|
-
}
|
330
|
-
|
331
|
-
function addExpression (parentExpNode, exp) {
|
332
|
-
|
333
|
-
var end = parentExpNode.lastChild;
|
334
|
-
var node = renderExpression(parentExpNode, exp);
|
335
|
-
parentExpNode.replaceChild(node, end);
|
336
|
-
parentExpNode.appendChild(end);
|
337
|
-
|
338
|
-
if (end.childNodes.length == 0)
|
339
|
-
end.appendChild(document.createTextNode('end'));
|
340
|
-
|
341
|
-
triggerChange(parentExpNode);
|
342
|
-
}
|
343
|
-
|
344
|
-
function removeExpression (expNode) {
|
345
|
-
|
346
|
-
var p = expNode.parentNode;
|
347
|
-
p.removeChild(expNode);
|
348
|
-
|
349
|
-
if (p.childNodes.length == 2)
|
350
|
-
p.lastChild.removeChild(p.lastChild.firstChild);
|
351
|
-
|
352
|
-
document._rfe_clipboard = toTree(expNode);
|
353
|
-
|
354
|
-
triggerChange(p);
|
355
|
-
}
|
356
|
-
|
357
|
-
function renderExpression (parentNode, exp, isRootExp) {
|
358
|
-
|
359
|
-
//
|
360
|
-
// draw expression
|
361
|
-
|
362
|
-
var node = document.createElement('div');
|
363
|
-
node.className = 'rfe_expression';
|
364
|
-
|
365
|
-
if ( ! isRootExp)
|
366
|
-
node.setAttribute('style', 'margin-left: 14px;');
|
367
|
-
|
368
|
-
parentNode.appendChild(node);
|
369
|
-
|
370
|
-
if ( ! (exp instanceof Array)) {
|
371
|
-
renderExpressionString(node, exp.toString());
|
372
|
-
return;
|
373
|
-
}
|
374
|
-
|
375
|
-
ExpressionHead.render(node, exp);
|
376
|
-
|
377
|
-
//
|
378
|
-
// draw children
|
379
|
-
|
380
|
-
for (var i=0; i < exp[2].length; i++) renderExpression(node, exp[2][i]);
|
381
|
-
|
382
|
-
//
|
383
|
-
// over
|
384
|
-
|
385
|
-
renderEnding(node, exp);
|
386
|
-
|
387
|
-
return node;
|
388
|
-
}
|
389
|
-
|
390
|
-
function renderFlow (parentNode, flow) {
|
391
|
-
|
392
|
-
if ((typeof parentNode) == 'string') {
|
393
|
-
parentNode = document.getElementById(parentNode);
|
394
|
-
}
|
395
|
-
|
396
|
-
parentNode.className = 'rfe_root';
|
397
|
-
|
398
|
-
while(parentNode.firstChild) {
|
399
|
-
parentNode.removeChild(parentNode.firstChild);
|
400
|
-
}
|
401
|
-
|
402
|
-
renderExpression(parentNode, flow, true);
|
403
|
-
|
404
|
-
parentNode.stack = []; // the undo stack
|
405
|
-
parentNode.currentTree = flow;
|
406
|
-
}
|
407
|
-
|
408
|
-
function moveExpression (elt, delta) {
|
409
|
-
|
410
|
-
var p = elt.parentNode;
|
411
|
-
|
412
|
-
if (delta == -1) { // move up
|
413
|
-
if (elt.previousSibling.className != 'rfe_expression') return;
|
414
|
-
p.insertBefore(elt, elt.previousSibling);
|
415
|
-
}
|
416
|
-
else { // move down
|
417
|
-
if (elt.nextSibling.className != 'rfe_expression') return;
|
418
|
-
p.insertBefore(elt, elt.nextSibling.nextSibling);
|
419
|
-
}
|
420
|
-
|
421
|
-
FluoEditor.triggerChange(p);
|
422
|
-
}
|
423
|
-
|
424
|
-
function insertExpression (before, exp) {
|
425
|
-
|
426
|
-
var newNode = renderExpression(before.parentNode, exp);
|
427
|
-
|
428
|
-
before.parentNode.insertBefore(newNode, before);
|
429
|
-
|
430
|
-
FluoEditor.triggerChange(before.parentNode);
|
431
|
-
}
|
432
|
-
|
433
|
-
function triggerChange (elt) {
|
434
|
-
|
435
|
-
var rfeRoot = findRfeRoot(elt);
|
436
|
-
var tree = toTree(rfeRoot);
|
437
|
-
|
438
|
-
stack(rfeRoot, tree);
|
439
|
-
|
440
|
-
if (rfeRoot.onChange) rfeRoot.onChange(tree);
|
441
|
-
}
|
442
|
-
|
443
|
-
function stack(root, tree) {
|
444
|
-
root.stack.push(root.currentTree);
|
445
|
-
root.currentTree = tree;
|
446
|
-
}
|
447
|
-
|
448
|
-
function undo (root) {
|
449
|
-
|
450
|
-
if ((typeof root) == 'string') root = document.getElementById(root);
|
451
|
-
if (root.stack.length < 1) return;
|
452
|
-
|
453
|
-
while (root.firstChild != null) root.removeChild(root.firstChild);
|
454
|
-
|
455
|
-
var tree = root.stack.pop();
|
456
|
-
|
457
|
-
root.currentTree = tree;
|
458
|
-
renderExpression(root, tree, true);
|
459
|
-
|
460
|
-
if (root.onChange) root.onChange(tree);
|
461
|
-
}
|
462
|
-
|
463
|
-
function findRfeRoot (node) {
|
464
|
-
|
465
|
-
if (node.className == 'rfe_root') return node;
|
466
|
-
return findRfeRoot(node.parentNode);
|
467
|
-
}
|
468
|
-
|
469
|
-
function computeExpId (node, from, expid) {
|
470
|
-
|
471
|
-
if (from == null) {
|
472
|
-
from = findRfeRoot(node);
|
473
|
-
expid = '';
|
474
|
-
}
|
475
|
-
if (from == node) return expid.substring(1, expid.length);
|
476
|
-
|
477
|
-
var divs = from.childNodes;
|
478
|
-
var childid = -1;
|
479
|
-
|
480
|
-
for (var i=0; i<divs.length; i++) {
|
481
|
-
var e = divs[i];
|
482
|
-
if (e.nodeType != 1) continue;
|
483
|
-
if (e.className != 'rfe_expression') continue;
|
484
|
-
childid += 1;
|
485
|
-
var ei = computeExpId(node, e, expid + '_' + childid);
|
486
|
-
if (ei != null) return ei;
|
487
|
-
}
|
488
|
-
|
489
|
-
return null;
|
490
|
-
}
|
491
|
-
|
492
|
-
function toTree (node) {
|
493
|
-
|
494
|
-
node.focus();
|
495
|
-
//
|
496
|
-
// making sure all the input boxes get blurred...
|
497
|
-
|
498
|
-
if (node.className != 'rfe_expression') {
|
499
|
-
node = node.firstChildOfClass('rfe_expression');
|
500
|
-
}
|
501
|
-
|
502
|
-
//
|
503
|
-
// expression itself
|
504
|
-
|
505
|
-
var exp = ExpressionHead.toExp(node);
|
506
|
-
|
507
|
-
//
|
508
|
-
// children
|
509
|
-
|
510
|
-
var divs = node.childNodes;
|
511
|
-
|
512
|
-
var children = exp[2];
|
513
|
-
|
514
|
-
for (var i=0; i<divs.length; i++) {
|
515
|
-
var e = divs[i];
|
516
|
-
if (e.nodeType != 1) continue;
|
517
|
-
if (e.className != 'rfe_expression') continue;
|
518
|
-
children.push(toTree(e));
|
519
|
-
}
|
520
|
-
|
521
|
-
//
|
522
|
-
// done
|
523
|
-
|
524
|
-
return exp;
|
525
|
-
}
|
526
|
-
|
527
|
-
//
|
528
|
-
// public methods
|
529
|
-
//
|
530
|
-
return {
|
531
|
-
|
532
|
-
TEXTS: TEXTS,
|
533
|
-
|
534
|
-
ExpressionHead: ExpressionHead,
|
535
|
-
Attributes: Attributes, // for testing purposes
|
536
|
-
|
537
|
-
renderFlow: renderFlow,
|
538
|
-
addExpression: addExpression,
|
539
|
-
removeExpression: removeExpression,
|
540
|
-
moveExpression: moveExpression,
|
541
|
-
insertExpression: insertExpression,
|
542
|
-
triggerChange: triggerChange,
|
543
|
-
undo: undo,
|
544
|
-
asJson: asJson,
|
545
|
-
imageRoot: imageRoot
|
546
|
-
};
|
547
|
-
}();
|
548
|
-
|