icfs 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
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
- 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
- }
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
- 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
- }
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
- 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
- }
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
- var scr = document.getElementById("ent-idx-script");
179
- scr = scr.getAttribute("value");
183
+ var scr = document.getElementById("ent-idx-script");
184
+ scr = scr.getAttribute("value");
180
185
 
181
- var cid = document.getElementById("ent-idx-caseid");
182
- cid = cid.getAttribute("value");
186
+ var cid = document.getElementById("ent-idx-caseid");
187
+ cid = cid.getAttribute("value");
183
188
 
184
- var tit = document.getElementById("ent-idx-lu");
185
- tit = encodeURIComponent(tit.value);
186
- var url = scr + "/index_lookup?title=" + tit + "&caseid=" + cid;
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
- ht.open("GET", url, true);
189
- ht.send();
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
- var lst = document.getElementById("ent-idx-list");
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
- var div = document.createElement("div");
201
- lst.appendChild(div);
206
+ var lst = document.getElementById("ent-idx-list");
202
207
 
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
+ var div = document.createElement("div");
209
+ lst.appendChild(div);
208
210
 
209
- div.appendChild(document.createTextNode(title));
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
- var btn = btnDelDiv("form-del", "X");
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
- 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");
232
+ var sel = document.getElementById("ent-stat-sel");
233
+ var stat = sel.value;
284
234
 
285
- var ccnt = cnt.getAttribute("value");
286
- ccnt = parseInt(ccnt, 10) + 1;
287
- cnt.setAttribute("value", ccnt);
235
+ var slist = document.getElementById("ent-stats-list");
288
236
 
289
- var div = document.createElement("div");
290
- clst.appendChild(div);
237
+ var row = document.createElement("div");
238
+ row.setAttribute("class", "list-row");
239
+ slist.appendChild(row);
291
240
 
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
- }
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
- 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);
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
- var sel = document.getElementById("ent-perm-sel");
309
- var perm = sel.value;
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
- var div = document.createElement("div");
266
+ clst = document.createElement("div");
267
+ clst.setAttribute("class", "list-vert");
268
+ row.appendChild(clst);
269
+ row.appendChild(document.createTextNode(" "));
312
270
 
313
- var txt = document.createTextNode(perm);
314
- div.appendChild(txt);
271
+ div = document.createElement("div");
272
+ clst.appendChild(div);
315
273
 
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);
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
- var lst = document.getElementById("ent-perm-list");
327
- lst.appendChild(div);
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
- 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;
322
+ var sel = document.getElementById("ent-perm-sel");
323
+ var perm = sel.value;
336
324
 
337
- var div = document.createElement("div");
325
+ var div = document.createElement("div");
338
326
 
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);
327
+ var txt = document.createTextNode(perm);
328
+ div.appendChild(txt);
344
329
 
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);
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
- inp = btnDelDiv("form-del", "X");
352
- div.appendChild(inp);
336
+ var btn = btnDelDiv("form-del", "X");
337
+ document.createElement("button");
338
+ div.appendChild(btn);
353
339
 
354
- var lst = document.getElementById("ent-file-list");
355
- lst.appendChild(div);
340
+ var lst = document.getElementById("ent-perm-list");
341
+ lst.appendChild(div);
342
+ }
356
343
 
357
- fcnt.setAttribute("value", file_cnt);
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
- 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
- }
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
- 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
+ // 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
- 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
- }
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
+ }