-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditLocality.cfm
1168 lines (1142 loc) · 46.1 KB
/
editLocality.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">
<style type="text/css">
#map-canvas { height: 300px;width:500px; }
</style>
<cfoutput>
<script>
function useGL(glat,glon,gerr){
$("##MAX_ERROR_DISTANCE").val(gerr);
$("##MAX_ERROR_UNITS").val('m');
$("##datum").val('World Geodetic System 1984');
$("##georeference_source").val('GeoLocate');
$("##georeference_protocol").val('GeoLocate');
$("##dec_lat").val(glat);
$("##dec_long").val(glon);
closeGeoLocate();
}
</script>
</cfoutput>
<cfif action is "nothing">
<cfquery name="cf_global_settings" datasource="uam_god" cachedwithin="#createtimespan(0,0,60,0)#">
select
google_client_id,
google_private_key
from cf_global_settings
</cfquery>
<cfset title="Edit Locality">
<script language="JavaScript" src="/includes/jquery/scrollTo.js" type="text/javascript"></script>
<cfoutput>
<cfhtmlhead text='<script src="http://maps.googleapis.com/maps/api/js?client=#cf_global_settings.google_client_id#&sensor=false&libraries=geometry" type="text/javascript"></script>'>
</cfoutput>
<script language="javascript" type="text/javascript">
rad = function(x) {return x*Math.PI/180;}
distHaversine = function(p1, p2) {
var R = 6371; // earth's mean radius in km
var dLat = rad(p2.lat() - p1.lat());
var dLong = rad(p2.lng() - p1.lng());
var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(rad(p1.lat())) * Math.cos(rad(p2.lat())) * Math.sin(dLong/2) * Math.sin(dLong/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c;
return d.toFixed(3);
}
jQuery(document).ready(function() {
var map;
var mapOptions = {
center: new google.maps.LatLng($("#s_dollar_dec_lat").val(), $("#s_dollar_dec_long").val()),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var bounds = new google.maps.LatLngBounds();
function initialize() {
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
}
initialize();
var latLng1 = new google.maps.LatLng($("#dec_lat").val(), $("#dec_long").val());
if ($("#dec_lat").val().length>0){
var marker1 = new google.maps.Marker({
position: latLng1,
map: map,
icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'
});
var circleOptions = {
center: latLng1,
radius: Math.round($("#error_in_meters").val()),
map: map,
editable: false
};
var circle = new google.maps.Circle(circleOptions);
}
var latLng2 = new google.maps.LatLng($("#s_dollar_dec_lat").val(), $("#s_dollar_dec_long").val());
if ($("#s_dollar_dec_lat").val().length>0){
var marker2 = new google.maps.Marker({
position: latLng2,
map: map,
icon: 'http://maps.google.com/mapfiles/ms/icons/red-dot.png'
});
}
bounds.extend(latLng1);
bounds.extend(latLng2);
// center the map on the points
map.fitBounds(bounds);
// and zoom back out a bit, if the points will still fit
// because the centering zooms WAY in if the points are close together
var p1 = new google.maps.LatLng($("#dec_lat").val(),$("#dec_long").val());
var p2 = new google.maps.LatLng($("#s_dollar_dec_lat").val(),$("#s_dollar_dec_long").val());
var tdis=distHaversine(p1,p2);
$("#distanceBetween").val(tdis);
if (tdis < 50) {
// if hte points are close together autozoom goes too far
var listener = google.maps.event.addListener(map, "idle", function() {
if (map.getZoom() > 4) map.setZoom(4);
google.maps.event.removeListener(listener);
});
}
// end map setup
$("select[id^='geology_attribute_']").each(function(e){
populateGeology(this.id);
});
$.each($("input[id^='geo_att_determined_date_']"), function() {
$("#" + this.id).datepicker();
});
if (window.addEventListener) {
window.addEventListener("message", getGeolocate, false);
} else {
window.attachEvent("onmessage", getGeolocate);
}
});
function useAutoCoords(){
$("#dec_lat").val($("#s_dollar_dec_lat").val());
$("#dec_long").val($("#s_dollar_dec_long").val());
$("#datum").val('World Geodetic System 1984');
$("#georeference_source").val('Google auto-suggest georeference');
$("#georeference_protocol").val('Google automated georeference');
}
function geolocate(method) {
alert('This opens a map. There is a help link at the top. Use it. The save button will create a new determination.');
var guri='http://www.museum.tulane.edu/geolocate/web/webgeoreflight.aspx?georef=run';
if (method=='adjust'){
guri+="&tab=result&points=" + $("#dec_lat").val() + "|" + $("#dec_long").val() + "|||" + $("#error_in_meters").val();
} else {
guri+="&state=" + $("#state_prov").val();
guri+="&country="+$("#country").val();
guri+="&county="+$("#county").val().replace(" County", "");
guri+="&locality="+$("#spec_locality").val();
}
var bgDiv = document.createElement('div');
bgDiv.id = 'bgDiv';
bgDiv.className = 'bgDiv';
bgDiv.setAttribute('onclick','closeGeoLocate("clicked closed")');
document.body.appendChild(bgDiv);
var popDiv=document.createElement('div');
popDiv.id = 'popDiv';
popDiv.className = 'editAppBox';
document.body.appendChild(popDiv);
var cDiv=document.createElement('div');
cDiv.className = 'fancybox-close';
cDiv.id='cDiv';
cDiv.setAttribute('onclick','closeGeoLocate("clicked closed")');
$("#popDiv").append(cDiv);
var hDiv=document.createElement('div');
hDiv.className = 'fancybox-help';
hDiv.id='hDiv';
hDiv.innerHTML='<a href="https://arctosdb.wordpress.com/how-to/create/data-entry/geolocate/" target="blank">[ help ]</a>';
$("#popDiv").append(hDiv);
$("#popDiv").append('<img src="/images/loadingAnimation.gif" class="centeredImage">');
var theFrame = document.createElement('iFrame');
theFrame.id='theFrame';
theFrame.className = 'editFrame';
theFrame.src=guri;
$("#popDiv").append(theFrame);
}
function getGeolocate(evt) {
var message;
if (evt.origin !== "http://www.museum.tulane.edu") {
alert( "iframe url does not have permision to interact with me" );
closeGeoLocate('intruder alert');
}
else {
var breakdown = evt.data.split("|");
if (breakdown.length == 4) {
var glat=breakdown[0];
var glon=breakdown[1];
var gerr=breakdown[2];
useGL(glat,glon,gerr)
} else {
alert( "Whoa - that's not supposed to happen. " + breakdown.length);
closeGeoLocate('ERROR - breakdown length');
}
}
}
function closeGeoLocate(msg) {
$('#bgDiv').remove();
$('#bgDiv', window.parent.document).remove();
$('#popDiv').remove();
$('#popDiv', window.parent.document).remove();
$('#cDiv').remove();
$('#cDiv', window.parent.document).remove();
$('#theFrame').remove();
$('#theFrame', window.parent.document).remove();
}
function populateGeology(id) {
if (id=='geology_attribute') {
var idNum='';
var thisValue=$("#geology_attribute").val();
var dataValue=$("#geo_att_value").val();
var theSelect="geo_att_value";
} else {
var idNum=id.replace('geology_attribute_','');
var thisValue=$("#geology_attribute_" + idNum).val();;
var dataValue=$("#geo_att_value_" + idNum).val();
var theSelect="geo_att_value_";
}
jQuery.getJSON("/component/functions.cfc",
{
method : "getGeologyValues",
attribute : thisValue,
returnformat : "json",
queryformat : 'column'
},
function (r) {
var s='';
for (i=0; i<r.ROWCOUNT; ++i) {
s+='<option value="' + r.DATA.ATTRIBUTE_VALUE[i] + '"';
if (r.DATA.ATTRIBUTE_VALUE[i]==dataValue) {
s+=' selected="selected"';
}
s+='>' + r.DATA.ATTRIBUTE_VALUE[i] + '</option>';
}
$("select#" + theSelect + idNum).html(s);
}
);
}
function cloneLocality(locality_id) {
if(confirm('Are you sure you want to create a copy of this locality which you may then edit?')) {
var rurl='editLocality.cfm?action=clone&locality_id=' + locality_id;
document.location=rurl;
}
}
function convertToDD(format){
if (format=='dms'){
var lat_deg=$("#lat_deg").val();
if(lat_deg==''){
lat_deg=0;
}
var lat_min=$("#lat_min").val();
if(lat_min==''){
lat_min=0;
}
var lat_sec=$("#lat_sec").val();
if(lat_sec==''){
lat_sec=0;
}
var dms_latdir=$("#dms_latdir").val();
var long_deg=$("#long_deg").val();
if(long_deg==''){
long_deg=0;
}
var long_min=$("#long_min").val();
if(long_min==''){
long_min=0;
}
var long_sec=$("#long_sec").val();
if(long_sec==''){
long_sec=0;
}
var dms_longdir=$("#dms_longdir").val();
var dec_lat = parseFloat(lat_deg) + (parseFloat(lat_min) / 60) + (parseFloat(lat_sec) / 3600);
if (dms_latdir == 'S'){
dec_lat = dec_lat * -1;
}
var dec_long = parseFloat(long_deg) + (parseFloat(long_min) / 60) + (parseFloat(long_sec) / 3600);
if (dms_longdir == 'W'){
dec_long = dec_long * -1;
}
}
if (format=='dm'){
var dec_lat_deg=$("#dec_lat_deg").val();
if(dec_lat_deg==''){
dec_lat_deg=0;
}
var dec_lat_min=$("#dec_lat_min").val();
if(dec_lat_min==''){
dec_lat_min=0;
}
var dm_latdir=$("#dm_latdir").val();
var dec_long_deg=$("#dec_long_deg").val();
if(dec_long_deg==''){
dec_long_deg=0;
}
var dec_long_min=$("#dec_long_min").val();
if(dec_long_min==''){
dec_long_min=0;
}
var dm_longdir=$("#dm_longdir").val();
var dec_lat = parseFloat(dec_lat_deg) + (parseFloat(dec_lat_min) / 60);
if (dm_latdir == 'S'){
dec_lat = dec_lat * -1;
}
var dec_long = parseFloat(dec_long_deg) + (parseFloat(dec_long_min) / 60);
if (dm_longdir == 'W'){
dec_long = dec_long * -1;
}
}
$("#dec_lat").val(dec_lat);
$("#dec_long").val(dec_long);
}
</script>
<cfoutput>
<!----
BEFORE getting the SQL to build this page,
fetch the static image with forceOverrideCache=true
to reset the stuff from the webservice
shouldn't get too much traffic here, at edit locality,
and this will keep things less confusing when
folks are actively editing
---->
<cfset obj = CreateObject("component","component.functions")>
<cfset staticImageMap = obj.getMap(
locality_id="#locality_id#",
forceOverrideCache=true)>
<cfquery name="locDet" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select
locality.locality_id,
geog_auth_rec.GEOG_AUTH_REC_ID,
higher_geog,
state_prov,
county,
country,
spec_locality,
MIN_DEPTH,
MAX_DEPTH,
DEPTH_UNITS,
LOCALITY_REMARKS,
MINIMUM_ELEVATION,
MAXIMUM_ELEVATION,
ORIG_ELEV_UNITS,
SPEC_LOCALITY,
DEC_LAT,
DEC_LONG,
MAX_ERROR_DISTANCE,
MAX_ERROR_UNITS,
to_meters(MAX_ERROR_DISTANCE,MAX_ERROR_UNITS) error_in_meters,
DATUm,
georeference_source,
georeference_protocol,
locality_name,
s$elevation,
s$geography,
s$dec_lat,
s$dec_long,
to_meters(locality.minimum_elevation,locality.orig_elev_units) min_elev_in_m,
to_meters(locality.maximum_elevation,locality.orig_elev_units) max_elev_in_m
from
locality,
geog_auth_rec
where
locality.geog_auth_rec_id = geog_auth_rec.geog_auth_rec_id and
locality.locality_id=#locality_id#
</cfquery>
<cfif locDet.recordcount is not 1>
<div class="error">locality not found</div><cfabort>
</cfif>
<cfquery name="geolDet" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select
*
from
geology_attributes,
preferred_agent_name
where
geology_attributes.geo_att_determiner_id = preferred_agent_name.agent_id (+) and
geology_attributes.locality_id=#locality_id#
</cfquery>
<cfquery name="ctdatum" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select datum from ctdatum order by datum
</cfquery>
<cfquery name="ctElevUnit" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select orig_elev_units from ctorig_elev_units order by orig_elev_units
</cfquery>
<cfquery name="ctDepthUnit" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select depth_units from ctdepth_units order by depth_units
</cfquery>
<cfquery name="cterror" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select LAT_LONG_ERROR_UNITS from ctLAT_LONG_ERROR_UNITS order by LAT_LONG_ERROR_UNITS
</cfquery>
<cfquery name="ctgeoreference_protocol" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select georeference_protocol from ctgeoreference_protocol order by georeference_protocol
</cfquery>
<cfquery name="ctgeology_attribute" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select geology_attribute from ctgeology_attribute order by geology_attribute
</cfquery>
<cfquery name="ctVerificationStatus" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
select VerificationStatus from ctVerificationStatus order by VerificationStatus
</cfquery>
<cfset contents = obj.getLocalityContents(locality_id="#locality_id#")>
#contents#
<br>
<div style="border:5px solid red; background-color:red;">
<br>Red is scary. This form is dangerous. Make sure you know what it's doing before you get all clicky.
<cfquery name="vstat" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select
verificationstatus,
collection,
count(*) c
from
specimen_event,
cataloged_item,
collection,
collecting_event
where
specimen_event.collection_object_id=cataloged_item.collection_object_id and
cataloged_item.collection_id=collection.collection_id and
specimen_event.collecting_event_id=collecting_event.collecting_event_id and
collecting_event.locality_id=#locDet.locality_id#
group by
verificationstatus,
collection
</cfquery>
<label for="dfs">"Your" specimens in this locality:</label>
<table id="dfs" border>
<tr>
<th>Collection</th>
<th>VerificationStatus</th>
<th>NumberSpecimenEvents</th>
</tr>
<cfloop query="vstat">
<tr>
<td>#collection#</td>
<td>#verificationstatus#</td>
<td>#c#</td>
</tr>
</cfloop>
</table>
<form name="x" method="post" action="editLocality.cfm">
<input type="hidden" name="locality_id" value="#locDet.locality_id#">
<input type="hidden" name="action" value="updateAllVerificationStatus">
<label for="VerificationStatus" class="likeLink" onClick="getDocs('lat_long','verification_status')">Update Verification Status for ALL specimen_events in this collecting event to....</label>
<select name="VerificationStatus" id="verificationstatus" size="1" class="reqdClr">
<option value=""></option>
<cfloop query="ctVerificationStatus">
<option value="#VerificationStatus#">#VerificationStatus#</option>
</cfloop>
</select>
<label for="VerificationStatusIs">
.....where current verificationstatus IS (leave blank to get everything)
</label>
<select name="VerificationStatusIs" id="VerificationStatusIs" size="1" class="reqdClr">
<option value=""></option>
<cfloop query="ctVerificationStatus">
<option value="#VerificationStatus#">#VerificationStatus#</option>
</cfloop>
</select>
<br>
<input type="submit" class="lnkBtn" value="Update Verification Status for all of your specimen_events in this locality to value in pick above">
</form>
</div>
<span style="margin:1em;display:inline-block;padding:1em;border:3px solid black;">
<table width="100%"><tr><td valign="top">
<p><strong>Locality</strong></p>
<form name="locality" method="post" action="editLocality.cfm">
<input type="hidden" id="state_prov" name="state_prov" value="#locDet.state_prov#">
<input type="hidden" id="country" name="country" value="#locDet.country#">
<input type="hidden" id="county" name="county" value="#locDet.county#">
<input type="hidden" name="action" value="saveLocalityEdit">
<input type="hidden" name="locality_id" value="#locDet.locality_id#">
<input type="hidden" name="geog_auth_rec_id" value="#locDet.geog_auth_rec_id#">
<label for="higher_geog">Higer Geography</label>
<input type="text" name="higher_geog" id="higher_geog" value="#locDet.higher_geog#" size="120" class="readClr" readonly="yes">
<input type="button" value="Change" class="picBtn" id="changeGeogButton"
onclick="GeogPick('geog_auth_rec_id','higher_geog','locality'); return false;">
<input type="button" value="Edit" class="lnkBtn"
onClick="document.location='Locality.cfm?action=editGeog&geog_auth_rec_id=#locDet.geog_auth_rec_id#'">
<label for="spec_locality" class="likeLink" onClick="getDocs('locality','specific_locality')">
Specific Locality
</label>
<input type="text"id="spec_locality" name="spec_locality" value="#stripQuotes(locDet.spec_locality)#" size="120">
<label for="locality_name" class="likeLink" onClick="getDocs('locality','locality_name')">
Locality Nickname
</label>
<input type="text" id="locality_name" name="locality_name" value="#stripQuotes(locDet.locality_name)#" size="120">
<cfif len(locDet.locality_name) is 0>
<span class="infoLink" onclick="$('##locality_name').val('#CreateUUID()#');">create GUID</span>
</cfif>
<table>
<tr>
<td>
<label for="minimum_elevation" onClick="getDocs('locality','elevation')" class="likeLink">
Min. Elev.
</label>
<input type="text" name="minimum_elevation" id="minimum_elevation" value="#locDet.minimum_elevation#" size="3">
</td>
<td>TO</td>
<td>
<label for="maximum_elevation" onClick="getDocs('locality','elevation')" class="likeLink">
Max. Elev.
</label>
<input type="text" name="maximum_elevation" id="maximum_elevation" value="#locDet.maximum_elevation#" size="3">
</td>
<td>
<label for="orig_elev_units" onClick="getDocs('locality','elevation')" class="likeLink">
Elev. Unit
</label>
<select name="orig_elev_units" size="1" id="orig_elev_units">
<option value=""></option>
<cfloop query="ctElevUnit">
<option <cfif ctelevunit.orig_elev_units is locdet.orig_elev_units> selected="selected" </cfif>value="#ctElevUnit.orig_elev_units#">#ctElevUnit.orig_elev_units#</option>
</cfloop>
</select>
</td>
</tr>
</table>
<table>
<tr>
<td>
<label for="min_depth" onClick="getDocs('locality','depth')" class="likeLink">
Min. Depth.
</label>
<input type="text" name="min_depth" id="min_depth" value="#locDet.min_depth#" size="3">
</td>
<td>TO</td>
<td>
<label for="max_depth" class="likeLink" onClick="getDocs('locality','depth')">
Max. Depth.
</label>
<input type="text" name="max_depth" id="max_depth" value="#locDet.max_depth#" size="3">
</td>
<td>
<label for="depth_units" class="likeLink" onClick="getDocs('locality','depth')">
Depth Unit
</label>
<select name="depth_units" size="1" id="depth_units">
<option value=""></option>
<cfloop query="ctDepthUnit">
<option <cfif ctDepthUnit.depth_units is locdet.depth_units> selected="selected" </cfif>value="#ctDepthUnit.depth_units#">#ctDepthUnit.depth_units#</option>
</cfloop>
</select>
</td>
</tr>
</table>
<label for="locality_remarks">Locality Remarks</label>
<input type="text" name="locality_remarks" id="locality_remarks" value="#stripQuotes(locDet.locality_remarks)#" size="120">
<table>
<tr>
<td>
<label for="dec_lat">Decimal Latitude</label>
<input type="text" name="DEC_LAT" id="dec_lat" value="#locDet.DEC_LAT#" class="">
</td>
<td>
<label for="dec_long">Decimal Longitude</label>
<input type="text" name="DEC_LONG" value="#locDet.DEC_LONG#" id="dec_long" class="">
</td>
<td rowspan="3">
<cfquery name="events" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select
count(*) c,
VERBATIM_DATE,
VERBATIM_LOCALITY,
VERBATIM_COORDINATES,
COLLECTING_EVENT_NAME
from
collecting_event
where
locality_id=#locDet.locality_id#
group by
VERBATIM_DATE,
VERBATIM_LOCALITY,
VERBATIM_COORDINATES,
COLLECTING_EVENT_NAME
</cfquery>
<label for="et">Events using this Locality</label>
<div style="max-height:200px;overflow:auto;">
<table id="et" border>
<tr>
<th>Count</th>
<th>Nickname</th>
<th>Date</th>
<th>Coordinates</th>
</tr>
<cfloop query="events">
<tr>
<td>#c#</td>
<td>#COLLECTING_EVENT_NAME#</td>
<td>#VERBATIM_DATE#</td>
<td>#verbatim_coordinates#</td>
</tr>
</cfloop>
</table>
<input type="button" value="Update all events to use locality coordinates" class="lnkBtn"
onclick="document.location='/Locality.cfm?action=massEditCollEvent&locality_id=#locDet.locality_id#'">
</div>
</td>
</tr>
<tr>
<td colspan="2">
<label for="dmsdiv">Convert to decimal degrees</label>
<div id="dmsdiv" style="border:1px solid black;padding-left:1.5em;background-color:LightGray;">
<table>
<tr>
<td>
<label for="lat_deg">LatDeg</label>
<input type="text" name="lat_deg" id="lat_deg" size="2">
</td>
<td>
<label for="lat_min">LatMin</label>
<input type="text" name="lat_min" id="lat_min" size="2">
</td>
<td>
<label for="lat_sec">LatSec</label>
<input type="text" name="lat_sec" id="lat_sec" size="2">
</td>
<td>
<label for="lat_dir">LatDir</label>
<select name="dms_latdir" id="dms_latdir">
<option value="N">N</option>
<option value="S">S</option>
</select>
</td>
<td rowspan="2" style="vertical-align: middle;">
<input type="button" class="lnkBtn" onclick="convertToDD('dms');" value="convert to decimal">
</td>
</tr>
<tr>
<td>
<label for="long_deg">LongDeg</label>
<input type="text" name="long_deg" id="long_deg" size="2">
</td>
<td>
<label for="long_min">LongMin</label>
<input type="text" name="long_min" id="long_min" size="2">
</td>
<td>
<label for="long_sec">LongSec</label>
<input type="text" name="long_sec" id="long_sec" size="2">
</td>
<td>
<label for="dms_longdir">LongDir</label>
<select name="dms_longdir" id="dms_longdir">
<option value="E">E</option>
<option value="W">W</option>
</select>
</td>
</tr>
</table>
</div>
<div style="border:1px solid black;padding-left:1.5em;background-color:LightGray;">
<table>
<tr>
<td>
<label for="dec_lat_deg">LatDeg</label>
<input type="text" name="dec_lat_deg" id="dec_lat_deg" size="2">
</td>
<td>
<label for="dec_lat_min">DecLatMin</label>
<input type="text" name="dec_lat_min" id="dec_lat_min" size="4">
</td>
<td>
<label for="dm_latdir">LatDir</label>
<select name="dm_latdir" id="dm_latdir">
<option value="N">N</option>
<option value="S">S</option>
</select>
</td>
<td rowspan="2" style="vertical-align: middle;">
<input type="button" class="lnkBtn" onclick="convertToDD('dm');" value="convert to decimal">
</td>
</tr>
<tr>
<td>
<label for="dec_long_deg">LongDeg</label>
<input type="text" name="dec_long_deg" id="dec_long_deg" size="2">
</td>
<td>
<label for="dec_long_min">DecLongMin</label>
<input type="text" name="dec_long_min" id="dec_long_min" size="2">
</td>
<td>
<label for="dm_longdir">LongDir</label>
<select name="dm_longdir" id="dm_longdir">
<option value="E">E</option>
<option value="W">W</option>
</select>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<input type="hidden" id="error_in_meters" value="#locDet.error_in_meters#">
<label for="MAX_ERROR_DISTANCE" class="likeLink" onClick="getDocs('lat_long','maximum_error')">Max Error</label>
<input type="text" name="MAX_ERROR_DISTANCE" id="MAX_ERROR_DISTANCE" value="#locDet.MAX_ERROR_DISTANCE#" size="6">
</td>
<td>
<label for="MAX_ERROR_UNITS" class="likeLink" onClick="getDocs('lat_long','maximum_error')">Max Error Units</label>
<select name="MAX_ERROR_UNITS" size="1" id="MAX_ERROR_UNITS">
<option value=""></option>
<cfloop query="cterror">
<option <cfif cterror.LAT_LONG_ERROR_UNITS is locDet.MAX_ERROR_UNITS> selected="selected" </cfif>
value="#cterror.LAT_LONG_ERROR_UNITS#">#cterror.LAT_LONG_ERROR_UNITS#</option>
</cfloop>
</select>
</td>
</tr>
</table>
<label for="datum" class="likeLink" onClick="getDocs('lat_long','datum')">Datum</label>
<select name="datum" id="datum" size="1" class="reqdClr">
<option value=''></option>
<cfloop query="ctdatum">
<option <cfif ctdatum.DATUM is locDet.DATUM> selected="selected" </cfif> value="#ctdatum.DATUM#">#ctdatum.DATUM#</option>
</cfloop>
</select>
<label for="georeference_source" class="likeLink" onClick="getDocs('lat_long','georeference_source')">georeference_source</label>
<input type="text" name="georeference_source" id="georeference_source" size="120" class="reqdClr" value='#preservesinglequotes(locDet.georeference_source)#' />
<label for="georeference_protocol" class="likeLink" onClick="getDocs('lat_long','georeference_protocol')">Georeference Protocol</label>
<select name="georeference_protocol" id="georeference_protocol" size="1" class="reqdClr">
<option value=''></option>
<cfloop query="ctgeoreference_protocol">
<option
<cfif locDet.georeference_protocol is ctgeoreference_protocol.georeference_protocol> selected="selected" </cfif>
value="#ctgeoreference_protocol.georeference_protocol#">#ctgeoreference_protocol.georeference_protocol#</option>
</cfloop>
</select>
<br>
<input type="button" value="Save" class="savBtn" onclick="locality.action.value='saveLocalityEdit';locality.submit();">
<input type="button" value="Delete" class="delBtn" onClick="locality.action.value='deleteLocality';confirmDelete('locality');">
<input type="button" value="Clone Locality" class="insBtn" onClick="cloneLocality(#locality_id#)">
<input type="button" value="Add Collecting Event" class="insBtn"
onclick="document.location='Locality.cfm?action=newCollEvent&locality_id=#locDet.locality_id#'">
<input type="button" value="Georeference with GeoLocate" class="insBtn" onClick="geolocate();">
<cfif len(locDet.DEC_LONG) gt 0>
<input type="button" value="Modify Coordinates/Error with GeoLocate" class="insBtn" onClick="geolocate('adjust');">
</cfif>
<br>
<a href="Locality.cfm?action=findCollEvent&locality_id=#locDet.locality_id#">[ Find all Collecting Events ]</a>
<a href="http://manisnet.org/gci2.html" target="_blank" class="external">[ Georef Calculator ]</a>
<span class="likeLink" onClick="getDocs('lat_long')">[ lat_long help ]</span>
</td>
<td valign="top">
<cfif len(locDet.dec_lat) gt 0>
<table>
<tr>
<td>#staticImageMap#</td>
<td>
<div style="font-size:smaller;font-weight:bold;">
Click the map to open BerkeleyMapper. This won't work if you do not have database permission for at
least one specimen
in the locality -
try <a href="https://maps.google.com/?q=#locDet.dec_lat#,#locDet.dec_long#">Google Maps</a>
(scroll down a bit for a map with uncertainty) or one of the
GeoLocate options to the left.
</div>
</td>
</tr>
</table>
</cfif>
<div style="border:1px dashed red; padding:1em;background-color:lightgray;font-size:small;">
<strong>Webservice Lookup Data</strong>
<div style="font-size:small;font-style:italic; max-height:6em;overflow:auto;border:2px solid red;">
<p style="font-style:bold;font-size:large;text-align:center;">READ THIS!</p>
<span style="font-style:bold;">
Data in this box come from various webservices. They are NOT "specimen data," are derived from entirely automated processes,
and come with no guarantees.
</span>
<p>Not seeing anything here, or seeing old data? Try waiting a couple minutes and reloading -
webservice data are asynchronously refreshed when this page loads, but can take a few minutes to find their way here.
(Webservice data are otherwise created when users load maps and refreshed
every 6 months.)
</p>
<p>
Automated georeferencing comes from either higher geography and locality or higher geography alone, and
contains no indication of error.
Curatorially-supplied error is displayed with the
curatorially-asserted point on the map below. The accuracy and usefulness of the automated georeferencing is hugely variable -
use it as a tool and make no assumptions.
</p>
<p>
There's a link to add the generated coordinates to the edit form. It copies only; you'll
need to manually calculate error (or use GeoLocate) and save to keep the copied data.
</p>
<p>
Distance between points is an estimate calculated using the
<a href="http://goo.gl/Pwhm0" class="external" target="_blank">Haversine formula</a>.
If it's a large value, careful scrutiny of coordinates and locality information is warranted.
</p>
<p>
Elevation is retrieved for the <strong>point</strong> given by the asserted coordinates.
</p>
<p>
Reverse-georeference Geography string is for both the coordinates and the spec locality (including higher geog).
It's used for searching, and can mostly be ignored.
Use the Contact link in the footer if it's horrendously wrong somewhere - let us know the locality_id.
</p>
</div>
<br>
Coordinates:
<input type="text" id="s_dollar_dec_lat" value="#locDet.s$dec_lat#" size="6">
<input type="text" id="s_dollar_dec_long" value="#locDet.s$dec_long#" size="6">
<span class="likeLink" onclick="useAutoCoords()">Copy these coordinates to the form</span>
<br>Distance between asserted and lookup coordinates (km):
<input type="text" id="distanceBetween" size="6">
<br>Elevation (m):
<input type="text" id="s_dollar_elev" value="#locDet.s$elevation#" size="6">
<span style="font-style:italic;">
<cfif len(locDet.min_elev_in_m) is 0>
There is no curatorially-supplied elevation.
<cfelseif locDet.min_elev_in_m gt locDet.s$elevation or locDet.s$elevation gt locDet.max_elev_in_m>
Automated georeference is outside the curatorially-supplied elevation range.
<cfelseif locDet.min_elev_in_m lte locDet.s$elevation and locDet.s$elevation lte locDet.max_elev_in_m>
Automated georeference is within the curatorially-supplied elevation range.
</cfif>
</span>
<br>Tags:
<span style="font-weight:bold;">#locDet.s$geography#</span>
<div id="map-canvas"></div>
<img src="http://maps.google.com/mapfiles/ms/micons/red-dot.png"> is service-suggested, <img src="http://maps.google.com/mapfiles/ms/micons/green-dot.png"> is curatorially-asserted.
</td></tr></table>
</form>
</span>
<hr>
<strong>Geology Attributes</strong>
<cfif geolDet.recordcount gt 0>
<form name="editGeolAtt" method="post" action="editLocality.cfm">
<input type="hidden" name="action" value="editGeol">
<input type="hidden" name="locality_id" value="#locDet.locality_id#">
<input type="hidden" name="number_of_determinations" value="#geolDet.recordcount#">
<cfset i=1>
<table border>
<cfloop query="geolDet">
<input type="hidden" name="geology_attribute_id_#i#" value="#geology_attribute_id#">
<tr #iif(i MOD 2,DE("class='evenRow'"),DE("class='oddRow'"))#>
<td>
<label for="geology_attribute_#i#">Geology Attribute</label>
<select name="geology_attribute_#i#" id="geology_attribute_#i#" class="reqdClr" onchange="populateGeology(this.id)">
<option value="delete" class="red">Delete This</option>
<cfloop query="ctgeology_attribute">
<option <cfif #geology_attribute# is geolDet.geology_attribute> selected="selected" </cfif>value="#geology_attribute#">#geology_attribute#</option>
</cfloop>
</select>
<span class="infoLink" onclick="document.getElementById('geology_attribute_#i#').value='delete'">Delete This</span>
<label for="geo_att_value">Value</label>
<select name="geo_att_value_#i#" id="geo_att_value_#i#" class="reqdClr">
<option value="#geo_att_value#">#geo_att_value#</option>
</select>
<label for="geo_att_determiner_#i#">Determiner</label>
<input type="text" name="geo_att_determiner_#i#" size="40"
onchange="getAgent('geo_att_determiner_id_#i#','geo_att_determiner_#i#','editGeolAtt',this.value); return false;"
onKeyPress="return noenter(event);"
value="#agent_name#">
<input type="hidden" name="geo_att_determiner_id_#i#" id="geo_att_determiner_id" value="#geo_att_determiner_id#">
<label for="geo_att_determined_date_#i#">Date</label>
<input type="text" name="geo_att_determined_date_#i#" id="geo_att_determined_date_#i#" value="#dateformat(geo_att_determined_date,'yyyy-mm-dd')#">
<label for="geo_att_determined_method_#i#">Method</label>
<input type="text" name="geo_att_determined_method_#i#" size="60" value="#geo_att_determined_method#">
<label for="geo_att_remark_#i#">Remark</label>
<input type="text" name="geo_att_remark_#i#" size="60" value="#geo_att_remark#">
</td>
</tr>
<cfset i=i+1>
</cfloop>
<tr>
<td colspan="2">
<input type="submit" value="Save Changes" class="savBtn">
</td>
</tr>
</table>
</form>
</cfif>
<table class="newRec">
<tr>
<td>
<strong>Create Geology Determination</strong>
<form name="newGeolDet" method="post" action="editLocality.cfm">
<input type="hidden" name="action" value="AddGeol">
<input type="hidden" name="locality_id" value="#locDet.locality_id#">
<label for="geology_attribute">Geology Attribute</label>
<select name="geology_attribute" id="geology_attribute" class="reqdClr" onchange="populateGeology(this.id)">
<option value=""></option>
<cfloop query="ctgeology_attribute">
<option value="#geology_attribute#">#geology_attribute#</option>
</cfloop>
</select>
<label for="geo_att_value">Value</label>
<select name="geo_att_value" id="geo_att_value" class="reqdClr"></select>
<label for="geo_att_determiner">Determiner</label>
<input type="text" name="geo_att_determiner" id="geo_att_determiner" size="40"
onchange="getAgent('geo_att_determiner_id','geo_att_determiner','newGeolDet',this.value); return false;"
onKeyPress="return noenter(event);">
<input type="hidden" name="geo_att_determiner_id" id="geo_att_determiner_id">
<label for="geo_att_determined_date">Determined Date</label>
<input type="text" name="geo_att_determined_date" id="geo_att_determined_date">
<label for="geo_att_determined_method">Determination Method</label>
<input type="text" name="geo_att_determined_method" id="geo_att_determined_method" size="60">
<label for="geo_att_remark">Remark</label>
<input type="text" name="geo_att_remark" id="geo_att_remark" size="60">
<br>
<input type="submit" value="Create Determination" class="insBtn">
</form>
</td>
</tr>
</table>
</cfoutput>
<cfinclude template="/includes/_footer.cfm">
</cfif>
<!------------------------------------------------------------------------------------------------------>
<cfif action is "updateAllVerificationStatus">
<cfoutput>
<cfquery name="upall" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
update
specimen_event
set
VerificationStatus='#VerificationStatus#'
where
COLLECTING_EVENT_ID in (select COLLECTING_EVENT_ID from COLLECTING_EVENT where locality_id = #locality_id#) and
COLLECTION_OBJECT_ID in (select COLLECTION_OBJECT_ID from cataloged_item) -- keep things on the right side of the VPD
<cfif isdefined("VerificationStatusIs") and len(VerificationStatusIs) gt 0>
and VerificationStatus='#VerificationStatusIs#'
</cfif>
</cfquery>
<cflocation addtoken="false" url="editLocality.cfm?locality_id=#locality_id#">
</cfoutput>
</cfif>
<!------------------------------------------------------------------------------------------------------>
<cfif action is "editGeol">
<cfoutput>
<cfloop from="1" to="#number_of_determinations#" index="n">
<cfset deleteThis="">
<cfset thisID = #evaluate("geology_attribute_id_" & n)#>
<cfset thisAttribute = #evaluate("geology_attribute_" & n)#>
<cfset thisValue = #evaluate("geo_att_value_" & n)#>
<cfset thisDate = #evaluate("geo_att_determined_date_" & n)#>
<cfset thisMethod = #evaluate("geo_att_determined_method_" & n)#>
<cfset thisDeterminer = #evaluate("geo_att_determiner_id_" & n)#>
<cfset thisRemark = #evaluate("geo_att_remark_" & n)#>
<cfif #thisAttribute# is "delete">
<cfquery name="deleteGeol" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
delete from geology_attributes where geology_attribute_id=#thisID#
</cfquery>
<cfelse>
<cfquery name="upGeol" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
update
geology_attributes
set
geology_attribute='#thisAttribute#',
geo_att_value='#stripQuotes(thisValue)#'
<cfif len(#thisDeterminer#) gt 0>
,geo_att_determiner_id=#thisDeterminer#
<cfelse>
,geo_att_determiner_id=NULL
</cfif>
<cfif len(#thisDate#) gt 0>
,geo_att_determined_date='#dateformat(thisDate,"yyyy-mm-dd")#'
<cfelse>
,geo_att_determined_date=NULL
</cfif>
<cfif len(#thisMethod#) gt 0>
,geo_att_determined_method='#stripQuotes(thisMethod)#'
<cfelse>
,geo_att_determined_method=NULL
</cfif>
<cfif len(#thisRemark#) gt 0>
,geo_att_remark='#stripQuotes(thisRemark)#'
<cfelse>
,geo_att_remark=NULL
</cfif>
where
geology_attribute_id=#thisID#
</cfquery>
</cfif>
</cfloop>
<cflocation url="editLocality.cfm?locality_id=#locality_id#" addtoken="no">
</cfoutput>
</cfif>
<!------------------------------------------------------------------------------------------------------>
<cfif action is "AddGeol">
<cfoutput>
<cfquery name="changeGeog" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into geology_attributes (
locality_id,
geology_attribute,
geo_att_value
<cfif len(#geo_att_determiner_id#) gt 0>
,geo_att_determiner_id
</cfif>
<cfif len(#geo_att_determined_date#) gt 0>
,geo_att_determined_date
</cfif>
<cfif len(#geo_att_determined_method#) gt 0>
,geo_att_determined_method
</cfif>
<cfif len(#geo_att_remark#) gt 0>
,geo_att_remark
</cfif>
) values (
#locality_id#,
'#geology_attribute#',
'#stripQuotes(geo_att_value)#'
<cfif len(#geo_att_determiner_id#) gt 0>
,#geo_att_determiner_id#
</cfif>