-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCodeTableEditor.cfm
717 lines (713 loc) · 24.6 KB
/
CodeTableEditor.cfm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
<cfinclude template="includes/_header.cfm">
<cfquery name="ctcollcde" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select distinct collection_cde from ctcollection_cde
</cfquery>
<cfoutput>
<cfset title = "Edit Code Tables">
<cfif action is "nothing">
<cfquery name="getCTName" datasource="uam_god">
select
distinct(table_name) table_name
from
sys.user_tables
where
table_name like 'CT%'
UNION
select 'CTGEOLOGY_ATTRIBUTE' table_name from dual
order by table_name
</cfquery>
<cfloop query="getCTName">
<a href="CodeTableEditor.cfm?action=edit&tbl=#getCTName.table_name#">#getCTName.table_name#</a><br>
</cfloop>
<cfelseif action is "edit">
<p>
<a href="/CodeTableEditor.cfm">Back to table list</a>
</p>
<cfif tbl is "CTGEOLOGY_ATTRIBUTE"><!---------------------------------------------------->
<cflocation url="/info/geol_hierarchy.cfm" addtoken="false">
<cfelseif tbl is "ctspecimen_part_name"><!---------------------------------------------------->
<cflocation url="/Admin/ctspecimen_part_name.cfm" addtoken="false">
<cfelseif tbl is "ctspec_part_att_att"><!---------------------------------------------------->
<cflocation url="/Admin/ctspec_part_att_att.cfm" addtoken="false">
<cfelseif tbl is "ctmedia_license"><!---------------------------------------------------->
<cflocation url="/Admin/ctmedia_license.cfm" addtoken="false">
<cfelseif tbl is "ctattribute_code_tables"><!---------------------------------------------------->
<cfquery name="ctAttribute_type" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select distinct(attribute_type) from ctAttribute_type
</cfquery>
<cfquery name="thisRec" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
Select * from ctattribute_code_tables
order by attribute_type
</cfquery>
<cfquery name="allCTs" datasource="uam_god">
select distinct(table_name) as tablename from sys.user_tables where table_name like 'CT%' order by table_name
</cfquery>
<br>Create Attribute Control
<table class="newRec" border>
<tr>
<th>Attribute</th>
<th>Value Code Table</th>
<th>Units Code Table</th>
<th> </th>
</tr>
<form method="post" action="CodeTableEditor.cfm">
<input type="hidden" name="action" value="newValue">
<input type="hidden" name="tbl" value="#tbl#">
<tr>
<td>
<select name="attribute_type" size="1">
<option value=""></option>
<cfloop query="ctAttribute_type">
<option
value="#ctAttribute_type.attribute_type#">#ctAttribute_type.attribute_type#</option>
</cfloop>
</select>
</td>
<td>
<cfset thisValueTable = #thisRec.value_code_table#>
<select name="value_code_table" size="1">
<option value="">none</option>
<cfloop query="allCTs">
<option
value="#allCTs.tablename#">#allCTs.tablename#</option>
</cfloop>
</select>
</td>
<td>
<cfset thisUnitsTable = #thisRec.units_code_table#>
<select name="units_code_table" size="1">
<option value="">none</option>
<cfloop query="allCTs">
<option
value="#allCTs.tablename#">#allCTs.tablename#</option>
</cfloop>
</select>
</td>
<td>
<input type="submit"
value="Create"
class="insBtn">
</td>
</tr>
</form>
</table>
<br>Edit Attribute Controls
<table border>
<tr>
<th>Attribute</th>
<th>Value Code Table</th>
<th>Units Code Table</th>
<th> </th>
</tr>
<cfset i=1>
<cfloop query="thisRec">
<form name="att#i#" method="post" action="CodeTableEditor.cfm">
<input type="hidden" name="action" value="">
<input type="hidden" name="tbl" value="#tbl#">
<input type="hidden" name="oldAttribute_type" value="#Attribute_type#">
<input type="hidden" name="oldvalue_code_table" value="#value_code_table#">
<input type="hidden" name="oldunits_code_table" value="#units_code_table#">
<tr>
<td>
<cfset thisAttType = #thisRec.attribute_type#>
<select name="attribute_type" size="1">
<option value=""></option>
<cfloop query="ctAttribute_type">
<option
<cfif #thisAttType# is "#ctAttribute_type.attribute_type#"> selected </cfif>value="#ctAttribute_type.attribute_type#">#ctAttribute_type.attribute_type#</option>
</cfloop>
</select>
</td>
<td>
<cfset thisValueTable = #thisRec.value_code_table#>
<select name="value_code_table" size="1">
<option value="">none</option>
<cfloop query="allCTs">
<option
<cfif #thisValueTable# is "#allCTs.tablename#"> selected </cfif>value="#allCTs.tablename#">#allCTs.tablename#</option>
</cfloop>
</select>
</td>
<td>
<cfset thisUnitsTable = #thisRec.units_code_table#>
<select name="units_code_table" size="1">
<option value="">none</option>
<cfloop query="allCTs">
<option
<cfif #thisUnitsTable# is "#allCTs.tablename#"> selected </cfif>value="#allCTs.tablename#">#allCTs.tablename#</option>
</cfloop>
</select>
</td>
<td>
<input type="button"
value="Save"
class="savBtn"
onclick="att#i#.action.value='saveEdit';submit();">
<input type="button"
value="Delete"
class="delBtn"
onclick="att#i#.action.value='deleteValue';submit();">
</td>
</tr>
</form>
<cfset i=#i#+1>
</cfloop>
</table>
<cfelseif tbl is "ctpublication_attribute"><!---------------------------------------------------->
<cfquery name="q" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select * from ctpublication_attribute order by publication_attribute
</cfquery>
<cfquery name="allCTs" datasource="uam_god">
select distinct(table_name) as tablename from sys.user_tables where table_name like 'CT%' order by table_name
</cfquery>
<form name="newData" method="post" action="CodeTableEditor.cfm">
<input type="hidden" name="action" value="newValue">
<input type="hidden" name="tbl" value="ctpublication_attribute">
<table class="newRec">
<tr>
<th>Publication Attribute</th>
<th>Description</th>
<th>Control</th>
<th></th>
</tr>
<tr>
<td>
<input type="text" name="newData" >
</td>
<td>
<textarea name="description" rows="4" cols="40"></textarea>
</td>
<td>
<select name="control">
<option value=""></option>
<cfloop query="allCTs">
<option value="#tablename#">#tablename#</option>
</cfloop>
</select>
</td>
<td>
<input type="submit"
value="Insert"
class="insBtn">
</td>
</tr>
</table>
</form>
<cfset i = 1>
<table>
<tr>
<th>Type</th>
<th>Description</th>
<th>Control</th>
</tr>
<cfloop query="q">
<tr #iif(i MOD 2,DE("class='evenRow'"),DE("class='oddRow'"))#>
<form name="#tbl##i#" method="post" action="CodeTableEditor.cfm">
<input type="hidden" name="action" value="">
<input type="hidden" name="tbl" value="ctpublication_attribute">
<input type="hidden" name="origData" value="#publication_attribute#">
<td>
<input type="text" name="publication_attribute" value="#publication_attribute#" size="50">
</td>
<td>
<textarea name="description" rows="4" cols="40">#description#</textarea>
</td>
<td>
<select name="control">
<option value=""></option>
<cfloop query="allCTs">
<option <cfif q.control is allCTs.tablename> selected="selected" </cfif>value="#tablename#">#tablename#</option>
</cfloop>
</select>
</td>
<td>
<input type="button"
value="Save"
class="savBtn"
onclick="#tbl##i#.action.value='saveEdit';submit();">
<input type="button"
value="Delete"
class="delBtn"
onclick="#tbl##i#.action.value='deleteValue';submit();">
</td>
</form>
</tr>
<cfset i = #i#+1>
</cfloop>
</table>
<cfelseif tbl is "ctcoll_other_id_type"><!--------------------------------------------------------------->
<cfquery name="q" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select * from ctcoll_other_id_type order by other_id_type
</cfquery>
<form name="newData" method="post" action="CodeTableEditor.cfm">
<input type="hidden" name="action" value="newValue">
<input type="hidden" name="tbl" value="ctcoll_other_id_type">
<table class="newRec">
<tr>
<th>ID Type</th>
<th>Description</th>
<th>Base URL</th>
<th></th>
</tr>
<tr>
<td>
<input type="text" name="newData" >
</td>
<td>
<textarea name="description" rows="4" cols="40"></textarea>
</td>
<td>
<input type="text" name="base_url" size="50">
</td>
<td>
<input type="submit"
value="Insert"
class="insBtn">
</td>
</tr>
</table>
</form>
<cfset i = 1>
<table>
<tr>
<th>Type</th>
<th>Description</th>
<th>Base URL</th>
</tr>
<cfloop query="q">
<tr #iif(i MOD 2,DE("class='evenRow'"),DE("class='oddRow'"))#>
<form name="#tbl##i#" method="post" action="CodeTableEditor.cfm">
<input type="hidden" name="action" value="">
<input type="hidden" name="tbl" value="ctcoll_other_id_type">
<input type="hidden" name="origData" value="#other_id_type#">
<td>
<input type="text" name="other_id_type" value="#other_id_type#" size="50">
</td>
<td>
<textarea name="description" rows="4" cols="40">#description#</textarea>
</td>
<td>
<input type="text" name="base_url" size="60" value="#base_url#">
</td>
<td>
<input type="button"
value="Save"
class="savBtn"
onclick="#tbl##i#.action.value='saveEdit';submit();">
<input type="button"
value="Delete"
class="delBtn"
onclick="#tbl##i#.action.value='deleteValue';submit();">
</td>
</form>
</tr>
<cfset i = #i#+1>
</cfloop>
</table>
<cfelseif tbl is "ctspecimen_part_list_order"><!--- special section to handle another funky code table --->
<cfquery name="thisRec" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select * from ctspecimen_part_list_order order by
list_order,partname
</cfquery>
<cfquery name="ctspecimen_part_name" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select collection_cde, part_name partname from ctspecimen_part_name
</cfquery>
<cfquery name="mo" dbtype="query">
select max(list_order) +1 maxNum from thisRec
</cfquery>
<p>
This application sets the order part names appear in certain reports and forms.
Nothing prevents you from making several parts the same
order, and doing so will just cause them to not be ordered. You don't have to order things you don't care about.
</p>
Create part ordering
<table class="newRec" border>
<tr>
<th>Part Name</th>
<th>List Order</th>
<th></th>
</tr>
<form name="newPart" method="post" action="CodeTableEditor.cfm">
<input type="hidden" name="action" value="newValue">
<input type="hidden" name="tbl" value="#tbl#">
<tr>
<td>
<cfset thisPart = #thisRec.partname#>
<select name="partname" size="1">
<cfloop query="ctspecimen_part_name">
<option
value="#ctspecimen_part_name.partname#">#ctspecimen_part_name.partname# (#ctspecimen_part_name.collection_cde#)</option>
</cfloop>
</select>
</td>
<cfquery name="mo" dbtype="query">
select max(list_order) +1 maxNum from thisRec
</cfquery>
<td>
<cfset thisLO = #thisRec.list_order#>
<select name="list_order" size="1">
<cfloop from="1" to="#mo.maxNum#" index="n">
<option value="#n#">#n#</option>
</cfloop>
</select>
</td>
<td colspan="3">
<input type="submit"
value="Create"
class="insBtn">
</td>
</tr>
</form>
</table>
Edit part order
<table border>
<tr>
<th>Part Name</th>
<th>List Order</th>
<th> </th>
</tr>
<cfset i=1>
<cfloop query="thisRec">
<form name="part#i#" method="post" action="CodeTableEditor.cfm">
<input type="hidden" name="action" value="ctspecimen_part_list_order">
<input type="hidden" name="tbl" value="#tbl#">
<input type="hidden" name="oldlist_order" value="#list_order#">
<input type="hidden" name="oldpartname" value="#partname#">
<tr>
<td>
<cfset thisPart = #thisRec.partname#>
<select name="partname" size="1">
<cfloop query="ctspecimen_part_name">
<option
<cfif #thisPart# is "#ctspecimen_part_name.partname#"> selected </cfif>value="#ctspecimen_part_name.partname#">#ctspecimen_part_name.partname#</option>
</cfloop>
</select>
</td>
<td>
<cfset thisLO = #thisRec.list_order#>
<select name="list_order" size="1">
<cfloop from="1" to="#mo.maxNum#" index="n">
<option <cfif #thisLO# is "#n#"> selected </cfif>value="#n#">#n#</option>
</cfloop>
</select>
</td>
<td colspan="3">
<input type="button"
value="Save"
class="savBtn"
onclick="part#i#.action.value='saveEdit';submit();">
<input type="button"
value="Delete"
class="delBtn"
onclick="part#i#.action.value='deleteValue';submit();">
</td>
</tr>
</form>
<cfset i=#i#+1>
</cfloop>
</table>
<cfelse><!---------------------------- normal CTs --------------->
<cfquery name="getCols" datasource="uam_god">
select column_name from sys.user_tab_columns where table_name='#tbl#'
</cfquery>
<cfset collcde=listfindnocase(valuelist(getCols.column_name),"collection_cde")>
<cfset hasDescn=listfindnocase(valuelist(getCols.column_name),"description")>
<cfquery name="f" dbtype="query">
select column_name from getCols where lower(column_name) not in ('collection_cde','description')
</cfquery>
<cfset fld=f.column_name>
<cfquery name="q" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select #fld# as data
<cfif collcde gt 0>
,collection_cde
</cfif>
<cfif hasDescn gt 0>
,description
</cfif>
from #tbl#
ORDER BY
<cfif collcde gt 0>
collection_cde,
</cfif>
#fld#
</cfquery>
Add record:
<table class="newRec" border="1">
<tr>
<cfif collcde gt 0>
<th>Collection Type</th>
</cfif>
<th>#fld#</th>
<cfif hasDescn gt 0>
<th>Description</th>
</cfif>
</tr>
<form name="newData" method="post" action="CodeTableEditor.cfm">
<input type="hidden" name="collcde" value="#collcde#">
<input type="hidden" name="action" value="newValue">
<input type="hidden" name="tbl" value="#tbl#">
<input type="hidden" name="hasDescn" value="#hasDescn#">
<input type="hidden" name="fld" value="#fld#">
<tr>
<cfif collcde gt 0>
<td>
<select name="collection_cde" size="1">
<cfloop query="ctcollcde">
<option value="#ctcollcde.collection_cde#">#ctcollcde.collection_cde#</option>
</cfloop>
</select>
</td>
</cfif>
<td>
<input type="text" name="newData" >
</td>
<cfif hasDescn gt 0>
<td>
<textarea name="description" id="description" rows="4" cols="40"></textarea>
</td>
</cfif>
<td>
<input type="submit"
value="Insert"
class="insBtn">
</td>
</tr>
</form>
</table>
<cfset i = 1>
Edit #tbl#:
<table border="1">
<tr>
<cfif collcde gt 0>
<th>Collection Type</th>
</cfif>
<th>#fld#</th>
<cfif hasDescn gt 0>
<th>Description</th>
</cfif>
</tr>
<cfloop query="q">
<tr #iif(i MOD 2,DE("class='evenRow'"),DE("class='oddRow'"))#>
<form name="#tbl##i#" method="post" action="CodeTableEditor.cfm">
<input type="hidden" name="Action">
<input type="hidden" name="tbl" value="#tbl#">
<input type="hidden" name="fld" value="#fld#">
<input type="hidden" name="collcde" value="#collcde#">
<input type="hidden" name="hasDescn" value="#hasDescn#">
<input type="hidden" name="origData" value="#q.data#">
<cfif collcde gt 0>
<input type="hidden" name="origcollection_cde" value="#q.collection_cde#">
<cfset thisColl=#q.collection_cde#>
<td>
<select name="collection_cde" size="1">
<cfloop query="ctcollcde">
<option
<cfif #thisColl# is "#ctcollcde.collection_cde#"> selected </cfif>value="#ctcollcde.collection_cde#">#ctcollcde.collection_cde#</option>
</cfloop>
</select>
</td>
</cfif>
<td>
<input type="text" name="thisField" value="#q.data#" size="50">
</td>
<cfif hasDescn gt 0>
<td>
<textarea name="description" rows="4" cols="40">#q.description#</textarea>
</td>
</cfif>
<td>
<input type="button"
value="Save"
class="savBtn"
onclick="#tbl##i#.Action.value='saveEdit';submit();">
<input type="button"
value="Delete"
class="delBtn"
onclick="#tbl##i#.Action.value='deleteValue';submit();">
</td>
</form>
</tr>
<cfset i = #i#+1>
</cfloop>
</table>
</cfif>
<cfelseif action is "deleteValue">
<cfif tbl is "ctpublication_attribute">
<cfquery name="sav" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
delete from ctpublication_attribute
where
publication_attribute='#origData#'
</cfquery>
<cfelseif tbl is "ctcoll_other_id_type">
<cfquery name="sav" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
delete from ctcoll_other_id_type
where
OTHER_ID_TYPE='#origData#'
</cfquery>
<cfelseif tbl is "ctattribute_code_tables">
<cfquery name="del" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
DELETE FROM ctattribute_code_tables
WHERE
Attribute_type = '#oldAttribute_type#'
<cfif len(#oldvalue_code_table#) gt 0>
AND value_code_table = '#oldvalue_code_table#'
</cfif>
<cfif len(#oldunits_code_table#) gt 0>
AND units_code_table = '#oldunits_code_table#'
</cfif>
</cfquery>
<cfelseif tbl is "ctspecimen_part_list_order">
<cfquery name="del" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
DELETE FROM ctspecimen_part_list_order
WHERE
partname = '#oldpartname#' AND
list_order = '#oldlist_order#'
</cfquery>
<cfelse>
<cfquery name="del" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
DELETE FROM #tbl#
where #fld# = '#origData#'
<cfif isdefined("collection_cde") and len(collection_cde) gt 0>
AND collection_cde='#origcollection_cde#'
</cfif>
</cfquery>
</cfif>
<cflocation url="CodeTableEditor.cfm?action=edit&tbl=#tbl#" addtoken="false">
<cfelseif action is "saveEdit">
<cfif tbl is "ctpublication_attribute">
<cfquery name="sav" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
update ctpublication_attribute set
publication_attribute='#publication_attribute#',
DESCRIPTION='#description#',
control='#control#'
where
publication_attribute='#origData#'
</cfquery>
<cfelseif tbl is "ctcoll_other_id_type">
<cfquery name="sav" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
update ctcoll_other_id_type set
OTHER_ID_TYPE='#other_id_type#',
DESCRIPTION='#description#',
base_URL='#base_url#'
where
OTHER_ID_TYPE='#origData#'
</cfquery>
<cfelseif tbl is "ctattribute_code_tables">
<cfquery name="sav" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
UPDATE ctattribute_code_tables SET
Attribute_type = '#Attribute_type#',
value_code_table = '#value_code_table#',
units_code_table = '#units_code_table#'
WHERE
Attribute_type = '#oldAttribute_type#' AND
value_code_table = '#oldvalue_code_table#' AND
units_code_table = '#oldunits_code_table#'
</cfquery>
<cfelseif tbl is "ctspecimen_part_list_order">
<cfquery name="sav" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
UPDATE ctspecimen_part_list_order SET
partname = '#partname#',
list_order = '#list_order#'
WHERE
partname = '#oldpartname#' AND
list_order = '#oldlist_order#'
</cfquery>
<cfelse>
<cfquery name="up" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
UPDATE #tbl# SET #fld# = '#thisField#'
<cfif isdefined("collection_cde") and len(collection_cde) gt 0>
,collection_cde='#collection_cde#'
</cfif>
<cfif isdefined("description")>
,description='#description#'
</cfif>
where #fld# = '#origData#'
<cfif isdefined("collection_cde") and len(collection_cde) gt 0>
AND collection_cde='#origcollection_cde#'
</cfif>
</cfquery>
</cfif>
<cflocation url="CodeTableEditor.cfm?action=edit&tbl=#tbl#" addtoken="false">
<cfelseif action is "newValue">
<cfif tbl is "ctpublication_attribute">
<cfquery name="sav" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into ctpublication_attribute (
publication_attribute,
DESCRIPTION,
control
) values (
'#newData#',
'#description#',
'#control#'
)
</cfquery>
<cfelseif tbl is "ctcoll_other_id_type">
<cfquery name="sav" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into ctcoll_other_id_type (
OTHER_ID_TYPE,
DESCRIPTION,
base_URL
) values (
'#newData#',
'#description#',
'#base_url#'
)
</cfquery>
<cfelseif tbl is "ctattribute_code_tables">
<cfquery name="new" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
INSERT INTO ctattribute_code_tables (
Attribute_type
<cfif len(#value_code_table#) gt 0>
,value_code_table
</cfif>
<cfif len(#units_code_table#) gt 0>
,units_code_table
</cfif>
)
VALUES (
'#Attribute_type#'
<cfif len(#value_code_table#) gt 0>
,'#value_code_table#'
</cfif>
<cfif len(#units_code_table#) gt 0>
,'#units_code_table#'
</cfif>
)
</cfquery>
<cfelseif tbl is "ctspecimen_part_list_order">
<cfquery name="new" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
INSERT INTO ctspecimen_part_list_order (
partname,
list_order
)
VALUES (
'#partname#',
#list_order#
)
</cfquery>
<cfelse>
<cfquery name="new" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
INSERT INTO #tbl#
(#fld#
<cfif isdefined("collection_cde") and len(collection_cde) gt 0>
,collection_cde
</cfif>
<cfif isdefined("description") and len(description) gt 0>
,description
</cfif>
)
VALUES
('#newData#'
<cfif isdefined("collection_cde") and len(collection_cde) gt 0>
,'#collection_cde#'
</cfif>
<cfif isdefined("description") and len(description) gt 0>
,'#description#'
</cfif>
)
</cfquery>
</cfif>
<cflocation url="CodeTableEditor.cfm?action=edit&tbl=#tbl#" addtoken="false">
</cfif>
</cfoutput>
<cfinclude template="includes/_footer.cfm">