icfs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +674 -0
- data/bin/icfs_demo_create.rb +89 -0
- data/bin/icfs_demo_fcgi.rb +51 -0
- data/bin/icfs_demo_ssl_gen.rb +84 -0
- data/bin/icfs_demo_web.rb +50 -0
- data/bin/icfs_dev_todo.rb +20 -0
- data/data/demo_config.yml +94 -0
- data/data/icfs.css +475 -0
- data/data/icfs.js +458 -0
- data/lib/icfs.rb +109 -0
- data/lib/icfs/api.rb +1436 -0
- data/lib/icfs/cache.rb +254 -0
- data/lib/icfs/cache_elastic.rb +1154 -0
- data/lib/icfs/demo/auth.rb +74 -0
- data/lib/icfs/demo/static.rb +59 -0
- data/lib/icfs/demo/timezone.rb +38 -0
- data/lib/icfs/elastic.rb +83 -0
- data/lib/icfs/items.rb +653 -0
- data/lib/icfs/store.rb +278 -0
- data/lib/icfs/store_fs.rb +98 -0
- data/lib/icfs/store_s3.rb +97 -0
- data/lib/icfs/users.rb +80 -0
- data/lib/icfs/users_elastic.rb +166 -0
- data/lib/icfs/users_fs.rb +132 -0
- data/lib/icfs/validate.rb +479 -0
- data/lib/icfs/web/auth_ssl.rb +73 -0
- data/lib/icfs/web/client.rb +4498 -0
- metadata +77 -0
data/data/icfs.js
ADDED
@@ -0,0 +1,458 @@
|
|
1
|
+
/*************************************************************************
|
2
|
+
#
|
3
|
+
# Investigative Case File System
|
4
|
+
#
|
5
|
+
# Copyright 2019 by Graham A. Field
|
6
|
+
#
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License version 3.
|
9
|
+
#
|
10
|
+
# This program is distributed WITHOUT ANY WARRANTY; without even the
|
11
|
+
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
12
|
+
#
|
13
|
+
**************************************************************************/
|
14
|
+
|
15
|
+
///////////////////////////////////////////////
|
16
|
+
// Enable or disable a hidden div
|
17
|
+
function enaDiv(idDiv, idInp) {
|
18
|
+
var div = document.getElementById(idDiv);
|
19
|
+
var ena = document.getElementById(idInp);
|
20
|
+
if( ena.getAttribute("value") == "true" ) {
|
21
|
+
div.classList.add("hidden");
|
22
|
+
ena.setAttribute("value", "false");
|
23
|
+
} else {
|
24
|
+
div.classList.remove("hidden");
|
25
|
+
ena.setAttribute("value", "true");
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
///////////////////////////////////////////////
|
31
|
+
// Delete parent div
|
32
|
+
function delDiv(btn) {
|
33
|
+
var div = btn.parentNode;
|
34
|
+
div.parentNode.removeChild(div);
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
///////////////////////////////////////////////
|
39
|
+
// Create a delete button
|
40
|
+
function btnDelDiv(btn_class, btn_text){
|
41
|
+
var btn = document.createElement("button");
|
42
|
+
btn.setAttribute("class", btn_class);
|
43
|
+
btn.setAttribute("type", "button");
|
44
|
+
btn.setAttribute("onclick", "delDiv(this)");
|
45
|
+
btn.appendChild(document.createTextNode(btn_text));
|
46
|
+
return btn;
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
///////////////////////////////////////////////
|
51
|
+
// Add an input to a list
|
52
|
+
function addListInput(list_id, input_class, button){
|
53
|
+
var list = document.getElementById(list_id);
|
54
|
+
|
55
|
+
var cnt_inp = list.getElementsByTagName("input")[0];
|
56
|
+
var cnt = cnt_inp.getAttribute("value");
|
57
|
+
cnt = parseInt(cnt, 10) + 1
|
58
|
+
cnt_inp.setAttribute("value", cnt);
|
59
|
+
|
60
|
+
var base = cnt_inp.getAttribute("name");
|
61
|
+
|
62
|
+
var div = document.createElement("div");
|
63
|
+
list.appendChild(div);
|
64
|
+
|
65
|
+
var inp = document.createElement("input");
|
66
|
+
inp.setAttribute("type", "text");
|
67
|
+
inp.setAttribute("class", input_class);
|
68
|
+
inp.setAttribute("name", base + "-" + cnt);
|
69
|
+
div.appendChild(inp);
|
70
|
+
|
71
|
+
if( button ){
|
72
|
+
var btn = btnDelDiv(button, "X");
|
73
|
+
div.appendChild(btn);
|
74
|
+
}
|
75
|
+
|
76
|
+
inp.focus();
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
///////////////////////////////////////////////
|
81
|
+
// Add a tag
|
82
|
+
function addTag(id) {
|
83
|
+
addListInput(id, "form-tag", "form-del");
|
84
|
+
}
|
85
|
+
|
86
|
+
|
87
|
+
///////////////////////////////////////////////
|
88
|
+
// Add a stat to a case
|
89
|
+
function cseAddStat() {
|
90
|
+
addListInput("cse-stat-list", "form-stat", "form-del");
|
91
|
+
}
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
// Case
|
96
|
+
|
97
|
+
function cseAddAcc(){
|
98
|
+
var acnt = document.getElementById("cse-acc-cnt");
|
99
|
+
var acc_cnt = acnt.getAttribute("value");
|
100
|
+
acc_cnt = parseInt(acc_cnt, 10) + 1;
|
101
|
+
acnt.setAttribute("value", acc_cnt);
|
102
|
+
|
103
|
+
var alist = document.getElementById("cse-acc-list");
|
104
|
+
|
105
|
+
var row = document.createElement("div");
|
106
|
+
row.setAttribute("class", "list-row");
|
107
|
+
alist.appendChild(row);
|
108
|
+
|
109
|
+
var inp = document.createElement("input");
|
110
|
+
inp.setAttribute("type", "hidden");
|
111
|
+
inp.setAttribute("name", "cse-acc-" + acc_cnt);
|
112
|
+
inp.setAttribute("value", "1");
|
113
|
+
row.appendChild(inp);
|
114
|
+
|
115
|
+
inp = document.createElement("input");
|
116
|
+
inp.setAttribute("type", "text");
|
117
|
+
inp.setAttribute("class", "form-perm");
|
118
|
+
inp.setAttribute("name", "cse-acc-" + acc_cnt + "-perm");
|
119
|
+
row.appendChild(inp);
|
120
|
+
inp.focus();
|
121
|
+
|
122
|
+
var glst = document.createElement("div");
|
123
|
+
row.appendChild(glst);
|
124
|
+
row.appendChild(document.createTextNode(" "));
|
125
|
+
|
126
|
+
var gnt = document.createElement("div");
|
127
|
+
glst.appendChild(gnt);
|
128
|
+
|
129
|
+
inp = document.createElement("input");
|
130
|
+
inp.setAttribute("type", "text");
|
131
|
+
inp.setAttribute("class", "form-usergrp");
|
132
|
+
inp.setAttribute("name", "cse-acc-" + acc_cnt + "-1");
|
133
|
+
glst.appendChild(inp);
|
134
|
+
|
135
|
+
inp = document.createElement("button");
|
136
|
+
inp.setAttribute("type", "button");
|
137
|
+
inp.setAttribute("class", "add-grant");
|
138
|
+
inp.setAttribute("onclick", "cseAddGrant(this)");
|
139
|
+
inp.appendChild(document.createTextNode("+"));
|
140
|
+
row.appendChild(inp);
|
141
|
+
}
|
142
|
+
|
143
|
+
function cseAddGrant(b){
|
144
|
+
var row = b.parentNode;
|
145
|
+
var cnt = row.getElementsByTagName("input")[0];
|
146
|
+
var glst = row.getElementsByTagName("div")[0];
|
147
|
+
var name = cnt.getAttribute("name");
|
148
|
+
|
149
|
+
var gcnt = cnt.getAttribute("value");
|
150
|
+
gcnt = parseInt(gcnt, 10) + 1;
|
151
|
+
cnt.setAttribute("value", gcnt);
|
152
|
+
|
153
|
+
var div = document.createElement("div");
|
154
|
+
glst.appendChild(div);
|
155
|
+
|
156
|
+
var inp = document.createElement("input");
|
157
|
+
inp.setAttribute("type", "text");
|
158
|
+
inp.setAttribute("class", "form-usergrp");
|
159
|
+
inp.setAttribute("name", name + "-" + gcnt);
|
160
|
+
div.appendChild(inp);
|
161
|
+
inp.focus();
|
162
|
+
}
|
163
|
+
|
164
|
+
|
165
|
+
// Entry
|
166
|
+
|
167
|
+
function entAddIndex(){
|
168
|
+
var ht = new XMLHttpRequest();
|
169
|
+
ht.onreadystatechange = function() {
|
170
|
+
if( this.readyState == 4 && this.status == 200) {
|
171
|
+
var jr = JSON.parse(ht.responseText);
|
172
|
+
if( jr.index != null ){
|
173
|
+
entAddIndexRaw(jr.index, jr.title);
|
174
|
+
}
|
175
|
+
}
|
176
|
+
};
|
177
|
+
|
178
|
+
var scr = document.getElementById("ent-idx-script");
|
179
|
+
scr = scr.getAttribute("value");
|
180
|
+
|
181
|
+
var cid = document.getElementById("ent-idx-caseid");
|
182
|
+
cid = cid.getAttribute("value");
|
183
|
+
|
184
|
+
var tit = document.getElementById("ent-idx-lu");
|
185
|
+
tit = encodeURIComponent(tit.value);
|
186
|
+
var url = scr + "/index_lookup?title=" + tit + "&caseid=" + cid;
|
187
|
+
|
188
|
+
ht.open("GET", url, true);
|
189
|
+
ht.send();
|
190
|
+
}
|
191
|
+
|
192
|
+
function entAddIndexRaw(num, title){
|
193
|
+
var icnt = document.getElementById("ent-idx-cnt");
|
194
|
+
var idx_cnt = icnt.getAttribute("value");
|
195
|
+
idx_cnt = parseInt(idx_cnt, 10) + 1;
|
196
|
+
icnt.setAttribute("value", idx_cnt);
|
197
|
+
|
198
|
+
var lst = document.getElementById("ent-idx-list");
|
199
|
+
|
200
|
+
var div = document.createElement("div");
|
201
|
+
lst.appendChild(div);
|
202
|
+
|
203
|
+
var inp = document.createElement("input");
|
204
|
+
inp.setAttribute("type", "hidden");
|
205
|
+
inp.setAttribute("name", "ent-idx-" + idx_cnt);
|
206
|
+
inp.setAttribute("value", num);
|
207
|
+
div.appendChild(inp);
|
208
|
+
|
209
|
+
div.appendChild(document.createTextNode(title));
|
210
|
+
|
211
|
+
var btn = btnDelDiv("form-del", "X");
|
212
|
+
div.appendChild(btn);
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
function entAddStat(){
|
217
|
+
var scnt = document.getElementById("ent-stats-cnt");
|
218
|
+
var stat_cnt = scnt.getAttribute("value");
|
219
|
+
stat_cnt = parseInt(stat_cnt, 10) + 1;
|
220
|
+
scnt.setAttribute("value", stat_cnt);
|
221
|
+
|
222
|
+
var sel = document.getElementById("ent-stat-sel");
|
223
|
+
var stat = sel.value;
|
224
|
+
|
225
|
+
var slist = document.getElementById("ent-stats-list");
|
226
|
+
|
227
|
+
var row = document.createElement("div");
|
228
|
+
row.setAttribute("class", "list-row");
|
229
|
+
slist.appendChild(row);
|
230
|
+
|
231
|
+
var inp = document.createElement("input");
|
232
|
+
inp.setAttribute("type", "hidden");
|
233
|
+
inp.setAttribute("name", "ent-stat-" + stat_cnt);
|
234
|
+
inp.setAttribute("value", "1");
|
235
|
+
row.appendChild(inp);
|
236
|
+
|
237
|
+
inp = document.createElement("input");
|
238
|
+
inp.setAttribute("type", "hidden");
|
239
|
+
inp.setAttribute("name", "ent-stat-" + stat_cnt + "-name");
|
240
|
+
inp.setAttribute("value", stat);
|
241
|
+
row.appendChild(inp);
|
242
|
+
|
243
|
+
var div = document.createElement("div");
|
244
|
+
div.setAttribute("class", "list-stat");
|
245
|
+
div.appendChild(document.createTextNode(stat));
|
246
|
+
row.appendChild(div);
|
247
|
+
|
248
|
+
inp = document.createElement("input");
|
249
|
+
inp.setAttribute("type", "text");
|
250
|
+
inp.setAttribute("class", "form-float");
|
251
|
+
inp.setAttribute("name", "ent-stat-" + stat_cnt + "-value");
|
252
|
+
row.appendChild(inp);
|
253
|
+
row.appendChild(document.createTextNode(" "));
|
254
|
+
inp.focus();
|
255
|
+
|
256
|
+
clst = document.createElement("div");
|
257
|
+
clst.setAttribute("class", "list-vert");
|
258
|
+
row.appendChild(clst);
|
259
|
+
row.appendChild(document.createTextNode(" "));
|
260
|
+
|
261
|
+
div = document.createElement("div");
|
262
|
+
clst.appendChild(div);
|
263
|
+
|
264
|
+
inp = document.createElement("input");
|
265
|
+
inp.setAttribute("type", "text");
|
266
|
+
inp.setAttribute("class", "form-usergrp");
|
267
|
+
inp.setAttribute("name", "ent-stat-" + stat_cnt + "-1");
|
268
|
+
clst.appendChild(inp);
|
269
|
+
|
270
|
+
inp = document.createElement("button");
|
271
|
+
inp.setAttribute("type", "button");
|
272
|
+
inp.setAttribute("class", "add-claim");
|
273
|
+
inp.setAttribute("onClick", "entAddClaim(this)");
|
274
|
+
inp.appendChild(document.createTextNode("+"));
|
275
|
+
row.appendChild(inp);
|
276
|
+
}
|
277
|
+
|
278
|
+
|
279
|
+
function entAddClaim(b){
|
280
|
+
var row = b.parentNode;
|
281
|
+
var cnt = row.getElementsByTagName("input")[0];
|
282
|
+
var clst = row.getElementsByTagName("div")[1];
|
283
|
+
var name = cnt.getAttribute("name");
|
284
|
+
|
285
|
+
var ccnt = cnt.getAttribute("value");
|
286
|
+
ccnt = parseInt(ccnt, 10) + 1;
|
287
|
+
cnt.setAttribute("value", ccnt);
|
288
|
+
|
289
|
+
var div = document.createElement("div");
|
290
|
+
clst.appendChild(div);
|
291
|
+
|
292
|
+
var inp = document.createElement("input");
|
293
|
+
inp.setAttribute("type", "text");
|
294
|
+
inp.setAttribute("class", "form-usergrp");
|
295
|
+
inp.setAttribute("name", name + "_" + ccnt);
|
296
|
+
div.appendChild(inp);
|
297
|
+
inp.focus();
|
298
|
+
}
|
299
|
+
|
300
|
+
|
301
|
+
function entAddPerm(){
|
302
|
+
var pcnt = document.getElementById("ent-perm-cnt");
|
303
|
+
var perm_cnt = pcnt.getAttribute("value");
|
304
|
+
perm_cnt = parseInt(perm_cnt, 10);
|
305
|
+
perm_cnt = perm_cnt + 1;
|
306
|
+
pcnt.setAttribute("value", perm_cnt);
|
307
|
+
|
308
|
+
var sel = document.getElementById("ent-perm-sel");
|
309
|
+
var perm = sel.value;
|
310
|
+
|
311
|
+
var div = document.createElement("div");
|
312
|
+
|
313
|
+
var txt = document.createTextNode(perm);
|
314
|
+
div.appendChild(txt);
|
315
|
+
|
316
|
+
var inp = document.createElement("input");
|
317
|
+
inp.setAttribute("type", "hidden");
|
318
|
+
inp.setAttribute("name", "ent-perm-" + perm_cnt);
|
319
|
+
inp.setAttribute("value", perm);
|
320
|
+
div.appendChild(inp);
|
321
|
+
|
322
|
+
var btn = btnDelDiv("form-del", "X");
|
323
|
+
document.createElement("button");
|
324
|
+
div.appendChild(btn);
|
325
|
+
|
326
|
+
var lst = document.getElementById("ent-perm-list");
|
327
|
+
lst.appendChild(div);
|
328
|
+
}
|
329
|
+
|
330
|
+
|
331
|
+
function entAddFile(){
|
332
|
+
var fcnt = document.getElementById("ent-file-cnt");
|
333
|
+
var file_cnt = fcnt.getAttribute("value");
|
334
|
+
file_cnt = parseInt(file_cnt, 10);
|
335
|
+
file_cnt = file_cnt + 1;
|
336
|
+
|
337
|
+
var div = document.createElement("div");
|
338
|
+
|
339
|
+
var inp = document.createElement("input");
|
340
|
+
inp.setAttribute("type", "text");
|
341
|
+
inp.setAttribute("name", "ent-file-" + file_cnt + "-name");
|
342
|
+
inp.setAttribute("class", "form-file-name");
|
343
|
+
div.appendChild(inp);
|
344
|
+
|
345
|
+
inp = document.createElement("input");
|
346
|
+
inp.setAttribute("type", "file");
|
347
|
+
inp.setAttribute("name", "ent-file-" + file_cnt + "-file");
|
348
|
+
inp.setAttribute("class", "form-file-upl");
|
349
|
+
div.appendChild(inp);
|
350
|
+
|
351
|
+
inp = btnDelDiv("form-del", "X");
|
352
|
+
div.appendChild(inp);
|
353
|
+
|
354
|
+
var lst = document.getElementById("ent-file-list");
|
355
|
+
lst.appendChild(div);
|
356
|
+
|
357
|
+
fcnt.setAttribute("value", file_cnt);
|
358
|
+
}
|
359
|
+
|
360
|
+
|
361
|
+
// Action
|
362
|
+
|
363
|
+
function actEnable(){
|
364
|
+
var but = document.getElementById("act-task-add");
|
365
|
+
var ena = document.getElementById("act-ena");
|
366
|
+
var tsk = document.getElementById("act-tasks");
|
367
|
+
|
368
|
+
var enabled = ena.getAttribute("value");
|
369
|
+
if( enabled == "true" ){
|
370
|
+
ena.setAttribute("value", "false");
|
371
|
+
tsk.setAttribute("class", "sect-right hidden");
|
372
|
+
but.setAttribute("class", "sect-right invisible");
|
373
|
+
} else {
|
374
|
+
ena.setAttribute("value", "true");
|
375
|
+
tsk.setAttribute("class", "sect-right");
|
376
|
+
but.setAttribute("class", "sect-right");
|
377
|
+
}
|
378
|
+
}
|
379
|
+
|
380
|
+
function actRow(label, tsk){
|
381
|
+
var row = document.createElement("div");
|
382
|
+
row.setAttribute("class", "form-row");
|
383
|
+
var div = document.createElement("div");
|
384
|
+
div.setAttribute("class", "list-label");
|
385
|
+
div.appendChild(document.createTextNode(label));
|
386
|
+
row.appendChild(div);
|
387
|
+
tsk.appendChild(row);
|
388
|
+
return row;
|
389
|
+
}
|
390
|
+
|
391
|
+
function actText(name, cl, row){
|
392
|
+
var inp = document.createElement("input");
|
393
|
+
inp.setAttribute("type", "text");
|
394
|
+
inp.setAttribute("name", name);
|
395
|
+
inp.setAttribute("class", cl);
|
396
|
+
row.appendChild(inp);
|
397
|
+
return inp;
|
398
|
+
}
|
399
|
+
|
400
|
+
function actCheck(name, cl, row){
|
401
|
+
inp = document.createElement("input");
|
402
|
+
inp.setAttribute("type", "checkbox");
|
403
|
+
inp.setAttribute("name", name);
|
404
|
+
inp.setAttribute("class", cl);
|
405
|
+
inp.setAttribute("value", "true");
|
406
|
+
inp.setAttribute("checked", "");
|
407
|
+
row.appendChild(inp);
|
408
|
+
return inp;
|
409
|
+
}
|
410
|
+
|
411
|
+
function actAddTask(){
|
412
|
+
var tasks = document.getElementById("act-tasks");
|
413
|
+
var acnt = document.getElementById("act-cnt");
|
414
|
+
|
415
|
+
var tnum = acnt.getAttribute("value");
|
416
|
+
tnum = parseInt(tnum, 10) + 1;
|
417
|
+
acnt.setAttribute("value", tnum);
|
418
|
+
|
419
|
+
var tsk = document.createElement("div");
|
420
|
+
tsk.setAttribute("class", "task");
|
421
|
+
tasks.appendChild(tsk);
|
422
|
+
|
423
|
+
var row = actRow("Tasked:", tsk);
|
424
|
+
var inp_tsk = actText("act-" + tnum + "-task", "usergrp", row);
|
425
|
+
|
426
|
+
row = actRow("Title:", tsk);
|
427
|
+
actText("act-" + tnum + "-title", "form-title", row);
|
428
|
+
|
429
|
+
row = actRow("Open:", tsk);
|
430
|
+
actCheck("act-" + tnum + "-status", "form-check", row);
|
431
|
+
|
432
|
+
row = actRow("Flag:", tsk);
|
433
|
+
actCheck("act-" + tnum + "-flag", "form-check", row);
|
434
|
+
|
435
|
+
row = actRow("Time:", tsk);
|
436
|
+
actText("act-" + tnum + "-time", "form-time", row);
|
437
|
+
|
438
|
+
row = actRow("Tags:", tsk);
|
439
|
+
var tags = document.createElement("div");
|
440
|
+
tags.setAttribute("class", "tags-list");
|
441
|
+
tags.setAttribute("id", "act-" + tnum + "-tag-list");
|
442
|
+
row.appendChild(tags);
|
443
|
+
var inp = document.createElement("input");
|
444
|
+
inp.setAttribute("type", "hidden");
|
445
|
+
inp.setAttribute("name", "act-" + tnum + "-tag");
|
446
|
+
inp.setAttribute("value", "0");
|
447
|
+
tags.appendChild(inp);
|
448
|
+
addTag("act-" + tnum + "-tag-list")
|
449
|
+
var btn = document.createElement("button");
|
450
|
+
btn.setAttribute("type", "button");
|
451
|
+
btn.setAttribute("class", "tag-add");
|
452
|
+
btn.setAttribute("onclick", "addTag(\"act-" + tnum +
|
453
|
+
"-tag-list\")");
|
454
|
+
btn.appendChild(document.createTextNode("+"));
|
455
|
+
row.appendChild(btn);
|
456
|
+
|
457
|
+
inp_tsk.focus();
|
458
|
+
}
|