icfs 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/icfs.js +349 -316
- data/devel/devel-webrick.yml +49 -0
- data/devel/docker-compose.yml +63 -0
- data/devel/icfs +1 -0
- data/devel/run/copy-s3.rb +43 -0
- data/devel/{test/init.rb → run/init-icfs.rb} +5 -20
- data/devel/{test/run.rb → run/webrick.rb} +14 -11
- data/lib/icfs/api.rb +23 -9
- data/lib/icfs/users.rb +9 -0
- data/lib/icfs/users_fs.rb +6 -0
- data/lib/icfs/users_redis.rb +26 -4
- data/lib/icfs/users_s3.rb +8 -2
- data/lib/icfs/web/auth_ssl.rb +5 -1
- data/lib/icfs/web/client.rb +1 -0
- metadata +8 -26
- data/bin/icfs_demo_check.rb +0 -29
- data/bin/icfs_demo_create.rb +0 -89
- data/bin/icfs_demo_web.rb +0 -50
- data/data/demo_config.yml +0 -94
- data/data/docker/build-web.sh +0 -27
- data/data/docker/compose-demo.yml +0 -41
- data/data/docker/compose-init.yml +0 -32
- data/data/docker/icfs-app.rb +0 -50
- data/data/docker/icfs-cfg.yml +0 -88
- data/data/docker/icfs-init.rb +0 -75
- data/data/docker/icfs-ruby/Dockerfile +0 -22
- data/data/docker/icfs-ruby/build.sh +0 -14
- data/data/docker/nginx.conf +0 -68
- data/devel/create.sh +0 -15
- data/devel/elastic.sh +0 -20
- data/devel/minio.sh +0 -22
- data/devel/redis.sh +0 -18
- data/devel/server.sh +0 -18
- data/devel/test/es-s3-fs-init.rb +0 -93
- data/devel/test/es-s3-fs-webrick.rb +0 -79
- data/devel/test/es-s3-restore.rb +0 -56
- data/lib/icfs/demo/timezone.rb +0 -38
data/data/icfs.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
/*************************************************************************
|
2
|
-
#
|
3
2
|
# Investigative Case File System
|
4
3
|
#
|
5
4
|
# Copyright 2019 by Graham A. Field
|
@@ -91,368 +90,402 @@
|
|
91
90
|
}
|
92
91
|
|
93
92
|
|
94
|
-
|
95
93
|
// Case
|
96
94
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
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
|
-
}
|
95
|
+
///////////////////////////////////////////////
|
96
|
+
// Add an access
|
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);
|
142
102
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
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
|
+
|
144
|
+
///////////////////////////////////////////////
|
145
|
+
// Add an access grant
|
146
|
+
function cseAddGrant(b){
|
147
|
+
var row = b.parentNode;
|
148
|
+
var cnt = row.getElementsByTagName("input")[0];
|
149
|
+
var glst = row.getElementsByTagName("div")[0];
|
150
|
+
var name = cnt.getAttribute("name");
|
151
|
+
|
152
|
+
var gcnt = cnt.getAttribute("value");
|
153
|
+
gcnt = parseInt(gcnt, 10) + 1;
|
154
|
+
cnt.setAttribute("value", gcnt);
|
155
|
+
|
156
|
+
var div = document.createElement("div");
|
157
|
+
glst.appendChild(div);
|
158
|
+
|
159
|
+
var inp = document.createElement("input");
|
160
|
+
inp.setAttribute("type", "text");
|
161
|
+
inp.setAttribute("class", "form-usergrp");
|
162
|
+
inp.setAttribute("name", name + "-" + gcnt);
|
163
|
+
div.appendChild(inp);
|
164
|
+
inp.focus();
|
165
|
+
}
|
163
166
|
|
164
167
|
|
165
168
|
// Entry
|
166
169
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
170
|
+
///////////////////////////////////////////////
|
171
|
+
// Add an index
|
172
|
+
function entAddIndex(){
|
173
|
+
var ht = new XMLHttpRequest();
|
174
|
+
ht.onreadystatechange = function() {
|
175
|
+
if( this.readyState == 4 && this.status == 200) {
|
176
|
+
var jr = JSON.parse(ht.responseText);
|
177
|
+
if( jr.index != null ){
|
178
|
+
entAddIndexRaw(jr.index, jr.title);
|
175
179
|
}
|
176
|
-
}
|
180
|
+
}
|
181
|
+
};
|
177
182
|
|
178
|
-
|
179
|
-
|
183
|
+
var scr = document.getElementById("ent-idx-script");
|
184
|
+
scr = scr.getAttribute("value");
|
180
185
|
|
181
|
-
|
182
|
-
|
186
|
+
var cid = document.getElementById("ent-idx-caseid");
|
187
|
+
cid = cid.getAttribute("value");
|
183
188
|
|
184
|
-
|
185
|
-
|
186
|
-
|
189
|
+
var tit = document.getElementById("ent-idx-lu");
|
190
|
+
tit = encodeURIComponent(tit.value);
|
191
|
+
var url = scr + "/index_lookup?title=" + tit + "&caseid=" + cid;
|
187
192
|
|
188
|
-
|
189
|
-
|
190
|
-
|
193
|
+
ht.open("GET", url, true);
|
194
|
+
ht.send();
|
195
|
+
}
|
191
196
|
|
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
197
|
|
198
|
-
|
198
|
+
///////////////////////////////////////////////
|
199
|
+
// Adds a index given the number and title
|
200
|
+
function entAddIndexRaw(num, title){
|
201
|
+
var icnt = document.getElementById("ent-idx-cnt");
|
202
|
+
var idx_cnt = icnt.getAttribute("value");
|
203
|
+
idx_cnt = parseInt(idx_cnt, 10) + 1;
|
204
|
+
icnt.setAttribute("value", idx_cnt);
|
199
205
|
|
200
|
-
|
201
|
-
lst.appendChild(div);
|
206
|
+
var lst = document.getElementById("ent-idx-list");
|
202
207
|
|
203
|
-
|
204
|
-
|
205
|
-
inp.setAttribute("name", "ent-idx-" + idx_cnt);
|
206
|
-
inp.setAttribute("value", num);
|
207
|
-
div.appendChild(inp);
|
208
|
+
var div = document.createElement("div");
|
209
|
+
lst.appendChild(div);
|
208
210
|
|
209
|
-
|
211
|
+
var inp = document.createElement("input");
|
212
|
+
inp.setAttribute("type", "hidden");
|
213
|
+
inp.setAttribute("name", "ent-idx-" + idx_cnt);
|
214
|
+
inp.setAttribute("value", num);
|
215
|
+
div.appendChild(inp);
|
210
216
|
|
211
|
-
|
212
|
-
div.appendChild(btn);
|
213
|
-
}
|
217
|
+
div.appendChild(document.createTextNode(title));
|
214
218
|
|
219
|
+
var btn = btnDelDiv("form-del", "X");
|
220
|
+
div.appendChild(btn);
|
221
|
+
}
|
215
222
|
|
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
223
|
|
224
|
+
///////////////////////////////////////////////
|
225
|
+
// Add a stat
|
226
|
+
function entAddStat(){
|
227
|
+
var scnt = document.getElementById("ent-stats-cnt");
|
228
|
+
var stat_cnt = scnt.getAttribute("value");
|
229
|
+
stat_cnt = parseInt(stat_cnt, 10) + 1;
|
230
|
+
scnt.setAttribute("value", stat_cnt);
|
278
231
|
|
279
|
-
|
280
|
-
|
281
|
-
var cnt = row.getElementsByTagName("input")[0];
|
282
|
-
var clst = row.getElementsByTagName("div")[1];
|
283
|
-
var name = cnt.getAttribute("name");
|
232
|
+
var sel = document.getElementById("ent-stat-sel");
|
233
|
+
var stat = sel.value;
|
284
234
|
|
285
|
-
|
286
|
-
ccnt = parseInt(ccnt, 10) + 1;
|
287
|
-
cnt.setAttribute("value", ccnt);
|
235
|
+
var slist = document.getElementById("ent-stats-list");
|
288
236
|
|
289
|
-
|
290
|
-
|
237
|
+
var row = document.createElement("div");
|
238
|
+
row.setAttribute("class", "list-row");
|
239
|
+
slist.appendChild(row);
|
291
240
|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
inp.focus();
|
298
|
-
}
|
241
|
+
var inp = document.createElement("input");
|
242
|
+
inp.setAttribute("type", "hidden");
|
243
|
+
inp.setAttribute("name", "ent-stat-" + stat_cnt);
|
244
|
+
inp.setAttribute("value", "1");
|
245
|
+
row.appendChild(inp);
|
299
246
|
|
247
|
+
inp = document.createElement("input");
|
248
|
+
inp.setAttribute("type", "hidden");
|
249
|
+
inp.setAttribute("name", "ent-stat-" + stat_cnt + "-name");
|
250
|
+
inp.setAttribute("value", stat);
|
251
|
+
row.appendChild(inp);
|
300
252
|
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
perm_cnt = perm_cnt + 1;
|
306
|
-
pcnt.setAttribute("value", perm_cnt);
|
253
|
+
var div = document.createElement("div");
|
254
|
+
div.setAttribute("class", "list-stat");
|
255
|
+
div.appendChild(document.createTextNode(stat));
|
256
|
+
row.appendChild(div);
|
307
257
|
|
308
|
-
|
309
|
-
|
258
|
+
inp = document.createElement("input");
|
259
|
+
inp.setAttribute("type", "text");
|
260
|
+
inp.setAttribute("class", "form-float");
|
261
|
+
inp.setAttribute("name", "ent-stat-" + stat_cnt + "-value");
|
262
|
+
row.appendChild(inp);
|
263
|
+
row.appendChild(document.createTextNode(" "));
|
264
|
+
inp.focus();
|
310
265
|
|
311
|
-
|
266
|
+
clst = document.createElement("div");
|
267
|
+
clst.setAttribute("class", "list-vert");
|
268
|
+
row.appendChild(clst);
|
269
|
+
row.appendChild(document.createTextNode(" "));
|
312
270
|
|
313
|
-
|
314
|
-
|
271
|
+
div = document.createElement("div");
|
272
|
+
clst.appendChild(div);
|
315
273
|
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
274
|
+
inp = document.createElement("input");
|
275
|
+
inp.setAttribute("type", "text");
|
276
|
+
inp.setAttribute("class", "form-usergrp");
|
277
|
+
inp.setAttribute("name", "ent-stat-" + stat_cnt + "-1");
|
278
|
+
clst.appendChild(inp);
|
279
|
+
|
280
|
+
inp = document.createElement("button");
|
281
|
+
inp.setAttribute("type", "button");
|
282
|
+
inp.setAttribute("class", "add-claim");
|
283
|
+
inp.setAttribute("onClick", "entAddClaim(this)");
|
284
|
+
inp.appendChild(document.createTextNode("+"));
|
285
|
+
row.appendChild(inp);
|
286
|
+
}
|
321
287
|
|
322
|
-
var btn = btnDelDiv("form-del", "X");
|
323
|
-
document.createElement("button");
|
324
|
-
div.appendChild(btn);
|
325
288
|
|
326
|
-
|
327
|
-
|
328
|
-
|
289
|
+
///////////////////////////////////////////////
|
290
|
+
// Add a stat claim
|
291
|
+
function entAddClaim(b){
|
292
|
+
var row = b.parentNode;
|
293
|
+
var cnt = row.getElementsByTagName("input")[0];
|
294
|
+
var clst = row.getElementsByTagName("div")[1];
|
295
|
+
var name = cnt.getAttribute("name");
|
296
|
+
|
297
|
+
var ccnt = cnt.getAttribute("value");
|
298
|
+
ccnt = parseInt(ccnt, 10) + 1;
|
299
|
+
cnt.setAttribute("value", ccnt);
|
300
|
+
|
301
|
+
var div = document.createElement("div");
|
302
|
+
clst.appendChild(div);
|
303
|
+
|
304
|
+
var inp = document.createElement("input");
|
305
|
+
inp.setAttribute("type", "text");
|
306
|
+
inp.setAttribute("class", "form-usergrp");
|
307
|
+
inp.setAttribute("name", name + "_" + ccnt);
|
308
|
+
div.appendChild(inp);
|
309
|
+
inp.focus();
|
310
|
+
}
|
311
|
+
|
329
312
|
|
313
|
+
///////////////////////////////////////////////
|
314
|
+
// Add a perm
|
315
|
+
function entAddPerm(){
|
316
|
+
var pcnt = document.getElementById("ent-perm-cnt");
|
317
|
+
var perm_cnt = pcnt.getAttribute("value");
|
318
|
+
perm_cnt = parseInt(perm_cnt, 10);
|
319
|
+
perm_cnt = perm_cnt + 1;
|
320
|
+
pcnt.setAttribute("value", perm_cnt);
|
330
321
|
|
331
|
-
|
332
|
-
|
333
|
-
var file_cnt = fcnt.getAttribute("value");
|
334
|
-
file_cnt = parseInt(file_cnt, 10);
|
335
|
-
file_cnt = file_cnt + 1;
|
322
|
+
var sel = document.getElementById("ent-perm-sel");
|
323
|
+
var perm = sel.value;
|
336
324
|
|
337
|
-
|
325
|
+
var div = document.createElement("div");
|
338
326
|
|
339
|
-
|
340
|
-
|
341
|
-
inp.setAttribute("name", "ent-file-" + file_cnt + "-name");
|
342
|
-
inp.setAttribute("class", "form-file-name");
|
343
|
-
div.appendChild(inp);
|
327
|
+
var txt = document.createTextNode(perm);
|
328
|
+
div.appendChild(txt);
|
344
329
|
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
330
|
+
var inp = document.createElement("input");
|
331
|
+
inp.setAttribute("type", "hidden");
|
332
|
+
inp.setAttribute("name", "ent-perm-" + perm_cnt);
|
333
|
+
inp.setAttribute("value", perm);
|
334
|
+
div.appendChild(inp);
|
350
335
|
|
351
|
-
|
352
|
-
|
336
|
+
var btn = btnDelDiv("form-del", "X");
|
337
|
+
document.createElement("button");
|
338
|
+
div.appendChild(btn);
|
353
339
|
|
354
|
-
|
355
|
-
|
340
|
+
var lst = document.getElementById("ent-perm-list");
|
341
|
+
lst.appendChild(div);
|
342
|
+
}
|
356
343
|
|
357
|
-
|
358
|
-
|
344
|
+
|
345
|
+
///////////////////////////////////////////////
|
346
|
+
// Add a file
|
347
|
+
function entAddFile(){
|
348
|
+
var fcnt = document.getElementById("ent-file-cnt");
|
349
|
+
var file_cnt = fcnt.getAttribute("value");
|
350
|
+
file_cnt = parseInt(file_cnt, 10);
|
351
|
+
file_cnt = file_cnt + 1;
|
352
|
+
|
353
|
+
var div = document.createElement("div");
|
354
|
+
|
355
|
+
var inp = document.createElement("input");
|
356
|
+
inp.setAttribute("type", "text");
|
357
|
+
inp.setAttribute("name", "ent-file-" + file_cnt + "-name");
|
358
|
+
inp.setAttribute("class", "form-file-name");
|
359
|
+
div.appendChild(inp);
|
360
|
+
|
361
|
+
inp = document.createElement("input");
|
362
|
+
inp.setAttribute("type", "file");
|
363
|
+
inp.setAttribute("name", "ent-file-" + file_cnt + "-file");
|
364
|
+
inp.setAttribute("class", "form-file-upl");
|
365
|
+
div.appendChild(inp);
|
366
|
+
|
367
|
+
inp = btnDelDiv("form-del", "X");
|
368
|
+
div.appendChild(inp);
|
369
|
+
|
370
|
+
var lst = document.getElementById("ent-file-list");
|
371
|
+
lst.appendChild(div);
|
372
|
+
|
373
|
+
fcnt.setAttribute("value", file_cnt);
|
374
|
+
}
|
359
375
|
|
360
376
|
|
361
377
|
// Action
|
362
378
|
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
379
|
+
///////////////////////////////////////////////
|
380
|
+
// Enable/disable editing the action
|
381
|
+
function actEnable(){
|
382
|
+
var but = document.getElementById("act-task-add");
|
383
|
+
var ena = document.getElementById("act-ena");
|
384
|
+
var tsk = document.getElementById("act-tasks");
|
385
|
+
|
386
|
+
var enabled = ena.getAttribute("value");
|
387
|
+
if( enabled == "true" ){
|
388
|
+
ena.setAttribute("value", "false");
|
389
|
+
tsk.setAttribute("class", "sect-right hidden");
|
390
|
+
but.setAttribute("class", "sect-right invisible");
|
391
|
+
} else {
|
392
|
+
ena.setAttribute("value", "true");
|
393
|
+
tsk.setAttribute("class", "sect-right");
|
394
|
+
but.setAttribute("class", "sect-right");
|
378
395
|
}
|
396
|
+
}
|
379
397
|
|
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
398
|
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
+
///////////////////////////////////////////////
|
400
|
+
// Add a row to a task
|
401
|
+
// Helper function
|
402
|
+
function actRow(label, tsk){
|
403
|
+
var row = document.createElement("div");
|
404
|
+
row.setAttribute("class", "form-row");
|
405
|
+
var div = document.createElement("div");
|
406
|
+
div.setAttribute("class", "list-label");
|
407
|
+
div.appendChild(document.createTextNode(label));
|
408
|
+
row.appendChild(div);
|
409
|
+
tsk.appendChild(row);
|
410
|
+
return row;
|
411
|
+
}
|
399
412
|
|
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
413
|
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
414
|
+
///////////////////////////////////////////////
|
415
|
+
// Add text input to a row
|
416
|
+
// Helpter function
|
417
|
+
function actText(name, cl, row){
|
418
|
+
var inp = document.createElement("input");
|
419
|
+
inp.setAttribute("type", "text");
|
420
|
+
inp.setAttribute("name", name);
|
421
|
+
inp.setAttribute("class", cl);
|
422
|
+
row.appendChild(inp);
|
423
|
+
return inp;
|
424
|
+
}
|
425
|
+
|
426
|
+
|
427
|
+
//////////////////////////////////////////////
|
428
|
+
// Add checkbox input to a row
|
429
|
+
// Helper function
|
430
|
+
function actCheck(name, cl, row){
|
431
|
+
inp = document.createElement("input");
|
432
|
+
inp.setAttribute("type", "checkbox");
|
433
|
+
inp.setAttribute("name", name);
|
434
|
+
inp.setAttribute("class", cl);
|
435
|
+
inp.setAttribute("value", "true");
|
436
|
+
inp.setAttribute("checked", "");
|
437
|
+
row.appendChild(inp);
|
438
|
+
return inp;
|
439
|
+
}
|
440
|
+
|
441
|
+
|
442
|
+
///////////////////////////////////////////////
|
443
|
+
// Add a task
|
444
|
+
function actAddTask(){
|
445
|
+
var tasks = document.getElementById("act-tasks");
|
446
|
+
var acnt = document.getElementById("act-cnt");
|
447
|
+
|
448
|
+
var tnum = acnt.getAttribute("value");
|
449
|
+
tnum = parseInt(tnum, 10) + 1;
|
450
|
+
acnt.setAttribute("value", tnum);
|
451
|
+
|
452
|
+
var tsk = document.createElement("div");
|
453
|
+
tsk.setAttribute("class", "task");
|
454
|
+
tasks.appendChild(tsk);
|
455
|
+
|
456
|
+
var row = actRow("Tasked:", tsk);
|
457
|
+
var inp_tsk = actText("act-" + tnum + "-task", "usergrp", row);
|
458
|
+
|
459
|
+
row = actRow("Title:", tsk);
|
460
|
+
actText("act-" + tnum + "-title", "form-title", row);
|
461
|
+
|
462
|
+
row = actRow("Open:", tsk);
|
463
|
+
actCheck("act-" + tnum + "-status", "form-check", row);
|
464
|
+
|
465
|
+
row = actRow("Flag:", tsk);
|
466
|
+
actCheck("act-" + tnum + "-flag", "form-check", row);
|
467
|
+
|
468
|
+
row = actRow("Time:", tsk);
|
469
|
+
actText("act-" + tnum + "-time", "form-time", row);
|
470
|
+
|
471
|
+
row = actRow("Tags:", tsk);
|
472
|
+
var tags = document.createElement("div");
|
473
|
+
tags.setAttribute("class", "tags-list");
|
474
|
+
tags.setAttribute("id", "act-" + tnum + "-tag-list");
|
475
|
+
row.appendChild(tags);
|
476
|
+
var inp = document.createElement("input");
|
477
|
+
inp.setAttribute("type", "hidden");
|
478
|
+
inp.setAttribute("name", "act-" + tnum + "-tag");
|
479
|
+
inp.setAttribute("value", "0");
|
480
|
+
tags.appendChild(inp);
|
481
|
+
addTag("act-" + tnum + "-tag-list")
|
482
|
+
var btn = document.createElement("button");
|
483
|
+
btn.setAttribute("type", "button");
|
484
|
+
btn.setAttribute("class", "tag-add");
|
485
|
+
btn.setAttribute("onclick", "addTag(\"act-" + tnum +
|
486
|
+
"-tag-list\")");
|
487
|
+
btn.appendChild(document.createTextNode("+"));
|
488
|
+
row.appendChild(btn);
|
489
|
+
|
490
|
+
inp_tsk.focus();
|
491
|
+
}
|