bizside 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/assets/images/jquery-treeTable/images/toggle-collapse-dark.png +0 -0
- data/app/assets/images/jquery-treeTable/images/toggle-collapse-light.png +0 -0
- data/app/assets/images/jquery-treeTable/images/toggle-expand-dark.png +0 -0
- data/app/assets/images/jquery-treeTable/images/toggle-expand-light.png +0 -0
- data/app/assets/javascripts/bizside.js +1 -0
- data/app/assets/javascripts/jquery-treeTable/jquery.treeTable.js +400 -0
- data/app/assets/stylesheets/bizside.css +3 -0
- data/app/assets/stylesheets/jquery-treeTable/jquery.treeTable.css.erb +55 -0
- data/lib/bizside/acl/access_control_utils.rb +36 -0
- data/lib/bizside/acl/available_helper.rb +65 -0
- data/lib/bizside/acl/controller_helper.rb +15 -0
- data/lib/bizside/acl.rb +6 -0
- data/lib/bizside/active_record_logger.rb +3 -0
- data/lib/bizside/audit/job_logger.rb +14 -0
- data/lib/bizside/audit/logger.rb +35 -0
- data/lib/bizside/audit_log.rb +158 -0
- data/lib/bizside/cache/entry.rb +112 -0
- data/lib/bizside/cache/file_store.rb +167 -0
- data/lib/bizside/cache/store.rb +237 -0
- data/lib/bizside/cache_util.rb +47 -0
- data/lib/bizside/cache_utils.rb +10 -0
- data/lib/bizside/carrierwave.rb +48 -0
- data/lib/bizside/config.rb +63 -0
- data/lib/bizside/configurations/mail.rb +37 -0
- data/lib/bizside/configurations/prefix.rb +25 -0
- data/lib/bizside/configurations/storage.rb +28 -0
- data/lib/bizside/coverage/launch.rb +25 -0
- data/lib/bizside/coverage/rcov_formatter.rb +13 -0
- data/lib/bizside/cron_validator.rb +62 -0
- data/lib/bizside/cucumber.rb +1 -0
- data/lib/bizside/engine.rb +4 -0
- data/lib/bizside/file_converter.rb +56 -0
- data/lib/bizside/file_uploader.rb +71 -0
- data/lib/bizside/gengou.rb +46 -0
- data/lib/bizside/gengou.yml +5 -0
- data/lib/bizside/hanaita_conf.rb +88 -0
- data/lib/bizside/implicit_ftps.rb +29 -0
- data/lib/bizside/itamae_conf.rb +186 -0
- data/lib/bizside/job_utils.rb +285 -0
- data/lib/bizside/log_analyzer.rb +122 -0
- data/lib/bizside/mailer.rb +56 -0
- data/lib/bizside/query_builder.rb +78 -0
- data/lib/bizside/railtie.rb +80 -0
- data/lib/bizside/record_has_warnings.rb +4 -0
- data/lib/bizside/resque.rb +141 -0
- data/lib/bizside/rsync.rb +40 -0
- data/lib/bizside/safe_pty.rb +17 -0
- data/lib/bizside/shib_utils.rb +18 -0
- data/lib/bizside/show_exceptions.rb +18 -0
- data/lib/bizside/sql_utils.rb +45 -0
- data/lib/bizside/string_io.rb +39 -0
- data/lib/bizside/string_utils.rb +157 -0
- data/lib/bizside/task_helper.rb +263 -0
- data/lib/bizside/tasks.rb +6 -0
- data/lib/bizside/test_help.rb +17 -0
- data/lib/bizside/uploader/content_type_validator.rb +39 -0
- data/lib/bizside/uploader/default_extensions.yml +15 -0
- data/lib/bizside/uploader/exif.rb +43 -0
- data/lib/bizside/uploader/extension_whitelist.rb +26 -0
- data/lib/bizside/uploader/filename_validator.rb +31 -0
- data/lib/bizside/user_agent/action_view/action_view_4.rb +56 -0
- data/lib/bizside/user_agent/action_view/use_variant.rb +4 -0
- data/lib/bizside/user_agent/action_view.rb +10 -0
- data/lib/bizside/user_agent/controller_helper.rb +51 -0
- data/lib/bizside/user_agent.rb +108 -0
- data/lib/bizside/validations.rb +8 -0
- data/lib/bizside/version.rb +3 -0
- data/lib/bizside/view_helper.rb +10 -0
- data/lib/bizside/warning.rb +24 -0
- data/lib/bizside/yes.rb +16 -0
- data/lib/bizside.rb +96 -0
- data/lib/cron_validator.rb +3 -0
- data/lib/gengou.rb +3 -0
- data/lib/job_utils.rb +3 -0
- data/lib/query_builder.rb +3 -0
- data/lib/record_has_warnings.rb +3 -0
- data/lib/sql_utils.rb +3 -0
- data/lib/string_utils.rb +3 -0
- data/lib/user_agent.rb +3 -0
- data/lib/yes.rb +3 -0
- data/rails/locales/ja.yml +12 -0
- data/validations/collection_presence_validator.rb +15 -0
- data/validations/email_validator.rb +1 -0
- data/validations/ip_address_validator.rb +22 -0
- data/validations/tel_validator.rb +28 -0
- data/validations/url_validator.rb +30 -0
- data/validations/zip_validator.rb +35 -0
- metadata +467 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9dcc6b0f9213ae2af553a733bccf759947c3815a9942c10c6942ad790920c4ec
|
4
|
+
data.tar.gz: 93a2466cbd7420b711fc9d2ca8a4d910bb2507054fc52b60a32b5268bb614349
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f8e2f4bd706c81e0a9029af91a19af46835843e44b5074809bda0f17331eb66284da30723a57e5133220d168db5ea07b49c874198d06bc077654021d94d92cd0
|
7
|
+
data.tar.gz: 31bfb0c73147bcf7246d8378cc6b426d834fc989bca781d684ce7016f586070aa45e0c3a4ea7b65592b5c0c268becfcd1a279d8f0afcb624a4612d542558f2c3
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require_tree ./jquery-treeTable
|
@@ -0,0 +1,400 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery treeTable Plugin VERSION
|
3
|
+
* http://ludo.cubicphuse.nl/jquery-plugins/treeTable/doc/
|
4
|
+
*
|
5
|
+
* Copyright 2011, Ludo van den Boom
|
6
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
7
|
+
*/
|
8
|
+
(function($) {
|
9
|
+
// Helps to make options available to all functions
|
10
|
+
// TODO: This gives problems when there are both expandable and non-expandable
|
11
|
+
// trees on a page. The options shouldn't be global to all these instances!
|
12
|
+
var options;
|
13
|
+
var defaultPaddingLeft;
|
14
|
+
var persistStore;
|
15
|
+
var rootOfChildClass;//child-of-root-6形式。rootの直下を示すclass文字列
|
16
|
+
|
17
|
+
$.fn.treeTable = function(opts) {
|
18
|
+
options = $.extend({}, $.fn.treeTable.defaults, opts);
|
19
|
+
|
20
|
+
if(options.persist) {
|
21
|
+
persistStore = new Persist.Store(options.persistStoreName);
|
22
|
+
}
|
23
|
+
|
24
|
+
return this.each(function() {
|
25
|
+
$(this).addClass("treeTable").find("tbody tr").each(function() {
|
26
|
+
// Skip initialized nodes.
|
27
|
+
if (!$(this).hasClass('initialized')) {
|
28
|
+
var isRootNode = ($(this)[0].className.search(options.childPrefix) == -1);
|
29
|
+
|
30
|
+
if (isRootNode) {
|
31
|
+
$(this).addClass('trroot');
|
32
|
+
rootOfChildClass = options.childPrefix + $(this).attr("id");
|
33
|
+
}
|
34
|
+
// To optimize performance of indentation, I retrieve the padding-left
|
35
|
+
// value of the first root node. This way I only have to call +css+
|
36
|
+
// once.
|
37
|
+
if (isRootNode && isNaN(defaultPaddingLeft)) {
|
38
|
+
defaultPaddingLeft = parseInt($($(this).children("td")[options.treeColumn]).css('padding-left'), 10);
|
39
|
+
}
|
40
|
+
|
41
|
+
// Set child nodes to initial state if we're in expandable mode.
|
42
|
+
if(!isRootNode && options.expandable && options.initialState == "collapsed") {
|
43
|
+
$(this).addClass('ui-helper-hidden');
|
44
|
+
}
|
45
|
+
|
46
|
+
// If we're not in expandable mode, initialize all nodes.
|
47
|
+
// If we're in expandable mode, only initialize root nodes.
|
48
|
+
if(!options.expandable || isRootNode || options.lazyLoad) {
|
49
|
+
initialize($(this));
|
50
|
+
}
|
51
|
+
}
|
52
|
+
});
|
53
|
+
});
|
54
|
+
};
|
55
|
+
|
56
|
+
$.fn.treeTable.defaults = {
|
57
|
+
childPrefix: "child-of-",
|
58
|
+
clickableNodeNames: false,
|
59
|
+
expandable: true,
|
60
|
+
indent: 19,
|
61
|
+
childRight: 0,
|
62
|
+
initialState: "collapsed",
|
63
|
+
onNodeShow: null,
|
64
|
+
onNodeHide: null,
|
65
|
+
treeColumn: 0,
|
66
|
+
persist: false,
|
67
|
+
persistStoreName: 'treeTable',
|
68
|
+
stringExpand: "Expand",
|
69
|
+
stringCollapse: "Collapse",
|
70
|
+
leafIconPath: "",
|
71
|
+
lazyLoad: false,
|
72
|
+
onNodeLoad: null
|
73
|
+
};
|
74
|
+
|
75
|
+
//Expand all nodes
|
76
|
+
$.fn.expandAll = function() {
|
77
|
+
$(this).find("tr").each(function() {
|
78
|
+
$(this).expand();
|
79
|
+
});
|
80
|
+
};
|
81
|
+
|
82
|
+
//Collapse all nodes
|
83
|
+
$.fn.collapseAll = function() {
|
84
|
+
$(this).find("tr").each(function() {
|
85
|
+
$(this).collapse();
|
86
|
+
});
|
87
|
+
};
|
88
|
+
|
89
|
+
// Recursively hide all node's children in a tree
|
90
|
+
$.fn.collapse = function() {
|
91
|
+
return this.each(function() {
|
92
|
+
$(this).removeClass("expanded").addClass("collapsed");
|
93
|
+
|
94
|
+
if (options.persist) {
|
95
|
+
persistNodeState($(this));
|
96
|
+
}
|
97
|
+
|
98
|
+
childrenOf($(this)).each(function() {
|
99
|
+
if(!$(this).hasClass("collapsed")) {
|
100
|
+
$(this).collapse();
|
101
|
+
}
|
102
|
+
|
103
|
+
$(this).addClass('ui-helper-hidden');
|
104
|
+
|
105
|
+
if($.isFunction(options.onNodeHide)) {
|
106
|
+
options.onNodeHide.call(this);
|
107
|
+
}
|
108
|
+
|
109
|
+
});
|
110
|
+
});
|
111
|
+
};
|
112
|
+
|
113
|
+
// Recursively show all node's children in a tree
|
114
|
+
$.fn.expand = function() {
|
115
|
+
return this.each(function() {
|
116
|
+
$(this).removeClass("collapsed").addClass("expanded");
|
117
|
+
|
118
|
+
if (options.persist) {
|
119
|
+
persistNodeState($(this));
|
120
|
+
}
|
121
|
+
|
122
|
+
childrenOf($(this)).each(function() {
|
123
|
+
initialize($(this));
|
124
|
+
|
125
|
+
if($(this).is(".expanded.parent")) {
|
126
|
+
$(this).expand();
|
127
|
+
}
|
128
|
+
|
129
|
+
$(this).removeClass('ui-helper-hidden');
|
130
|
+
|
131
|
+
if($.isFunction(options.onNodeShow)) {
|
132
|
+
options.onNodeShow.call(this);
|
133
|
+
}
|
134
|
+
});
|
135
|
+
});
|
136
|
+
};
|
137
|
+
|
138
|
+
// 現在の設定を一つ取得
|
139
|
+
$.fn.getoption = function(key) {
|
140
|
+
return options[key];
|
141
|
+
};
|
142
|
+
|
143
|
+
// Reveal a node by expanding all ancestors
|
144
|
+
$.fn.reveal = function() {
|
145
|
+
$(ancestorsOf($(this)).reverse()).each(function() {
|
146
|
+
initialize($(this));
|
147
|
+
$(this).expand().show();
|
148
|
+
});
|
149
|
+
|
150
|
+
return this;
|
151
|
+
};
|
152
|
+
|
153
|
+
// Add an entire branch to +destination+
|
154
|
+
$.fn.appendBranchTo = function(destination) {
|
155
|
+
var node = $(this);
|
156
|
+
var parent = parentOf(node);
|
157
|
+
|
158
|
+
var ancestorNames = $.map(ancestorsOf($(destination)), function(a) { return a.id; });
|
159
|
+
|
160
|
+
// Conditions:
|
161
|
+
// 1: +node+ should not be inserted in a location in a branch if this would
|
162
|
+
// result in +node+ being an ancestor of itself.
|
163
|
+
// 2: +node+ should not have a parent OR the destination should not be the
|
164
|
+
// same as +node+'s current parent (this last condition prevents +node+
|
165
|
+
// from being moved to the same location where it already is).
|
166
|
+
// 3: +node+ should not be inserted as a child of +node+ itself.
|
167
|
+
if($.inArray(node[0].id, ancestorNames) == -1 && (!parent || (destination.id != parent[0].id)) && destination.id != node[0].id) {
|
168
|
+
indent(node, ancestorsOf(node).length * options.indent * -1); // Remove indentation
|
169
|
+
|
170
|
+
if(parent) { node.removeClass(options.childPrefix + parent[0].id); }
|
171
|
+
|
172
|
+
node.addClass(options.childPrefix + destination.id);
|
173
|
+
move(node, destination); // Recursively move nodes to new location
|
174
|
+
indent(node, ancestorsOf(node).length * options.indent);
|
175
|
+
}
|
176
|
+
|
177
|
+
return this;
|
178
|
+
};
|
179
|
+
|
180
|
+
// Add reverse() function from JS Arrays
|
181
|
+
$.fn.reverse = function() {
|
182
|
+
return this.pushStack(this.get().reverse(), arguments);
|
183
|
+
};
|
184
|
+
|
185
|
+
// Toggle an entire branch
|
186
|
+
$.fn.toggleBranch = function() {
|
187
|
+
if($(this).hasClass("collapsed")) {
|
188
|
+
if (options.lazyLoad && !$(this).hasClass('loaded')) {
|
189
|
+
if($.isFunction(options.onNodeLoad)) {
|
190
|
+
options.onNodeLoad.call(this, $(this));
|
191
|
+
}
|
192
|
+
}
|
193
|
+
$(this).expand();
|
194
|
+
} else {
|
195
|
+
$(this).collapse();
|
196
|
+
}
|
197
|
+
|
198
|
+
return this;
|
199
|
+
};
|
200
|
+
|
201
|
+
// Private関数だったmoveを無理やりpublicにしたもの。set要素は無いです。
|
202
|
+
$.fn.setmove = function(node, destination) {
|
203
|
+
return move(node, destination);
|
204
|
+
};
|
205
|
+
|
206
|
+
//子の有無を抜きにして矢印を設定
|
207
|
+
//treetableプラグインは▼矢印がつくかどうかを子があるかどうかで判断しており、
|
208
|
+
//Explorerのようなフォルダとファイルの区別がない。
|
209
|
+
//それでは困るため、ここで指定したnodeは子の有無にかかわらず▼矢印をつける。
|
210
|
+
$.fn.setNodeArrow = function(node) {
|
211
|
+
var childNodes = childrenOf(node);
|
212
|
+
|
213
|
+
if(!node.hasClass("parent")) {
|
214
|
+
node.addClass("parent");
|
215
|
+
}
|
216
|
+
|
217
|
+
if(node.hasClass("parent")) {
|
218
|
+
var cell = $(node.children("td")[options.treeColumn]);
|
219
|
+
var padding = getPaddingLeft(cell) + options.indent;
|
220
|
+
|
221
|
+
childNodes.each(function() {
|
222
|
+
if($(this).hasClass(rootOfChildClass)){
|
223
|
+
}else{
|
224
|
+
padding = padding - options.childRight;
|
225
|
+
}
|
226
|
+
$(this).children("td")[options.treeColumn].style.paddingLeft = (padding + options.childRight) + "px";
|
227
|
+
});
|
228
|
+
|
229
|
+
if(options.expandable) {
|
230
|
+
var newLink = '<a href="#" title="' + options.stringExpand + '" style="margin-left: ' + (-1)*(options.indent) + 'px; padding-left: ' + options.indent + 'px" class="expander"></a>';
|
231
|
+
|
232
|
+
cell.find('a[title="' + options.stringExpand + '"]').remove();
|
233
|
+
|
234
|
+
if(options.clickableNodeNames) {
|
235
|
+
cell.wrapInner(newLink);
|
236
|
+
} else {
|
237
|
+
cell.html(newLink+cell.html());
|
238
|
+
}
|
239
|
+
|
240
|
+
$(cell[0].firstChild).click(function() { node.toggleBranch(); return false; }).mousedown(function() { return false; });
|
241
|
+
$(cell[0].firstChild).keydown(function(e) { if(e.keyCode == 13) { node.toggleBranch(); return false; }});
|
242
|
+
|
243
|
+
if(options.clickableNodeNames) {
|
244
|
+
cell[0].style.cursor = "pointer";
|
245
|
+
$(cell).click(function(e) {
|
246
|
+
// Don't double-toggle if the click is on the existing expander icon
|
247
|
+
if (e.target.className != 'expander') {
|
248
|
+
node.toggleBranch();
|
249
|
+
}
|
250
|
+
});
|
251
|
+
}
|
252
|
+
|
253
|
+
if (options.persist && getPersistedNodeState(node)) {
|
254
|
+
node.addClass('expanded');
|
255
|
+
}
|
256
|
+
|
257
|
+
// Check for a class set explicitly by the user, otherwise set the default class
|
258
|
+
if(!(node.hasClass("expanded") || node.hasClass("collapsed"))) {
|
259
|
+
node.addClass(options.initialState);
|
260
|
+
}
|
261
|
+
|
262
|
+
if(node.hasClass("expanded")) {
|
263
|
+
node.expand();
|
264
|
+
}
|
265
|
+
}
|
266
|
+
}
|
267
|
+
return this;
|
268
|
+
};
|
269
|
+
|
270
|
+
// === Private functions
|
271
|
+
|
272
|
+
function ancestorsOf(node) {
|
273
|
+
var ancestors = [];
|
274
|
+
while(node = parentOf(node)) {
|
275
|
+
ancestors[ancestors.length] = node[0];
|
276
|
+
}
|
277
|
+
return ancestors;
|
278
|
+
};
|
279
|
+
|
280
|
+
function childrenOf(node) {
|
281
|
+
return $(node).siblings("tr." + options.childPrefix + node[0].id);
|
282
|
+
};
|
283
|
+
|
284
|
+
function getPaddingLeft(node) {
|
285
|
+
var paddingLeft = parseInt(node[0].style.paddingLeft, 10);
|
286
|
+
return (isNaN(paddingLeft)) ? defaultPaddingLeft : paddingLeft;
|
287
|
+
}
|
288
|
+
|
289
|
+
function indent(node, value) {
|
290
|
+
var cell = $(node.children("td")[options.treeColumn]);
|
291
|
+
cell[0].style.paddingLeft = getPaddingLeft(cell) + value + "px";
|
292
|
+
|
293
|
+
childrenOf(node).each(function() {
|
294
|
+
indent($(this), value);
|
295
|
+
});
|
296
|
+
};
|
297
|
+
|
298
|
+
function initialize(node) {
|
299
|
+
if(!node.hasClass("initialized")) {
|
300
|
+
node.addClass("initialized");
|
301
|
+
|
302
|
+
var childNodes = childrenOf(node);
|
303
|
+
|
304
|
+
if(!node.hasClass("parent") && (childNodes.length > 0 || options.lazyLoad)) {
|
305
|
+
node.addClass("parent");
|
306
|
+
}
|
307
|
+
|
308
|
+
if(node.hasClass("parent")) {
|
309
|
+
var cell = $(node.children("td")[options.treeColumn]);
|
310
|
+
var padding = getPaddingLeft(cell) + options.indent;
|
311
|
+
|
312
|
+
childNodes.each(function() {
|
313
|
+
if($(this).hasClass(rootOfChildClass)){
|
314
|
+
}else{
|
315
|
+
padding = padding - options.childRight;
|
316
|
+
}
|
317
|
+
$(this).children("td")[options.treeColumn].style.paddingLeft = (padding + options.childRight) + "px";
|
318
|
+
});
|
319
|
+
|
320
|
+
if(options.expandable) {
|
321
|
+
var newLink = '<a href="#" title="' + options.stringExpand + '" style="margin-left: ' + (-1)*(options.indent) + 'px; padding-left: ' + options.indent + 'px" class="expander"></a>';
|
322
|
+
|
323
|
+
if(options.clickableNodeNames) {
|
324
|
+
cell.wrapInner(newLink);
|
325
|
+
} else {
|
326
|
+
cell.html(newLink+cell.html());
|
327
|
+
}
|
328
|
+
|
329
|
+
$(cell[0].firstChild).click(function() { node.toggleBranch(); return false; }).mousedown(function() { return false; });
|
330
|
+
$(cell[0].firstChild).keydown(function(e) { if(e.keyCode == 13) { node.toggleBranch(); return false; }});
|
331
|
+
|
332
|
+
if(options.clickableNodeNames) {
|
333
|
+
cell[0].style.cursor = "pointer";
|
334
|
+
$(cell).click(function(e) {
|
335
|
+
// Don't double-toggle if the click is on the existing expander icon
|
336
|
+
if (e.target.className != 'expander') {
|
337
|
+
node.toggleBranch();
|
338
|
+
}
|
339
|
+
});
|
340
|
+
}
|
341
|
+
|
342
|
+
if (options.persist && getPersistedNodeState(node)) {
|
343
|
+
node.addClass('expanded');
|
344
|
+
}
|
345
|
+
|
346
|
+
// Check for a class set explicitly by the user, otherwise set the default class
|
347
|
+
if(!(node.hasClass("expanded") || node.hasClass("collapsed"))) {
|
348
|
+
node.addClass(options.initialState);
|
349
|
+
}
|
350
|
+
|
351
|
+
if(node.hasClass("expanded")) {
|
352
|
+
node.expand();
|
353
|
+
}
|
354
|
+
}
|
355
|
+
}
|
356
|
+
}
|
357
|
+
};
|
358
|
+
|
359
|
+
function move(node, destination) {
|
360
|
+
node.insertAfter(destination);
|
361
|
+
childrenOf(node).reverse().each(function() { move($(this), node[0]); });
|
362
|
+
};
|
363
|
+
|
364
|
+
function parentOf(node) {
|
365
|
+
var classNames = node[0].className.split(' ');
|
366
|
+
|
367
|
+
for(var key=0; key<classNames.length; key++) {
|
368
|
+
if(classNames[key].match(options.childPrefix)) {
|
369
|
+
return $(node).siblings("#" + classNames[key].substring(options.childPrefix.length));
|
370
|
+
}
|
371
|
+
}
|
372
|
+
|
373
|
+
return null;
|
374
|
+
};
|
375
|
+
|
376
|
+
//saving state functions, not critical, so will not generate alerts on error
|
377
|
+
function persistNodeState(node) {
|
378
|
+
if(node.hasClass('expanded')) {
|
379
|
+
try {
|
380
|
+
persistStore.set(node.attr('id'), '1');
|
381
|
+
} catch (err) {
|
382
|
+
|
383
|
+
}
|
384
|
+
} else {
|
385
|
+
try {
|
386
|
+
persistStore.remove(node.attr('id'));
|
387
|
+
} catch (err) {
|
388
|
+
|
389
|
+
}
|
390
|
+
}
|
391
|
+
}
|
392
|
+
|
393
|
+
function getPersistedNodeState(node) {
|
394
|
+
try {
|
395
|
+
return persistStore.get(node.attr('id')) == '1';
|
396
|
+
} catch (err) {
|
397
|
+
return false;
|
398
|
+
}
|
399
|
+
}
|
400
|
+
})(jQuery);
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/* jQuery treeTable stylesheet
|
2
|
+
*
|
3
|
+
* This file contains styles that are used to display the tree table. Each tree
|
4
|
+
* table is assigned the +treeTable+ class.
|
5
|
+
* ========================================================================= */
|
6
|
+
|
7
|
+
/* jquery.treeTable.collapsible
|
8
|
+
* ------------------------------------------------------------------------- */
|
9
|
+
.treeTable tr td .expander {
|
10
|
+
cursor: pointer;
|
11
|
+
padding: 0;
|
12
|
+
zoom: 1; /* IE7 Hack */
|
13
|
+
}
|
14
|
+
|
15
|
+
.treeTable tr td a.expander {
|
16
|
+
background-position: left center;
|
17
|
+
background-repeat: no-repeat;
|
18
|
+
color: #000;
|
19
|
+
text-decoration: none;
|
20
|
+
}
|
21
|
+
|
22
|
+
.treeTable tr.collapsed td a.expander {
|
23
|
+
background-image: url(<%= asset_path 'jquery-treeTable/images/toggle-expand-dark.png' %>);
|
24
|
+
}
|
25
|
+
|
26
|
+
.treeTable tr.expanded td a.expander {
|
27
|
+
background-image: url(<%= asset_path 'jquery-treeTable/images/toggle-collapse-dark.png' %>);
|
28
|
+
}
|
29
|
+
|
30
|
+
/* jquery.treeTable.sortable
|
31
|
+
* ------------------------------------------------------------------------- */
|
32
|
+
.treeTable tr.selected, .treeTable tr.accept {
|
33
|
+
background-color: #3875d7;
|
34
|
+
}
|
35
|
+
|
36
|
+
.treeTable tr.selected a.expander, .treeTable tr.accept a.expander {
|
37
|
+
color: #fff;
|
38
|
+
}
|
39
|
+
|
40
|
+
.treeTable tr.collapsed.selected td a.expander, .treeTable tr.collapsed.accept td a.expander {
|
41
|
+
background-image: url(<%= asset_path 'jquery-treeTable/images/toggle-expand-light.png' %>);
|
42
|
+
}
|
43
|
+
|
44
|
+
.treeTable tr.expanded.selected td a.expander, .treeTable tr.expanded.accept td a.expander {
|
45
|
+
background-image: url(<%= asset_path 'jquery-treeTable/images/toggle-collapse-light.png' %>);
|
46
|
+
}
|
47
|
+
|
48
|
+
.treeTable .ui-draggable-dragging {
|
49
|
+
color: #000;
|
50
|
+
z-index: 1;
|
51
|
+
}
|
52
|
+
|
53
|
+
/* Layout helper taken from jQuery UI. This way I don't have to require the
|
54
|
+
* full jQuery UI CSS to be loaded. */
|
55
|
+
.ui-helper-hidden { display: none; }
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# アクセス制御のユーティリティクラス
|
2
|
+
class Bizside::Acl::AccessControlUtils
|
3
|
+
|
4
|
+
@@access_control = nil
|
5
|
+
|
6
|
+
def self.init(reload = false)
|
7
|
+
if reload or @@access_control.nil?
|
8
|
+
@@access_control = {}
|
9
|
+
config_files = Bizside.config.acl.config_files? ? Bizside.config.acl.config_files : ['config/acl.yml']
|
10
|
+
config_files.each do |config|
|
11
|
+
merge(config)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.merge(filename)
|
17
|
+
yml = YAML.load_file(filename)
|
18
|
+
|
19
|
+
yml.each do |roll_key, values|
|
20
|
+
@@access_control[roll_key] ||= {}
|
21
|
+
@@access_control[roll_key].merge!(values)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.role_keys
|
26
|
+
# Railsを使用 かつ 開発環境の場合はリロードする
|
27
|
+
init(Bizside.rails_env&.development?)
|
28
|
+
|
29
|
+
@@access_control.keys.sort
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.get_access_control(roll_key)
|
33
|
+
@@access_control[roll_key]
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require_relative 'access_control_utils'
|
2
|
+
|
3
|
+
module Bizside::Acl::AvailableHelper
|
4
|
+
|
5
|
+
def available_for(controller_name, action_name = nil, params = {})
|
6
|
+
controller_name = controller_name[1..-1] if controller_name.start_with?('/')
|
7
|
+
action_name ||= 'index'
|
8
|
+
message = "ACL: #{controller_name}##{action_name} => "
|
9
|
+
|
10
|
+
Bizside::Acl::AccessControlUtils::role_keys.each do |role_key|
|
11
|
+
access_control = Bizside::Acl::AccessControlUtils::get_access_control(role_key)
|
12
|
+
|
13
|
+
# コントローラの定義を取得
|
14
|
+
controller_value = access_control[controller_name]
|
15
|
+
next unless controller_value.present?
|
16
|
+
|
17
|
+
# アクションの定義を取得
|
18
|
+
if controller_value.is_a?(String)
|
19
|
+
action_value = controller_value
|
20
|
+
elsif controller_value.is_a?(Array)
|
21
|
+
action_value = controller_value
|
22
|
+
elsif controller_value.is_a?(TrueClass)
|
23
|
+
action_value = true
|
24
|
+
elsif controller_value.is_a?(FalseClass)
|
25
|
+
action_value = false
|
26
|
+
else
|
27
|
+
action_value = controller_value[action_name]
|
28
|
+
action_value = controller_value['index'] if action_value.nil?
|
29
|
+
if action_value.is_a?(Hash)
|
30
|
+
action_value = controller_value[action_value['same_as']] if action_value['same_as'].present?
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
next if action_value.nil?
|
35
|
+
|
36
|
+
# アクセス定義を確認
|
37
|
+
role = eval(role_key)
|
38
|
+
if role
|
39
|
+
if action_value.is_a?(String)
|
40
|
+
ret = role.instance_eval(action_value)
|
41
|
+
elsif action_value.is_a?(Array)
|
42
|
+
action_value.each do |judge|
|
43
|
+
ret = role.instance_eval(judge)
|
44
|
+
break unless ret
|
45
|
+
end
|
46
|
+
elsif action_value.is_a?(FalseClass)
|
47
|
+
ret = false
|
48
|
+
else
|
49
|
+
ret = true
|
50
|
+
end
|
51
|
+
else
|
52
|
+
ret = false
|
53
|
+
end
|
54
|
+
|
55
|
+
unless ret
|
56
|
+
Bizside.logger.debug message + 'false'
|
57
|
+
return false
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
Bizside.logger.debug message + 'true'
|
63
|
+
true
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Bizside
|
2
|
+
module Acl
|
3
|
+
module ControllerHelper
|
4
|
+
include Bizside::Acl::AvailableHelper
|
5
|
+
|
6
|
+
def authorize_user!
|
7
|
+
unless available_for(params[:controller], params[:action], params)
|
8
|
+
redirect_to root_path
|
9
|
+
return
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/bizside/acl.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
require 'logger'
|
3
|
+
require 'ltsv'
|
4
|
+
|
5
|
+
module Bizside
|
6
|
+
module Audit
|
7
|
+
class Logger
|
8
|
+
include Singleton
|
9
|
+
|
10
|
+
def self.logger
|
11
|
+
self.instance
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
path = file_path
|
16
|
+
FileUtils.mkdir_p( File.dirname(path) )
|
17
|
+
file = File.open(path, 'a')
|
18
|
+
file.sync = true
|
19
|
+
|
20
|
+
@logger = ::Logger.new(file)
|
21
|
+
@logger.formatter = proc do |severity, datetime, progname, msg|
|
22
|
+
"#{msg}\n"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def record(info = {})
|
27
|
+
@logger.info LTSV.dump(info)
|
28
|
+
end
|
29
|
+
|
30
|
+
def file_path
|
31
|
+
File.join('log', 'audit.log')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|