ruote-kit 2.1.4
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.
- data/.document +0 -0
- data/.gitignore +8 -0
- data/Gemfile +10 -0
- data/README.rdoc +132 -0
- data/Rakefile +57 -0
- data/config.ru +21 -0
- data/lib/ruote-kit/application.rb +50 -0
- data/lib/ruote-kit/configuration.rb +52 -0
- data/lib/ruote-kit/helpers/engine_helpers.rb +24 -0
- data/lib/ruote-kit/helpers/form_helpers.rb +11 -0
- data/lib/ruote-kit/helpers/launch_item_parser.rb +59 -0
- data/lib/ruote-kit/helpers/navigation_helpers.rb +54 -0
- data/lib/ruote-kit/helpers/render_helpers.rb +103 -0
- data/lib/ruote-kit/helpers.rb +9 -0
- data/lib/ruote-kit/public/_ruote/images/bg.gif +0 -0
- data/lib/ruote-kit/public/_ruote/images/bg_button_left.gif +0 -0
- data/lib/ruote-kit/public/_ruote/images/bg_button_left_cancel.gif +0 -0
- data/lib/ruote-kit/public/_ruote/images/bg_button_left_submit.gif +0 -0
- data/lib/ruote-kit/public/_ruote/images/bg_button_right.gif +0 -0
- data/lib/ruote-kit/public/_ruote/javascripts/SimplyButtons.js +191 -0
- data/lib/ruote-kit/public/_ruote/javascripts/fluo-can.js +1111 -0
- data/lib/ruote-kit/public/_ruote/javascripts/fluo-dial.js +149 -0
- data/lib/ruote-kit/public/_ruote/javascripts/fluo-json.js +183 -0
- data/lib/ruote-kit/public/_ruote/javascripts/fluo-tred.js +515 -0
- data/lib/ruote-kit/public/_ruote/stylesheets/SimplyButtons.css +226 -0
- data/lib/ruote-kit/public/_ruote/stylesheets/base.css +336 -0
- data/lib/ruote-kit/public/_ruote/stylesheets/rk.css +30 -0
- data/lib/ruote-kit/public/_ruote/stylesheets/style.css +393 -0
- data/lib/ruote-kit/resources/expressions.rb +55 -0
- data/lib/ruote-kit/resources/processes.rb +52 -0
- data/lib/ruote-kit/resources/workitems.rb +64 -0
- data/lib/ruote-kit/spec/ruote_helpers.rb +47 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/LICENSE +21 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/README.markdown +102 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/Rakefile +30 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/VERSION.yml +4 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/lib/sinatra/respond_to.rb +206 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/sinatra-respond_to.gemspec +56 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/public/static folder/.keep +0 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/public/static.txt +1 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/test_app.rb +53 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/unreachable_static.txt +1 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/layout.html.haml +2 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/resource.html.haml +1 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/resource.js.erb +3 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/resource.xml.builder +3 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/spec/extension_spec.rb +403 -0
- data/lib/ruote-kit/vendor/sinatra-respond_to/spec/spec_helper.rb +18 -0
- data/lib/ruote-kit/views/expression.html.haml +38 -0
- data/lib/ruote-kit/views/expressions.html.haml +30 -0
- data/lib/ruote-kit/views/index.html.haml +1 -0
- data/lib/ruote-kit/views/launch_process.html.haml +19 -0
- data/lib/ruote-kit/views/layout.html.haml +46 -0
- data/lib/ruote-kit/views/process.html.haml +55 -0
- data/lib/ruote-kit/views/processes.html.haml +27 -0
- data/lib/ruote-kit/views/resource_not_found.html.haml +7 -0
- data/lib/ruote-kit/views/workitem.html.haml +39 -0
- data/lib/ruote-kit/views/workitems.html.haml +23 -0
- data/lib/ruote-kit.rb +105 -0
- data/ruote-kit.gemspec +136 -0
- data/spec/helpers/render_helpers_spec.rb +211 -0
- data/spec/resources/expressions_spec.rb +179 -0
- data/spec/resources/index_spec.rb +46 -0
- data/spec/resources/processes_spec.rb +259 -0
- data/spec/resources/workitems_spec.rb +308 -0
- data/spec/ruote-kit_spec.rb +4 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +152 -0
- data/spec/views/launch_process.html.haml_spec.rb +21 -0
- data/spec/views/process.html.haml_spec.rb +16 -0
- data/spec/views/processes.html.haml_spec.rb +30 -0
- data/spec/views/workitems.html.haml_spec.rb +68 -0
- metadata +185 -0
@@ -0,0 +1,149 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* OpenWFEru - open source ruby workflow and bpm engine
|
4
|
+
* (c) 2008 John Mettraux
|
5
|
+
*
|
6
|
+
* OpenWFEru is freely distributable under the terms
|
7
|
+
* of a BSD-style license.
|
8
|
+
* For details, see the OpenWFEru web site: http://openwferu.rubyforge.org
|
9
|
+
*
|
10
|
+
* Made in Japan
|
11
|
+
*/
|
12
|
+
|
13
|
+
//
|
14
|
+
// example usage :
|
15
|
+
//
|
16
|
+
// var d = FluoDial.newDialog
|
17
|
+
// ("upload new version of expression (as YAML file)", 500, 105);
|
18
|
+
//
|
19
|
+
// var f = new Element
|
20
|
+
// ("form", { "method": "POST", "enctype": "multipart/form-data" });
|
21
|
+
// var fi = new Element
|
22
|
+
// ("input", { "type": "file", "name": "expression", "size": "50" });
|
23
|
+
// var si = new Element
|
24
|
+
// ("input", { "type": "submit", "value": "upload" });
|
25
|
+
// f.appendChild(fi);
|
26
|
+
// f.appendChild(si);
|
27
|
+
// d.body.appendChild(f);
|
28
|
+
//
|
29
|
+
|
30
|
+
var FluoDial = function() {
|
31
|
+
|
32
|
+
//
|
33
|
+
// private methods
|
34
|
+
|
35
|
+
function resizeItem (id, width, height) {
|
36
|
+
var item = $(id);
|
37
|
+
item.setStyle({ "width": ""+width+"px" });
|
38
|
+
item.setStyle({ "height": ""+height+"px" });
|
39
|
+
}
|
40
|
+
|
41
|
+
function centerItem (id) {
|
42
|
+
|
43
|
+
var item = $(id);
|
44
|
+
|
45
|
+
var w = item.getDimensions()["width"];
|
46
|
+
var h = item.getDimensions()["height"];
|
47
|
+
|
48
|
+
if (centerItem.arguments.length > 1) {
|
49
|
+
w = centerItem.arguments[1];
|
50
|
+
h = centerItem.arguments[2];
|
51
|
+
}
|
52
|
+
|
53
|
+
var l = (window.innerWidth - w) / 2;
|
54
|
+
var t = (window.innerHeight - h) / 2;
|
55
|
+
|
56
|
+
item.setStyle({ "left": ""+l+"px" });
|
57
|
+
item.setStyle({ "top": ""+t+"px" });
|
58
|
+
}
|
59
|
+
|
60
|
+
function resizeAndCenterItem (id, width, height) {
|
61
|
+
|
62
|
+
resizeItem(id, width, height);
|
63
|
+
centerItem(id, width, height);
|
64
|
+
}
|
65
|
+
|
66
|
+
function newRectangle (id, cclass, width, height) {
|
67
|
+
|
68
|
+
var r = $(id);
|
69
|
+
|
70
|
+
if (r) {
|
71
|
+
r.childElements().each(function (elt) {
|
72
|
+
elt.remove();
|
73
|
+
});
|
74
|
+
r.show();
|
75
|
+
}
|
76
|
+
else {
|
77
|
+
r = new Element("div", { "id": id, "class": cclass });
|
78
|
+
}
|
79
|
+
|
80
|
+
resizeAndCenterItem(r, width, height);
|
81
|
+
|
82
|
+
return r;
|
83
|
+
}
|
84
|
+
|
85
|
+
function newDialog (title, width, height) {
|
86
|
+
|
87
|
+
var sheet = newRectangle
|
88
|
+
("dial_sheet", "dial_sheet", width, height);
|
89
|
+
var dialog = newRectangle
|
90
|
+
("dial_dialog", "dial_dialog", width-20, height-20);
|
91
|
+
|
92
|
+
document.body.appendChild(sheet);
|
93
|
+
document.body.appendChild(dialog);
|
94
|
+
|
95
|
+
var header = new Element
|
96
|
+
("div", { "class": "dial_header" });
|
97
|
+
var body = new Element
|
98
|
+
("div", { "id": dialog.id+"_body", "class": "dial_body" });
|
99
|
+
|
100
|
+
dialog.appendChild(header);
|
101
|
+
dialog.appendChild(body);
|
102
|
+
|
103
|
+
dialog.header = header;
|
104
|
+
dialog.body = body;
|
105
|
+
|
106
|
+
dialog.close = function () {
|
107
|
+
sheet.hide();
|
108
|
+
dialog.hide();
|
109
|
+
};
|
110
|
+
dialog.show = function () {
|
111
|
+
sheet.show();
|
112
|
+
dialog.show();
|
113
|
+
};
|
114
|
+
dialog.resize = function (w, h) {
|
115
|
+
resizeAndCenterItem(sheet, w, h);
|
116
|
+
resizeAndCenterItem(dialog, w-20, h-20);
|
117
|
+
};
|
118
|
+
dialog.stealElement = function (el) {
|
119
|
+
if ( ! (el instanceof HTMLElement)) el = document.getElementById(el);
|
120
|
+
this.body.appendChild(el);
|
121
|
+
//el.parentNode = dialog.body;
|
122
|
+
}
|
123
|
+
|
124
|
+
var htitle = new Element("div", { "class": "dial_title" });
|
125
|
+
htitle.appendChild(document.createTextNode(title));
|
126
|
+
header.appendChild(htitle);
|
127
|
+
|
128
|
+
var hmenu = new Element("div", { "class": "dial_menu" });
|
129
|
+
var hclose = new Element
|
130
|
+
("a",
|
131
|
+
{ "href": "#",
|
132
|
+
"title": "close this dialog",
|
133
|
+
"onclick": "$('dial_dialog').close(); return false;" });
|
134
|
+
hclose.innerHTML = "close";
|
135
|
+
hmenu.appendChild(hclose);
|
136
|
+
header.appendChild(hmenu);
|
137
|
+
|
138
|
+
return dialog;
|
139
|
+
}
|
140
|
+
|
141
|
+
return {
|
142
|
+
|
143
|
+
//
|
144
|
+
// public methods
|
145
|
+
|
146
|
+
newDialog: newDialog
|
147
|
+
};
|
148
|
+
}();
|
149
|
+
|
@@ -0,0 +1,183 @@
|
|
1
|
+
// Copyright (C) 2008 Google Inc.
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @param {string} json per RFC 4627
|
17
|
+
* @return {Object|Array}
|
18
|
+
* @author Mike Samuel <mikesamuel@gmail.com>
|
19
|
+
*/
|
20
|
+
//var jsonParse = (function () {
|
21
|
+
var fluoFromJson = (function () {
|
22
|
+
var number
|
23
|
+
= '(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)';
|
24
|
+
var oneChar = '(?:[^\\0-\\x08\\x0a-\\x1f\"\\\\]'
|
25
|
+
+ '|\\\\(?:[\"/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';
|
26
|
+
var string = '(?:\"' + oneChar + '*\")';
|
27
|
+
|
28
|
+
// Will match a value in a well-formed JSON file.
|
29
|
+
// If the input is not well-formed, may match strangely, but not in an unsafe
|
30
|
+
// way.
|
31
|
+
// Since this only matches value tokens, it does not match whitespace, colons,
|
32
|
+
// or commas.
|
33
|
+
var jsonToken = new RegExp(
|
34
|
+
'(?:false|true|null|[\\{\\}\\[\\]]'
|
35
|
+
+ '|' + number
|
36
|
+
+ '|' + string
|
37
|
+
+ ')', 'g');
|
38
|
+
|
39
|
+
// Matches escape sequences in a string literal
|
40
|
+
var escapeSequence = new RegExp('\\\\(?:([^u])|u(.{4}))', 'g');
|
41
|
+
|
42
|
+
// Decodes escape sequences in object literals
|
43
|
+
var escapes = {
|
44
|
+
'"': '"',
|
45
|
+
'/': '/',
|
46
|
+
'\\': '\\',
|
47
|
+
'b': '\b',
|
48
|
+
'f': '\f',
|
49
|
+
'n': '\n',
|
50
|
+
'r': '\r',
|
51
|
+
't': '\t'
|
52
|
+
};
|
53
|
+
function unescapeOne(_, ch, hex) {
|
54
|
+
return ch ? escapes[ch] : String.fromCharCode(parseInt(hex, 16));
|
55
|
+
}
|
56
|
+
|
57
|
+
// A non-falsy value that coerces to the empty string when used as a key.
|
58
|
+
var EMPTY_STRING = new String('');
|
59
|
+
var SLASH = '\\';
|
60
|
+
|
61
|
+
// Constructor to use based on an open token.
|
62
|
+
var firstTokenCtors = { '{': Object, '[': Array };
|
63
|
+
|
64
|
+
return function (json) {
|
65
|
+
// Split into tokens
|
66
|
+
var toks = json.match(jsonToken);
|
67
|
+
// Construct the object to return
|
68
|
+
var result;
|
69
|
+
var tok = toks[0];
|
70
|
+
if ('{' === tok) {
|
71
|
+
result = {};
|
72
|
+
} else if ('[' === tok) {
|
73
|
+
result = [];
|
74
|
+
} else {
|
75
|
+
throw new Error(tok);
|
76
|
+
}
|
77
|
+
|
78
|
+
// If undefined, the key in an object key/value record to use for the next
|
79
|
+
// value parsed.
|
80
|
+
var key;
|
81
|
+
// Loop over remaining tokens maintaining a stack of uncompleted objects and
|
82
|
+
// arrays.
|
83
|
+
var stack = [result];
|
84
|
+
for (var i = 1, n = toks.length; i < n; ++i) {
|
85
|
+
tok = toks[i];
|
86
|
+
|
87
|
+
var cont;
|
88
|
+
switch (tok.charCodeAt(0)) {
|
89
|
+
default: // sign or digit
|
90
|
+
cont = stack[0];
|
91
|
+
cont[key || cont.length] = +(tok);
|
92
|
+
key = void 0;
|
93
|
+
break;
|
94
|
+
case 0x22: // '"'
|
95
|
+
tok = tok.substring(1, tok.length - 1);
|
96
|
+
if (tok.indexOf(SLASH) !== -1) {
|
97
|
+
tok = tok.replace(escapeSequence, unescapeOne);
|
98
|
+
}
|
99
|
+
cont = stack[0];
|
100
|
+
if (!key) {
|
101
|
+
if (cont instanceof Array) {
|
102
|
+
key = cont.length;
|
103
|
+
} else {
|
104
|
+
key = tok || EMPTY_STRING; // Use as key for next value seen.
|
105
|
+
break;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
cont[key] = tok;
|
109
|
+
key = void 0;
|
110
|
+
break;
|
111
|
+
case 0x5b: // '['
|
112
|
+
cont = stack[0];
|
113
|
+
stack.unshift(cont[key || cont.length] = []);
|
114
|
+
key = void 0;
|
115
|
+
break;
|
116
|
+
case 0x5d: // ']'
|
117
|
+
stack.shift();
|
118
|
+
break;
|
119
|
+
case 0x66: // 'f'
|
120
|
+
cont = stack[0];
|
121
|
+
cont[key || cont.length] = false;
|
122
|
+
key = void 0;
|
123
|
+
break;
|
124
|
+
case 0x6e: // 'n'
|
125
|
+
cont = stack[0];
|
126
|
+
cont[key || cont.length] = null;
|
127
|
+
key = void 0;
|
128
|
+
break;
|
129
|
+
case 0x74: // 't'
|
130
|
+
cont = stack[0];
|
131
|
+
cont[key || cont.length] = true;
|
132
|
+
key = void 0;
|
133
|
+
break;
|
134
|
+
case 0x7b: // '{'
|
135
|
+
cont = stack[0];
|
136
|
+
stack.unshift(cont[key || cont.length] = {});
|
137
|
+
key = void 0;
|
138
|
+
break;
|
139
|
+
case 0x7d: // '}'
|
140
|
+
stack.shift();
|
141
|
+
break;
|
142
|
+
}
|
143
|
+
}
|
144
|
+
// Fail if we've got an uncompleted object.
|
145
|
+
if (stack.length) { throw new Error(); }
|
146
|
+
return result;
|
147
|
+
};
|
148
|
+
})();
|
149
|
+
|
150
|
+
|
151
|
+
//
|
152
|
+
// the following code is ruote-fluo code, under the BSD license.
|
153
|
+
//
|
154
|
+
function fluoToJson (o, quotes) {
|
155
|
+
if (quotes != false) quotes = true;
|
156
|
+
if (o == null) return 'null';
|
157
|
+
var t = (typeof o);
|
158
|
+
if (t == 'undefined') return 'null' // really ?
|
159
|
+
if (t == 'number') return o;
|
160
|
+
if (t == 'string') {
|
161
|
+
//return quotes ? '"' + o + '"' : o;
|
162
|
+
if ( ! quotes) return o;
|
163
|
+
return '"' +
|
164
|
+
o
|
165
|
+
.replace(/"/g, '\\"')
|
166
|
+
.replace(/\r/g, '')
|
167
|
+
.replace(/\n/g, '\\n') +
|
168
|
+
'"';
|
169
|
+
// this global replace works with safari (webkit) and ffox
|
170
|
+
}
|
171
|
+
if (o.constructor.toString().indexOf(' Array()') == 8) {
|
172
|
+
var a = [];
|
173
|
+
for (var i = 0; i < o.length; i++) a.push(fluoToJson(o[i]));
|
174
|
+
return '[' + a.join(', ') + ']';
|
175
|
+
}
|
176
|
+
if (t == 'object') {
|
177
|
+
var a = [];
|
178
|
+
for (var key in o) a.push(fluoToJson(key) + ': ' + fluoToJson(o[key]));
|
179
|
+
return '{' + a.join(', ') + '}';
|
180
|
+
}
|
181
|
+
return o.toString();
|
182
|
+
}
|
183
|
+
|