icfs 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/icfs_demo_fcgi.rb +2 -0
- data/{bin/icfs_demo_ssl_gen.rb → devel/demo/ssl_gen.rb} +25 -13
- data/devel/demo/ssl_gen.yml +14 -0
- data/devel/icfs-wrk/Dockerfile +1 -1
- data/devel/run/base.rb +92 -0
- data/devel/run/copy-s3.rb +2 -0
- data/devel/run/email.rb +36 -0
- data/devel/run/email_imap.rb +43 -0
- data/devel/run/email_smime.rb +47 -0
- data/devel/run/init-icfs.rb +2 -0
- data/devel/run/webrick.rb +5 -57
- data/lib/icfs/api.rb +101 -90
- data/lib/icfs/cache.rb +2 -0
- data/lib/icfs/cache_elastic.rb +127 -125
- data/lib/icfs/{web/config.rb → config.rb} +3 -3
- data/lib/icfs/{web/config_redis.rb → config_redis.rb} +8 -8
- data/lib/icfs/{web/config_s3.rb → config_s3.rb} +8 -8
- data/lib/icfs/demo/auth.rb +5 -7
- data/lib/icfs/demo/static.rb +2 -0
- data/lib/icfs/elastic.rb +10 -8
- data/lib/icfs/email/basic.rb +242 -0
- data/lib/icfs/email/core.rb +293 -0
- data/lib/icfs/email/from.rb +52 -0
- data/lib/icfs/email/imap.rb +148 -0
- data/lib/icfs/email/smime.rb +139 -0
- data/lib/icfs/items.rb +5 -3
- data/lib/icfs/store.rb +20 -18
- data/lib/icfs/store_fs.rb +7 -5
- data/lib/icfs/store_s3.rb +4 -2
- data/lib/icfs/users.rb +5 -3
- data/lib/icfs/users_fs.rb +8 -6
- data/lib/icfs/users_redis.rb +12 -10
- data/lib/icfs/users_s3.rb +6 -4
- data/lib/icfs/utils/backup.rb +30 -29
- data/lib/icfs/utils/check.rb +36 -34
- data/lib/icfs/validate.rb +24 -15
- data/lib/icfs/web/auth_ssl.rb +7 -9
- data/lib/icfs/web/client.rb +671 -679
- data/lib/icfs.rb +174 -10
- metadata +16 -7
- data/devel/devel-webrick.yml +0 -49
data/lib/icfs/web/client.rb
CHANGED
@@ -9,6 +9,8 @@
|
|
9
9
|
# This program is distributed WITHOUT ANY WARRANTY; without even the
|
10
10
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
11
11
|
|
12
|
+
# frozen_string_literal: true
|
13
|
+
|
12
14
|
require 'rack'
|
13
15
|
|
14
16
|
module ICFS
|
@@ -47,7 +49,7 @@ class Client
|
|
47
49
|
if path.empty?
|
48
50
|
cmps = ['']
|
49
51
|
else
|
50
|
-
cmps = path.split('/'
|
52
|
+
cmps = path.split('/', -1)
|
51
53
|
cmps.shift if cmps[0].empty?
|
52
54
|
cmps = [''] if cmps.empty?
|
53
55
|
end
|
@@ -61,8 +63,8 @@ class Client
|
|
61
63
|
# search
|
62
64
|
when 'case_search'
|
63
65
|
return _call_search(env,
|
64
|
-
'Case Search'
|
65
|
-
'Case Search'
|
66
|
+
'Case Search',
|
67
|
+
'Case Search',
|
66
68
|
QueryCase,
|
67
69
|
ListCase,
|
68
70
|
:case_search,
|
@@ -71,8 +73,8 @@ class Client
|
|
71
73
|
|
72
74
|
when 'entry_search'
|
73
75
|
return _call_search(env,
|
74
|
-
'Entry Search'
|
75
|
-
'Entry Search'
|
76
|
+
'Entry Search',
|
77
|
+
'Entry Search',
|
76
78
|
QueryEntry,
|
77
79
|
ListEntry,
|
78
80
|
:entry_search,
|
@@ -81,8 +83,8 @@ class Client
|
|
81
83
|
|
82
84
|
when 'log_search'
|
83
85
|
return _call_search(env,
|
84
|
-
'Log Search'
|
85
|
-
'Log Search'
|
86
|
+
'Log Search',
|
87
|
+
'Log Search',
|
86
88
|
QueryLog,
|
87
89
|
ListLog,
|
88
90
|
:log_search,
|
@@ -91,8 +93,8 @@ class Client
|
|
91
93
|
|
92
94
|
when 'action_search'
|
93
95
|
return _call_search(env,
|
94
|
-
'Action Search'
|
95
|
-
'Action Search'
|
96
|
+
'Action Search',
|
97
|
+
'Action Search',
|
96
98
|
QueryAction,
|
97
99
|
ListAction,
|
98
100
|
:action_search,
|
@@ -101,8 +103,8 @@ class Client
|
|
101
103
|
|
102
104
|
when 'index_search'
|
103
105
|
return _call_search(env,
|
104
|
-
'Index Search'
|
105
|
-
'Index Search'
|
106
|
+
'Index Search',
|
107
|
+
'Index Search',
|
106
108
|
QueryIndex,
|
107
109
|
ListIndex,
|
108
110
|
:index_search,
|
@@ -114,8 +116,8 @@ class Client
|
|
114
116
|
# aggregations
|
115
117
|
when 'stats'
|
116
118
|
return _call_search(env,
|
117
|
-
'Stats Search'
|
118
|
-
'Stats Search'
|
119
|
+
'Stats Search',
|
120
|
+
'Stats Search',
|
119
121
|
QueryStats,
|
120
122
|
ListStats,
|
121
123
|
:stats,
|
@@ -124,8 +126,8 @@ class Client
|
|
124
126
|
|
125
127
|
when 'case_tags'
|
126
128
|
return _call_search(env,
|
127
|
-
'Case Tags'
|
128
|
-
'Case Tags Search'
|
129
|
+
'Case Tags',
|
130
|
+
'Case Tags Search',
|
129
131
|
QueryCaseTags,
|
130
132
|
ListCaseTags,
|
131
133
|
:case_tags,
|
@@ -134,8 +136,8 @@ class Client
|
|
134
136
|
|
135
137
|
when 'entry_tags'
|
136
138
|
return _call_search(env,
|
137
|
-
'Entry Tags'
|
138
|
-
'Entry Tag Search'
|
139
|
+
'Entry Tags',
|
140
|
+
'Entry Tag Search',
|
139
141
|
QueryEntryTags,
|
140
142
|
ListEntryTags,
|
141
143
|
:entry_tags,
|
@@ -144,8 +146,8 @@ class Client
|
|
144
146
|
|
145
147
|
when 'action_tags'
|
146
148
|
return _call_search(env,
|
147
|
-
'Action Tags'
|
148
|
-
'Action Tag Search'
|
149
|
+
'Action Tags',
|
150
|
+
'Action Tag Search',
|
149
151
|
QueryActionTags,
|
150
152
|
ListActionTags,
|
151
153
|
:action_tags,
|
@@ -154,8 +156,8 @@ class Client
|
|
154
156
|
|
155
157
|
when 'index_tags'
|
156
158
|
return _call_search(env,
|
157
|
-
'Index Tags'
|
158
|
-
'Index Tag Search'
|
159
|
+
'Index Tags',
|
160
|
+
'Index Tag Search',
|
159
161
|
QueryIndexTags,
|
160
162
|
ListIndexTags,
|
161
163
|
:index_tags,
|
@@ -183,24 +185,24 @@ class Client
|
|
183
185
|
|
184
186
|
# not supported path
|
185
187
|
else
|
186
|
-
env['icfs.page'] = 'Invalid'
|
187
|
-
raise(Error::NotFound, 'Invalid request'
|
188
|
+
env['icfs.page'] = 'Invalid'
|
189
|
+
raise(Error::NotFound, 'Invalid request')
|
188
190
|
end
|
189
191
|
|
190
192
|
rescue Error::NotFound => e
|
191
|
-
return _resp_notfound( env, 'Not found: %s'
|
193
|
+
return _resp_notfound( env, 'Not found: %s' %
|
192
194
|
Rack::Utils.escape_html(e.message) )
|
193
195
|
|
194
196
|
rescue Error::Perms => e
|
195
|
-
return _resp_forbidden( env, 'Forbidden: %s'
|
197
|
+
return _resp_forbidden( env, 'Forbidden: %s' %
|
196
198
|
Rack::Utils.escape_html(e.message) )
|
197
199
|
|
198
200
|
rescue Error::Conflict => e
|
199
|
-
return _resp_conflict( env, 'Conflict: %s'
|
201
|
+
return _resp_conflict( env, 'Conflict: %s' %
|
200
202
|
Rack::Utils.escape_html(e.message) )
|
201
203
|
|
202
204
|
rescue Error::Value => e
|
203
|
-
return _resp_badreq( env, 'Invalid values: %s'
|
205
|
+
return _resp_badreq( env, 'Invalid values: %s' %
|
204
206
|
Rack::Utils.escape_html(e.message) )
|
205
207
|
|
206
208
|
rescue Error::Interface => e
|
@@ -218,14 +220,14 @@ class Client
|
|
218
220
|
###############################################
|
219
221
|
# Info page
|
220
222
|
def _call_info(env)
|
221
|
-
env['icfs.page'] = 'Info'
|
223
|
+
env['icfs.page'] = 'Info'
|
222
224
|
api = env['icfs']
|
223
225
|
_verb_get(env)
|
224
226
|
body = [
|
225
227
|
_div_nav(env),
|
226
|
-
_div_desc('Info'
|
228
|
+
_div_desc('Info', ''),
|
227
229
|
_div_info(env)
|
228
|
-
].join(''
|
230
|
+
].join('')
|
229
231
|
return _resp_success(env, body)
|
230
232
|
end # def _call_info()
|
231
233
|
|
@@ -238,13 +240,13 @@ class Client
|
|
238
240
|
env['icfs.page'] = page
|
239
241
|
api = env['icfs']
|
240
242
|
_verb_get(env)
|
241
|
-
act = '%s/%s'
|
243
|
+
act = '%s/%s' % [env['SCRIPT_NAME'], env['icfs.cmps'][0]]
|
242
244
|
|
243
245
|
# form
|
244
246
|
if env['QUERY_STRING'].empty?
|
245
247
|
body = [
|
246
248
|
_div_nav(env),
|
247
|
-
_div_desc(type, ''
|
249
|
+
_div_desc(type, ''),
|
248
250
|
_form_query(env, query_get, {}, act, true)
|
249
251
|
]
|
250
252
|
|
@@ -266,7 +268,7 @@ class Client
|
|
266
268
|
end
|
267
269
|
end
|
268
270
|
|
269
|
-
return _resp_success(env, body.join(''
|
271
|
+
return _resp_success(env, body.join(''))
|
270
272
|
end # def _call_search()
|
271
273
|
|
272
274
|
|
@@ -274,15 +276,15 @@ class Client
|
|
274
276
|
|
275
277
|
# Case query options
|
276
278
|
QueryCase = [
|
277
|
-
['title'
|
278
|
-
['tags'
|
279
|
-
['status'
|
280
|
-
['template'
|
281
|
-
['grantee'
|
282
|
-
['perm'
|
283
|
-
['size'
|
284
|
-
['page'
|
285
|
-
['purpose'
|
279
|
+
['title', :title, :string].freeze,
|
280
|
+
['tags', :tags, :string].freeze,
|
281
|
+
['status', :status, :boolean].freeze,
|
282
|
+
['template', :template, :boolean].freeze,
|
283
|
+
['grantee', :grantee, :string].freeze,
|
284
|
+
['perm', :perm, :string].freeze,
|
285
|
+
['size', :size, :integer].freeze,
|
286
|
+
['page', :page, :integer].freeze,
|
287
|
+
['purpose', :purpose, :string].freeze,
|
286
288
|
].freeze
|
287
289
|
|
288
290
|
|
@@ -297,19 +299,19 @@ class Client
|
|
297
299
|
|
298
300
|
# Entry query options
|
299
301
|
QueryEntry = [
|
300
|
-
['title'
|
301
|
-
['content'
|
302
|
-
['tags'
|
303
|
-
['caseid'
|
304
|
-
['action'
|
305
|
-
['after'
|
306
|
-
['before'
|
307
|
-
['stat'
|
308
|
-
['credit'
|
309
|
-
['size'
|
310
|
-
['page'
|
311
|
-
['sort'
|
312
|
-
['purpose'
|
302
|
+
['title', :title, :string].freeze,
|
303
|
+
['content', :content, :string].freeze,
|
304
|
+
['tags', :tags, :string].freeze,
|
305
|
+
['caseid', :caseid, :string].freeze,
|
306
|
+
['action', :action, :integer].freeze,
|
307
|
+
['after', :after, :time].freeze,
|
308
|
+
['before', :before, :time].freeze,
|
309
|
+
['stat', :stat, :string].freeze,
|
310
|
+
['credit', :credit, :string].freeze,
|
311
|
+
['size', :size, :integer].freeze,
|
312
|
+
['page', :page, :integer].freeze,
|
313
|
+
['sort', :sort, :string].freeze,
|
314
|
+
['purpose', :purpose, :string].freeze,
|
313
315
|
].freeze
|
314
316
|
|
315
317
|
|
@@ -330,17 +332,17 @@ class Client
|
|
330
332
|
|
331
333
|
# Log query options
|
332
334
|
QueryLog = [
|
333
|
-
['caseid'
|
334
|
-
['after'
|
335
|
-
['before'
|
336
|
-
['user'
|
337
|
-
['entry'
|
338
|
-
['index'
|
339
|
-
['action'
|
340
|
-
['size'
|
341
|
-
['page'
|
342
|
-
['sort'
|
343
|
-
['purpose'
|
335
|
+
['caseid', :caseid, :string].freeze,
|
336
|
+
['after', :after, :time].freeze,
|
337
|
+
['before', :before, :time].freeze,
|
338
|
+
['user', :user, :string].freeze,
|
339
|
+
['entry', :entry, :integer].freeze,
|
340
|
+
['index', :index, :integer].freeze,
|
341
|
+
['action', :action, :integer].freeze,
|
342
|
+
['size', :size, :integer].freeze,
|
343
|
+
['page', :page, :integer].freeze,
|
344
|
+
['sort', :sort, :string].freeze,
|
345
|
+
['purpose', :purpose, :string].freeze,
|
344
346
|
].freeze
|
345
347
|
|
346
348
|
|
@@ -358,18 +360,18 @@ class Client
|
|
358
360
|
|
359
361
|
# Task query options
|
360
362
|
QueryAction = [
|
361
|
-
['assigned'
|
362
|
-
['caseid'
|
363
|
-
['title'
|
364
|
-
['status'
|
365
|
-
['flag'
|
366
|
-
['before'
|
367
|
-
['after'
|
368
|
-
['tags'
|
369
|
-
['purpose'
|
370
|
-
['size'
|
371
|
-
['page'
|
372
|
-
['sort'
|
363
|
+
['assigned', :assigned, :string].freeze,
|
364
|
+
['caseid', :caseid, :string].freeze,
|
365
|
+
['title', :title, :string].freeze,
|
366
|
+
['status', :status, :boolean].freeze,
|
367
|
+
['flag', :flag, :boolean].freeze,
|
368
|
+
['before', :before, :time].freeze,
|
369
|
+
['after', :after, :time].freeze,
|
370
|
+
['tags', :tags, :string].freeze,
|
371
|
+
['purpose', :purpose, :string].freeze,
|
372
|
+
['size', :size, :integer].freeze,
|
373
|
+
['page', :page, :integer].freeze,
|
374
|
+
['sort', :sort, :string].freeze,
|
373
375
|
].freeze
|
374
376
|
|
375
377
|
|
@@ -388,13 +390,13 @@ class Client
|
|
388
390
|
# Do an index lookup
|
389
391
|
#
|
390
392
|
def _call_index_lookup(env)
|
391
|
-
env['icfs.page'] = 'Index Lookup'
|
393
|
+
env['icfs.page'] = 'Index Lookup'
|
392
394
|
api = env['icfs']
|
393
395
|
_verb_get(env)
|
394
396
|
|
395
397
|
# query required
|
396
398
|
if env['QUERY_STRING'].empty?
|
397
|
-
raise(Error::Interface, 'Query string required'
|
399
|
+
raise(Error::Interface, 'Query string required')
|
398
400
|
end
|
399
401
|
|
400
402
|
# do the query
|
@@ -415,7 +417,7 @@ class Client
|
|
415
417
|
end
|
416
418
|
body = JSON.generate(body)
|
417
419
|
head = {
|
418
|
-
'Content-Type' => 'application/json'
|
420
|
+
'Content-Type' => 'application/json',
|
419
421
|
'Content-Length' => body.bytesize.to_s
|
420
422
|
}
|
421
423
|
return [200, head, [body]]
|
@@ -424,15 +426,15 @@ class Client
|
|
424
426
|
|
425
427
|
# Index query options
|
426
428
|
QueryIndex = [
|
427
|
-
['caseid'
|
428
|
-
['title'
|
429
|
-
['prefix'
|
430
|
-
['content'
|
431
|
-
['tags'
|
432
|
-
['purpose'
|
433
|
-
['size'
|
434
|
-
['page'
|
435
|
-
['sort'
|
429
|
+
['caseid', :caseid, :string].freeze,
|
430
|
+
['title', :title, :string].freeze,
|
431
|
+
['prefix', :prefix, :string].freeze,
|
432
|
+
['content', :content, :string].freeze,
|
433
|
+
['tags', :tags, :string].freeze,
|
434
|
+
['purpose', :purpose, :string].freeze,
|
435
|
+
['size', :size, :integer].freeze,
|
436
|
+
['page', :page, :integer].freeze,
|
437
|
+
['sort', :sort, :string].freeze,
|
436
438
|
].freeze
|
437
439
|
|
438
440
|
|
@@ -447,11 +449,11 @@ class Client
|
|
447
449
|
|
448
450
|
# Stats query options
|
449
451
|
QueryStats = [
|
450
|
-
['credit'
|
451
|
-
['caseid'
|
452
|
-
['before'
|
453
|
-
['after'
|
454
|
-
['purpose'
|
452
|
+
['credit', :credit, :string].freeze,
|
453
|
+
['caseid', :caseid, :string].freeze,
|
454
|
+
['before', :before, :time].freeze,
|
455
|
+
['after', :after, :time].freeze,
|
456
|
+
['purpose', :purpose, :string].freeze,
|
455
457
|
].freeze
|
456
458
|
|
457
459
|
# Stats list options
|
@@ -464,10 +466,10 @@ class Client
|
|
464
466
|
|
465
467
|
# Query for case tags
|
466
468
|
QueryCaseTags = [
|
467
|
-
['status'
|
468
|
-
['template'
|
469
|
-
['grantee'
|
470
|
-
['purpose'
|
469
|
+
['status', :status, :boolean].freeze,
|
470
|
+
['template', :template, :boolean].freeze,
|
471
|
+
['grantee', :grantee, :string].freeze,
|
472
|
+
['purpose', :purpose, :string].freeze,
|
471
473
|
].freeze
|
472
474
|
|
473
475
|
|
@@ -480,8 +482,8 @@ class Client
|
|
480
482
|
|
481
483
|
# Entry tags query options
|
482
484
|
QueryEntryTags = [
|
483
|
-
['caseid'
|
484
|
-
['purpose'
|
485
|
+
['caseid', :caseid, :string].freeze,
|
486
|
+
['purpose', :purpose, :string].freeze,
|
485
487
|
].freeze
|
486
488
|
|
487
489
|
|
@@ -494,13 +496,13 @@ class Client
|
|
494
496
|
|
495
497
|
# Action Tag query
|
496
498
|
QueryActionTags = [
|
497
|
-
['caseid'
|
498
|
-
['assigned'
|
499
|
-
['status'
|
500
|
-
['flag'
|
501
|
-
['before'
|
502
|
-
['after'
|
503
|
-
['purpose'
|
499
|
+
['caseid', :caseid, :string].freeze,
|
500
|
+
['assigned', :assigned, :string].freeze,
|
501
|
+
['status', :status, :boolean].freeze,
|
502
|
+
['flag', :flag, :boolean].freeze,
|
503
|
+
['before', :before, :time].freeze,
|
504
|
+
['after', :after, :time].freeze,
|
505
|
+
['purpose', :purpose, :string].freeze,
|
504
506
|
].freeze
|
505
507
|
|
506
508
|
|
@@ -513,8 +515,8 @@ class Client
|
|
513
515
|
|
514
516
|
# Index tags query
|
515
517
|
QueryIndexTags = [
|
516
|
-
['caseid'
|
517
|
-
['purpose'
|
518
|
+
['caseid', :caseid, :string].freeze,
|
519
|
+
['purpose', :purpose, :string].freeze,
|
518
520
|
].freeze
|
519
521
|
|
520
522
|
|
@@ -529,15 +531,15 @@ class Client
|
|
529
531
|
# Create a new case
|
530
532
|
#
|
531
533
|
def _call_case_create(env)
|
532
|
-
env['icfs.page'] = 'Case Create'
|
534
|
+
env['icfs.page'] = 'Case Create'
|
533
535
|
api = env['icfs']
|
534
536
|
tid = _util_case(env)
|
535
537
|
_verb_getpost(env)
|
536
538
|
|
537
539
|
# get the form
|
538
|
-
if env['REQUEST_METHOD'] == 'GET'
|
540
|
+
if env['REQUEST_METHOD'] == 'GET'
|
539
541
|
tpl = api.case_read(tid)
|
540
|
-
tpl['title'] = ''
|
542
|
+
tpl['title'] = ''
|
541
543
|
parts = [
|
542
544
|
_form_entry(env, tid, nil),
|
543
545
|
_form_create(env),
|
@@ -546,25 +548,25 @@ class Client
|
|
546
548
|
body = [
|
547
549
|
_div_nav(env),
|
548
550
|
_div_desc(
|
549
|
-
'Create New Case'
|
550
|
-
'<i>template:</i> %s'
|
551
|
+
'Create New Case',
|
552
|
+
'<i>template:</i> %s' % Rack::Utils.escape_html(tid),
|
551
553
|
),
|
552
|
-
_div_form(env, '/case_create/'
|
553
|
-
].join(''
|
554
|
+
_div_form(env, '/case_create/', tid, parts, 'Create Case')
|
555
|
+
].join('')
|
554
556
|
return _resp_success(env, body)
|
555
557
|
|
556
558
|
# post the form
|
557
|
-
elsif env['REQUEST_METHOD'] == 'POST'
|
559
|
+
elsif env['REQUEST_METHOD'] == 'POST'
|
558
560
|
para = _util_post(env)
|
559
561
|
|
560
562
|
# process
|
561
563
|
cse = _post_case(env, para)
|
562
564
|
cid = para['create_cid']
|
563
|
-
cse['template'] = (para['create_tmpl'] == 'true'
|
565
|
+
cse['template'] = (para['create_tmpl'] == 'true') ? true : false
|
564
566
|
|
565
567
|
# process entry
|
566
568
|
ent = _post_entry(env, para)
|
567
|
-
Items.validate(tid, 'Template ID'
|
569
|
+
Items.validate(tid, 'Template ID', Items::FieldCaseid)
|
568
570
|
ent['caseid'] = cid
|
569
571
|
|
570
572
|
# create
|
@@ -582,13 +584,13 @@ class Client
|
|
582
584
|
# Edit a case
|
583
585
|
#
|
584
586
|
def _call_case_edit(env)
|
585
|
-
env['icfs.page'] = 'Case Edit'
|
587
|
+
env['icfs.page'] = 'Case Edit'
|
586
588
|
cid = _util_case(env)
|
587
589
|
api = env['icfs']
|
588
590
|
_verb_getpost(env)
|
589
591
|
|
590
592
|
# get the form
|
591
|
-
if env['REQUEST_METHOD'] == 'GET'
|
593
|
+
if env['REQUEST_METHOD'] == 'GET'
|
592
594
|
cse = api.case_read(cid)
|
593
595
|
parts = [
|
594
596
|
_form_entry(env, cid, nil),
|
@@ -596,13 +598,13 @@ class Client
|
|
596
598
|
]
|
597
599
|
body = [
|
598
600
|
_div_nav(env),
|
599
|
-
_div_desc('Edit Case'
|
600
|
-
_div_form(env, '/case_edit/'
|
601
|
-
].join(''
|
601
|
+
_div_desc('Edit Case', ''),
|
602
|
+
_div_form(env, '/case_edit/', cid, parts, 'Record Case'),
|
603
|
+
].join('')
|
602
604
|
return _resp_success(env, body)
|
603
605
|
|
604
606
|
# post the form
|
605
|
-
elsif env['REQUEST_METHOD'] == 'POST'
|
607
|
+
elsif env['REQUEST_METHOD'] == 'POST'
|
606
608
|
para = _util_post(env)
|
607
609
|
|
608
610
|
# process
|
@@ -629,32 +631,32 @@ class Client
|
|
629
631
|
# Edit an entry
|
630
632
|
#
|
631
633
|
def _call_entry_edit(env)
|
632
|
-
env['icfs.page'] = 'Entry Edit'
|
634
|
+
env['icfs.page'] = 'Entry Edit'
|
633
635
|
api = env['icfs']
|
634
636
|
_verb_getpost(env)
|
635
637
|
|
636
638
|
cid = _util_case(env)
|
637
639
|
|
638
640
|
# get the form
|
639
|
-
if env['REQUEST_METHOD'] == 'GET'
|
641
|
+
if env['REQUEST_METHOD'] == 'GET'
|
640
642
|
enum = _util_num(env, 2)
|
641
643
|
anum = _util_num(env, 3)
|
642
644
|
|
643
645
|
# entry or action specified
|
644
646
|
if enum != 0
|
645
|
-
desc = 'Edit Entry'
|
647
|
+
desc = 'Edit Entry'
|
646
648
|
ent = api.entry_read(cid, enum)
|
647
649
|
elsif anum != 0
|
648
|
-
desc = 'New Entry in Action'
|
650
|
+
desc = 'New Entry in Action'
|
649
651
|
act = api.action_read(cid, anum)
|
650
652
|
else
|
651
|
-
desc = 'New Entry'
|
653
|
+
desc = 'New Entry'
|
652
654
|
end
|
653
655
|
|
654
656
|
# see if editing is possible
|
655
657
|
unless( api.access_list(cid).include?(ICFS::PermWrite) || (
|
656
658
|
(anum != 0) && api.tasked?(cid, anum)))
|
657
|
-
raise(Error::Perms, 'Not able to edit this entry.'
|
659
|
+
raise(Error::Perms, 'Not able to edit this entry.')
|
658
660
|
end
|
659
661
|
|
660
662
|
# build form
|
@@ -665,14 +667,14 @@ class Client
|
|
665
667
|
end
|
666
668
|
body = [
|
667
669
|
_div_nav(env),
|
668
|
-
_div_desc(desc, ''
|
669
|
-
_div_form(env, '/entry_edit/'
|
670
|
-
'Record Entry'
|
671
|
-
].join(''
|
670
|
+
_div_desc(desc, ''),
|
671
|
+
_div_form(env, '/entry_edit/', cid, parts,
|
672
|
+
'Record Entry'),
|
673
|
+
].join('')
|
672
674
|
return _resp_success(env, body)
|
673
675
|
|
674
676
|
# post the form
|
675
|
-
elsif env['REQUEST_METHOD'] == 'POST'
|
677
|
+
elsif env['REQUEST_METHOD'] == 'POST'
|
676
678
|
para = _util_post(env)
|
677
679
|
|
678
680
|
# process
|
@@ -691,7 +693,7 @@ class Client
|
|
691
693
|
_div_entry(env, ent)
|
692
694
|
]
|
693
695
|
body << _div_action(env, act) if act
|
694
|
-
return _resp_success(env, body.join(''
|
696
|
+
return _resp_success(env, body.join(''))
|
695
697
|
end
|
696
698
|
end # def _call_entry_edit()
|
697
699
|
|
@@ -700,18 +702,18 @@ class Client
|
|
700
702
|
# Edit an Index
|
701
703
|
#
|
702
704
|
def _call_index_edit(env)
|
703
|
-
env['icfs.page'] = 'Index Edit'
|
705
|
+
env['icfs.page'] = 'Index Edit'
|
704
706
|
api = env['icfs']
|
705
707
|
_verb_getpost(env)
|
706
708
|
|
707
709
|
cid = _util_case(env)
|
708
710
|
|
709
711
|
# get the form
|
710
|
-
if env['REQUEST_METHOD'] == 'GET'
|
712
|
+
if env['REQUEST_METHOD'] == 'GET'
|
711
713
|
|
712
714
|
# see if editing is possible
|
713
715
|
unless api.access_list(cid).include?(ICFS::PermWrite)
|
714
|
-
raise(Error::Perms, 'Not able to edit this index.'
|
716
|
+
raise(Error::Perms, 'Not able to edit this index.')
|
715
717
|
end
|
716
718
|
|
717
719
|
xnum = _util_num(env, 2)
|
@@ -720,17 +722,17 @@ class Client
|
|
720
722
|
_form_entry(env, cid, nil),
|
721
723
|
_form_index(env, cid, idx),
|
722
724
|
]
|
723
|
-
desc = idx ? 'Edit Index'
|
725
|
+
desc = idx ? 'Edit Index' : 'New Index'
|
724
726
|
body = [
|
725
727
|
_div_nav(env),
|
726
|
-
_div_desc(desc, ''
|
727
|
-
_div_form(env, '/index_edit/'
|
728
|
-
'Record Index'
|
729
|
-
].join(''
|
728
|
+
_div_desc(desc, ''),
|
729
|
+
_div_form(env, '/index_edit/', cid, parts,
|
730
|
+
'Record Index'),
|
731
|
+
].join('')
|
730
732
|
return _resp_success(env, body)
|
731
733
|
|
732
734
|
# post the form
|
733
|
-
elsif env['REQUEST_METHOD'] == 'POST'
|
735
|
+
elsif env['REQUEST_METHOD'] == 'POST'
|
734
736
|
para = _util_post(env)
|
735
737
|
|
736
738
|
# process
|
@@ -749,7 +751,7 @@ class Client
|
|
749
751
|
_div_nav(env),
|
750
752
|
_div_entry(env, ent),
|
751
753
|
_div_index(env, idx)
|
752
|
-
].join(''
|
754
|
+
].join('')
|
753
755
|
return _resp_success(env, body)
|
754
756
|
end
|
755
757
|
end # def _call_index_edit()
|
@@ -759,24 +761,24 @@ class Client
|
|
759
761
|
# Edit configuration
|
760
762
|
#
|
761
763
|
def _call_config_edit(env)
|
762
|
-
env['icfs.page'] = 'Config Edit'
|
764
|
+
env['icfs.page'] = 'Config Edit'
|
763
765
|
api = env['icfs']
|
764
|
-
cfg =
|
766
|
+
cfg = api.config
|
765
767
|
_verb_getpost(env)
|
766
768
|
|
767
769
|
# get the form
|
768
|
-
if env['REQUEST_METHOD'] == 'GET'
|
770
|
+
if env['REQUEST_METHOD'] == 'GET'
|
769
771
|
parts = [ _form_config(env) ]
|
770
772
|
body = [
|
771
773
|
_div_nav(env),
|
772
|
-
_div_desc('Edit Configuration'
|
773
|
-
_div_form(env, '/config_edit/'
|
774
|
-
'Save Config'
|
775
|
-
].join(''
|
774
|
+
_div_desc('Edit Configuration', ''),
|
775
|
+
_div_form(env, '/config_edit/', nil, parts,
|
776
|
+
'Save Config'),
|
777
|
+
].join('')
|
776
778
|
return _resp_success(env, body)
|
777
779
|
|
778
780
|
# post the form
|
779
|
-
elsif env['REQUEST_METHOD'] == 'POST'
|
781
|
+
elsif env['REQUEST_METHOD'] == 'POST'
|
780
782
|
para = _util_post(env)
|
781
783
|
_post_config(env, para).each{|key, val| cfg.set(key,val) }
|
782
784
|
cfg.save
|
@@ -785,9 +787,9 @@ class Client
|
|
785
787
|
# display the index
|
786
788
|
body = [
|
787
789
|
_div_nav(env),
|
788
|
-
_div_desc('Edit Configuration'
|
790
|
+
_div_desc('Edit Configuration', 'Settings saved'),
|
789
791
|
_div_info(env),
|
790
|
-
].join(''
|
792
|
+
].join('')
|
791
793
|
return _resp_success(env, body)
|
792
794
|
end
|
793
795
|
end # def _call_config_edit()
|
@@ -796,13 +798,13 @@ class Client
|
|
796
798
|
###############################################
|
797
799
|
# User Home page
|
798
800
|
def _call_home(env)
|
799
|
-
env['icfs.page'] = 'Home'
|
801
|
+
env['icfs.page'] = 'Home'
|
800
802
|
_verb_get(env)
|
801
803
|
body = [
|
802
804
|
_div_nav(env),
|
803
|
-
_div_desc('User Home'
|
805
|
+
_div_desc('User Home', ''),
|
804
806
|
_div_home(env),
|
805
|
-
].join(''
|
807
|
+
].join('')
|
806
808
|
return _resp_success(env, body)
|
807
809
|
end # def _call_home()
|
808
810
|
|
@@ -811,22 +813,22 @@ class Client
|
|
811
813
|
# Display a Case
|
812
814
|
#
|
813
815
|
def _call_case(env)
|
814
|
-
env['icfs.page'] = 'Case View'
|
816
|
+
env['icfs.page'] = 'Case View'
|
815
817
|
api = env['icfs']
|
816
818
|
_verb_get(env)
|
817
819
|
cid = _util_case(env)
|
818
820
|
lnum = _util_num(env, 2)
|
819
821
|
cse = api.case_read(cid, lnum)
|
820
822
|
if lnum != 0
|
821
|
-
msg = 'This is a historical version of this Case'
|
823
|
+
msg = 'This is a historical version of this Case'
|
822
824
|
else
|
823
|
-
msg = ''
|
825
|
+
msg = ''
|
824
826
|
end
|
825
827
|
body = [
|
826
828
|
_div_nav(env),
|
827
|
-
_div_desc('Case Information'
|
829
|
+
_div_desc('Case Information', msg),
|
828
830
|
_div_case(env, cse),
|
829
|
-
].join(''
|
831
|
+
].join('')
|
830
832
|
return _resp_success(env, body)
|
831
833
|
end # def _call_case()
|
832
834
|
|
@@ -835,24 +837,24 @@ class Client
|
|
835
837
|
# Display an Entry
|
836
838
|
#
|
837
839
|
def _call_entry(env)
|
838
|
-
env['icfs.page'] = 'Entry View'
|
840
|
+
env['icfs.page'] = 'Entry View'
|
839
841
|
api = env['icfs']
|
840
842
|
_verb_get(env)
|
841
843
|
cid = _util_case(env)
|
842
844
|
enum = _util_num(env, 2)
|
843
845
|
lnum = _util_num(env, 3)
|
844
|
-
raise(Error::Interface, 'No Entry requested'
|
846
|
+
raise(Error::Interface, 'No Entry requested') if enum == 0
|
845
847
|
ent = api.entry_read(cid, enum, lnum)
|
846
848
|
if lnum != 0
|
847
|
-
msg = 'This is a historical version of this Entry'
|
849
|
+
msg = 'This is a historical version of this Entry'
|
848
850
|
else
|
849
|
-
msg = ''
|
851
|
+
msg = ''
|
850
852
|
end
|
851
853
|
body = [
|
852
854
|
_div_nav(env),
|
853
|
-
_div_desc('View Entry'
|
855
|
+
_div_desc('View Entry', msg),
|
854
856
|
_div_entry(env, ent),
|
855
|
-
].join(''
|
857
|
+
].join('')
|
856
858
|
return _resp_success(env, body)
|
857
859
|
end # def _call_entry()
|
858
860
|
|
@@ -861,18 +863,18 @@ class Client
|
|
861
863
|
# Display a Log
|
862
864
|
#
|
863
865
|
def _call_log(env)
|
864
|
-
env['icfs.page'] = 'Log View'
|
866
|
+
env['icfs.page'] = 'Log View'
|
865
867
|
api = env['icfs']
|
866
868
|
_verb_get(env)
|
867
869
|
cid = _util_case(env)
|
868
870
|
lnum = _util_num(env, 2)
|
869
|
-
raise(Error::Interface, 'No log requested'
|
871
|
+
raise(Error::Interface, 'No log requested') if lnum == 0
|
870
872
|
log = api.log_read(cid, lnum)
|
871
873
|
body = [
|
872
874
|
_div_nav(env),
|
873
|
-
_div_desc('View Log'
|
875
|
+
_div_desc('View Log', ''),
|
874
876
|
_div_log(env, log)
|
875
|
-
].join(''
|
877
|
+
].join('')
|
876
878
|
return _resp_success(env, body)
|
877
879
|
end # def _call_log()
|
878
880
|
|
@@ -881,38 +883,38 @@ class Client
|
|
881
883
|
# Display an Action
|
882
884
|
#
|
883
885
|
def _call_action(env)
|
884
|
-
env['icfs.page'] = 'Action View'
|
886
|
+
env['icfs.page'] = 'Action View'
|
885
887
|
api = env['icfs']
|
886
888
|
_verb_get(env)
|
887
889
|
cid = _util_case(env)
|
888
890
|
anum = _util_num(env, 2)
|
889
891
|
lnum = _util_num(env, 3)
|
890
|
-
raise(Error::Interface, 'No Action requested'
|
892
|
+
raise(Error::Interface, 'No Action requested') if anum == 0
|
891
893
|
|
892
894
|
# get the action
|
893
895
|
act = api.action_read(cid, anum, lnum)
|
894
896
|
if lnum != 0
|
895
|
-
msg = 'This is a historical version of this Action'
|
897
|
+
msg = 'This is a historical version of this Action'
|
896
898
|
else
|
897
|
-
msg = ''
|
899
|
+
msg = ''
|
898
900
|
end
|
899
901
|
|
900
902
|
# get the entries
|
901
903
|
query = {
|
902
904
|
caseid: cid,
|
903
905
|
action: anum,
|
904
|
-
purpose: 'Action Entries'
|
906
|
+
purpose: 'Action Entries',
|
905
907
|
}
|
906
908
|
resp = api.entry_search(query)
|
907
909
|
|
908
910
|
# display
|
909
911
|
body = [
|
910
912
|
_div_nav(env),
|
911
|
-
_div_desc('View Action'
|
913
|
+
_div_desc('View Action', msg),
|
912
914
|
_div_action(env, act),
|
913
915
|
_div_list(env, resp, ListEntry),
|
914
916
|
_div_page(resp){|qu, txt| _a_entry_search(env, qu, txt)},
|
915
|
-
].join(''
|
917
|
+
].join('')
|
916
918
|
return _resp_success(env, body)
|
917
919
|
end # def _call_action()
|
918
920
|
|
@@ -921,20 +923,20 @@ class Client
|
|
921
923
|
# Display an Index
|
922
924
|
#
|
923
925
|
def _call_index(env)
|
924
|
-
env['icfs.page'] = 'Index View'
|
926
|
+
env['icfs.page'] = 'Index View'
|
925
927
|
api = env['icfs']
|
926
928
|
_verb_get(env)
|
927
929
|
cid = _util_case(env)
|
928
930
|
xnum = _util_num(env, 2)
|
929
931
|
lnum = _util_num(env, 3)
|
930
|
-
raise(Error::Interface, 'No Index requested'
|
932
|
+
raise(Error::Interface, 'No Index requested') if xnum == 0
|
931
933
|
|
932
934
|
# get the index
|
933
935
|
idx = api.index_read(cid, xnum, lnum)
|
934
936
|
if lnum != 0
|
935
|
-
msg = 'This is a historical version of this Index'
|
937
|
+
msg = 'This is a historical version of this Index'
|
936
938
|
else
|
937
|
-
msg = ''
|
939
|
+
msg = ''
|
938
940
|
end
|
939
941
|
|
940
942
|
# get the entries
|
@@ -947,11 +949,11 @@ class Client
|
|
947
949
|
# display
|
948
950
|
body = [
|
949
951
|
_div_nav(env) +
|
950
|
-
_div_desc('View Index'
|
952
|
+
_div_desc('View Index', msg),
|
951
953
|
_div_index(env, idx),
|
952
954
|
_div_list(env, resp, ListEntry),
|
953
955
|
_div_page(resp){|qu, txt| _a_entry_search(env, qu, txt)},
|
954
|
-
].join(''
|
956
|
+
].join('')
|
955
957
|
return _resp_success(env, body)
|
956
958
|
end # def _call_index()
|
957
959
|
|
@@ -959,7 +961,7 @@ class Client
|
|
959
961
|
###############################################
|
960
962
|
# Get a file
|
961
963
|
def _call_file(env)
|
962
|
-
env['icfs.page'] = 'File Download'
|
964
|
+
env['icfs.page'] = 'File Download'
|
963
965
|
api = env['icfs']
|
964
966
|
_verb_get(env)
|
965
967
|
cid = _util_case(env)
|
@@ -967,21 +969,21 @@ class Client
|
|
967
969
|
# get filename
|
968
970
|
cmps = env['icfs.cmps']
|
969
971
|
if cmps.size < 3 || cmps[2].empty?
|
970
|
-
raise(Error::Interface, 'No file specified in the URL'
|
972
|
+
raise(Error::Interface, 'No file specified in the URL')
|
971
973
|
end
|
972
974
|
fnam = Rack::Utils.unescape(cmps[2])
|
973
975
|
ma = /^(\d+)-(\d+)-(\d+)-(.+)$/.match fnam
|
974
976
|
if !ma
|
975
|
-
raise(Error::Interface, 'File not properly specified in URL'
|
977
|
+
raise(Error::Interface, 'File not properly specified in URL')
|
976
978
|
end
|
977
979
|
enum = ma[1].to_i
|
978
980
|
lnum = ma[2].to_i
|
979
981
|
fnum = ma[3].to_i
|
980
|
-
ext = ma[4].rpartition('.'
|
982
|
+
ext = ma[4].rpartition('.')[2]
|
981
983
|
|
982
984
|
# get MIME-type by extension
|
983
985
|
if ext.empty?
|
984
|
-
mime = 'application/octet-stream'
|
986
|
+
mime = 'application/octet-stream'
|
985
987
|
else
|
986
988
|
mime = Rack::Mime.mime_type('.' + ext)
|
987
989
|
end
|
@@ -992,7 +994,7 @@ class Client
|
|
992
994
|
headers = {
|
993
995
|
'Content-Length' => file.size.to_s,
|
994
996
|
'Content-Type' => mime,
|
995
|
-
'Content-Disposition' => 'attachment'
|
997
|
+
'Content-Disposition' => 'attachment',
|
996
998
|
}
|
997
999
|
return [200, headers, fr]
|
998
1000
|
|
@@ -1017,59 +1019,59 @@ class Client
|
|
1017
1019
|
tabs = [
|
1018
1020
|
_a_entry_search(env, {
|
1019
1021
|
caseid: cid,
|
1020
|
-
purpose: 'Case Entries'
|
1021
|
-
}, 'Entries'
|
1022
|
+
purpose: 'Case Entries',
|
1023
|
+
}, 'Entries'),
|
1022
1024
|
_a_index_search(env, {
|
1023
1025
|
caseid: cid,
|
1024
|
-
purpose: 'Case Indexes'
|
1025
|
-
}, 'Indexes'
|
1026
|
+
purpose: 'Case Indexes',
|
1027
|
+
}, 'Indexes'),
|
1026
1028
|
_a_stats(env, {
|
1027
1029
|
caseid: cid,
|
1028
|
-
purpose: 'Case Stats'
|
1029
|
-
}, 'Stats'
|
1030
|
+
purpose: 'Case Stats',
|
1031
|
+
}, 'Stats'),
|
1030
1032
|
_a_entry_tags(env, {
|
1031
1033
|
caseid: cid,
|
1032
|
-
purpose: 'Entry Tags'
|
1033
|
-
}, 'Entry Tags'
|
1034
|
+
purpose: 'Entry Tags',
|
1035
|
+
}, 'Entry Tags'),
|
1034
1036
|
_a_index_tags(env, {
|
1035
1037
|
caseid: cid,
|
1036
|
-
purpose: 'Index Tags'
|
1037
|
-
}, 'Index Tags'
|
1038
|
-
_a_entry_edit(env, cid, 0, 0, 'New Entry'
|
1039
|
-
_a_index_edit(env, cid, 0, 'New Index'
|
1038
|
+
purpose: 'Index Tags',
|
1039
|
+
}, 'Index Tags'),
|
1040
|
+
_a_entry_edit(env, cid, 0, 0, 'New Entry'),
|
1041
|
+
_a_index_edit(env, cid, 0, 'New Index'),
|
1040
1042
|
]
|
1041
1043
|
|
1042
1044
|
# no case
|
1043
1045
|
else
|
1044
|
-
tc = ''
|
1046
|
+
tc = ''
|
1045
1047
|
tabs = [
|
1046
1048
|
_a_action_search(env, {
|
1047
1049
|
assigned: unam,
|
1048
1050
|
status: true,
|
1049
1051
|
flag: true,
|
1050
|
-
purpose: 'Flagged Actions'
|
1051
|
-
}, 'Actions'
|
1052
|
+
purpose: 'Flagged Actions',
|
1053
|
+
}, 'Actions'),
|
1052
1054
|
_a_case_search(env, {
|
1053
1055
|
grantee: unam,
|
1054
1056
|
status: true,
|
1055
1057
|
template: false,
|
1056
|
-
purpose: 'Open Cases'
|
1057
|
-
}, 'Cases'
|
1058
|
+
purpose: 'Open Cases',
|
1059
|
+
}, 'Cases'),
|
1058
1060
|
_a_stats(env, {
|
1059
1061
|
credit: unam,
|
1060
1062
|
after: Time.now.to_i - 60*60*24*30,
|
1061
|
-
purpose: 'User Stats - Last 30 days'
|
1062
|
-
}, 'Stats'
|
1063
|
+
purpose: 'User Stats - Last 30 days',
|
1064
|
+
}, 'Stats'),
|
1063
1065
|
_a_config_edit(env, 'Config'),
|
1064
|
-
_a_info(env, 'Info'
|
1066
|
+
_a_info(env, 'Info'),
|
1065
1067
|
]
|
1066
1068
|
end
|
1067
1069
|
|
1068
1070
|
# tab divs
|
1069
|
-
tabs = tabs.map{|aa| DivNavTab % aa}.join(''
|
1071
|
+
tabs = tabs.map{|aa| DivNavTab % aa}.join('')
|
1070
1072
|
|
1071
1073
|
return DivNav % [
|
1072
|
-
_a_home(env, 'ICFS'
|
1074
|
+
_a_home(env, 'ICFS'),
|
1073
1075
|
tc,
|
1074
1076
|
tabs
|
1075
1077
|
]
|
@@ -1081,12 +1083,12 @@ class Client
|
|
1081
1083
|
<div class="nav">
|
1082
1084
|
<div class="nav-icfs">%s</div>
|
1083
1085
|
<div class="nav-case">%s</div>%s
|
1084
|
-
</div>'
|
1086
|
+
</div>'
|
1085
1087
|
|
1086
1088
|
|
1087
1089
|
# navbar tab
|
1088
1090
|
DivNavTab = '
|
1089
|
-
<div class="nav-tab">%s</div>'
|
1091
|
+
<div class="nav-tab">%s</div>'
|
1090
1092
|
|
1091
1093
|
|
1092
1094
|
###############################################
|
@@ -1100,7 +1102,7 @@ class Client
|
|
1100
1102
|
# message div
|
1101
1103
|
DivMsg = '
|
1102
1104
|
<div class="message">%s
|
1103
|
-
</div>'
|
1105
|
+
</div>'
|
1104
1106
|
|
1105
1107
|
|
1106
1108
|
###############################################
|
@@ -1108,7 +1110,7 @@ class Client
|
|
1108
1110
|
#
|
1109
1111
|
def _div_info(env)
|
1110
1112
|
api = env['icfs']
|
1111
|
-
tz =
|
1113
|
+
tz = api.config.get('tz')
|
1112
1114
|
|
1113
1115
|
# roles/groups/perms
|
1114
1116
|
roles = api.roles.map{|rol| DivInfoList % Rack::Utils.escape_html(rol)}
|
@@ -1121,10 +1123,10 @@ class Client
|
|
1121
1123
|
return DivInfo % [
|
1122
1124
|
Rack::Utils.escape_html(tz),
|
1123
1125
|
Rack::Utils.escape_html(api.user),
|
1124
|
-
roles.join(''
|
1125
|
-
grps.join(''
|
1126
|
-
perms.join(''
|
1127
|
-
gstats.join(''
|
1126
|
+
roles.join(''),
|
1127
|
+
grps.join(''),
|
1128
|
+
perms.join(''),
|
1129
|
+
gstats.join(''),
|
1128
1130
|
]
|
1129
1131
|
end # def _div_info()
|
1130
1132
|
|
@@ -1162,31 +1164,31 @@ class Client
|
|
1162
1164
|
</div>
|
1163
1165
|
</div>
|
1164
1166
|
</div>
|
1165
|
-
</div>'
|
1167
|
+
</div>'
|
1166
1168
|
|
1167
1169
|
|
1168
1170
|
# List items in the info div
|
1169
1171
|
DivInfoList = '
|
1170
|
-
<div>%s</div>'
|
1172
|
+
<div>%s</div>'
|
1171
1173
|
|
1172
1174
|
|
1173
1175
|
# Column classes by symbol
|
1174
1176
|
ListColClass = {
|
1175
|
-
entry: 'list-int'
|
1176
|
-
action: 'list-int'
|
1177
|
-
index: 'list-int'
|
1178
|
-
log: 'list-int'
|
1179
|
-
tags: 'list-int'
|
1180
|
-
tag: 'list-tag'
|
1181
|
-
stats: 'list-int'
|
1182
|
-
time: 'list-time'
|
1183
|
-
title: 'list-title'
|
1184
|
-
caseid: 'list-caseid'
|
1185
|
-
stat: 'list-stat'
|
1186
|
-
sum: 'list-float'
|
1187
|
-
count: 'list-int'
|
1188
|
-
files: 'list-int'
|
1189
|
-
user: 'list-usergrp'
|
1177
|
+
entry: 'list-int',
|
1178
|
+
action: 'list-int',
|
1179
|
+
index: 'list-int',
|
1180
|
+
log: 'list-int',
|
1181
|
+
tags: 'list-int',
|
1182
|
+
tag: 'list-tag',
|
1183
|
+
stats: 'list-int',
|
1184
|
+
time: 'list-time',
|
1185
|
+
title: 'list-title',
|
1186
|
+
caseid: 'list-caseid',
|
1187
|
+
stat: 'list-stat',
|
1188
|
+
sum: 'list-float',
|
1189
|
+
count: 'list-int',
|
1190
|
+
files: 'list-int',
|
1191
|
+
user: 'list-usergrp',
|
1190
1192
|
}.freeze
|
1191
1193
|
|
1192
1194
|
|
@@ -1198,7 +1200,7 @@ class Client
|
|
1198
1200
|
# @param list [Array] List of object items to display and how
|
1199
1201
|
#
|
1200
1202
|
def _div_list(env, resp, list)
|
1201
|
-
return _div_msg(env, 'No results found'
|
1203
|
+
return _div_msg(env, 'No results found') if resp[:list].size == 0
|
1202
1204
|
|
1203
1205
|
# did we query with caseid?
|
1204
1206
|
qcid = resp[:query].key?(:caseid)
|
@@ -1209,12 +1211,12 @@ class Client
|
|
1209
1211
|
# header row
|
1210
1212
|
hcols = list.map do |sym, opt|
|
1211
1213
|
if sym == :caseid && qcid
|
1212
|
-
''
|
1214
|
+
''
|
1213
1215
|
else
|
1214
1216
|
DivListHeadItems[sym]
|
1215
1217
|
end
|
1216
1218
|
end
|
1217
|
-
head = DivListHead % hcols.join(''
|
1219
|
+
head = DivListHead % hcols.join('')
|
1218
1220
|
|
1219
1221
|
# search results into rows
|
1220
1222
|
rows = resp[:list].map do |sr|
|
@@ -1228,14 +1230,14 @@ class Client
|
|
1228
1230
|
# snippets are special non-column, not in the object itself
|
1229
1231
|
if sym == :snippet
|
1230
1232
|
if sr[:snippet]
|
1231
|
-
next( DivListItem % ['list-snip'
|
1233
|
+
next( DivListItem % ['list-snip', sr[:snippet]])
|
1232
1234
|
else
|
1233
|
-
next(''
|
1235
|
+
next('')
|
1234
1236
|
end
|
1235
1237
|
|
1236
1238
|
# redacted result
|
1237
1239
|
elsif it.nil?
|
1238
|
-
next( DivListItem % [cc, '—'
|
1240
|
+
next( DivListItem % [cc, '—'])
|
1239
1241
|
end
|
1240
1242
|
|
1241
1243
|
# normal result
|
@@ -1264,29 +1266,29 @@ class Client
|
|
1264
1266
|
when :action
|
1265
1267
|
case opt
|
1266
1268
|
when :current
|
1267
|
-
cd = (it == 0) ? ''
|
1269
|
+
cd = (it == 0) ? '' : _a_action(env, cid, it, 0, it.to_s)
|
1268
1270
|
when :log
|
1269
1271
|
if it != 0
|
1270
1272
|
cd = _a_action(env, cid, it, obj[:log], it.to_s)
|
1271
1273
|
else
|
1272
|
-
cd = ''
|
1274
|
+
cd = ''
|
1273
1275
|
end
|
1274
1276
|
else
|
1275
|
-
cd = it == 0 ? ''
|
1277
|
+
cd = it == 0 ? '' : it.to_s
|
1276
1278
|
end
|
1277
1279
|
|
1278
1280
|
# index
|
1279
1281
|
when :index
|
1280
1282
|
case opt
|
1281
1283
|
when :entry
|
1282
|
-
cd = (it == 0) ? ''
|
1284
|
+
cd = (it == 0) ? '' : it.to_s
|
1283
1285
|
when :current
|
1284
1286
|
cd = _a_index(env, cid, it, 0, it.to_s)
|
1285
1287
|
when :log
|
1286
1288
|
if it != 0
|
1287
1289
|
cd = _a_index(env, cid, it, obj[:log], it.to_s)
|
1288
1290
|
else
|
1289
|
-
cd = ''
|
1291
|
+
cd = ''
|
1290
1292
|
end
|
1291
1293
|
else
|
1292
1294
|
cd = it.to_s
|
@@ -1304,7 +1306,7 @@ class Client
|
|
1304
1306
|
# tags
|
1305
1307
|
when :tags
|
1306
1308
|
if it.size == 1 && it[0] == ICFS::TagNone
|
1307
|
-
cd = ''
|
1309
|
+
cd = ''
|
1308
1310
|
else
|
1309
1311
|
cd = it.size.to_s
|
1310
1312
|
end
|
@@ -1315,16 +1317,16 @@ class Client
|
|
1315
1317
|
|
1316
1318
|
case opt
|
1317
1319
|
when :entry
|
1318
|
-
qu[:purpose] = 'Entry Tag Search'
|
1320
|
+
qu[:purpose] = 'Entry Tag Search'
|
1319
1321
|
cd = _a_entry_search(env, qu, it)
|
1320
1322
|
when :index
|
1321
|
-
qu[:purpose] = 'Index Tag Search'
|
1323
|
+
qu[:purpose] = 'Index Tag Search'
|
1322
1324
|
cd = _a_index_search(env, qu, it)
|
1323
1325
|
when :case
|
1324
|
-
qu[:purpose] = 'Case Tag Search'
|
1326
|
+
qu[:purpose] = 'Case Tag Search'
|
1325
1327
|
cd = _a_case_search(env, qu, it)
|
1326
1328
|
when :action
|
1327
|
-
qu[:purpose] = 'Action Tag Search'
|
1329
|
+
qu[:purpose] = 'Action Tag Search'
|
1328
1330
|
cd = _a_action_search(env, qu, it)
|
1329
1331
|
end
|
1330
1332
|
|
@@ -1370,7 +1372,7 @@ class Client
|
|
1370
1372
|
# stat - only on stats aggregation
|
1371
1373
|
when :stat
|
1372
1374
|
qu[:stat] = it
|
1373
|
-
qu[:purpose] = 'Entry Stat Search'
|
1375
|
+
qu[:purpose] = 'Entry Stat Search'
|
1374
1376
|
cd = _a_entry_search(env, qu, it)
|
1375
1377
|
|
1376
1378
|
# sum - only on stats aggregation
|
@@ -1383,7 +1385,7 @@ class Client
|
|
1383
1385
|
|
1384
1386
|
# files
|
1385
1387
|
when :files
|
1386
|
-
cd = it == 0 ? ''
|
1388
|
+
cd = it == 0 ? '' : it.to_s
|
1387
1389
|
|
1388
1390
|
# user
|
1389
1391
|
when :user
|
@@ -1391,20 +1393,20 @@ class Client
|
|
1391
1393
|
|
1392
1394
|
# stats
|
1393
1395
|
when :stats
|
1394
|
-
cd = it == 0 ? ''
|
1396
|
+
cd = it == 0 ? '' : it.to_s
|
1395
1397
|
|
1396
1398
|
# huh?
|
1397
1399
|
else
|
1398
1400
|
raise NotImplementedError, sym.to_s
|
1399
1401
|
end
|
1400
1402
|
|
1401
|
-
cd ? (DivListItem % [cc, cd]) : ''
|
1403
|
+
cd ? (DivListItem % [cc, cd]) : ''
|
1402
1404
|
end
|
1403
1405
|
|
1404
|
-
DivListRow % cols.join(''
|
1406
|
+
DivListRow % cols.join('')
|
1405
1407
|
end
|
1406
1408
|
|
1407
|
-
return DivList % [head, rows.join(''
|
1409
|
+
return DivList % [head, rows.join('')]
|
1408
1410
|
|
1409
1411
|
end # def _div_list()
|
1410
1412
|
|
@@ -1412,56 +1414,56 @@ class Client
|
|
1412
1414
|
# Search results list
|
1413
1415
|
DivList = '
|
1414
1416
|
<div class="list">%s%s
|
1415
|
-
</div>'
|
1417
|
+
</div>'
|
1416
1418
|
|
1417
1419
|
# Search results row
|
1418
1420
|
DivListRow = '
|
1419
1421
|
<div class="list-row">%s
|
1420
|
-
</div>'
|
1422
|
+
</div>'
|
1421
1423
|
|
1422
1424
|
# Search results header
|
1423
1425
|
DivListHead = '
|
1424
1426
|
<div class="list-head">%s
|
1425
|
-
</div>'
|
1427
|
+
</div>'
|
1426
1428
|
|
1427
1429
|
# Search results header items
|
1428
1430
|
DivListHeadItems = {
|
1429
1431
|
tags: '
|
1430
|
-
<div class="list-int">Tags</div>'
|
1432
|
+
<div class="list-int">Tags</div>',
|
1431
1433
|
tag: '
|
1432
|
-
<div class="list-tag">Tag</div>'
|
1434
|
+
<div class="list-tag">Tag</div>',
|
1433
1435
|
entry: '
|
1434
|
-
<div class="list-int">Entry</div>'
|
1436
|
+
<div class="list-int">Entry</div>',
|
1435
1437
|
index: '
|
1436
|
-
<div class="list-int">Index</div>'
|
1438
|
+
<div class="list-int">Index</div>',
|
1437
1439
|
action: '
|
1438
|
-
<div class="list-int">Action</div>'
|
1440
|
+
<div class="list-int">Action</div>',
|
1439
1441
|
log: '
|
1440
|
-
<div class="list-int">Log</div>'
|
1442
|
+
<div class="list-int">Log</div>',
|
1441
1443
|
title: '
|
1442
|
-
<div class="list-title">Title</div>'
|
1444
|
+
<div class="list-title">Title</div>',
|
1443
1445
|
caseid: '
|
1444
|
-
<div class="list-caseid">Case ID</div>'
|
1446
|
+
<div class="list-caseid">Case ID</div>',
|
1445
1447
|
stats: '
|
1446
|
-
<div class="list-int">Stats</div>'
|
1448
|
+
<div class="list-int">Stats</div>',
|
1447
1449
|
time: '
|
1448
|
-
<div class="list-time">Date/Time</div>'
|
1450
|
+
<div class="list-time">Date/Time</div>',
|
1449
1451
|
stat: '
|
1450
|
-
<div class="list-stat">Stat Name</div>'
|
1452
|
+
<div class="list-stat">Stat Name</div>',
|
1451
1453
|
sum: '
|
1452
|
-
<div class="list-float">Total</div>'
|
1454
|
+
<div class="list-float">Total</div>',
|
1453
1455
|
count: '
|
1454
|
-
<div class="list-int">Count</div>'
|
1456
|
+
<div class="list-int">Count</div>',
|
1455
1457
|
files: '
|
1456
|
-
<div class="list-int">Files</div>'
|
1458
|
+
<div class="list-int">Files</div>',
|
1457
1459
|
user: '
|
1458
|
-
<div class="list-usergrp">User</div>'
|
1459
|
-
snippet: ''
|
1460
|
+
<div class="list-usergrp">User</div>',
|
1461
|
+
snippet: ''
|
1460
1462
|
}.freeze
|
1461
1463
|
|
1462
1464
|
# search results item
|
1463
1465
|
DivListItem = '
|
1464
|
-
<div class="%s">%s</div>'
|
1466
|
+
<div class="%s">%s</div>'
|
1465
1467
|
|
1466
1468
|
|
1467
1469
|
###############################################
|
@@ -1476,7 +1478,7 @@ class Client
|
|
1476
1478
|
<div class="desc">
|
1477
1479
|
<div class="desc-head">%s</div>
|
1478
1480
|
%s
|
1479
|
-
</div>'
|
1481
|
+
</div>'
|
1480
1482
|
|
1481
1483
|
|
1482
1484
|
###############################################
|
@@ -1512,7 +1514,7 @@ class Client
|
|
1512
1514
|
disp_pages.times do |pg|
|
1513
1515
|
page = pg + 1
|
1514
1516
|
if page == cur
|
1515
|
-
ary << '<b>%d</b>'
|
1517
|
+
ary << '<b>%d</b>' % page
|
1516
1518
|
else
|
1517
1519
|
query[:page] = page
|
1518
1520
|
if pr
|
@@ -1526,30 +1528,30 @@ class Client
|
|
1526
1528
|
|
1527
1529
|
# previous
|
1528
1530
|
if cur == 1
|
1529
|
-
prev_page = ''
|
1531
|
+
prev_page = ''
|
1530
1532
|
else
|
1531
1533
|
query[:page] = cur - 1
|
1532
1534
|
if pr
|
1533
|
-
prev_page = pr.call(query, '(Prev)'
|
1535
|
+
prev_page = pr.call(query, '(Prev)')
|
1534
1536
|
else
|
1535
|
-
prev_page = yield(query, '(Prev)'
|
1537
|
+
prev_page = yield(query, '(Prev)')
|
1536
1538
|
end
|
1537
1539
|
end
|
1538
1540
|
|
1539
1541
|
# next
|
1540
1542
|
if cur == disp_pages
|
1541
|
-
next_page = ''
|
1543
|
+
next_page = ''
|
1542
1544
|
else
|
1543
1545
|
query[:page] = cur + 1
|
1544
1546
|
if pr
|
1545
|
-
next_page = pr.call(query, '(Next)'
|
1547
|
+
next_page = pr.call(query, '(Next)')
|
1546
1548
|
else
|
1547
|
-
next_page = yield(query, '(Next)'
|
1549
|
+
next_page = yield(query, '(Next)')
|
1548
1550
|
end
|
1549
1551
|
end
|
1550
1552
|
|
1551
1553
|
return DivPage % [
|
1552
|
-
prev_page, ary.join(' '
|
1554
|
+
prev_page, ary.join(' '), next_page,
|
1553
1555
|
hits, tot_pages
|
1554
1556
|
]
|
1555
1557
|
end # def _div_page()
|
@@ -1560,7 +1562,7 @@ class Client
|
|
1560
1562
|
<div class="pagenav">
|
1561
1563
|
<< %s %s %s >><br>
|
1562
1564
|
Hits: %d Pages: %d
|
1563
|
-
</div>'
|
1565
|
+
</div>'
|
1564
1566
|
|
1565
1567
|
|
1566
1568
|
###############################################
|
@@ -1581,61 +1583,61 @@ class Client
|
|
1581
1583
|
grantee: ug,
|
1582
1584
|
status: true,
|
1583
1585
|
template: false,
|
1584
|
-
purpose: 'Open Cases'
|
1585
|
-
}, 'open'
|
1586
|
+
purpose: 'Open Cases'
|
1587
|
+
}, 'open'),
|
1586
1588
|
_a_case_search(env, {
|
1587
1589
|
grantee: ug,
|
1588
1590
|
status: false,
|
1589
1591
|
template: false,
|
1590
|
-
purpose: 'Closed Cases'
|
1591
|
-
}, 'closed'
|
1592
|
+
purpose: 'Closed Cases'
|
1593
|
+
}, 'closed'),
|
1592
1594
|
_a_case_search(env, {
|
1593
1595
|
grantee: ug,
|
1594
1596
|
perm: ICFS::PermAction,
|
1595
1597
|
status: true,
|
1596
1598
|
template: false,
|
1597
|
-
purpose: 'Action Manager Cases'
|
1598
|
-
}, 'action mgr'
|
1599
|
+
purpose: 'Action Manager Cases'
|
1600
|
+
}, 'action mgr'),
|
1599
1601
|
_a_case_tags(env, {
|
1600
1602
|
grantee: ug,
|
1601
1603
|
status: true,
|
1602
1604
|
template: false,
|
1603
|
-
purpose: 'Open Case Tags'
|
1604
|
-
}, 'tags'
|
1605
|
-
].map{|lk| DivHomeLink % lk }.join(''
|
1605
|
+
purpose: 'Open Case Tags'
|
1606
|
+
}, 'tags'),
|
1607
|
+
].map{|lk| DivHomeLink % lk }.join('')
|
1606
1608
|
|
1607
1609
|
al = [
|
1608
1610
|
_a_action_search(env, {
|
1609
1611
|
assigned: ug,
|
1610
1612
|
status: true,
|
1611
1613
|
flag: true,
|
1612
|
-
purpose: 'Flagged Actions'
|
1613
|
-
}, 'flagged'
|
1614
|
+
purpose: 'Flagged Actions'
|
1615
|
+
}, 'flagged'),
|
1614
1616
|
_a_action_search(env, {
|
1615
1617
|
assigned: ug,
|
1616
1618
|
status: true,
|
1617
1619
|
before: now,
|
1618
|
-
sort: 'time_asc'
|
1619
|
-
purpose: 'Actions - Past Date'
|
1620
|
-
}, 'past'
|
1620
|
+
sort: 'time_asc',
|
1621
|
+
purpose: 'Actions - Past Date',
|
1622
|
+
}, 'past'),
|
1621
1623
|
_a_action_search(env, {
|
1622
1624
|
assigned: ug,
|
1623
1625
|
status: true,
|
1624
1626
|
after: now,
|
1625
|
-
sort: 'time_desc'
|
1626
|
-
purpose: 'Actions - Future Date'
|
1627
|
-
}, 'future'
|
1627
|
+
sort: 'time_desc',
|
1628
|
+
purpose: 'Actions - Future Date',
|
1629
|
+
}, 'future'),
|
1628
1630
|
_a_action_search(env, {
|
1629
1631
|
assigned: ug,
|
1630
1632
|
status: true,
|
1631
|
-
purpose: 'Open Actions'
|
1632
|
-
}, 'all open'
|
1633
|
+
purpose: 'Open Actions'
|
1634
|
+
}, 'all open'),
|
1633
1635
|
_a_action_tags(env, {
|
1634
1636
|
assigned: ug,
|
1635
1637
|
status: true,
|
1636
|
-
purpose: 'Open Action Tags'
|
1637
|
-
}, 'tags'
|
1638
|
-
].map{|lk| DivHomeLink % lk }.join(''
|
1638
|
+
purpose: 'Open Action Tags'
|
1639
|
+
}, 'tags'),
|
1640
|
+
].map{|lk| DivHomeLink % lk }.join('')
|
1639
1641
|
|
1640
1642
|
ol = [
|
1641
1643
|
_a_case_search(env, {
|
@@ -1643,27 +1645,27 @@ class Client
|
|
1643
1645
|
perm: ICFS::PermManage,
|
1644
1646
|
status: true,
|
1645
1647
|
template: false,
|
1646
|
-
purpose: 'Managed Cases'
|
1647
|
-
}, 'managed'
|
1648
|
+
purpose: 'Managed Cases',
|
1649
|
+
}, 'managed'),
|
1648
1650
|
_a_case_search(env, {
|
1649
1651
|
grantee: ug,
|
1650
1652
|
perm: ICFS::PermManage,
|
1651
1653
|
status: true,
|
1652
1654
|
template: true,
|
1653
|
-
purpose: 'Templates'
|
1654
|
-
}, 'templates'
|
1655
|
+
purpose: 'Templates',
|
1656
|
+
}, 'templates'),
|
1655
1657
|
_a_stats(env, {
|
1656
1658
|
credit: ug,
|
1657
1659
|
after: Time.now.to_i - 60*60*24*30,
|
1658
|
-
purpose: 'User/Role Stats - 30 days'
|
1659
|
-
}, '30-day stats'
|
1660
|
-
].map{|lk| DivHomeLink % lk }.join(''
|
1660
|
+
purpose: 'User/Role Stats - 30 days',
|
1661
|
+
}, '30-day stats'),
|
1662
|
+
].map{|lk| DivHomeLink % lk }.join('')
|
1661
1663
|
|
1662
1664
|
|
1663
1665
|
DivHomeUr % [Rack::Utils.escape_html(ug), al, cl, ol ]
|
1664
1666
|
end
|
1665
1667
|
|
1666
|
-
DivHome % useract.join(''
|
1668
|
+
DivHome % useract.join('')
|
1667
1669
|
end # def _div_home()
|
1668
1670
|
|
1669
1671
|
|
@@ -1676,7 +1678,7 @@ class Client
|
|
1676
1678
|
<div class="list-text-s">Cases</div>
|
1677
1679
|
<div class="list-text-s">Other</div>
|
1678
1680
|
</div>%s
|
1679
|
-
</div>'
|
1681
|
+
</div>'
|
1680
1682
|
|
1681
1683
|
|
1682
1684
|
# Home user/role
|
@@ -1689,19 +1691,19 @@ class Client
|
|
1689
1691
|
</div>
|
1690
1692
|
<div class="links-list">%s
|
1691
1693
|
</div>
|
1692
|
-
</div>'
|
1694
|
+
</div>'
|
1693
1695
|
|
1694
1696
|
|
1695
1697
|
# Home Link
|
1696
1698
|
DivHomeLink = '
|
1697
|
-
<div class="list-text-s">%s</div>'
|
1699
|
+
<div class="list-text-s">%s</div>'
|
1698
1700
|
|
1699
1701
|
|
1700
1702
|
###############################################
|
1701
1703
|
# Case Create Form
|
1702
1704
|
#
|
1703
1705
|
def _form_create(env)
|
1704
|
-
[ FormCaseCreate, ''
|
1706
|
+
[ FormCaseCreate, '' ]
|
1705
1707
|
end # def _form_create()
|
1706
1708
|
|
1707
1709
|
|
@@ -1732,7 +1734,7 @@ class Client
|
|
1732
1734
|
when making new cases.
|
1733
1735
|
</div></div>
|
1734
1736
|
</div>
|
1735
|
-
</div>'
|
1737
|
+
</div>'
|
1736
1738
|
|
1737
1739
|
|
1738
1740
|
###############################################
|
@@ -1748,7 +1750,7 @@ class Client
|
|
1748
1750
|
spath += Rack::Utils.escape(cid) if cid
|
1749
1751
|
return DivForm % [
|
1750
1752
|
spath,
|
1751
|
-
parts.join(''
|
1753
|
+
parts.join(''),
|
1752
1754
|
button,
|
1753
1755
|
]
|
1754
1756
|
end # def _div_form()
|
@@ -1759,7 +1761,7 @@ class Client
|
|
1759
1761
|
enctype="multipart/form-data" accept-charset="utf-8">
|
1760
1762
|
%s
|
1761
1763
|
<input class="submit" type="submit" value="%s">
|
1762
|
-
</form></div>'
|
1764
|
+
</form></div>'
|
1763
1765
|
|
1764
1766
|
|
1765
1767
|
|
@@ -1772,17 +1774,17 @@ class Client
|
|
1772
1774
|
cid = cse['caseid']
|
1773
1775
|
al = api.access_list(cid)
|
1774
1776
|
|
1775
|
-
status = cse['status'] ? 'Open'
|
1776
|
-
template = cse['template'] ? 'Yes'
|
1777
|
+
status = cse['status'] ? 'Open' : 'Closed'
|
1778
|
+
template = cse['template'] ? 'Yes' : 'No'
|
1777
1779
|
|
1778
1780
|
# case links
|
1779
1781
|
links = [
|
1780
|
-
_a_log_search(env, {caseid: cid}, 'History of Case'
|
1782
|
+
_a_log_search(env, {caseid: cid}, 'History of Case'),
|
1781
1783
|
]
|
1782
1784
|
if al.include?(ICFS::PermManage)
|
1783
|
-
links << _a_case_edit(env, cid, 'Edit This Case'
|
1785
|
+
links << _a_case_edit(env, cid, 'Edit This Case')
|
1784
1786
|
if cse['template']
|
1785
|
-
links << _a_case_create(env, cid, 'Create New Case'
|
1787
|
+
links << _a_case_create(env, cid, 'Create New Case')
|
1786
1788
|
end
|
1787
1789
|
end
|
1788
1790
|
links.map!{|aa| DivCaseLink % aa}
|
@@ -1796,40 +1798,40 @@ class Client
|
|
1796
1798
|
assigned: ICFS::UserCase,
|
1797
1799
|
status: true,
|
1798
1800
|
flag: true,
|
1799
|
-
purpose: 'Flagged Actions'
|
1800
|
-
}, 'flagged'
|
1801
|
+
purpose: 'Flagged Actions',
|
1802
|
+
}, 'flagged'),
|
1801
1803
|
_a_action_search(env, {
|
1802
1804
|
caseid: cid,
|
1803
1805
|
assigned: ICFS::UserCase,
|
1804
1806
|
status: true,
|
1805
1807
|
before: now,
|
1806
|
-
sort: 'time_asc'
|
1807
|
-
purpose: 'Actions - Past Date'
|
1808
|
-
}, 'past'
|
1808
|
+
sort: 'time_asc',
|
1809
|
+
purpose: 'Actions - Past Date',
|
1810
|
+
}, 'past'),
|
1809
1811
|
_a_action_search(env, {
|
1810
1812
|
caseid: cid,
|
1811
1813
|
assigned: ICFS::UserCase,
|
1812
1814
|
status: true,
|
1813
1815
|
after: now,
|
1814
|
-
sort: 'time_desc'
|
1815
|
-
purpose: 'Actions - Future Date'
|
1816
|
-
}, 'future'
|
1816
|
+
sort: 'time_desc',
|
1817
|
+
purpose: 'Actions - Future Date',
|
1818
|
+
}, 'future'),
|
1817
1819
|
_a_action_search(env, {
|
1818
1820
|
caseid: cid,
|
1819
1821
|
assigned: ICFS::UserCase,
|
1820
1822
|
status: true,
|
1821
|
-
purpose: 'Open Actions'
|
1822
|
-
}, 'all open'
|
1823
|
+
purpose: 'Open Actions',
|
1824
|
+
}, 'all open'),
|
1823
1825
|
_a_action_tags(env, {
|
1824
1826
|
caseid: cid,
|
1825
1827
|
assigned: ICFS::UserCase,
|
1826
1828
|
status: true,
|
1827
|
-
purpose: 'Open Action Tags'
|
1828
|
-
}, 'tags'
|
1829
|
+
purpose: 'Open Action Tags',
|
1830
|
+
}, 'tags'),
|
1829
1831
|
].map{|lk| DivCaseLink % lk}
|
1830
|
-
actions = DivCaseActions % actions.join(''
|
1832
|
+
actions = DivCaseActions % actions.join('')
|
1831
1833
|
else
|
1832
|
-
actions = ''
|
1834
|
+
actions = ''
|
1833
1835
|
end
|
1834
1836
|
|
1835
1837
|
# tags
|
@@ -1844,19 +1846,19 @@ class Client
|
|
1844
1846
|
ugl = ac['grant'].map do |ug|
|
1845
1847
|
DivCaseGrant % Rack::Utils.escape_html(ug)
|
1846
1848
|
end
|
1847
|
-
DivCaseAccess % [ pm, ugl.join(''
|
1849
|
+
DivCaseAccess % [ pm, ugl.join('') ]
|
1848
1850
|
end
|
1849
1851
|
|
1850
1852
|
# stats
|
1851
1853
|
if cse['stats']
|
1852
1854
|
stats = cse['stats'].map do |st|
|
1853
1855
|
DivCaseStatEach % _a_entry_search(env, { caseid: cid, stat: st,
|
1854
|
-
purpose: 'Entries with Stat'
|
1856
|
+
purpose: 'Entries with Stat' },
|
1855
1857
|
Rack::Utils.escape_html(st) )
|
1856
1858
|
end
|
1857
|
-
stats = DivCaseStats % stats.join(''
|
1859
|
+
stats = DivCaseStats % stats.join('')
|
1858
1860
|
else
|
1859
|
-
stats = ''
|
1861
|
+
stats = ''
|
1860
1862
|
end
|
1861
1863
|
|
1862
1864
|
return DivCase % [
|
@@ -1864,10 +1866,10 @@ class Client
|
|
1864
1866
|
_a_log(env, cid, cse['log'], cse['log'].to_s),
|
1865
1867
|
status,
|
1866
1868
|
template,
|
1867
|
-
links.join(''
|
1869
|
+
links.join(''),
|
1868
1870
|
Rack::Utils.escape_html(cse['title']),
|
1869
|
-
acc.join(''
|
1870
|
-
tags.join(''
|
1871
|
+
acc.join(''),
|
1872
|
+
tags.join(''),
|
1871
1873
|
stats,
|
1872
1874
|
actions,
|
1873
1875
|
]
|
@@ -1914,19 +1916,19 @@ class Client
|
|
1914
1916
|
<div class="sect-head">Tags</div>%s
|
1915
1917
|
</div>%s%s
|
1916
1918
|
</div>
|
1917
|
-
</div>'
|
1919
|
+
</div>'
|
1918
1920
|
|
1919
1921
|
|
1920
1922
|
# Case div action links
|
1921
1923
|
DivCaseActions = '
|
1922
1924
|
<div class="sect">
|
1923
1925
|
<div class="sect-head">Actions</div>%s
|
1924
|
-
</div>'
|
1926
|
+
</div>'
|
1925
1927
|
|
1926
1928
|
|
1927
1929
|
# Case div links
|
1928
1930
|
DivCaseLink = '
|
1929
|
-
<div>%s</div>'
|
1931
|
+
<div>%s</div>'
|
1930
1932
|
|
1931
1933
|
# Case div each access
|
1932
1934
|
DivCaseAccess = '
|
@@ -1934,17 +1936,17 @@ class Client
|
|
1934
1936
|
<div class="list-perm">%s</div>
|
1935
1937
|
<div class="list-vert list-usergrp">%s
|
1936
1938
|
</div>
|
1937
|
-
</div>'
|
1939
|
+
</div>'
|
1938
1940
|
|
1939
1941
|
|
1940
1942
|
# Case div each grant
|
1941
1943
|
DivCaseGrant = '
|
1942
|
-
<div>%s</div>'
|
1944
|
+
<div>%s</div>'
|
1943
1945
|
|
1944
1946
|
|
1945
1947
|
# Case div each tag
|
1946
1948
|
DivCaseTag = '
|
1947
|
-
<div class="item-tag">%s</div>'
|
1949
|
+
<div class="item-tag">%s</div>'
|
1948
1950
|
|
1949
1951
|
|
1950
1952
|
# Case div stats section
|
@@ -1953,12 +1955,12 @@ class Client
|
|
1953
1955
|
<div class="sect-head">Stats</div>
|
1954
1956
|
<div class="list">%s
|
1955
1957
|
</div>
|
1956
|
-
</div>'
|
1958
|
+
</div>'
|
1957
1959
|
|
1958
1960
|
|
1959
1961
|
# Case div each stat
|
1960
1962
|
DivCaseStatEach = '
|
1961
|
-
<div class="list-perm">%s</div>'
|
1963
|
+
<div class="list-perm">%s</div>'
|
1962
1964
|
|
1963
1965
|
|
1964
1966
|
###############################################
|
@@ -1971,21 +1973,21 @@ class Client
|
|
1971
1973
|
links = []
|
1972
1974
|
|
1973
1975
|
enum = ent['entry']
|
1974
|
-
links << _a_entry_edit(env, cid, enum, 0, 'Edit This Entry'
|
1976
|
+
links << _a_entry_edit(env, cid, enum, 0, 'Edit This Entry')
|
1975
1977
|
|
1976
1978
|
lnum = ent['log']
|
1977
1979
|
links << _a_log_search(env, {
|
1978
1980
|
'caseid' => cid,
|
1979
1981
|
'entry' => enum,
|
1980
|
-
'purpose' => 'History of Entry'
|
1981
|
-
}, 'History of Entry'
|
1982
|
+
'purpose' => 'History of Entry',
|
1983
|
+
}, 'History of Entry')
|
1982
1984
|
|
1983
1985
|
if ent['action']
|
1984
1986
|
anum = ent['action']
|
1985
1987
|
action = DivEntryAction % _a_action(env, cid, anum, 0, anum.to_s)
|
1986
|
-
links << _a_entry_edit(env, cid, 0, anum, 'New Entry in Action'
|
1988
|
+
links << _a_entry_edit(env, cid, 0, anum, 'New Entry in Action')
|
1987
1989
|
else
|
1988
|
-
action = ''
|
1990
|
+
action = ''
|
1989
1991
|
end
|
1990
1992
|
|
1991
1993
|
if ent['index']
|
@@ -1993,16 +1995,16 @@ class Client
|
|
1993
1995
|
idx = api.index_read(cid, xnum)
|
1994
1996
|
DivEntryIndexEach % _a_index(env, cid, xnum, 0, idx['title'])
|
1995
1997
|
end
|
1996
|
-
index = DivEntryIndex % indexes.join(''
|
1998
|
+
index = DivEntryIndex % indexes.join('')
|
1997
1999
|
else
|
1998
|
-
index = ''
|
2000
|
+
index = ''
|
1999
2001
|
end
|
2000
2002
|
|
2001
2003
|
tags = ent['tags'].map do |tag|
|
2002
2004
|
DivEntryTag % _a_entry_search(env, {
|
2003
2005
|
'caseid' => cid,
|
2004
2006
|
'tags' => tag,
|
2005
|
-
'purpose' => 'Tag Entries'
|
2007
|
+
'purpose' => 'Tag Entries',
|
2006
2008
|
}, tag)
|
2007
2009
|
end
|
2008
2010
|
|
@@ -2010,9 +2012,9 @@ class Client
|
|
2010
2012
|
pa = ent['perms'].map do |pm|
|
2011
2013
|
DivEntryPermEach % Rack::Utils.escape_html(pm)
|
2012
2014
|
end
|
2013
|
-
perms = DivEntryPerms % pa.join("\n"
|
2015
|
+
perms = DivEntryPerms % pa.join("\n")
|
2014
2016
|
else
|
2015
|
-
perms = ''
|
2017
|
+
perms = ''
|
2016
2018
|
end
|
2017
2019
|
|
2018
2020
|
if ent['stats']
|
@@ -2023,12 +2025,12 @@ class Client
|
|
2023
2025
|
DivEntryStatEach % [
|
2024
2026
|
Rack::Utils.escape_html(st['name']),
|
2025
2027
|
st['value'],
|
2026
|
-
ca.join(', '
|
2028
|
+
ca.join(', ')
|
2027
2029
|
]
|
2028
2030
|
end
|
2029
|
-
stats = DivEntryStats % sa.join("\n"
|
2031
|
+
stats = DivEntryStats % sa.join("\n")
|
2030
2032
|
else
|
2031
|
-
stats = ''
|
2033
|
+
stats = ''
|
2032
2034
|
end
|
2033
2035
|
|
2034
2036
|
if ent['files']
|
@@ -2036,9 +2038,9 @@ class Client
|
|
2036
2038
|
DivEntryFileEach % _a_file(env, cid, enum, fd['log'],
|
2037
2039
|
fd['num'], fd['name'], fd['name'])
|
2038
2040
|
end
|
2039
|
-
files = DivEntryFiles % fa.join("\n"
|
2041
|
+
files = DivEntryFiles % fa.join("\n")
|
2040
2042
|
else
|
2041
|
-
files = ''
|
2043
|
+
files = ''
|
2042
2044
|
end
|
2043
2045
|
|
2044
2046
|
return DivEntry % [
|
@@ -2047,11 +2049,11 @@ class Client
|
|
2047
2049
|
_a_log(env, cid, lnum, lnum.to_s),
|
2048
2050
|
Rack::Utils.escape_html(ent['user']),
|
2049
2051
|
action,
|
2050
|
-
links.map{|lk| DivEntryLink % lk }.join(''
|
2052
|
+
links.map{|lk| DivEntryLink % lk }.join(''),
|
2051
2053
|
Rack::Utils.escape_html(ent['title']),
|
2052
2054
|
_util_time(env, ent['time']),
|
2053
2055
|
Rack::Utils.escape_html(ent['content']),
|
2054
|
-
tags.join("\n"
|
2056
|
+
tags.join("\n"),
|
2055
2057
|
index,
|
2056
2058
|
perms,
|
2057
2059
|
stats,
|
@@ -2096,17 +2098,17 @@ class Client
|
|
2096
2098
|
</div>
|
2097
2099
|
</div>%s%s%s%s
|
2098
2100
|
</div>
|
2099
|
-
</div>'
|
2101
|
+
</div>'
|
2100
2102
|
|
2101
2103
|
|
2102
2104
|
# entry tag each
|
2103
2105
|
DivEntryTag = '
|
2104
|
-
<div>%s</div>'
|
2106
|
+
<div>%s</div>'
|
2105
2107
|
|
2106
2108
|
|
2107
2109
|
# entry link each
|
2108
2110
|
DivEntryLink = '
|
2109
|
-
<div>%s</div>'
|
2111
|
+
<div>%s</div>'
|
2110
2112
|
|
2111
2113
|
|
2112
2114
|
# entry action
|
@@ -2114,7 +2116,7 @@ class Client
|
|
2114
2116
|
<div class="list-row">
|
2115
2117
|
<div class="list-label">Action:</div>
|
2116
2118
|
<div class="list-int">%s</div>
|
2117
|
-
</div>'
|
2119
|
+
</div>'
|
2118
2120
|
|
2119
2121
|
|
2120
2122
|
# entry index
|
@@ -2123,12 +2125,12 @@ class Client
|
|
2123
2125
|
<div class="sect-head">Indexes</div>
|
2124
2126
|
<div class="index-list">%s
|
2125
2127
|
</div>
|
2126
|
-
</div>'
|
2128
|
+
</div>'
|
2127
2129
|
|
2128
2130
|
|
2129
2131
|
# entry index each
|
2130
2132
|
DivEntryIndexEach = '
|
2131
|
-
<div>%s</div>'
|
2133
|
+
<div>%s</div>'
|
2132
2134
|
|
2133
2135
|
|
2134
2136
|
# entry perms
|
@@ -2137,12 +2139,12 @@ class Client
|
|
2137
2139
|
<div class="sect-head">Permissions</div>
|
2138
2140
|
<div class="perms-list">%s
|
2139
2141
|
</div>
|
2140
|
-
</div>'
|
2142
|
+
</div>'
|
2141
2143
|
|
2142
2144
|
|
2143
2145
|
# entry perm each
|
2144
2146
|
DivEntryPermEach = '
|
2145
|
-
<div>%s</div>'
|
2147
|
+
<div>%s</div>'
|
2146
2148
|
|
2147
2149
|
|
2148
2150
|
# entry stats
|
@@ -2151,12 +2153,12 @@ class Client
|
|
2151
2153
|
<div class="sect-head">Stats</div>
|
2152
2154
|
<div class="stats-list">%s
|
2153
2155
|
</div>
|
2154
|
-
</div>'
|
2156
|
+
</div>'
|
2155
2157
|
|
2156
2158
|
|
2157
2159
|
# entry each stat
|
2158
2160
|
DivEntryStatEach = '
|
2159
|
-
<div>%s %f %s</div>'
|
2161
|
+
<div>%s %f %s</div>'
|
2160
2162
|
|
2161
2163
|
|
2162
2164
|
# entry files
|
@@ -2165,12 +2167,12 @@ class Client
|
|
2165
2167
|
<div class="sect-head">Files</div>
|
2166
2168
|
<div class="files-list">%s
|
2167
2169
|
</div>
|
2168
|
-
</div>'
|
2170
|
+
</div>'
|
2169
2171
|
|
2170
2172
|
|
2171
2173
|
# entry each file
|
2172
2174
|
DivEntryFileEach = '
|
2173
|
-
<div>%s</div>'
|
2175
|
+
<div>%s</div>'
|
2174
2176
|
|
2175
2177
|
|
2176
2178
|
###############################################
|
@@ -2181,15 +2183,15 @@ class Client
|
|
2181
2183
|
lnum = log['log']
|
2182
2184
|
enum = log['entry']['num']
|
2183
2185
|
|
2184
|
-
navp = (lnum == 1) ? 'prev'
|
2185
|
-
navn = _a_log(env, cid, lnum + 1, 'next'
|
2186
|
+
navp = (lnum == 1) ? 'prev' : _a_log(env, cid, lnum-1, 'prev')
|
2187
|
+
navn = _a_log(env, cid, lnum + 1, 'next')
|
2186
2188
|
|
2187
2189
|
time = _util_time(env, log['time'])
|
2188
2190
|
|
2189
2191
|
if log['case_hash']
|
2190
2192
|
chash = DivLogCase % _a_case(env, cid, lnum, log['case_hash'])
|
2191
2193
|
else
|
2192
|
-
chash = ''
|
2194
|
+
chash = ''
|
2193
2195
|
end
|
2194
2196
|
|
2195
2197
|
if log['action']
|
@@ -2198,7 +2200,7 @@ class Client
|
|
2198
2200
|
log['action']['num'],
|
2199
2201
|
]
|
2200
2202
|
else
|
2201
|
-
action = ''
|
2203
|
+
action = ''
|
2202
2204
|
end
|
2203
2205
|
|
2204
2206
|
if log['index']
|
@@ -2207,7 +2209,7 @@ class Client
|
|
2207
2209
|
log['index']['num'],
|
2208
2210
|
]
|
2209
2211
|
else
|
2210
|
-
index = ''
|
2212
|
+
index = ''
|
2211
2213
|
end
|
2212
2214
|
|
2213
2215
|
if log['files_hash']
|
@@ -2215,13 +2217,13 @@ class Client
|
|
2215
2217
|
fa = []
|
2216
2218
|
ha.each_index do |ix|
|
2217
2219
|
fa << DivLogFileEach % [
|
2218
|
-
_a_file(env, cid, enum, lnum, ix, 'file.bin'
|
2220
|
+
_a_file(env, cid, enum, lnum, ix, 'file.bin', ha[ix]),
|
2219
2221
|
ix
|
2220
2222
|
]
|
2221
2223
|
end
|
2222
|
-
files = DivLogFiles % fa.join("\n"
|
2224
|
+
files = DivLogFiles % fa.join("\n")
|
2223
2225
|
else
|
2224
|
-
files = ''
|
2226
|
+
files = ''
|
2225
2227
|
end
|
2226
2228
|
|
2227
2229
|
return DivLog % [
|
@@ -2280,7 +2282,7 @@ class Client
|
|
2280
2282
|
<div class="list-int">%d</div>
|
2281
2283
|
</div>%s%s%s%s
|
2282
2284
|
</div>
|
2283
|
-
</div>'
|
2285
|
+
</div>'
|
2284
2286
|
|
2285
2287
|
|
2286
2288
|
# log action
|
@@ -2289,7 +2291,7 @@ class Client
|
|
2289
2291
|
<div class="list-label">Action:</div>
|
2290
2292
|
<div class="list-hash">%s</div>
|
2291
2293
|
<div class="list-int">%d</div>
|
2292
|
-
</div>'
|
2294
|
+
</div>'
|
2293
2295
|
|
2294
2296
|
|
2295
2297
|
# log index
|
@@ -2298,7 +2300,7 @@ class Client
|
|
2298
2300
|
<div class="list-label">Index:</div>
|
2299
2301
|
<div class="list-hash">%s</div>
|
2300
2302
|
<div class="list-int">%d</div>
|
2301
|
-
</div>'
|
2303
|
+
</div>'
|
2302
2304
|
|
2303
2305
|
|
2304
2306
|
# log case
|
@@ -2307,7 +2309,7 @@ class Client
|
|
2307
2309
|
<div class="list-label">Case:</div>
|
2308
2310
|
<div class="list-hash">%s</div>
|
2309
2311
|
</div>
|
2310
|
-
'
|
2312
|
+
'
|
2311
2313
|
|
2312
2314
|
# log file
|
2313
2315
|
DivLogFiles = '
|
@@ -2315,7 +2317,7 @@ class Client
|
|
2315
2317
|
<div class="list-label">Files:</div>
|
2316
2318
|
<div class="files-list">%s
|
2317
2319
|
</div>
|
2318
|
-
</div>'
|
2320
|
+
</div>'
|
2319
2321
|
|
2320
2322
|
|
2321
2323
|
# log file
|
@@ -2323,7 +2325,7 @@ class Client
|
|
2323
2325
|
<div>
|
2324
2326
|
<div class="list-hash">%s</div>
|
2325
2327
|
<div class="list-int">%d</div>
|
2326
|
-
</div>'
|
2328
|
+
</div>'
|
2327
2329
|
|
2328
2330
|
|
2329
2331
|
###############################################
|
@@ -2342,14 +2344,14 @@ class Client
|
|
2342
2344
|
|
2343
2345
|
links = []
|
2344
2346
|
anum = act['action']
|
2345
|
-
links << _a_entry_edit(env, cid, 0, anum, 'New Entry in Action'
|
2347
|
+
links << _a_entry_edit(env, cid, 0, anum, 'New Entry in Action')
|
2346
2348
|
|
2347
2349
|
lnum = act['log']
|
2348
2350
|
links << _a_log_search(env, {
|
2349
2351
|
'caseid' => cid,
|
2350
2352
|
'action' => anum,
|
2351
|
-
'purpose' => 'Action History'
|
2352
|
-
}, 'History of Action'
|
2353
|
+
'purpose' => 'Action History',
|
2354
|
+
}, 'History of Action')
|
2353
2355
|
|
2354
2356
|
# each task
|
2355
2357
|
tasks = []
|
@@ -2372,13 +2374,13 @@ class Client
|
|
2372
2374
|
end
|
2373
2375
|
|
2374
2376
|
tasks << DivActionTask % [
|
2375
|
-
edit ? 'task-ed'
|
2377
|
+
edit ? 'task-ed' : 'task-ro',
|
2376
2378
|
Rack::Utils.escape_html(tk['assigned']),
|
2377
2379
|
Rack::Utils.escape_html(tk['title']),
|
2378
|
-
tk['status'] ? 'Open'
|
2379
|
-
tk['flag'] ? 'Raised'
|
2380
|
+
tk['status'] ? 'Open' : 'Closed',
|
2381
|
+
tk['flag'] ? 'Raised' : 'Normal',
|
2380
2382
|
_util_time(env, tk['time']),
|
2381
|
-
tags.join(''
|
2383
|
+
tags.join(''),
|
2382
2384
|
]
|
2383
2385
|
end
|
2384
2386
|
|
@@ -2386,8 +2388,8 @@ class Client
|
|
2386
2388
|
_a_case(env, cid, 0, cid),
|
2387
2389
|
_a_action(env, cid, anum, 0, anum.to_s),
|
2388
2390
|
_a_log(env, cid, lnum, lnum.to_s),
|
2389
|
-
links.map{|lk| DivActionLink % lk }.join(''
|
2390
|
-
tasks.join(''
|
2391
|
+
links.map{|lk| DivActionLink % lk }.join(''),
|
2392
|
+
tasks.join('')
|
2391
2393
|
]
|
2392
2394
|
end # def _div_action()
|
2393
2395
|
|
@@ -2419,12 +2421,12 @@ class Client
|
|
2419
2421
|
<div class="sbar-main">%s
|
2420
2422
|
</div>
|
2421
2423
|
|
2422
|
-
</div>'
|
2424
|
+
</div>'
|
2423
2425
|
|
2424
2426
|
|
2425
2427
|
# Action link
|
2426
2428
|
DivActionLink = '
|
2427
|
-
<div>%s</div>'
|
2429
|
+
<div>%s</div>'
|
2428
2430
|
|
2429
2431
|
|
2430
2432
|
# Action task
|
@@ -2455,12 +2457,12 @@ class Client
|
|
2455
2457
|
<div class="list-vert">%s
|
2456
2458
|
</div>
|
2457
2459
|
</div>
|
2458
|
-
</div>'
|
2460
|
+
</div>'
|
2459
2461
|
|
2460
2462
|
|
2461
2463
|
# Action Tag
|
2462
2464
|
DivActionTag = '
|
2463
|
-
<div>%s</div>'
|
2465
|
+
<div>%s</div>'
|
2464
2466
|
|
2465
2467
|
|
2466
2468
|
###############################################
|
@@ -2471,20 +2473,20 @@ class Client
|
|
2471
2473
|
|
2472
2474
|
links = []
|
2473
2475
|
xnum = idx['index']
|
2474
|
-
links << _a_index_edit(env, cid, xnum, 'Edit This Index'
|
2476
|
+
links << _a_index_edit(env, cid, xnum, 'Edit This Index')
|
2475
2477
|
|
2476
2478
|
lnum = idx['log']
|
2477
2479
|
links << _a_log_search(env, {
|
2478
2480
|
'caseid' => cid,
|
2479
2481
|
'index' => xnum,
|
2480
|
-
'purpose' => 'Index History'
|
2482
|
+
'purpose' => 'Index History',
|
2481
2483
|
}, 'History of Index')
|
2482
2484
|
|
2483
2485
|
tags = idx['tags'].map do |tg|
|
2484
2486
|
DivIndexTag % _a_index_search(env, {
|
2485
2487
|
'caseid' => cid,
|
2486
2488
|
'tags' => tg,
|
2487
|
-
'purpose' => 'Index Entries'
|
2489
|
+
'purpose' => 'Index Entries',
|
2488
2490
|
}, tg)
|
2489
2491
|
end
|
2490
2492
|
|
@@ -2492,10 +2494,10 @@ class Client
|
|
2492
2494
|
_a_case(env, cid, 0, cid),
|
2493
2495
|
_a_index(env, cid, xnum, 0, xnum.to_s),
|
2494
2496
|
_a_log(env, cid, lnum, lnum.to_s),
|
2495
|
-
links.map{|lk| DivIndexLink % lk }.join(''
|
2497
|
+
links.map{|lk| DivIndexLink % lk }.join(''),
|
2496
2498
|
Rack::Utils.escape_html(idx['title']),
|
2497
2499
|
Rack::Utils.escape_html(idx['content']),
|
2498
|
-
tags.join(''
|
2500
|
+
tags.join(''),
|
2499
2501
|
]
|
2500
2502
|
end # def _div_index()
|
2501
2503
|
|
@@ -2531,16 +2533,16 @@ class Client
|
|
2531
2533
|
</div>
|
2532
2534
|
</div>
|
2533
2535
|
</div>
|
2534
|
-
</div>'
|
2536
|
+
</div>'
|
2535
2537
|
|
2536
2538
|
|
2537
2539
|
# Index Links
|
2538
2540
|
DivIndexLink = '
|
2539
|
-
<div>%s</div>'
|
2541
|
+
<div>%s</div>'
|
2540
2542
|
|
2541
2543
|
# Index tags
|
2542
2544
|
DivIndexTag = '
|
2543
|
-
<div>%s</div>'
|
2545
|
+
<div>%s</div>'
|
2544
2546
|
|
2545
2547
|
|
2546
2548
|
###############################################
|
@@ -2565,7 +2567,7 @@ class Client
|
|
2565
2567
|
when :string
|
2566
2568
|
para = Rack::Utils.escape_html(val)
|
2567
2569
|
when :boolean
|
2568
|
-
para = val ? 'true'
|
2570
|
+
para = val ? 'true' : 'false'
|
2569
2571
|
when :integer
|
2570
2572
|
para = val.to_s
|
2571
2573
|
when :time
|
@@ -2574,16 +2576,16 @@ class Client
|
|
2574
2576
|
raise NotImplementedError, pr.to_s
|
2575
2577
|
end
|
2576
2578
|
|
2577
|
-
list << '<i>%s:</i> %s'
|
2579
|
+
list << '<i>%s:</i> %s' % [sym, para]
|
2578
2580
|
end
|
2579
2581
|
if list.empty?
|
2580
|
-
paras = ''
|
2582
|
+
paras = ''
|
2581
2583
|
else
|
2582
|
-
paras = ' – ' + list.join(', '
|
2584
|
+
paras = ' – ' + list.join(', ')
|
2583
2585
|
end
|
2584
2586
|
|
2585
2587
|
# enable value
|
2586
|
-
value = disp ? 'true'
|
2588
|
+
value = disp ? 'true' : 'false'
|
2587
2589
|
|
2588
2590
|
return _div_desc(purp, DivQuery % [ type, paras, value ])
|
2589
2591
|
end # def _div_query()
|
@@ -2599,7 +2601,7 @@ class Client
|
|
2599
2601
|
Click to display search form.
|
2600
2602
|
</div></div>
|
2601
2603
|
%s
|
2602
|
-
<input name="que-enable" id="que-ena" type="hidden" value="%s">'
|
2604
|
+
<input name="que-enable" id="que-ena" type="hidden" value="%s">'
|
2603
2605
|
|
2604
2606
|
|
2605
2607
|
###########################################################
|
@@ -2617,114 +2619,114 @@ class Client
|
|
2617
2619
|
|
2618
2620
|
case sym
|
2619
2621
|
when :caseid
|
2620
|
-
ilabel = 'Case ID'
|
2621
|
-
iclass = 'form-caseid'
|
2622
|
-
ihint = 'Filter for a specific case.'
|
2622
|
+
ilabel = 'Case ID'
|
2623
|
+
iclass = 'form-caseid'
|
2624
|
+
ihint = 'Filter for a specific case.'
|
2623
2625
|
when :title
|
2624
|
-
ilabel = 'Title'
|
2625
|
-
iclass = 'form-title'
|
2626
|
-
ihint = 'Text search within the title.'
|
2626
|
+
ilabel = 'Title'
|
2627
|
+
iclass = 'form-title'
|
2628
|
+
ihint = 'Text search within the title.'
|
2627
2629
|
when :prefix
|
2628
|
-
ilabel = 'Prefix'
|
2629
|
-
iclass = 'form-title'
|
2630
|
-
ihint = 'Filter for titles starting with fixed text.'
|
2630
|
+
ilabel = 'Prefix'
|
2631
|
+
iclass = 'form-title'
|
2632
|
+
ihint = 'Filter for titles starting with fixed text.'
|
2631
2633
|
when :content
|
2632
|
-
ilabel = 'Content'
|
2633
|
-
iclass = 'form-content'
|
2634
|
-
ihint = 'Text search within the content.'
|
2634
|
+
ilabel = 'Content'
|
2635
|
+
iclass = 'form-content'
|
2636
|
+
ihint = 'Text search within the content.'
|
2635
2637
|
when :tags
|
2636
|
-
ilabel = 'Tag'
|
2637
|
-
iclass = 'form-tag'
|
2638
|
-
ihint = 'Filter for only a specific tag.'
|
2638
|
+
ilabel = 'Tag'
|
2639
|
+
iclass = 'form-tag'
|
2640
|
+
ihint = 'Filter for only a specific tag.'
|
2639
2641
|
when :action
|
2640
|
-
ilabel = 'Action'
|
2641
|
-
iclass = 'form-int'
|
2642
|
-
ihint = 'Filter for a specific action (by number).'
|
2642
|
+
ilabel = 'Action'
|
2643
|
+
iclass = 'form-int'
|
2644
|
+
ihint = 'Filter for a specific action (by number).'
|
2643
2645
|
when :before
|
2644
|
-
ilabel = 'Before'
|
2645
|
-
iclass = 'form-time'
|
2646
|
-
ihint = 'Filter for items occuring before this date and time.'
|
2646
|
+
ilabel = 'Before'
|
2647
|
+
iclass = 'form-time'
|
2648
|
+
ihint = 'Filter for items occuring before this date and time.'
|
2647
2649
|
when :after
|
2648
|
-
ilabel = 'After'
|
2649
|
-
iclass = 'form-time'
|
2650
|
-
ihint = 'Filter for items occuring after this date and time.'
|
2650
|
+
ilabel = 'After'
|
2651
|
+
iclass = 'form-time'
|
2652
|
+
ihint = 'Filter for items occuring after this date and time.'
|
2651
2653
|
when :credit
|
2652
|
-
ilabel = 'Credit'
|
2653
|
-
iclass = 'form-usergrp'
|
2654
|
-
ihint = 'Filter for stats crediting this user or role.'
|
2654
|
+
ilabel = 'Credit'
|
2655
|
+
iclass = 'form-usergrp'
|
2656
|
+
ihint = 'Filter for stats crediting this user or role.'
|
2655
2657
|
when :size
|
2656
|
-
ilabel = 'Size'
|
2657
|
-
iclass = 'form-int'
|
2658
|
-
ihint = 'Number of results to be returned per page.'
|
2658
|
+
ilabel = 'Size'
|
2659
|
+
iclass = 'form-int'
|
2660
|
+
ihint = 'Number of results to be returned per page.'
|
2659
2661
|
when :page
|
2660
2662
|
next
|
2661
2663
|
when :sort
|
2662
|
-
ilabel = 'Sort'
|
2663
|
-
iclass = 'form-sort'
|
2664
|
-
ihint = 'How to sort the results.'
|
2664
|
+
ilabel = 'Sort'
|
2665
|
+
iclass = 'form-sort'
|
2666
|
+
ihint = 'How to sort the results.'
|
2665
2667
|
when :purpose
|
2666
2668
|
next
|
2667
2669
|
when :user
|
2668
|
-
ilabel = 'User'
|
2669
|
-
iclass = 'form-usergrp'
|
2670
|
-
ihint = 'Filter for logs authored by this user.'
|
2670
|
+
ilabel = 'User'
|
2671
|
+
iclass = 'form-usergrp'
|
2672
|
+
ihint = 'Filter for logs authored by this user.'
|
2671
2673
|
when :grantee
|
2672
|
-
ilabel = 'Grantee'
|
2673
|
-
iclass = 'form-usergrp'
|
2674
|
-
ihint = 'Filter for cases granting this user or role a permission.'
|
2674
|
+
ilabel = 'Grantee'
|
2675
|
+
iclass = 'form-usergrp'
|
2676
|
+
ihint = 'Filter for cases granting this user or role a permission.'
|
2675
2677
|
when :perm
|
2676
|
-
ilabel = 'Permission'
|
2677
|
-
iclass = 'form-perm'
|
2678
|
-
ihint = 'Filter for cases granting this permission.'
|
2678
|
+
ilabel = 'Permission'
|
2679
|
+
iclass = 'form-perm'
|
2680
|
+
ihint = 'Filter for cases granting this permission.'
|
2679
2681
|
when :entry
|
2680
|
-
ilabel = 'Entry'
|
2681
|
-
iclass = 'form-int'
|
2682
|
-
ihint = 'Filter for logs recording specified entry (by number).'
|
2682
|
+
ilabel = 'Entry'
|
2683
|
+
iclass = 'form-int'
|
2684
|
+
ihint = 'Filter for logs recording specified entry (by number).'
|
2683
2685
|
when :index
|
2684
|
-
ilabel = 'Index'
|
2685
|
-
iclass = 'form-int'
|
2686
|
-
ihint = 'Filter for specified index (by number).'
|
2686
|
+
ilabel = 'Index'
|
2687
|
+
iclass = 'form-int'
|
2688
|
+
ihint = 'Filter for specified index (by number).'
|
2687
2689
|
when :assigned
|
2688
|
-
ilabel = 'Assigned'
|
2689
|
-
iclass = 'form-usergrp'
|
2690
|
-
ihint = 'Filter for tasks assigned to specified user or role.'
|
2690
|
+
ilabel = 'Assigned'
|
2691
|
+
iclass = 'form-usergrp'
|
2692
|
+
ihint = 'Filter for tasks assigned to specified user or role.'
|
2691
2693
|
when :status
|
2692
|
-
ilabel = 'Status'
|
2693
|
-
iclass = 'form-boolean'
|
2694
|
-
ihint = 'Filter for open items. Use true or false.'
|
2694
|
+
ilabel = 'Status'
|
2695
|
+
iclass = 'form-boolean'
|
2696
|
+
ihint = 'Filter for open items. Use true or false.'
|
2695
2697
|
when :flag
|
2696
|
-
ilabel = 'Flag'
|
2697
|
-
iclass = 'form-boolean'
|
2698
|
-
ihint = 'Filter for flagged tasks. Use true or false.'
|
2698
|
+
ilabel = 'Flag'
|
2699
|
+
iclass = 'form-boolean'
|
2700
|
+
ihint = 'Filter for flagged tasks. Use true or false.'
|
2699
2701
|
when :template
|
2700
|
-
ilabel = 'Template'
|
2701
|
-
iclass = 'form-boolean'
|
2702
|
-
ihint = 'Filter for template cases. Use true or false.'
|
2702
|
+
ilabel = 'Template'
|
2703
|
+
iclass = 'form-boolean'
|
2704
|
+
ihint = 'Filter for template cases. Use true or false.'
|
2703
2705
|
when :stat
|
2704
|
-
ilabel = 'Stat'
|
2705
|
-
iclass = 'form-boolean'
|
2706
|
-
ihint = 'Filter for stats by name. Use true or false.'
|
2706
|
+
ilabel = 'Stat'
|
2707
|
+
iclass = 'form-boolean'
|
2708
|
+
ihint = 'Filter for stats by name. Use true or false.'
|
2707
2709
|
else
|
2708
2710
|
raise NotImplementedError, sym.to_s
|
2709
2711
|
end
|
2710
2712
|
|
2711
2713
|
case pr
|
2712
2714
|
when :string
|
2713
|
-
itype = 'text'
|
2714
|
-
ivalue = query[sym] || ''
|
2715
|
+
itype = 'text'
|
2716
|
+
ivalue = query[sym] || ''
|
2715
2717
|
when :boolean
|
2716
|
-
itype = 'text'
|
2718
|
+
itype = 'text'
|
2717
2719
|
if query[sym].nil?
|
2718
|
-
ivalue = ''
|
2720
|
+
ivalue = ''
|
2719
2721
|
else
|
2720
|
-
ivalue = query[sym] ? 'true'
|
2722
|
+
ivalue = query[sym] ? 'true' : 'false'
|
2721
2723
|
end
|
2722
2724
|
when :integer
|
2723
|
-
itype = 'text'
|
2725
|
+
itype = 'text'
|
2724
2726
|
ivalue = query[sym] ? query[sym].to_s : ''
|
2725
2727
|
when :time
|
2726
|
-
itype = 'text'
|
2727
|
-
ivalue = query[sym] ? _util_time(env, query[sym]) : ''
|
2728
|
+
itype = 'text'
|
2729
|
+
ivalue = query[sym] ? _util_time(env, query[sym]) : ''
|
2728
2730
|
else
|
2729
2731
|
raise NotImplementedError, pr.to_s
|
2730
2732
|
end
|
@@ -2733,12 +2735,12 @@ class Client
|
|
2733
2735
|
end
|
2734
2736
|
|
2735
2737
|
# display the form
|
2736
|
-
formClass = disp ? ''
|
2738
|
+
formClass = disp ? '' : ' hidden'
|
2737
2739
|
|
2738
2740
|
return FormQuery % [
|
2739
2741
|
formClass,
|
2740
2742
|
act,
|
2741
|
-
inputs.join(''
|
2743
|
+
inputs.join('')
|
2742
2744
|
]
|
2743
2745
|
end # def _form_query
|
2744
2746
|
|
@@ -2747,7 +2749,7 @@ class Client
|
|
2747
2749
|
FormQuery = '
|
2748
2750
|
<div class="form%s" id="que-form"><form method="get" action="%s">%s
|
2749
2751
|
<input class="submit" type="submit" value="Search">
|
2750
|
-
</form></div>'
|
2752
|
+
</form></div>'
|
2751
2753
|
|
2752
2754
|
|
2753
2755
|
# Query form item
|
@@ -2758,14 +2760,14 @@ class Client
|
|
2758
2760
|
<div class="tip"><div class="tip-disp"></div><div class="tip-info">
|
2759
2761
|
%s
|
2760
2762
|
</div></div>
|
2761
|
-
</div>'
|
2763
|
+
</div>'
|
2762
2764
|
|
2763
2765
|
|
2764
2766
|
###############################################
|
2765
2767
|
# Case form
|
2766
2768
|
def _form_case(env, cse)
|
2767
2769
|
|
2768
|
-
status = ' checked'
|
2770
|
+
status = ' checked' if cse['status']
|
2769
2771
|
|
2770
2772
|
# tags
|
2771
2773
|
tags_cnt = 0
|
@@ -2774,9 +2776,9 @@ class Client
|
|
2774
2776
|
tags_cnt = tags_cnt + 1
|
2775
2777
|
FormCaseTag % [ tags_cnt, Rack::Utils.escape_html(tg) ]
|
2776
2778
|
end
|
2777
|
-
tags = tags_list.join(''
|
2779
|
+
tags = tags_list.join('')
|
2778
2780
|
else
|
2779
|
-
tags = ''
|
2781
|
+
tags = ''
|
2780
2782
|
end
|
2781
2783
|
|
2782
2784
|
# stats
|
@@ -2786,9 +2788,9 @@ class Client
|
|
2786
2788
|
stats_cnt += 1
|
2787
2789
|
FormCaseStat % [stats_cnt, Rack::Utils.escape_html(st)]
|
2788
2790
|
end
|
2789
|
-
stats = stats_list.join(''
|
2791
|
+
stats = stats_list.join('')
|
2790
2792
|
else
|
2791
|
-
stats = ''
|
2793
|
+
stats = ''
|
2792
2794
|
end
|
2793
2795
|
|
2794
2796
|
# access
|
@@ -2807,7 +2809,7 @@ class Client
|
|
2807
2809
|
FormCaseAccess % [
|
2808
2810
|
acc_cnt, grant_cnt,
|
2809
2811
|
acc_cnt, Rack::Utils.escape_html(ad['perm']),
|
2810
|
-
grants.join(''
|
2812
|
+
grants.join(''),
|
2811
2813
|
]
|
2812
2814
|
end
|
2813
2815
|
|
@@ -2815,7 +2817,7 @@ class Client
|
|
2815
2817
|
Rack::Utils.escape_html(cse['title']),
|
2816
2818
|
status,
|
2817
2819
|
tags_cnt, tags,
|
2818
|
-
acc_cnt, acc_list.join(''
|
2820
|
+
acc_cnt, acc_list.join(''),
|
2819
2821
|
stats_cnt, stats,
|
2820
2822
|
]
|
2821
2823
|
end # def _form_case()
|
@@ -2898,7 +2900,7 @@ class Client
|
|
2898
2900
|
<div class="stat-list" id="cse-stat-list">
|
2899
2901
|
<input type="hidden" name="cse-stat" value="%d">%s
|
2900
2902
|
</div>
|
2901
|
-
</div>'
|
2903
|
+
</div>'
|
2902
2904
|
|
2903
2905
|
|
2904
2906
|
# Case form Tag each
|
@@ -2907,7 +2909,7 @@ class Client
|
|
2907
2909
|
<input class="form-tag" type="text" name="cse-tag-%d" value="%s">
|
2908
2910
|
<button class="form-del" type="button" onclick="delDiv(this)">X
|
2909
2911
|
</button>
|
2910
|
-
</div>'
|
2912
|
+
</div>'
|
2911
2913
|
|
2912
2914
|
|
2913
2915
|
# Case form Stat each
|
@@ -2916,7 +2918,7 @@ class Client
|
|
2916
2918
|
<input class="form-stat" type="text" name="cse-stat-%d" value="%s">
|
2917
2919
|
<button class="form-del" type="button" onclick="delDiv(this)">X
|
2918
2920
|
</button>
|
2919
|
-
</div>'
|
2921
|
+
</div>'
|
2920
2922
|
|
2921
2923
|
|
2922
2924
|
# Case form Access each
|
@@ -2930,14 +2932,14 @@ class Client
|
|
2930
2932
|
<button class="add-grant" type="button"
|
2931
2933
|
onclick="cseAddGrant(this)">+
|
2932
2934
|
</button>
|
2933
|
-
</div>'
|
2935
|
+
</div>'
|
2934
2936
|
|
2935
2937
|
# Case form Grant each
|
2936
2938
|
FormCaseGrant = '
|
2937
2939
|
<div>
|
2938
2940
|
<input class="form-usergrp" type="text" name="cse-acc-%d-%d"
|
2939
2941
|
value="%s">
|
2940
|
-
</div>'
|
2942
|
+
</div>'
|
2941
2943
|
|
2942
2944
|
|
2943
2945
|
#############################################
|
@@ -2950,21 +2952,21 @@ class Client
|
|
2950
2952
|
if ent && ent['title']
|
2951
2953
|
title = Rack::Utils.escape_html(ent['title'])
|
2952
2954
|
else
|
2953
|
-
title = ''
|
2955
|
+
title = ''
|
2954
2956
|
end
|
2955
2957
|
|
2956
2958
|
# time
|
2957
2959
|
if ent && ent['time']
|
2958
2960
|
time = _util_time(env, ent['time'])
|
2959
2961
|
else
|
2960
|
-
time = ''
|
2962
|
+
time = ''
|
2961
2963
|
end
|
2962
2964
|
|
2963
2965
|
# content
|
2964
2966
|
if ent && ent['content']
|
2965
2967
|
content = Rack::Utils.escape_html(ent['content'])
|
2966
2968
|
else
|
2967
|
-
content = ''
|
2969
|
+
content = ''
|
2968
2970
|
end
|
2969
2971
|
|
2970
2972
|
# files
|
@@ -2979,9 +2981,9 @@ class Client
|
|
2979
2981
|
files_cnt, fd['num'], fd['log']
|
2980
2982
|
]
|
2981
2983
|
end
|
2982
|
-
files = files_list.join("\n"
|
2984
|
+
files = files_list.join("\n")
|
2983
2985
|
else
|
2984
|
-
files = ''
|
2986
|
+
files = ''
|
2985
2987
|
end
|
2986
2988
|
|
2987
2989
|
# tags
|
@@ -2991,9 +2993,9 @@ class Client
|
|
2991
2993
|
tags_cnt = tags_cnt + 1
|
2992
2994
|
FormEntryTagEach % [tags_cnt, Rack::Utils.escape_html(tg)]
|
2993
2995
|
end
|
2994
|
-
tags = tags_list.join(''
|
2996
|
+
tags = tags_list.join('')
|
2995
2997
|
else
|
2996
|
-
tags = ''
|
2998
|
+
tags = ''
|
2997
2999
|
end
|
2998
3000
|
|
2999
3001
|
# indexes
|
@@ -3007,9 +3009,9 @@ class Client
|
|
3007
3009
|
Rack::Utils.escape_html(idx['title'])
|
3008
3010
|
]
|
3009
3011
|
end
|
3010
|
-
index = idx_list.join(''
|
3012
|
+
index = idx_list.join('')
|
3011
3013
|
else
|
3012
|
-
index = ''
|
3014
|
+
index = ''
|
3013
3015
|
end
|
3014
3016
|
|
3015
3017
|
# stats select
|
@@ -3017,7 +3019,7 @@ class Client
|
|
3017
3019
|
esc = Rack::Utils.escape_html(stat)
|
3018
3020
|
FormEntryStatOpt % [esc, esc]
|
3019
3021
|
end
|
3020
|
-
stats_sel = FormEntryStatSel % stats_sel.join(''
|
3022
|
+
stats_sel = FormEntryStatSel % stats_sel.join('')
|
3021
3023
|
|
3022
3024
|
# stats count & list
|
3023
3025
|
stats_cnt = 0
|
@@ -3038,12 +3040,12 @@ class Client
|
|
3038
3040
|
stats_cnt, claim_cnt,
|
3039
3041
|
stats_cnt, esc, esc,
|
3040
3042
|
stats_cnt, st['value'].to_s,
|
3041
|
-
claims.join(''
|
3043
|
+
claims.join('')
|
3042
3044
|
]
|
3043
3045
|
end
|
3044
|
-
stats = stats_list.join(''
|
3046
|
+
stats = stats_list.join('')
|
3045
3047
|
else
|
3046
|
-
stats = ''
|
3048
|
+
stats = ''
|
3047
3049
|
end
|
3048
3050
|
|
3049
3051
|
# perms select
|
@@ -3052,7 +3054,7 @@ class Client
|
|
3052
3054
|
esc = Rack::Utils.escape_html(pm)
|
3053
3055
|
FormEntryPermOpt % [esc, esc]
|
3054
3056
|
end
|
3055
|
-
perms_sel = perms_sel.join(''
|
3057
|
+
perms_sel = perms_sel.join('')
|
3056
3058
|
|
3057
3059
|
# perms count & list
|
3058
3060
|
perms_cnt = 0
|
@@ -3062,9 +3064,9 @@ class Client
|
|
3062
3064
|
esc = Rack::Utils.escape_html(pm)
|
3063
3065
|
FormEntryPermEach % [esc, perms_cnt, esc]
|
3064
3066
|
end
|
3065
|
-
perms = perms_list.join(''
|
3067
|
+
perms = perms_list.join('')
|
3066
3068
|
else
|
3067
|
-
perms = ''
|
3069
|
+
perms = ''
|
3068
3070
|
end
|
3069
3071
|
|
3070
3072
|
return FormEntry % [
|
@@ -3208,7 +3210,7 @@ class Client
|
|
3208
3210
|
<input type="hidden" name="ent-perm-cnt" id="ent-perm-cnt" value="%d">
|
3209
3211
|
<div class="perms-list" id="ent-perm-list">%s
|
3210
3212
|
</div>
|
3211
|
-
</div>'
|
3213
|
+
</div>'
|
3212
3214
|
|
3213
3215
|
|
3214
3216
|
# Entry form tag each
|
@@ -3217,7 +3219,7 @@ class Client
|
|
3217
3219
|
<input class="form-tag" type="text" name="ent-tag-%d" value="%s">
|
3218
3220
|
<button class="form-del" type="button" onclick="delDiv(this)">X
|
3219
3221
|
</button>
|
3220
|
-
</div>'
|
3222
|
+
</div>'
|
3221
3223
|
|
3222
3224
|
|
3223
3225
|
# Entry form index each
|
@@ -3226,7 +3228,7 @@ class Client
|
|
3226
3228
|
<input type="hidden" name="ent-idx-%d" value="%d">%s
|
3227
3229
|
<button class="form-del" type="button" onclick="delDiv(this)">X
|
3228
3230
|
</button>
|
3229
|
-
</div>'
|
3231
|
+
</div>'
|
3230
3232
|
|
3231
3233
|
|
3232
3234
|
# Entry form Perm each
|
@@ -3235,12 +3237,12 @@ class Client
|
|
3235
3237
|
<input type="hidden" name="ent-perm-%d" value="%s">
|
3236
3238
|
<button class="form-del" type="button" onclick="delDiv(this)">X
|
3237
3239
|
</button>
|
3238
|
-
</div>'
|
3240
|
+
</div>'
|
3239
3241
|
|
3240
3242
|
|
3241
3243
|
# Entry form Perm option
|
3242
3244
|
FormEntryPermOpt = '
|
3243
|
-
<option value="%s">%s</option>'
|
3245
|
+
<option value="%s">%s</option>'
|
3244
3246
|
|
3245
3247
|
|
3246
3248
|
# Entry form file each
|
@@ -3252,18 +3254,18 @@ class Client
|
|
3252
3254
|
<input type="hidden" name="ent-file-%d-num" value="%d-%d">
|
3253
3255
|
<button class="form-del" type="button" onclick="delDiv(this)">X
|
3254
3256
|
</button>
|
3255
|
-
</div>'
|
3257
|
+
</div>'
|
3256
3258
|
|
3257
3259
|
|
3258
3260
|
# Entry form Stat option
|
3259
3261
|
FormEntryStatOpt = '
|
3260
|
-
<option value="%s">%s</option>'
|
3262
|
+
<option value="%s">%s</option>'
|
3261
3263
|
|
3262
3264
|
|
3263
3265
|
# Entry form Stat select
|
3264
3266
|
FormEntryStatSel = '
|
3265
3267
|
<select class="stat-sel" id="ent-stat-sel" name="ent-stat-sel">%s
|
3266
|
-
</select>'
|
3268
|
+
</select>'
|
3267
3269
|
|
3268
3270
|
|
3269
3271
|
# Entry form Stat each
|
@@ -3279,7 +3281,7 @@ class Client
|
|
3279
3281
|
<button class="add-claim" type="button"
|
3280
3282
|
onClick="entAddClaim(this)">+
|
3281
3283
|
</button>
|
3282
|
-
</div>'
|
3284
|
+
</div>'
|
3283
3285
|
|
3284
3286
|
|
3285
3287
|
# Entry form Stat Claim
|
@@ -3287,7 +3289,7 @@ class Client
|
|
3287
3289
|
<div>
|
3288
3290
|
<input class="form-usergrp" type="text" name="ent-stat-%d-%d"
|
3289
3291
|
value="%s">
|
3290
|
-
</div>'
|
3292
|
+
</div>'
|
3291
3293
|
|
3292
3294
|
|
3293
3295
|
###############################################
|
@@ -3300,7 +3302,7 @@ class Client
|
|
3300
3302
|
if !act
|
3301
3303
|
ta = [{
|
3302
3304
|
'assigned' => ICFS::UserCase,
|
3303
|
-
'title' => ''
|
3305
|
+
'title' => '',
|
3304
3306
|
'status' => true,
|
3305
3307
|
'flag' => true,
|
3306
3308
|
'time' => nil,
|
@@ -3314,7 +3316,7 @@ class Client
|
|
3314
3316
|
al = api.access_list(cid)
|
3315
3317
|
perm_act = al.include?(ICFS::PermAction)
|
3316
3318
|
if !perm_act && !act
|
3317
|
-
raise(Error::Perms, 'Missing perm: %s'
|
3319
|
+
raise(Error::Perms, 'Missing perm: %s' % ICFS::PermAction)
|
3318
3320
|
end
|
3319
3321
|
|
3320
3322
|
# get user/group list
|
@@ -3324,13 +3326,13 @@ class Client
|
|
3324
3326
|
|
3325
3327
|
# editing
|
3326
3328
|
if opt[:edit]
|
3327
|
-
ena_val = 'true'
|
3328
|
-
ena_class_add = ''
|
3329
|
-
ena_class_tasks = ''
|
3329
|
+
ena_val = 'true'
|
3330
|
+
ena_class_add = ''
|
3331
|
+
ena_class_tasks = ''
|
3330
3332
|
else
|
3331
|
-
ena_val = 'false'
|
3332
|
-
ena_class_add = ' invisible'
|
3333
|
-
ena_class_tasks = ' hidden'
|
3333
|
+
ena_val = 'false'
|
3334
|
+
ena_class_add = ' invisible'
|
3335
|
+
ena_class_tasks = ' hidden'
|
3334
3336
|
end
|
3335
3337
|
|
3336
3338
|
# each task
|
@@ -3355,18 +3357,18 @@ class Client
|
|
3355
3357
|
title = FormActionTitleEd % [
|
3356
3358
|
ix, Rack::Utils.escape_html(tk['title']) ]
|
3357
3359
|
status = FormActionStatusEd % [
|
3358
|
-
ix, tk['status'] ? ' checked'
|
3360
|
+
ix, tk['status'] ? ' checked' : '' ]
|
3359
3361
|
flag = FormActionFlagEd % [
|
3360
|
-
ix, tk['flag'] ? ' checked'
|
3362
|
+
ix, tk['flag'] ? ' checked' : '' ]
|
3361
3363
|
if tk['time']
|
3362
3364
|
time = FormActionTimeEd % [ ix, _util_time(env, tk['time']) ]
|
3363
3365
|
else
|
3364
|
-
time = FormActionTimeEd % [ix, ''
|
3366
|
+
time = FormActionTimeEd % [ix, '']
|
3365
3367
|
end
|
3366
3368
|
|
3367
3369
|
if tk['tags'][0] == ICFS::TagNone
|
3368
3370
|
tags_cnt = 1
|
3369
|
-
tags = FormActionTagEd % [ix, 1, ''
|
3371
|
+
tags = FormActionTagEd % [ix, 1, '']
|
3370
3372
|
else
|
3371
3373
|
tags_cnt = 0
|
3372
3374
|
tags = tk['tags'].map do |tg|
|
@@ -3374,7 +3376,7 @@ class Client
|
|
3374
3376
|
FormActionTagEd % [
|
3375
3377
|
ix, tags_cnt, Rack::Utils.escape_html(tg) ]
|
3376
3378
|
end
|
3377
|
-
tags = tags.join(''
|
3379
|
+
tags = tags.join('')
|
3378
3380
|
end
|
3379
3381
|
|
3380
3382
|
tag_list = 'act-%d-tag-list' % ix
|
@@ -3385,13 +3387,13 @@ class Client
|
|
3385
3387
|
esc = Rack::Utils.escape_html(tk['title'])
|
3386
3388
|
title = FormActionTitleRo % [ ix, esc, esc ]
|
3387
3389
|
status = FormActionStatusRo % [ ix,
|
3388
|
-
tk['status'] ? 'true'
|
3389
|
-
tk['status'] ? 'Open'
|
3390
|
+
tk['status'] ? 'true' : 'false',
|
3391
|
+
tk['status'] ? 'Open' : 'Closed',
|
3390
3392
|
]
|
3391
3393
|
if tk['flag']
|
3392
3394
|
flag = FormActionFlagRo % ix
|
3393
3395
|
else
|
3394
|
-
flag = FormActionFlagEd % [ ix, ''
|
3396
|
+
flag = FormActionFlagEd % [ ix, '' ]
|
3395
3397
|
end
|
3396
3398
|
esc = _util_time(env, tk['time'])
|
3397
3399
|
time = FormActionTimeRo % [ ix, esc, esc ]
|
@@ -3403,17 +3405,17 @@ class Client
|
|
3403
3405
|
esc = Rack::Utils.escape_html(tg)
|
3404
3406
|
FormActionTagRo % [ ix, tags_cnt, esc, esc ]
|
3405
3407
|
end
|
3406
|
-
tags = tags.join(''
|
3408
|
+
tags = tags.join('')
|
3407
3409
|
else
|
3408
|
-
tags = ''
|
3410
|
+
tags = ''
|
3409
3411
|
end
|
3410
3412
|
|
3411
|
-
tag_add = ''
|
3413
|
+
tag_add = ''
|
3412
3414
|
|
3413
3415
|
end
|
3414
3416
|
|
3415
3417
|
tasks << FormActionTask % [
|
3416
|
-
edit ? 'ed'
|
3418
|
+
edit ? 'ed' : 'ro',
|
3417
3419
|
ug, title, status, flag, time, ix, ix, tags_cnt, tags, tag_add
|
3418
3420
|
]
|
3419
3421
|
end
|
@@ -3425,7 +3427,7 @@ class Client
|
|
3425
3427
|
tasks.size,
|
3426
3428
|
act ? act['action'] : 0,
|
3427
3429
|
ena_class_tasks,
|
3428
|
-
tasks.join(''
|
3430
|
+
tasks.join('')
|
3429
3431
|
]
|
3430
3432
|
end # def _form_action()
|
3431
3433
|
|
@@ -3456,7 +3458,7 @@ class Client
|
|
3456
3458
|
</div>
|
3457
3459
|
<div id="act-tasks" class="%s">%s
|
3458
3460
|
</div>
|
3459
|
-
</div>'
|
3461
|
+
</div>'
|
3460
3462
|
|
3461
3463
|
|
3462
3464
|
# action task
|
@@ -3504,66 +3506,66 @@ class Client
|
|
3504
3506
|
<input type="hidden" name="act-%d-tag" value="%d">%s
|
3505
3507
|
</div>%s
|
3506
3508
|
</div>
|
3507
|
-
</div>'
|
3509
|
+
</div>'
|
3508
3510
|
|
3509
3511
|
|
3510
3512
|
# action tasked editable
|
3511
3513
|
FormActionTaskedEd = '
|
3512
3514
|
<input class="form-usergrp" name="act-%d-task" type="text"
|
3513
|
-
value="%s">'
|
3515
|
+
value="%s">'
|
3514
3516
|
|
3515
3517
|
|
3516
3518
|
# action tasked read only
|
3517
3519
|
FormActionTaskedRo = '
|
3518
3520
|
<input name="act-%d-task" type="hidden" value="%s">
|
3519
|
-
<div class="list-usergrp">%s</div>'
|
3521
|
+
<div class="list-usergrp">%s</div>'
|
3520
3522
|
|
3521
3523
|
|
3522
3524
|
# action title editable
|
3523
3525
|
FormActionTitleEd = '
|
3524
3526
|
<input class="form-title" name="act-%d-title" type="text"
|
3525
|
-
value="%s">'
|
3527
|
+
value="%s">'
|
3526
3528
|
|
3527
3529
|
|
3528
3530
|
# action title read only
|
3529
3531
|
FormActionTitleRo = '
|
3530
3532
|
<input name="act-%d-title" type="hidden" value="%s">
|
3531
|
-
<div class="list-title">%s</div>'
|
3533
|
+
<div class="list-title">%s</div>'
|
3532
3534
|
|
3533
3535
|
|
3534
3536
|
# action open editable
|
3535
3537
|
FormActionStatusEd = '
|
3536
3538
|
<input class="form-check" name="act-%d-status" type="checkbox"
|
3537
|
-
value="true"%s>'
|
3539
|
+
value="true"%s>'
|
3538
3540
|
|
3539
3541
|
# action open readonly
|
3540
3542
|
FormActionStatusRo = '
|
3541
3543
|
<input name="act-%d-status" type="hidden" value="%s">
|
3542
|
-
<div class="item-boolean">%s</div>'
|
3544
|
+
<div class="item-boolean">%s</div>'
|
3543
3545
|
|
3544
3546
|
|
3545
3547
|
# action flag editable
|
3546
3548
|
FormActionFlagEd = '
|
3547
3549
|
<input class="form-check" name="act-%d-flag" type="checkbox"
|
3548
|
-
value="true"%s>'
|
3550
|
+
value="true"%s>'
|
3549
3551
|
|
3550
3552
|
|
3551
3553
|
# action flag read-only
|
3552
3554
|
FormActionFlagRo = '
|
3553
3555
|
<input name="act-%d-flag" type="hidden" value="true">
|
3554
|
-
<div class="item-boolean">flagged</div>'
|
3556
|
+
<div class="item-boolean">flagged</div>'
|
3555
3557
|
|
3556
3558
|
|
3557
3559
|
# action time editable
|
3558
3560
|
FormActionTimeEd = '
|
3559
3561
|
<input class="form-time" name="act-%d-time" type="text"
|
3560
|
-
value="%s">'
|
3562
|
+
value="%s">'
|
3561
3563
|
|
3562
3564
|
|
3563
3565
|
# action time read-only
|
3564
3566
|
FormActionTimeRo = '
|
3565
3567
|
<input name="act-%d-time" type="hidden" value="%s">
|
3566
|
-
<div class="item-time">%s</div>'
|
3568
|
+
<div class="item-time">%s</div>'
|
3567
3569
|
|
3568
3570
|
|
3569
3571
|
# action tag editable
|
@@ -3572,20 +3574,20 @@ class Client
|
|
3572
3574
|
<input class="form-tag" type="text" name="act-%d-tag-%d"
|
3573
3575
|
value="%s"><button class="form-del" type="button"
|
3574
3576
|
onclick="delDiv(this)">X</button>
|
3575
|
-
</div>'
|
3577
|
+
</div>'
|
3576
3578
|
|
3577
3579
|
|
3578
3580
|
# action tag read-only
|
3579
3581
|
FormActionTagRo = '
|
3580
3582
|
<div>
|
3581
3583
|
<input type="hidden" name="act-%d-tag-%d" value="%s">%s
|
3582
|
-
</div>'
|
3584
|
+
</div>'
|
3583
3585
|
|
3584
3586
|
|
3585
3587
|
# action tag button
|
3586
3588
|
FormActionTagButton = '
|
3587
3589
|
<button class="tag-add" type="button"
|
3588
|
-
onClick="addTag("%s")">+</button>'
|
3590
|
+
onClick="addTag("%s")">+</button>'
|
3589
3591
|
|
3590
3592
|
|
3591
3593
|
###############################################
|
@@ -3596,14 +3598,14 @@ class Client
|
|
3596
3598
|
if idx && idx['title']
|
3597
3599
|
title = Rack::Utils.escape_html(idx['title'])
|
3598
3600
|
else
|
3599
|
-
title = ''
|
3601
|
+
title = ''
|
3600
3602
|
end
|
3601
3603
|
|
3602
3604
|
# content
|
3603
3605
|
if idx && idx['content']
|
3604
3606
|
content = Rack::Utils.escape_html(idx['content'])
|
3605
3607
|
else
|
3606
|
-
content = ''
|
3608
|
+
content = ''
|
3607
3609
|
end
|
3608
3610
|
|
3609
3611
|
# tags
|
@@ -3613,9 +3615,9 @@ class Client
|
|
3613
3615
|
tags_cnt += 1
|
3614
3616
|
FormIndexTagEach % [tags_cnt, Rack::Utils.escape_html(tg)]
|
3615
3617
|
end
|
3616
|
-
tags = tags_list.join(''
|
3618
|
+
tags = tags_list.join('')
|
3617
3619
|
else
|
3618
|
-
tags = ''
|
3620
|
+
tags = ''
|
3619
3621
|
end
|
3620
3622
|
|
3621
3623
|
return FormIndex % [
|
@@ -3669,22 +3671,21 @@ class Client
|
|
3669
3671
|
<div class="tag-list" id="idx-tag-list">
|
3670
3672
|
<input type="hidden" name="idx-tag" value="%d">%s
|
3671
3673
|
</div>
|
3672
|
-
</div> '
|
3674
|
+
</div> '
|
3673
3675
|
|
3674
3676
|
|
3675
3677
|
# Index form tag
|
3676
3678
|
FormIndexTagEach = '
|
3677
3679
|
<div>
|
3678
3680
|
<input class="form-tag" type="text" name="idx-tag-%d" value="%s">
|
3679
|
-
</div>'
|
3681
|
+
</div>'
|
3680
3682
|
|
3681
3683
|
|
3682
3684
|
###############################################
|
3683
3685
|
# Config Form
|
3684
3686
|
#
|
3685
3687
|
def _form_config(env)
|
3686
|
-
|
3687
|
-
tz = cfg.get('tz')
|
3688
|
+
tz = env['icfs'].config.get('tz')
|
3688
3689
|
return FormConfig % [tz]
|
3689
3690
|
end # def _form_config()
|
3690
3691
|
|
@@ -3706,7 +3707,7 @@ class Client
|
|
3706
3707
|
Timezone to display date/times, format as +/-HH:MM.
|
3707
3708
|
</div></div>
|
3708
3709
|
</div>
|
3709
|
-
</div>'
|
3710
|
+
</div>'
|
3710
3711
|
|
3711
3712
|
|
3712
3713
|
###########################################################
|
@@ -3726,16 +3727,16 @@ class Client
|
|
3726
3727
|
cse['title'] = para['cse-title']
|
3727
3728
|
|
3728
3729
|
# status
|
3729
|
-
cse['status'] = (para['cse-status'] == 'true'
|
3730
|
+
cse['status'] = (para['cse-status'] == 'true') ? true : false
|
3730
3731
|
|
3731
3732
|
# tags
|
3732
3733
|
tags = []
|
3733
3734
|
tcnt = para['cse-tag'].to_i
|
3734
3735
|
if tcnt > 100
|
3735
|
-
raise(Error::Interface, 'Tag count too large'
|
3736
|
+
raise(Error::Interface, 'Tag count too large')
|
3736
3737
|
end
|
3737
3738
|
tcnt.times do |ix|
|
3738
|
-
tx = 'cse-tag-%d'
|
3739
|
+
tx = 'cse-tag-%d' % [ix + 1]
|
3739
3740
|
tag = para[tx]
|
3740
3741
|
next if !tag || tag.empty?
|
3741
3742
|
tags << tag
|
@@ -3750,21 +3751,21 @@ class Client
|
|
3750
3751
|
acc = []
|
3751
3752
|
acnt = para['cse-acc-cnt'].to_i
|
3752
3753
|
if acnt > 100
|
3753
|
-
raise(Error::Interface, 'Access count too large'
|
3754
|
+
raise(Error::Interface, 'Access count too large')
|
3754
3755
|
end
|
3755
3756
|
acnt.times do |ix|
|
3756
3757
|
ixr = ix + 1
|
3757
3758
|
|
3758
|
-
pnam = para['cse-acc-%d-perm'
|
3759
|
-
gcnt = para['cse-acc-%d'
|
3759
|
+
pnam = para['cse-acc-%d-perm' % ixr]
|
3760
|
+
gcnt = para['cse-acc-%d' % ixr].to_i
|
3760
3761
|
next if gcnt == 0 || !pnam || pnam.empty?
|
3761
3762
|
|
3762
3763
|
grant = []
|
3763
3764
|
if gcnt > 100
|
3764
|
-
raise(Error::Interface, 'Grant count too large'
|
3765
|
+
raise(Error::Interface, 'Grant count too large')
|
3765
3766
|
end
|
3766
3767
|
gcnt.times do |gx|
|
3767
|
-
sug = para['cse-acc-%d-%d'
|
3768
|
+
sug = para['cse-acc-%d-%d' % [ixr, gx+1]]
|
3768
3769
|
next if !sug || sug.empty?
|
3769
3770
|
grant << sug
|
3770
3771
|
end
|
@@ -3824,9 +3825,9 @@ class Client
|
|
3824
3825
|
# tags
|
3825
3826
|
tags = []
|
3826
3827
|
tcnt = para['ent-tag'].to_i
|
3827
|
-
raise(Error::Interface, 'too many tags'
|
3828
|
+
raise(Error::Interface, 'too many tags') if(tcnt > 100)
|
3828
3829
|
tcnt.times do |ix|
|
3829
|
-
tx = 'ent-tag-%d'
|
3830
|
+
tx = 'ent-tag-%d' % [ix + 1]
|
3830
3831
|
tag = para[tx]
|
3831
3832
|
tags << tag unless( !tag || tag.empty? )
|
3832
3833
|
end
|
@@ -3835,9 +3836,9 @@ class Client
|
|
3835
3836
|
# indexes
|
3836
3837
|
index = []
|
3837
3838
|
icnt = para['ent-idx-cnt'].to_i
|
3838
|
-
raise(Error::Interface, 'Too many indexes'
|
3839
|
+
raise(Error::Interface, 'Too many indexes') if(icnt > 100)
|
3839
3840
|
icnt.times do |ix|
|
3840
|
-
tx = 'ent-idx-%d'
|
3841
|
+
tx = 'ent-idx-%d' % (ix + 1)
|
3841
3842
|
xnum = para[tx].to_i
|
3842
3843
|
index << xnum unless xnum == 0
|
3843
3844
|
end
|
@@ -3846,9 +3847,9 @@ class Client
|
|
3846
3847
|
# perms
|
3847
3848
|
perms = []
|
3848
3849
|
pcnt = para['ent-perm-cnt'].to_i
|
3849
|
-
raise(Error::Interface, 'Too many perms'
|
3850
|
+
raise(Error::Interface, 'Too many perms') if(pcnt > 100)
|
3850
3851
|
pcnt.times do |ix|
|
3851
|
-
px = 'ent-perm-%d'
|
3852
|
+
px = 'ent-perm-%d' % [ix + 1]
|
3852
3853
|
pm = para[px]
|
3853
3854
|
next if !pm || pm.empty?
|
3854
3855
|
perms << pm
|
@@ -3858,20 +3859,20 @@ class Client
|
|
3858
3859
|
# stats
|
3859
3860
|
stats = []
|
3860
3861
|
scnt = para['ent-stats-cnt'].to_i
|
3861
|
-
raise(Error::Interface, 'Too many stats'
|
3862
|
+
raise(Error::Interface, 'Too many stats') if(scnt > 100)
|
3862
3863
|
scnt.times do |ix|
|
3863
3864
|
ixr = ix + 1
|
3864
|
-
sname = para['ent-stat-%d-name'
|
3865
|
-
sval = para['ent-stat-%d-value'
|
3865
|
+
sname = para['ent-stat-%d-name' % ixr]
|
3866
|
+
sval = para['ent-stat-%d-value' % ixr]
|
3866
3867
|
next if !sname || !sval || sname.empty? || sval.empty?
|
3867
3868
|
|
3868
3869
|
sval = sval.to_f
|
3869
3870
|
|
3870
|
-
scred = para['ent-stat-%d'
|
3871
|
+
scred = para['ent-stat-%d' % ixr].to_i
|
3871
3872
|
sugs = []
|
3872
|
-
raise(Error::Interface, 'Too many credits'
|
3873
|
+
raise(Error::Interface, 'Too many credits') if(scred > 100)
|
3873
3874
|
scred.times do |cx|
|
3874
|
-
sug = para['ent-stat-%d-%d'
|
3875
|
+
sug = para['ent-stat-%d-%d' % [ixr, cx + 1]]
|
3875
3876
|
next if !sug || sug.empty?
|
3876
3877
|
sugs << sug
|
3877
3878
|
end
|
@@ -3888,7 +3889,7 @@ class Client
|
|
3888
3889
|
# files
|
3889
3890
|
files = []
|
3890
3891
|
fcnt = para['ent-file-cnt'].to_i
|
3891
|
-
raise(Error::Interface, 'Too many files'
|
3892
|
+
raise(Error::Interface, 'Too many files') if(fcnt > 100)
|
3892
3893
|
fcnt.times do |ix|
|
3893
3894
|
ixr = ix + 1
|
3894
3895
|
fnam = para['ent-file-%d-name' % ixr]
|
@@ -3896,7 +3897,7 @@ class Client
|
|
3896
3897
|
fnum = para['ent-file-%d-num' % ixr]
|
3897
3898
|
|
3898
3899
|
if fnum
|
3899
|
-
fnum, flog = fnum.split('-'
|
3900
|
+
fnum, flog = fnum.split('-').map do |xx|
|
3900
3901
|
y = xx.to_i
|
3901
3902
|
(y == 0) ? nil : y
|
3902
3903
|
end
|
@@ -3941,28 +3942,28 @@ class Client
|
|
3941
3942
|
act['action'] = anum if anum != 0
|
3942
3943
|
|
3943
3944
|
# any edit?
|
3944
|
-
return anum unless para['act-ena'] == 'true'
|
3945
|
+
return anum unless para['act-ena'] == 'true'
|
3945
3946
|
|
3946
3947
|
# tasks
|
3947
3948
|
tasks = []
|
3948
3949
|
acnt = para['act-cnt'].to_i
|
3949
|
-
raise(Error::Interface, 'Too many tasks'
|
3950
|
+
raise(Error::Interface, 'Too many tasks') if(acnt > 100)
|
3950
3951
|
acnt.times do |ix|
|
3951
|
-
tx = 'act-%d'
|
3952
|
+
tx = 'act-%d' % [ix + 1]
|
3952
3953
|
|
3953
|
-
ug = para[tx + '-task'
|
3954
|
-
title = para[tx + '-title'
|
3955
|
-
status = (para[tx + '-status'] == 'true'
|
3956
|
-
flag = (para[tx + '-flag'] == 'true'
|
3954
|
+
ug = para[tx + '-task']
|
3955
|
+
title = para[tx + '-title']
|
3956
|
+
status = (para[tx + '-status'] == 'true') ? true : false
|
3957
|
+
flag = (para[tx + '-flag'] == 'true') ? true : false
|
3957
3958
|
|
3958
3959
|
tstr = para[tx + '-time']
|
3959
3960
|
time = _util_time_parse(env, tstr)
|
3960
3961
|
|
3961
3962
|
tags = []
|
3962
|
-
tcnt = para[tx + '-tag'
|
3963
|
-
raise(Error::Interface, 'Too many tags'
|
3963
|
+
tcnt = para[tx + '-tag'].to_i
|
3964
|
+
raise(Error::Interface, 'Too many tags') if (tcnt > 100)
|
3964
3965
|
tcnt.times do |gx|
|
3965
|
-
tag = para[tx + '-tag-%d'
|
3966
|
+
tag = para[tx + '-tag-%d' % [gx + 1]]
|
3966
3967
|
next if !tag || tag.empty?
|
3967
3968
|
tags << tag
|
3968
3969
|
end
|
@@ -4007,9 +4008,9 @@ class Client
|
|
4007
4008
|
# tags
|
4008
4009
|
tags = []
|
4009
4010
|
tcnt = para['idx-tag'].to_i
|
4010
|
-
raise(Error::Interface, 'Too many tags'
|
4011
|
+
raise(Error::Interface, 'Too many tags') if(tcnt > 100)
|
4011
4012
|
tcnt.times do |ix|
|
4012
|
-
tx = 'idx-tag-%d'
|
4013
|
+
tx = 'idx-tag-%d' % [ix + 1]
|
4013
4014
|
tag = para[tx]
|
4014
4015
|
tags << tag unless( !tag | tag.empty? )
|
4015
4016
|
end
|
@@ -4038,7 +4039,7 @@ class Client
|
|
4038
4039
|
# Link to info page
|
4039
4040
|
#
|
4040
4041
|
def _a_info(env, txt)
|
4041
|
-
'<a href="%s/info">%s</a>'
|
4042
|
+
'<a href="%s/info">%s</a>' % [
|
4042
4043
|
env['SCRIPT_NAME'],
|
4043
4044
|
Rack::Utils.escape_html(txt)
|
4044
4045
|
]
|
@@ -4048,7 +4049,7 @@ class Client
|
|
4048
4049
|
###############################################
|
4049
4050
|
# Link to Case search
|
4050
4051
|
def _a_case_search(env, query, txt)
|
4051
|
-
'<a href="%s/case_search%s">%s</a>'
|
4052
|
+
'<a href="%s/case_search%s">%s</a>' % [
|
4052
4053
|
env['SCRIPT_NAME'],
|
4053
4054
|
_util_query(query),
|
4054
4055
|
Rack::Utils.escape_html(txt)
|
@@ -4060,7 +4061,7 @@ class Client
|
|
4060
4061
|
# Link to Entry search
|
4061
4062
|
#
|
4062
4063
|
def _a_entry_search(env, query, txt)
|
4063
|
-
'<a href="%s/entry_search%s">%s</a>'
|
4064
|
+
'<a href="%s/entry_search%s">%s</a>' % [
|
4064
4065
|
env['SCRIPT_NAME'],
|
4065
4066
|
_util_query(query),
|
4066
4067
|
Rack::Utils.escape_html(txt)
|
@@ -4072,7 +4073,7 @@ class Client
|
|
4072
4073
|
# Link to Log search
|
4073
4074
|
#
|
4074
4075
|
def _a_log_search(env, query, txt)
|
4075
|
-
'<a href="%s/log_search%s">%s</a>'
|
4076
|
+
'<a href="%s/log_search%s">%s</a>' % [
|
4076
4077
|
env['SCRIPT_NAME'],
|
4077
4078
|
_util_query(query),
|
4078
4079
|
Rack::Utils.escape_html(txt)
|
@@ -4084,7 +4085,7 @@ class Client
|
|
4084
4085
|
# Link to Action search
|
4085
4086
|
#
|
4086
4087
|
def _a_action_search(env, query, txt)
|
4087
|
-
'<a href="%s/action_search%s">%s</a>'
|
4088
|
+
'<a href="%s/action_search%s">%s</a>' % [
|
4088
4089
|
env['SCRIPT_NAME'],
|
4089
4090
|
_util_query(query),
|
4090
4091
|
Rack::Utils.escape_html(txt)
|
@@ -4096,7 +4097,7 @@ class Client
|
|
4096
4097
|
# Link to Index search
|
4097
4098
|
#
|
4098
4099
|
def _a_index_search(env, query, txt)
|
4099
|
-
'<a href="%s/index_search%s">%s</a>'
|
4100
|
+
'<a href="%s/index_search%s">%s</a>' % [
|
4100
4101
|
env['SCRIPT_NAME'],
|
4101
4102
|
_util_query(query),
|
4102
4103
|
Rack::Utils.escape_html(txt)
|
@@ -4108,7 +4109,7 @@ class Client
|
|
4108
4109
|
# Link to stats search
|
4109
4110
|
#
|
4110
4111
|
def _a_stats(env, query, txt)
|
4111
|
-
'<a href="%s/stats%s">%s</a>'
|
4112
|
+
'<a href="%s/stats%s">%s</a>' % [
|
4112
4113
|
env['SCRIPT_NAME'],
|
4113
4114
|
_util_query(query),
|
4114
4115
|
Rack::Utils.escape_html(txt)
|
@@ -4119,7 +4120,7 @@ class Client
|
|
4119
4120
|
###############################################
|
4120
4121
|
# Link to case tags
|
4121
4122
|
def _a_case_tags(env, query, txt)
|
4122
|
-
'<a href="%s/case_tags%s">%s</a>'
|
4123
|
+
'<a href="%s/case_tags%s">%s</a>' % [
|
4123
4124
|
env['SCRIPT_NAME'],
|
4124
4125
|
_util_query(query),
|
4125
4126
|
Rack::Utils.escape_html(txt)
|
@@ -4131,7 +4132,7 @@ class Client
|
|
4131
4132
|
# Link to entry tags
|
4132
4133
|
#
|
4133
4134
|
def _a_entry_tags(env, query, txt)
|
4134
|
-
'<a href="%s/entry_tags/%s">%s</a>'
|
4135
|
+
'<a href="%s/entry_tags/%s">%s</a>' % [
|
4135
4136
|
env['SCRIPT_NAME'],
|
4136
4137
|
_util_query(query),
|
4137
4138
|
Rack::Utils.escape_html(txt),
|
@@ -4142,7 +4143,7 @@ class Client
|
|
4142
4143
|
###############################################
|
4143
4144
|
# Link to action tags
|
4144
4145
|
def _a_action_tags(env, query, txt)
|
4145
|
-
'<a href="%s/action_tags%s">%s</a>'
|
4146
|
+
'<a href="%s/action_tags%s">%s</a>' % [
|
4146
4147
|
env['SCRIPT_NAME'],
|
4147
4148
|
_util_query(query),
|
4148
4149
|
Rack::Utils.escape_html(txt)
|
@@ -4153,7 +4154,7 @@ class Client
|
|
4153
4154
|
###############################################
|
4154
4155
|
# Link to action tags
|
4155
4156
|
def _a_index_tags(env, query, txt)
|
4156
|
-
'<a href="%s/index_tags/%s">%s</a>'
|
4157
|
+
'<a href="%s/index_tags/%s">%s</a>' % [
|
4157
4158
|
env['SCRIPT_NAME'],
|
4158
4159
|
_util_query(query),
|
4159
4160
|
Rack::Utils.escape_html(txt)
|
@@ -4165,7 +4166,7 @@ class Client
|
|
4165
4166
|
# Link to create a case
|
4166
4167
|
#
|
4167
4168
|
def _a_case_create(env, tid, txt)
|
4168
|
-
'<a href="%s/case_create/%s">%s</a>'
|
4169
|
+
'<a href="%s/case_create/%s">%s</a>' % [
|
4169
4170
|
env['SCRIPT_NAME'],
|
4170
4171
|
Rack::Utils.escape(tid),
|
4171
4172
|
Rack::Utils.escape_html(txt),
|
@@ -4177,7 +4178,7 @@ class Client
|
|
4177
4178
|
# Link to Case edit
|
4178
4179
|
#
|
4179
4180
|
def _a_case_edit(env, cid, txt)
|
4180
|
-
'<a href="%s/case_edit/%s">%s</a>'
|
4181
|
+
'<a href="%s/case_edit/%s">%s</a>' % [
|
4181
4182
|
env['SCRIPT_NAME'],
|
4182
4183
|
Rack::Utils.escape(cid),
|
4183
4184
|
Rack::Utils.escape_html(txt)
|
@@ -4189,7 +4190,7 @@ class Client
|
|
4189
4190
|
# Link to Entry edit
|
4190
4191
|
#
|
4191
4192
|
def _a_entry_edit(env, cid, enum, anum, txt)
|
4192
|
-
'<a href="%s/entry_edit/%s/%d/%d">%s</a>'
|
4193
|
+
'<a href="%s/entry_edit/%s/%d/%d">%s</a>' % [
|
4193
4194
|
env['SCRIPT_NAME'],
|
4194
4195
|
Rack::Utils.escape(cid),
|
4195
4196
|
enum, anum,
|
@@ -4202,7 +4203,7 @@ class Client
|
|
4202
4203
|
# Link to Index edit
|
4203
4204
|
#
|
4204
4205
|
def _a_index_edit(env, cid, xnum, txt)
|
4205
|
-
'<a href="%s/index_edit/%s/%d">%s</a>'
|
4206
|
+
'<a href="%s/index_edit/%s/%d">%s</a>' % [
|
4206
4207
|
env['SCRIPT_NAME'],
|
4207
4208
|
Rack::Utils.escape(cid),
|
4208
4209
|
xnum,
|
@@ -4215,7 +4216,7 @@ class Client
|
|
4215
4216
|
# Link to Config edit
|
4216
4217
|
#
|
4217
4218
|
def _a_config_edit(env, txt)
|
4218
|
-
'<a href="%s/config_edit">%s</a>'
|
4219
|
+
'<a href="%s/config_edit">%s</a>' % [
|
4219
4220
|
env['SCRIPT_NAME'],
|
4220
4221
|
Rack::Utils.escape_html(txt)
|
4221
4222
|
]
|
@@ -4226,7 +4227,7 @@ class Client
|
|
4226
4227
|
# Link to Home
|
4227
4228
|
#
|
4228
4229
|
def _a_home(env, txt)
|
4229
|
-
'<a href="%s/home">%s</a>'
|
4230
|
+
'<a href="%s/home">%s</a>' % [
|
4230
4231
|
env['SCRIPT_NAME'],
|
4231
4232
|
Rack::Utils.escape_html(txt)
|
4232
4233
|
]
|
@@ -4237,7 +4238,7 @@ class Client
|
|
4237
4238
|
# Link to Case
|
4238
4239
|
#
|
4239
4240
|
def _a_case(env, cid, lnum, txt)
|
4240
|
-
'<a href="%s/case/%s/%d">%s</a>'
|
4241
|
+
'<a href="%s/case/%s/%d">%s</a>' % [
|
4241
4242
|
env['SCRIPT_NAME'],
|
4242
4243
|
Rack::Utils.escape(cid),
|
4243
4244
|
lnum,
|
@@ -4249,7 +4250,7 @@ class Client
|
|
4249
4250
|
###############################################
|
4250
4251
|
# Link to an entry
|
4251
4252
|
def _a_entry(env, cid, enum, lnum, txt)
|
4252
|
-
'<a href="%s/entry/%s/%d/%d">%s</a>'
|
4253
|
+
'<a href="%s/entry/%s/%d/%d">%s</a>' % [
|
4253
4254
|
env['SCRIPT_NAME'],
|
4254
4255
|
Rack::Utils.escape(cid),
|
4255
4256
|
enum,
|
@@ -4263,7 +4264,7 @@ class Client
|
|
4263
4264
|
# Link to a Log
|
4264
4265
|
#
|
4265
4266
|
def _a_log(env, cid, lnum, txt)
|
4266
|
-
'<a href="%s/log/%s/%d">%s</a>'
|
4267
|
+
'<a href="%s/log/%s/%d">%s</a>' % [
|
4267
4268
|
env['SCRIPT_NAME'],
|
4268
4269
|
Rack::Utils.escape(cid),
|
4269
4270
|
lnum,
|
@@ -4276,7 +4277,7 @@ class Client
|
|
4276
4277
|
# Link to an Action
|
4277
4278
|
#
|
4278
4279
|
def _a_action(env, cid, anum, lnum, txt)
|
4279
|
-
'<a href="%s/action/%s/%d/%d">%s</a>'
|
4280
|
+
'<a href="%s/action/%s/%d/%d">%s</a>' % [
|
4280
4281
|
env['SCRIPT_NAME'],
|
4281
4282
|
Rack::Utils.escape(cid),
|
4282
4283
|
anum,
|
@@ -4290,7 +4291,7 @@ class Client
|
|
4290
4291
|
# Link to an Index
|
4291
4292
|
#
|
4292
4293
|
def _a_index(env, cid, xnum, lnum, txt)
|
4293
|
-
'<a href="%s/index/%s/%d/%d">%s</a>'
|
4294
|
+
'<a href="%s/index/%s/%d/%d">%s</a>' % [
|
4294
4295
|
env['SCRIPT_NAME'],
|
4295
4296
|
Rack::Utils.escape(cid),
|
4296
4297
|
xnum,
|
@@ -4304,7 +4305,7 @@ class Client
|
|
4304
4305
|
# Link to a File
|
4305
4306
|
#
|
4306
4307
|
def _a_file(env, cid, enum, lnum, fnum, fname, txt)
|
4307
|
-
'<a href="%s/file/%s/%d-%d-%d-%s">%s</a>'
|
4308
|
+
'<a href="%s/file/%s/%d-%d-%d-%s">%s</a>' % [
|
4308
4309
|
env['SCRIPT_NAME'],
|
4309
4310
|
Rack::Utils.escape(cid),
|
4310
4311
|
enum, lnum, fnum, Rack::Utils.escape(fname),
|
@@ -4322,8 +4323,8 @@ class Client
|
|
4322
4323
|
# Require a GET HTTP method
|
4323
4324
|
#
|
4324
4325
|
def _verb_get(env)
|
4325
|
-
if env['REQUEST_METHOD'] != 'GET'
|
4326
|
-
raise(Error::Interface, 'Only GET method allowed'
|
4326
|
+
if env['REQUEST_METHOD'] != 'GET'
|
4327
|
+
raise(Error::Interface, 'Only GET method allowed')
|
4327
4328
|
end
|
4328
4329
|
end # def _verb_get()
|
4329
4330
|
|
@@ -4332,9 +4333,9 @@ class Client
|
|
4332
4333
|
# Require a GET or POST method
|
4333
4334
|
#
|
4334
4335
|
def _verb_getpost(env)
|
4335
|
-
if env['REQUEST_METHOD'] != 'GET'
|
4336
|
-
env['REQUEST_METHOD'] != 'POST'
|
4337
|
-
raise(Error::Interface, 'Only GET or POST method allowed'
|
4336
|
+
if env['REQUEST_METHOD'] != 'GET' &&
|
4337
|
+
env['REQUEST_METHOD'] != 'POST'
|
4338
|
+
raise(Error::Interface, 'Only GET or POST method allowed')
|
4338
4339
|
end
|
4339
4340
|
end # def _verb_getpost()
|
4340
4341
|
|
@@ -4346,7 +4347,7 @@ class Client
|
|
4346
4347
|
rck = Rack::Request.new(env)
|
4347
4348
|
para = rck.POST
|
4348
4349
|
para.each do |key, val|
|
4349
|
-
val.force_encoding('utf-8'
|
4350
|
+
val.force_encoding('utf-8') if val.is_a?(String)
|
4350
4351
|
end
|
4351
4352
|
return para
|
4352
4353
|
end # def _util_post()
|
@@ -4358,10 +4359,10 @@ class Client
|
|
4358
4359
|
def _util_case(env)
|
4359
4360
|
cmps = env['icfs.cmps']
|
4360
4361
|
if cmps.size < 2 || cmps[1].empty?
|
4361
|
-
raise(Error::NotFound, 'No case specified in the URL'
|
4362
|
+
raise(Error::NotFound, 'No case specified in the URL')
|
4362
4363
|
end
|
4363
4364
|
cid = Rack::Utils.unescape(cmps[1])
|
4364
|
-
Items.validate(cid, 'case'
|
4365
|
+
Items.validate(cid, 'case', Items::FieldCaseid)
|
4365
4366
|
env['icfs.cid'] = cid
|
4366
4367
|
return cid
|
4367
4368
|
end # def _util_case()
|
@@ -4380,8 +4381,8 @@ class Client
|
|
4380
4381
|
# Epoch time as local
|
4381
4382
|
#
|
4382
4383
|
def _util_time(env, time)
|
4383
|
-
tz = env['icfs
|
4384
|
-
Time.at(time).getlocal(tz).strftime('%F %T'
|
4384
|
+
tz = env['icfs'].config.get('tz')
|
4385
|
+
Time.at(time).getlocal(tz).strftime('%F %T')
|
4385
4386
|
end
|
4386
4387
|
|
4387
4388
|
|
@@ -4389,19 +4390,10 @@ class Client
|
|
4389
4390
|
# Parse a provided time string
|
4390
4391
|
#
|
4391
4392
|
def _util_time_parse(env, str)
|
4392
|
-
|
4393
|
-
|
4394
|
-
|
4395
|
-
|
4396
|
-
# empty string defaults to now
|
4397
|
-
return now if val.empty?
|
4398
|
-
|
4399
|
-
# default use parse
|
4400
|
-
ma = /[+-]\d{2}:\d{2}$/.match str
|
4401
|
-
tstr = ma ? str : str + env['icfs.config'].get('tz')
|
4402
|
-
time = Time.parse(tstr).to_i
|
4403
|
-
rescue ArgumentError
|
4404
|
-
return nil
|
4393
|
+
cfg = env['icfs'].config
|
4394
|
+
time = ICFS.time_parse(str, cfg)
|
4395
|
+
raise(Error::Value, 'Invalid time string') if !time
|
4396
|
+
return time
|
4405
4397
|
end
|
4406
4398
|
|
4407
4399
|
|
@@ -4410,11 +4402,11 @@ class Client
|
|
4410
4402
|
def _util_query(query)
|
4411
4403
|
if query
|
4412
4404
|
qa = query.map do |key, val|
|
4413
|
-
'%s=%s'
|
4405
|
+
'%s=%s' % [Rack::Utils.escape(key), Rack::Utils.escape(val)]
|
4414
4406
|
end
|
4415
|
-
return '?'
|
4407
|
+
return '?' + qa.join('&')
|
4416
4408
|
else
|
4417
|
-
return ''
|
4409
|
+
return ''
|
4418
4410
|
end
|
4419
4411
|
end # def _util_query()
|
4420
4412
|
|
@@ -4435,7 +4427,7 @@ class Client
|
|
4435
4427
|
when :string
|
4436
4428
|
query[sym] = val
|
4437
4429
|
when :array
|
4438
|
-
query[sym] = val.split(','
|
4430
|
+
query[sym] = val.split(',').map{|aa| aa.strip}
|
4439
4431
|
when :boolean
|
4440
4432
|
if val == 'true'
|
4441
4433
|
query[sym] = true
|
@@ -4479,7 +4471,7 @@ class Client
|
|
4479
4471
|
body
|
4480
4472
|
]
|
4481
4473
|
head = {
|
4482
|
-
'Content-Type' => 'text/html; charset=utf-8'
|
4474
|
+
'Content-Type' => 'text/html; charset=utf-8',
|
4483
4475
|
'Content-Length' => html.bytesize.to_s
|
4484
4476
|
}
|
4485
4477
|
return [res, head, [html]]
|
@@ -4497,7 +4489,7 @@ class Client
|
|
4497
4489
|
<body>%s
|
4498
4490
|
</body>
|
4499
4491
|
</html>
|
4500
|
-
'
|
4492
|
+
'
|
4501
4493
|
|
4502
4494
|
|
4503
4495
|
###############################################
|