forked from ArctosDB/arctos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditTaxonomy.cfm
1538 lines (1485 loc) · 58.4 KB
/
editTaxonomy.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
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<cfinclude template="includes/_header.cfm">
<cfset noCloneTerms="author_text,display_name,infraspecific_author,remark,scientific_name,source_authority,species,subspecies,taxon_status">
<a target="_blank" class="external" href="http://arctosdb.org/documentation/identification/taxonomy/#edit">editing guidelines</a>
<!------------------------------------------------------------------------------->
<cfif action is "cloneClassificationNewName">
<cfquery name="cttaxonomy_source" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select source from cttaxonomy_source order by source
</cfquery>
<cfquery name="CTTAXON_TERM" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select taxon_term from CTTAXON_TERM where taxon_term not in (#listqualify(noCloneTerms,"'")#) order by taxon_term
</cfquery>
<cfoutput>
<p>
Use this form to create a clone of a name and classification as another (e.g., local and editable) Source.
</p>
<p>
You are creating a new namestring.
</p>
<p>
You should not do that if the namestring (scientific name) exists, even if it's currently used for some other
biological entity. That is, Diptera (flies) and Diptera (plants) share a namestring, and a new name is not necessary (or possible).
</p>
<p>
Pick a source below, enter the new namestring, click the button, and then you'll have a chance to edit the classification you've created.
</p>
<form name="x" method="post" action="editTaxonomy.cfm">
<input type="hidden" name="action" value="cloneClassificationNewName_insert">
<input type="hidden" name="classification_id" value="#classification_id#">
<label for="newName">New Namestring/Scientific Name</label>
<input type="text" name="newName" id="newName" class="reqdClr">
<label for="source">Clone into Source</label>
<select name="source" id="source" class="reqdClr">
<cfloop query="cttaxonomy_source">
<option value="#source#">#source#</option>
</cfloop>
</select>
<p>
IMPORTANT: Only select terms from <a target="_blank" href="/info/ctDocumentation.cfm?table=CTTAXON_TERM">CTTAXON_TERM</a>
will be cloned. Anything not in the list below will be ignored.
<ul>
<cfloop query="CTTAXON_TERM">
<li>#taxon_term#</li>
</cfloop>
</ul>
This may include terms that you do not wish to clone, and it may exclude terms which you do wish to clone. Please
carefully check everything before saving.
</p>
<input type="submit" value="create name and classification">
</form>
</cfoutput>
</cfif>
<!------------------------------------------------------------------------------->
<cfif action is "cloneClassificationNewName_insert">
<cfoutput>
<cfquery name="seedClassification" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select distinct
TAXON_NAME_ID,
CLASSIFICATION_ID,
TERM,
TERM_TYPE,
POSITION_IN_CLASSIFICATION
from
taxon_term
where
classification_id='#classification_id#' and
TERM_TYPE in (select taxon_term from CTTAXON_TERM where taxon_term not in (#listqualify(noCloneTerms,"'")#))
order by
POSITION_IN_CLASSIFICATION
</cfquery>
<!----
<cfdump var=#seedClassification#>
<cfabort>
---->
<cfset thisSourceID=CreateUUID()>
<cftransaction>
<!--- new name --->
<cfquery name="nnID" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select sq_taxon_name_id.nextval tnid from dual
</cfquery>
<cfquery name="newName" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into taxon_name (taxon_name_id,scientific_name) values (#nnID.tnid#,'#newName#')
</cfquery>
<cfset pic=1>
<cfloop query="seedClassification">
<cfquery name="seedClassification" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into taxon_term (
TAXON_NAME_ID,
CLASSIFICATION_ID,
TERM,
TERM_TYPE,
SOURCE,
POSITION_IN_CLASSIFICATION
) values (
#nnID.tnid#,
'#thisSourceID#',
'#TERM#',
'#TERM_TYPE#',
'#SOURCE#',
<cfif len(POSITION_IN_CLASSIFICATION) is 0>
NULL
<cfelse>
#pic#
<cfset pic=pic+1>
</cfif>
)
</cfquery>
</cfloop>
<cfquery name="scientific_name" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into taxon_term (
TAXON_NAME_ID,
CLASSIFICATION_ID,
TERM,
TERM_TYPE,
SOURCE,
POSITION_IN_CLASSIFICATION
) values (
#nnID.tnid#,
'#thisSourceID#',
'#newName#',
'scientific_name',
'#SOURCE#',
#pic#
)
</cfquery>
</cftransaction>
<cflocation url="/editTaxonomy.cfm?action=editClassification&classification_id=#thisSourceID#" addtoken="false">
</cfoutput>
</cfif>
<!------------------------------------------------------------------------------->
<cfif action is "cloneClassification">
<cfquery name="cttaxonomy_source" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select source from cttaxonomy_source order by source
</cfquery>
<cfoutput>
<p>
Use this form to create a clone of a classification as another (e.g., local and editable) Source.
</p>
<p>
Do NOT try to use this form to create names - use "create name" or "clone classification into new name" for that.
</p>
<p>
Do NOT use this form to assert taxon relationships - use "edit non-classification data" for that.
</p>
<p>
Pick a source below, click the button, and then you'll have a chance to edit the classification you've created.
</p>
<form name="x" method="post" action="editTaxonomy.cfm">
<input type="hidden" name="action" value="cloneClassification_insert">
<input type="hidden" name="classification_id" value="#classification_id#">
<input type="hidden" name="taxon_name_id" value="#taxon_name_id#">
<label for="source">Clone into Source</label>
<select name="source" id="source" class="reqdClr">
<cfloop query="cttaxonomy_source">
<option value="#source#">#source#</option>
</cfloop>
</select>
<input type="submit" value="create classification">
</form>
</cfoutput>
</cfif>
<!------------------------------------------------------------------------------->
<cfif action is "cloneClassification_insert">
<cfoutput>
<cfquery name="seedClassification" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select
TAXON_NAME_ID,
CLASSIFICATION_ID,
TERM,
TERM_TYPE,
POSITION_IN_CLASSIFICATION
from
taxon_term
where
taxon_name_id=#taxon_name_id# and
classification_id='#classification_id#'
group by
TAXON_NAME_ID,
CLASSIFICATION_ID,
TERM,
TERM_TYPE,
POSITION_IN_CLASSIFICATION
</cfquery>
<cfset thisSourceID=CreateUUID()>
<cftransaction>
<cfloop query="seedClassification">
<cfquery name="seedClassification" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into taxon_term (
TAXON_NAME_ID,
CLASSIFICATION_ID,
TERM,
TERM_TYPE,
SOURCE,
POSITION_IN_CLASSIFICATION
) values (
#TAXON_NAME_ID#,
'#thisSourceID#',
'#TERM#',
'#TERM_TYPE#',
'#SOURCE#',
<cfif len(POSITION_IN_CLASSIFICATION) is 0>
NULL
<cfelse>
#POSITION_IN_CLASSIFICATION#
</cfif>
)
</cfquery>
</cfloop>
</cftransaction>
<cflocation url="/editTaxonomy.cfm?action=editClassification&classification_id=#thisSourceID#" addtoken="false">
</cfoutput>
</cfif>
<!------------------------------------------------------------------------------->
<cfif action is "forceDeleteNonLocal">
<cfoutput>
Are you sure you want to delete all source-derived metadata?
<p>
You should probably use the "refresh from globalnames" link when you're done here.
</p>
<p>
Use your back button to get out of here.
</p>
<p>
<a href="editTaxonomy.cfm?action=yesReally_forceDeleteNonLocal&taxon_name_id=#taxon_name_id#">
Click here to finalize the delete of all non-local metadata
</a>
</p>
</cfoutput>
</cfif>
<!------------------------------------------------------------------------------->
<cfif action is "yesReally_forceDeleteNonLocal">
<cfoutput>
<cfquery name="insRow" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
delete from taxon_term where source not in (select source from cttaxonomy_source) and taxon_name_id=#taxon_name_id#
</cfquery>
<cflocation url="/taxonomy.cfm?taxon_name_id=#taxon_name_id#" addtoken="false">
</cfoutput>
</cfif>
<!------------------------------------------------------------------------------->
<cfif action is "saveNewClass">
<cfoutput>
<cfif len(source) is 0>
Source is required.
<cfabort>
</cfif>
<cfset thisSourceID=CreateUUID()>
<cftransaction>
<cfloop from="1" to="10" index="i">
<cfset thisTerm=evaluate("ncterm_" & i)>
<cfset thisTermType=evaluate("ncterm_type_" & i)>
<cfif len(thisTerm) gt 0 and len(thisTermType) gt 0>
<cfquery name="insRow" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into taxon_term (
taxon_term_id,
taxon_name_id,
term,
term_type,
source,
classification_id
) values (
sq_taxon_term_id.nextval,
#taxon_name_id#,
'#thisTerm#',
'#thisTermType#',
'#Source#',
'#thisSourceID#'
)
</cfquery>
</cfif>
</cfloop>
<cfset pos=1>
<cfloop from="1" to="10" index="i">
<!--- deal with yahoos leaving empty cells.... ---->
<cfset thisTerm=evaluate("term_" & i)>
<cfset thisTermType=evaluate("term_type_" & i)>
<cfif len(thisTerm) gt 0>
<cfquery name="insRow" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into taxon_term (
taxon_term_id,
taxon_name_id,
term,
term_type,
source,
position_in_classification,
classification_id
) values (
sq_taxon_term_id.nextval,
#taxon_name_id#,
'#thisTerm#',
'#lcase(thisTermType)#',
'#source#',
#pos#,
'#thisSourceID#'
)
</cfquery>
<cfset pos=pos+1>
</cfif>
</cfloop>
</cftransaction>
<cflocation url="/editTaxonomy.cfm?action=editClassification&classification_id=#thisSourceID#" addtoken="false">
<!----
---->
</cfoutput>
</cfif>
<!----
<!--------------------------------------------->
<cfif action is "newClassification">
<script>
// copy this with edit classification
$(function() {
// suggest some defaults
$("#ncterm_type_1").val('author_text');
$("#ncterm_type_2").val('display_name');
$("#ncterm_type_3").val('nomenclatural_code');
$("#ncterm_type_4").val('taxon_status');
$("#ncterm_type_5").val('infraspecific_author');
$( "#sortable" ).sortable({
handle: '.dragger'
});
var ac_isclass_ttoptions = {
source: '/component/functions.cfc?method=ac_isclass_tt',
width: 320,
max: 50,
autofill: false,
multiple: false,
scroll: true,
scrollHeight: 300,
matchContains: true,
minChars: 1,
selectFirst:false
};
var ac_noclass_ttoptions = {
source: '/component/functions.cfc?method=ac_noclass_tt',
width: 320,
max: 50,
autofill: false,
multiple: false,
scroll: true,
scrollHeight: 300,
matchContains: true,
minChars: 1,
selectFirst:false
};
$("input.ac_isclass_tt").live("keydown.autocomplete", function() {
$(this).autocomplete(ac_isclass_ttoptions);
});
$("input.ac_noclass_tt").live("keydown.autocomplete", function() {
$(this).autocomplete(ac_noclass_ttoptions);
});
});
function requirePair(i){
var tt=$("#ncterm_type_" + i).val().length;
var t=$("#ncterm_" + i).val().length;
if (tt>0 || t>0){
$("#ncterm_type_" + i).addClass('reqdClr');
$("#ncterm_" + i).addClass('reqdClr');
} else {
$("#ncterm_type_" + i).removeClass('reqdClr');
$("#ncterm_" + i).removeClass('reqdClr');
}
}
</script>
<p>
Create classifications here. This form is limited - you can edit classifications (after creating them here) to do more.
</p>
<p>"Classifications" consist of hierarchical "taxonomy" data and nonhierarchical, non-classification data attributable to a Source.
"Nomenclatural code according to Arctos" is part of a Clasification (so it can be linked to the potentially-ranked taxonomy) but is NOT part of the
taxonomic classification.</p>
<p>
There are no true hierarchies, and there are no data rules. You can type anything here. Be exceedingly careful.
</p>
<cfquery name="thisName" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select scientific_name from taxon_name where taxon_name_id=#taxon_name_id#
</cfquery>
<cfquery name="cttaxonomy_source" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select source from cttaxonomy_source order by source
</cfquery>
<cfoutput>
<cfset title="Create Classification for #thisName.scientific_name#">
<h3>Create Classification for #thisName.scientific_name#</h3>
<form name="f1" id="f1" method="post" action="editTaxonomy.cfm">
<input type="hidden" name="action" value="saveNewClass">
<input type="hidden" name="taxon_name_id" id="taxon_name_id" value="#taxon_name_id#">
<label for="source">Source</label>
<select name="source" id="source" class="reqdClr">
<cfloop query="cttaxonomy_source">
<option value="#source#">#source#</option>
</cfloop>
</select>
<h3>
Non-Classification Terms
</h3>
<p style="font-size:small;">
These are paired terms; unpaired terms will be ignored. That means you can ignore the defaulted-in suggestions if you want.
</p>
<table id="clastbl" border="1">
<thead>
<tr>
<th>
Term Type
<a target="_blank" href="/component/functions.cfc?method=ac_noclass_tt&term">[ view all (JSON)]</a>
</th>
<th>Term</th>
</tr>
</thead>
<tbody id="notsortable">
<cfloop from="1" to="10" index="i">
<tr id="nccell_#i#">
<td>
<input class="ac_noclass_tt" size="60" type="text" id="ncterm_type_#i#" name="ncterm_type_#i#" onchange="requirePair(#i#);">
</td>
<td>
<input size="60" type="text" id="ncterm_#i#" name="ncterm_#i#" onchange="requirePair(#i#);">
</td>
</tr>
</cfloop>
</tbody>
</table>
<h3>
Classification Terms
</h3>
<p style="font-size:small;">
Order is important here - "large" (eg, kingdom) at top to "small" (eg, subspecies) at bottom.
Use as many cells as you need; leave the rest empty.
TermType will be ignored if Term is empty. Term will be saved regardless of TermType; unranked terms are OK.
Add more via Edit (after you save here) if necessary.
</p>
<table id="clastbl" border="1">
<thead>
<tr><th>Term Type
<a target="_blank" href="/component/functions.cfc?method=ac_isclass_tt&term">[ view all (JSON)]</a>
</th><th>Term</th></tr>
</thead>
<tbody id="sortable">
<cfloop from="1" to="10" index="i">
<td>
<input size="60" class="ac_isclass_tt" type="text" id="term_type_#i#" name="term_type_#i#">
</td>
<td>
<input size="60" type="text" id="term_#i#" name="term_#i#" >
</td>
</tr>
</cfloop>
</tbody>
</table>
<p>
<input type="submit" value="Create Classification">
</p>
</form>
</cfoutput>
</cfif>
---->
<!--------------------------------------------->
<cfif action is "newClassification">
<!---- edit: don't suggest, force, using cttaxon_term ---->
<script>
// copy this with edit classification
$(function() {
// suggest some defaults
$("#ncterm_type_1").val('author_text');
$("#ncterm_type_2").val('display_name');
$("#ncterm_type_3").val('nomenclatural_code');
$("#ncterm_type_4").val('taxon_status');
$("#ncterm_type_5").val('infraspecific_author');
$( "#sortable" ).sortable({
handle: '.dragger'
});
/*
var ac_isclass_ttoptions = {
source: '/component/functions.cfc?method=ac_isclass_tt',
width: 320,
max: 50,
autofill: false,
multiple: false,
scroll: true,
scrollHeight: 300,
matchContains: true,
minChars: 1,
selectFirst:false
};
var ac_noclass_ttoptions = {
source: '/component/functions.cfc?method=ac_noclass_tt',
width: 320,
max: 50,
autofill: false,
multiple: false,
scroll: true,
scrollHeight: 300,
matchContains: true,
minChars: 1,
selectFirst:false
};
$("input.ac_isclass_tt").live("keydown.autocomplete", function() {
$(this).autocomplete(ac_isclass_ttoptions);
});
$("input.ac_noclass_tt").live("keydown.autocomplete", function() {
$(this).autocomplete(ac_noclass_ttoptions);
});
*/
});
function requirePair(i){
var tt=$("#ncterm_type_" + i).val().length;
var t=$("#ncterm_" + i).val().length;
if (tt>0 || t>0){
$("#ncterm_type_" + i).addClass('reqdClr');
$("#ncterm_" + i).addClass('reqdClr');
} else {
$("#ncterm_type_" + i).removeClass('reqdClr');
$("#ncterm_" + i).removeClass('reqdClr');
}
}
</script>
<p>
Create classifications here. This form is limited - you can edit classifications (after creating them here) to do more.
</p>
<p>"Classifications" consist of hierarchical "taxonomy" data and nonhierarchical, non-classification data attributable to a Source.
"Nomenclatural code according to Arctos" is part of a Clasification (so it can be linked to the potentially-ranked taxonomy) but is NOT part of the
taxonomic classification.</p>
<p>
There are no true hierarchies, and there are no data rules. You can type anything here. Be exceedingly careful.
</p>
<cfquery name="thisName" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select scientific_name from taxon_name where taxon_name_id=#taxon_name_id#
</cfquery>
<cfquery name="cttaxonomy_source" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select source from cttaxonomy_source order by source
</cfquery>
<cfquery name="cttaxon_term_noclass" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select taxon_term from cttaxon_term where is_classification=0 order by taxon_term
</cfquery>
<cfquery name="cttaxon_term_isclass" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select taxon_term from cttaxon_term where is_classification=1 order by taxon_term
</cfquery>
<cfoutput>
<cfset title="Create Classification for #thisName.scientific_name#">
<h3>Create Classification for #thisName.scientific_name#</h3>
<form name="f1" id="f1" method="post" action="editTaxonomy.cfm">
<input type="hidden" name="action" value="saveNewClass">
<input type="hidden" name="taxon_name_id" id="taxon_name_id" value="#taxon_name_id#">
<label for="source">Source</label>
<select name="source" id="source" class="reqdClr">
<cfloop query="cttaxonomy_source">
<option value="#source#">#source#</option>
</cfloop>
</select>
<h3>
Non-Classification Terms
</h3>
<p style="font-size:small;">
These are paired terms; unpaired terms will be ignored. That means you can ignore the defaulted-in suggestions if you want.
</p>
<table id="clastbl" border="1">
<thead>
<tr>
<th>
Term Type
<a target="_blank" href="/component/functions.cfc?method=ac_noclass_tt&term">[ view all (JSON)]</a>
</th>
<th>Term</th>
</tr>
</thead>
<tbody id="notsortable">
<cfloop from="1" to="10" index="i">
<tr id="nccell_#i#">
<td>
<select class="ac_noclass_tt" id="ncterm_type_#i#" name="ncterm_type_#i#" onchange="requirePair(#i#);">
<option value=""></option>
<cfloop query="cttaxon_term_noclass">
<option value="#taxon_term#">#taxon_term#</option>
</cfloop>
</select>
<!----
<input class="ac_noclass_tt" size="60" type="text" id="ncterm_type_#i#" name="ncterm_type_#i#" onchange="requirePair(#i#);">
---->
</td>
<td>
<input size="60" type="text" id="ncterm_#i#" name="ncterm_#i#" onchange="requirePair(#i#);">
</td>
</tr>
</cfloop>
</tbody>
</table>
<h3>
Classification Terms
</h3>
<p style="font-size:small;">
Order is important here - "large" (eg, kingdom) at top to "small" (eg, subspecies) at bottom.
Use as many cells as you need; leave the rest empty.
TermType will be ignored if Term is empty. Term will be saved regardless of TermType; unranked terms are OK.
Add more via Edit (after you save here) if necessary.
</p>
<table id="clastbl" border="1">
<thead>
<tr><th>Term Type
<a target="_blank" href="/component/functions.cfc?method=ac_isclass_tt&term">[ view all (JSON)]</a>
</th><th>Term</th></tr>
</thead>
<tbody id="sortable">
<cfloop from="1" to="10" index="i">
<td>
<select class="ac_isclass_tt" id="term_type_#i#" name="term_type_#i#">
<option value=""></option>
<cfloop query="cttaxon_term_isclass">
<option value="#taxon_term#">#taxon_term#</option>
</cfloop>
</select>
<!----
<input size="60" class="ac_isclass_tt" type="text" id="term_type_#i#" name="term_type_#i#">
---->
</td>
<td>
<input size="60" type="text" id="term_#i#" name="term_#i#" >
</td>
</tr>
</cfloop>
</tbody>
</table>
<p>
<input type="submit" value="Create Classification">
</p>
</form>
</cfoutput>
</cfif>
<!------------------------------------------------------------------->
<cfif action is "editClassification">
<!----= edit: force, don't suggest, using cttaxon_term ---->
<style>
.dragger {
cursor:move;
}
.isterm {
font-weight:bold;
font-style:italics;
}
.warningDiv {color:red;font-size:x-small;}
</style>
<script>
// copy this with create classification
$(function() {
$( "#sortable" ).sortable({
handle: '.dragger'
});
guessAtDisplayName();
});
function submitForm() {
var linkOrderData=$("#sortable").sortable('toArray').join(',');
$( "#classificationRowOrder" ).val(linkOrderData);
var nccellary = new Array();
$.each($("tr[id^='nccell_']"), function() {
nccellary.push(this.id);
});
var ncls=nccellary.join(',');
$( "#noclassrows" ).val(ncls);
$( "#f1" ).submit();
}
function deleteThis(r) {
$( "#cell_" + r ).remove();
}
function nc_deleteThis(r) {
$( "#nccell_" + r ).remove();
}
function addARow() {
var n=parseInt($("#maxposn").val());
++n;
var x='<tr id="cell_' + n + '">';
x+='<td class="dragger">(drag row here)</td>';
x+='<td><select class="ac_isclass_tt" id="term_type_' + n + '" name="term_type_' + n + '" onchange="guessAtDisplayName(this.id)"></select></td>';
x+='<td><input size="60" type="text" id="term_' + n + '" name="term_' + n + '" onchange="guessAtDisplayName(this.id)"></td>';
x+='<td><span class="likeLink" onclick="deleteThis(\'' + n + '\');">[ Delete this row ]</span></td>';
x+='</tr>';
$("#sortable").append(x);
$("#maxposn").val(n);
$('#term_type_1').find('option').clone().appendTo('#term_type_' + n);
$('#term_type_' + n).val('');
}
function nc_addARow() {
var n=parseInt($("#numnoclassrs").val());
++n;
var x='<tr id="nccell_' + n + '">';
x+='<td><select class="ac_noclass_tt" id="ncterm_type_' + n + '" name="ncterm_type_' + n + '" onchange="guessAtDisplayName(this.id)"></select></td>';
x+='<td><input size="60" type="text" id="ncterm_' + n + '" name="ncterm_' + n + '" onchange="guessAtDisplayName(this.id)"></td>';
x+='<td><span class="likeLink" onclick="nc_deleteThis(\'' + n + '\');">[ Delete this row ]</span></td>';
x+='</tr>';
$("#notsortable").append(x);
$("#numnoclassrs").val(n);
$('#template_ncterm_type_template').find('option').clone().appendTo('#ncterm_type_' + n);
$('#ncterm_type_' + n).val('');
}
function deleteClassification(cid,tnid) {
var msg='Are you sure you want to delete this classification?\nDo NOT delete classifications because you do not agree with them or because they';
msg+=' do not fit your collection or taxonomy preferences.\nDeleted classifications from GlobalNames will come back; fix them at the source.';
msg+='\nIf you did not create the classification you are trying to delete, you should probably click "cancel" now.';
var r=confirm(msg);
if (r==true) {
document.location='/editTaxonomy.cfm?action=deleteClassification&classification_id=' + cid + '&taxon_name_id=' + tnid;
}
}
function guessAtDisplayName(caller) {
// if this is being called by an element, check if that element is the value
// of display_name. If so, just exit. Otherwise, rock on.
if(caller && caller.substring(0, 2) == "nc") {
var cary=caller.split('_');
var theIdInt=cary[cary.length-1];
var theType=$("#ncterm_type_" + theIdInt).val();
if (theType == 'display_name'){
return false;
}
}
var genus; // just so that we can italicize @fallback
var species;
var infraspecific_term;
var infraspecific_rank;
var speciesauthor;
var subspeciesauthor;
var dv_element=""; // element of the term type
var dv_value=""; // contents of the term
var dv_value_element=""; // element of the term
var formatstyle = 'iczn'; // default to simple....
var formattedname; // with HTML
var lowestclassificationterm;
$(":input[name^='ncterm_type_']").each(function() {
var thisval = $(this).val();
var relatedElementID=this.id.replace("type_","");
var relatedElement=$("#" + relatedElementID).val();
if(thisval == "author_text") {
speciesauthor=relatedElement;
}
if(thisval == "infraspecific_author") {
subspeciesauthor=relatedElement;
}
if(thisval == "nomenclatural_code" && relatedElement=='ICBN') {
formatstyle='icbn';
}
});
// and this point, there should be a display_name and we should know it's ID.
$(":input[name^='term_type_']").each(function() {
var thisval = $(this).val();
var relatedElementID=this.id.replace("type_","");
var relatedElement=$("#" + relatedElementID).val();
if(thisval == "kingdom" && relatedElement=='Plantae') {
formatstyle='icbn';
}
if(thisval == "species" || thisval == "sp" || thisval == "sp.") {
species=relatedElement;
}
if(thisval == "genus" || thisval == "gen.") {
genus=relatedElement;
}
if(thisval == "subsp." || thisval == "variety" || thisval == "var." || thisval == "varietas" || thisval == "subvar." || thisval == "subspecies") {
infraspecific_term=relatedElement;
infraspecific_rank=thisval;
}
lowestclassificationterm=relatedElement;
});
if (species) {
formattedname = ' <i>' + species + '</i>';
if (formatstyle=='icbn'){
if (speciesauthor) {
formattedname += ' ' + speciesauthor;
}
if (infraspecific_rank) {
formattedname += ' ' + infraspecific_rank;
}
if (infraspecific_term) {
infraspecific_term=infraspecific_term.replace(species,"").trim();
infraspecific_term=infraspecific_term.replace(infraspecific_rank,"").trim();
formattedname += ' <i>' + infraspecific_term + '</i>';
}
if (subspeciesauthor) {
formattedname += ' ' + subspeciesauthor;
}
}
if (formatstyle=='iczn'){
if (infraspecific_term) {
infraspecific_term=infraspecific_term.replace(species,"").trim();
formattedname += ' <i>' + infraspecific_term + '</i>';
}
if (speciesauthor) {
formattedname += ' ' + speciesauthor;
}
}
}
if (! formattedname) {
if (genus) {
formattedname='<i>' + genus + '</i>';
if (speciesauthor) {
formattedname += ' ' + speciesauthor;
}
} else {
formattedname=lowestclassificationterm;
}
}
if (formattedname) {
formattedname=formattedname.replace(/<\/i> <i>/g, ' ').trim();
$("#dng").val(formattedname);
}
}
function useDNG(){
var dn=$("#dng").val();
var idOfDisplayRow;
$("select").each(function(){
if( $(this).val()=='display_name' ){
idOfDisplayRow=this.id;
}
});
if(typeof idOfDisplayRow === 'undefined'){
nc_addARow();
var n=parseInt($("#numnoclassrs").val());
$('#ncterm_type_' + n).val('display_name');
idOfDisplayRow='ncterm_type_' + n;
}
var vc=idOfDisplayRow.replace('type_','');
$("#" + vc).val(dn);
}
function scrollDNW () {
$('html, body').animate({
scrollTop: $("#dnWarning").offset().top
}, 1000);
}
</script>
<cfoutput>
<cfquery name="d" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select
*
from
taxon_name,
taxon_term
where
taxon_name.taxon_name_id=taxon_term.taxon_name_id and
classification_id='#classification_id#'
</cfquery>
<cfquery name="thisname" dbtype="query">
select
source,
scientific_name,
taxon_name_id
from
d
group by
source,
scientific_name,
taxon_name_id
</cfquery>
<cfquery name="noclass" dbtype="query">
select * from d where POSITION_IN_CLASSIFICATION is null order by term_type
</cfquery>
<cfquery name="hasclass" dbtype="query">
select * from d where POSITION_IN_CLASSIFICATION is not null order by POSITION_IN_CLASSIFICATION
</cfquery>
<cfquery name="maxclass" dbtype="query">
select max(POSITION_IN_CLASSIFICATION) m from hasclass
</cfquery>
<cfquery name="maxnoclass" dbtype="query">
select count(*) m from noclass
</cfquery>
<cfquery name="cttaxon_term" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select * from cttaxon_term
</cfquery>
<cfquery name="cttaxon_term_noclass" dbtype="query">
select taxon_term from cttaxon_term where is_classification=0 order by taxon_term
</cfquery>
<cfquery name="cttaxon_term_isclass" dbtype="query">
select taxon_term from cttaxon_term where is_classification=1 order by relative_position
</cfquery>
<cfset pterms=valuelist(cttaxon_term_noclass.taxon_term)>
<cfset pterms=listappend(pterms,valuelist(cttaxon_term_isclass.taxon_term))>
<cfset x=ListQualify(valuelist(cttaxon_term.taxon_term),"'")>
<cfquery name="noct" dbtype="query">
select term_type from d where term_type not in
(#PreserveSingleQuotes(x)#)
</cfquery>
<cfif len(noct.term_type) gt 0>
<div style="border:10px solid red; padding:2em; margin:2em;">
Caution: The following term(s) are used in this classification and are not
available from the code table. They will (not) show up as blank cells below
and may be difficult to distinguish from unranked terms.
Make sure you know what you're doing before saving!
Use the contact link in the footer if you need help.
<ul>
<cfloop query="noct">
<li>#term_type#</li>
</cfloop>
</ul>
</div>
</cfif>
<p>
Editing <strong>#thisName.source#</strong> classification for <strong>#thisName.scientific_name#</strong> (classification_id=#classification_id#)
<cfset title="Edit Classification: #thisName.scientific_name#">
<br>
<a href="/name/#thisname.scientific_name#">[ View Taxon Page ]</a>
<a href="/editTaxonomy.cfm?action=editnoclass&taxon_name_id=#thisname.taxon_name_id#">[ Edit Non-Classification Data ]</a>
<span class="likeLink" onclick="deleteClassification('#classification_id#','#thisname.taxon_name_id#');">[ Delete Classification ]</span>
</p>
<p>
Important randomness:
<ul>
<li>
<span class="isterm">Species</span> are binomials, not specific epithets: "Poa abbreviata" rather than "abbreviata."
</li>
<li>
ICZN-like subspecific terms (which should with rare exception be <span class="isterm">subspecies</span>) are trinomials:
"Alces alces shirasi," not "shirasi."
</li>
<li>
ICBN-like subspecific terms (<span class="isterm">subspecies</span>, <span class="isterm">subsp.</span>, <span class="isterm">var.</span>, etc.)
are ranked trinomials: "Poa abbreviata subsp. jordalii," not "jordalii."
</li>
<li>
There is no enforced order for classification terms. subpsecies-->kingdom-->genus is possible. Do not use this
form if you're not sure of how to correctly order ranked terms. (Why? Usage varies. Animal people think "section" is somewhere
between order and family, while plant people think it's a subdivision of subgenus.)
</li>
</ul>
</p>
<form name="f1" id="f1" method="post" action="editTaxonomy.cfm">
<input type="button" class="savBtn" onclick="submitForm();" value="Save Edits">
<input type="button" class="lnkBtn" onclick="scrollDNW();" value="See display_name suggestions">
<input type="hidden" name="action" value="saveClassEdits">
<input type="hidden" name="classification_id" id="classification_id" value="#classification_id#">
<input type="hidden" name="taxon_name_id" id="taxon_name_id" value="#thisname.taxon_name_id#">
<input type="hidden" name="source" id="source" value="#thisname.source#">
<cfif len(maxclass.m) is 0>
<cfset mc=0>
<cfelse>
<cfset mc=maxclass.m>
</cfif>
<input type="hidden" name="maxposn" id="maxposn" value="#mc#">
<cfif len(maxnoclass.m) is 0>
<cfset mc=0>
<cfelse>
<cfset mc=maxnoclass.m>
</cfif>
<input type="hidden" name="numnoclassrs" id="numnoclassrs" value="#mc#">
<input type="hidden" name="classificationRowOrder" id="classificationRowOrder">
<input type="hidden" name="noclassrows" id="noclassrows">
<select style="display: none"
id="template_ncterm_type_template">
<option value=""></option>
<cfloop query="cttaxon_term_noclass">
<option value="#taxon_term#">#taxon_term#</option>
</cfloop>
</select>
<h3>
Non-Classification Terms <span class="likeLink" onclick="getCtDoc('cttaxon_term');">code table</span>
</h3>
<p style="font-size:small;">
These are paired terms; unpaired terms - those with either side blank - will be ignored (=deleted).
</p>
<table id="clastbl" border="1">
<thead>
<tr><th>Term Type</th><th>Term</th><th>Delete</th></tr>
</thead>
<tbody id="notsortable">
<cfset thisrow=1>
<cfloop query="noclass">
<tr id="nccell_#thisrow#">
<td>
<select
class="ac_noclass_tt"
id="ncterm_type_#thisrow#"
name="ncterm_type_#thisrow#"