forked from ArctosDB/arctos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpecimenDetail.cfm
442 lines (438 loc) · 17.6 KB
/
SpecimenDetail.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
<cfinclude template="/includes/_header.cfm">
<cftry>
<script>
jQuery(document).ready(function() {
$.each($("div[id^='mapgohere-']"), function() {
var theElemID=this.id;
var theIDType=this.id.split('-')[1];
var theID=this.id.split('-')[2];
var ptl='/component/functions.cfc?method=getMap&showCaption=false&returnformat=plain&size=150x150&' + theIDType + '=' + theID;
jQuery.get(ptl, function(data){
jQuery("#" + theElemID).html(data);
});
});
});
</script>
<cfif isdefined("collection_object_id")>
<cfset checkSql(collection_object_id)>
<cfoutput>
<cfquery name="c" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select GUID from #session.flatTableName# where collection_object_id=#collection_object_id#
</cfquery>
<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="Location" value="/guid/#c.guid#">
<cfabort>
</cfoutput>
</cfif>
<cfif isdefined("guid")>
<cfif cgi.script_name contains "/SpecimenDetail.cfm">
<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="Location" value="/guid/#guid#">
<cfabort>
</cfif>
<cfset checkSql(guid)>
<cfif guid contains ":">
<cfoutput>
<cfset sql="select #session.flatTableName#.collection_object_id from
#session.flatTableName#,cataloged_item
WHERE
#session.flatTableName#.collection_object_id=cataloged_item.collection_object_id and
upper(#session.flatTableName#.guid)='#ucase(guid)#'">
<cfset checkSql(sql)>
<cfquery name="c" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
#preservesinglequotes(sql)#
</cfquery>
</cfoutput>
</cfif>
<cfif isdefined("c.collection_object_id") and len(c.collection_object_id) gt 0>
<cfset collection_object_id=c.collection_object_id>
<cfelse>
<cfinclude template="/errors/404.cfm">
<cfabort>
</cfif>
<cfelse>
<cfinclude template="/errors/404.cfm">
<cfabort>
</cfif>
<cfset detSelect = "
SELECT
#session.flatTableName#.guid,
#session.flatTableName#.collection_id,
#session.flatTableName#.locality_id,
web_link,
web_link_text,
#session.flatTableName#.cat_num,
#session.flatTableName#.collection_object_id as collection_object_id,
#session.flatTableName#.scientific_name,
#session.flatTableName#.collecting_event_id,
#session.flatTableName#.higher_geog,
#session.flatTableName#.spec_locality,
#session.flatTableName#.verbatim_date,
#session.flatTableName#.BEGAN_DATE,
#session.flatTableName#.ended_date,
#session.flatTableName#.parts as partString,
#session.flatTableName#.dec_lat,
#session.flatTableName#.dec_long">
<cfif len(session.CustomOtherIdentifier) gt 0>
<cfset detSelect = "#detSelect#
,concatSingleOtherId(#session.flatTableName#.collection_object_id,'#session.CustomOtherIdentifier#') as CustomID">
</cfif>
<cfset detSelect = "#detSelect#
FROM
#session.flatTableName#,
collection
where
#session.flatTableName#.collection_id = collection.collection_id AND
#session.flatTableName#.collection_object_id = #collection_object_id#
ORDER BY
cat_num">
<cfset checkSql(detSelect)>
<cfquery name="detail" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
#preservesinglequotes(detSelect)#
</cfquery>
<cfquery name="doi" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select doi from doi where COLLECTION_OBJECT_ID=#collection_object_id#
</cfquery>
<cfoutput>
<cfset title="#detail.guid#: #detail.scientific_name#">
<cfset metaDesc="#detail.guid#; #detail.scientific_name#; #detail.higher_geog#; #detail.spec_locality#">
<cf_customizeHeader collection_id=#detail.collection_id#>
<cfif (detail.verbatim_date is detail.began_date) AND (detail.verbatim_date is detail.ended_date)>
<cfset thisDate = detail.verbatim_date>
<cfelseif (
(detail.verbatim_date is not detail.began_date) OR
(detail.verbatim_date is not detail.ended_date)
)
AND
detail.began_date is detail.ended_date>
<cfset thisDate = "#detail.verbatim_date# (#detail.began_date#)">
<cfelse>
<cfset thisDate = "#detail.verbatim_date# (#detail.began_date# - #detail.ended_date#)">
</cfif>
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<table cellspacing="0" cellpadding="0">
<tr>
<td nowrap valign="top">
<div id="SDCollCatBlk">
<span id="SDheaderCollCatNum">
#detail.guid#
</span>
<cfif len(session.CustomOtherIdentifier) gt 0>
<div id="SDheaderCustID">
#session.CustomOtherIdentifier#: #detail.CustomID#
</div>
</cfif>
<cfset sciname = '#replace(detail.Scientific_Name," or ","</i> or <i>")#'>
<div id="SDheaderSciName">
#sciname#
</div>
<div id="SDheaderGoBakBtn">
<cfif isdefined("session.mapURL") and len(session.mapURL) gt 0>
<a href="/SpecimenResults.cfm?#session.mapURL#"><< Return to results</a>
</cfif>
</div>
<cfif len(doi.doi) gt 0>
doi:#doi.doi#
<cfelse>
<cfif isdefined("session.roles") and listfindnocase(session.roles,"coldfusion_user")>
<a href="/tools/doi.cfm?collection_object_id=#collection_object_id#">get a DOI</a>
</cfif>
</cfif>
</div>
</td>
</tr>
</table>
</td>
<td valign="top">
<table cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<div id="SDheaderSpecLoc">
#detail.spec_locality#
</div>
<div id="SDheaderGeog">
#detail.higher_geog#
</div>
<div id="SDheaderDate">
#thisDate#
</div>
</td>
</tr>
</table>
</td>
<td valign="top">
<div id="SDheaderPart">
#detail.partString#
</div>
</td>
<!----
<td valign="top" align="right">
<div id="SDheaderMap">
<cfif (len(detail.dec_lat) gt 0 and len(detail.dec_long) gt 0)>
<div id="mapgohere-collection_object_id-#detail.collection_object_id#"></div>
<!---
<cfinvoke component="component.functions" method="getMap" returnvariable="contents">
<cfinvokeargument name="collection_object_id" value="#detail.collection_object_id#">
<cfinvokeargument name="size" value="150x150">
<cfinvokeargument name="showCaption" value="false">
</cfinvoke>
#contents#
----->
</cfif>
</div>
</td>
---->
<td valign="top" align="right">
<div id="annotateSpace">
<cfquery name="existingAnnotations" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select count(*) cnt from annotations
where collection_object_id = #detail.collection_object_id#
</cfquery>
<span class="likeLink" onclick="openAnnotation('collection_object_id=#detail.collection_object_id#')">
[ Report Bad Data ]
</span>
<cfif existingAnnotations.cnt gt 0>
<br>(#existingAnnotations.cnt# annotations)
</cfif>
<cfif len(detail.web_link) gt 0>
<cfif len(detail.web_link_text) gt 0>
<cfset cLink=detail.web_link_text>
<cfelse>
<cfset cLink="collection">
</cfif>
<br><a href="#detail.web_link#" target="_blank" class="external">#cLink#</a>
</cfif>
<cfif isdefined("session.collObjIdList") and len(session.collObjIdList) gt 0 and listcontains(session.collObjIdList,detail.collection_object_id)>
<cfset isPrev = "no">
<cfset isNext = "no">
<cfset currPos = 0>
<cfset lenOfIdList = 0>
<cfset firstID = collection_object_id>
<cfset nextID = collection_object_id>
<cfset prevID = collection_object_id>
<cfset lastID = collection_object_id>
<cfset currPos = listfind(session.collObjIdList,collection_object_id)>
<cfset lenOfIdList = listlen(session.collObjIdList)>
<cfset firstID = listGetAt(session.collObjIdList,1)>
<cfif currPos lt lenOfIdList>
<cfset nextID = listGetAt(session.collObjIdList,currPos + 1)>
</cfif>
<cfif currPos gt 1>
<cfset prevID = listGetAt(session.collObjIdList,currPos - 1)>
</cfif>
<cfset lastID = listGetAt(session.collObjIdList,lenOfIdList)>
<cfif lenOfIdList gt 1>
<cfif currPos gt 1>
<cfset isPrev = "yes">
</cfif>
<cfif currPos lt lenOfIdList>
<cfset isNext = "yes">
</cfif>
</cfif>
<div id="navSpace">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<cfif isPrev is "yes">
<th>
<span onclick="document.location='/SpecimenDetail.cfm?collection_object_id=#firstID#'">first</span>
</th>
<th>
<span onclick="document.location='/SpecimenDetail.cfm?collection_object_id=#prevID#'">prev</span>
</th>
<cfelse>
<th>first</th>
<th>prev</th>
</cfif>
<cfif isNext is "yes">
<th>
<span onclick="document.location='/SpecimenDetail.cfm?collection_object_id=#nextID#'">next</span>
</th>
<th>
<span onclick="document.location='/SpecimenDetail.cfm?collection_object_id=#lastID#'">last</span>
</th>
<cfelse>
<th>next</th>
<th>last</th>
</cfif>
</tr>
<tr>
<cfif isPrev is "yes">
<td align="middle">
<img src="/images/first.gif" class="likeLink" onclick="document.location='/SpecimenDetail.cfm?collection_object_id=#firstID#'" alt="[ First Record ]">
</td>
<td align="middle">
<img src="/images/previous.gif" class="likeLink" onclick="document.location='/SpecimenDetail.cfm?collection_object_id=#prevID#'" alt="[ Previous Record ]">
</td>
<cfelse>
<td align="middle">
<img src="/images/no_first.gif" alt="[ inactive button ]">
</td>
<td align="middle">
<img src="/images/no_previous.gif" alt="[ inactive button ]">
</td>
</cfif>
<cfif isNext is "yes">
<td align="middle">
<img src="/images/next.gif" class="likeLink" onclick="document.location='/SpecimenDetail.cfm?collection_object_id=#nextID#'" alt="[ Next Record ]">
</td>
<td align="middle">
<img src="/images/last.gif" class="likeLink" onclick="document.location='/SpecimenDetail.cfm?collection_object_id=#lastID#'" alt="[ Last Record ]">
</td>
<cfelse>
<td align="middle">
<img src="/images/no_next.gif" alt="[ inactive button ]">
</td>
<td align="middle">
<img src="/images/no_last.gif" alt="[ inactive button ]">
</td>
</cfif>
</tr>
<tr>
<cfset lp=1>
<td>Record</td>
<td colspan="2">
<select id="recpager" onchange="document.location='/SpecimenDetail.cfm?collection_object_id='+this.value">
<cfloop list="#session.collObjIdList#" index="ccid">
<option <cfif currPos is lp>selected="selected"</cfif> value="#ccid#">#lp#</option>
<cfset lp=lp+1>
</cfloop>
</select>
</td>
<td>of #listlen(session.collObjIdList)#</td>
</tr>
</table>
</div>
</cfif>
</div>
</td>
</tr>
</table>
<cfif isdefined("session.roles") and listfindnocase(session.roles,"coldfusion_user")>
<script language="javascript" type="text/javascript">
function closeEditApp() {
$('##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();
$("span[id^='BTN_']").each(function(){
$("##" + this.id).removeClass('activeButton');
$('##' + this.id, window.parent.document).removeClass('activeButton');
});
}
function loadEditApp(q) {
closeEditApp();
var bgDiv = document.createElement('div');
bgDiv.id = 'bgDiv';
bgDiv.className = 'bgDiv';
bgDiv.setAttribute('onclick','closeEditApp()');
document.body.appendChild(bgDiv);
var popDiv=document.createElement('div');
popDiv.id = 'popDiv';
popDiv.className = 'editAppBox';
document.body.appendChild(popDiv);
var links='<ul id="navbar">';
links+='<li><span onclick="loadEditApp(\'editIdentification\')" class="likeLink" id="BTN_editIdentification">Identification</span></li>';
links+='<li><span onclick="loadEditApp(\'addAccn\')" class="likeLink" id="BTN_addAccn">Accession</span></li>';
links+='<li><span onclick="loadEditApp(\'specLocality\')" class="likeLink" id="BTN_specLocality">Locality</span></li>';
links+='<li><span onclick="loadEditApp(\'editColls\')" class="likeLink" id="BTN_editColls">Agent</span></li>';
links+='<li><span onclick="loadEditApp(\'editParts\')" class="likeLink" id="BTN_editParts">Parts</span></li>';
links+='<li><span onclick="loadEditApp(\'findContainer\')" class="likeLink" id="BTN_findContainer">Part Location</span></li>';
links+='<li><span onclick="loadEditApp(\'editBiolIndiv\')" class="likeLink" id="BTN_editBiolIndiv">Attributes</span></li>';
links+='<li><span onclick="loadEditApp(\'editIdentifiers\')" class="likeLink" id="BTN_editIdentifiers">Other IDs</span></li>';
links+='<li><span onclick="loadEditApp(\'MediaSearch\')" class="likeLink" id="BTN_MediaSearch">Media</span></li>';
links+='<li><span onclick="loadEditApp(\'Encumbrances\')" class="likeLink" id="BTN_Encumbrances">Encumbrance</span></li>';
//links+='<li><span onclick="loadEditApp(\'catalog\')" class="likeLink" id="BTN_catalog">Catalog</span></li>';
links+="</ul>";
$("##popDiv").append(links);
var cDiv=document.createElement('div');
cDiv.className = 'fancybox-close';
cDiv.id='cDiv';
cDiv.setAttribute('onclick','closeEditApp()');
$("##popDiv").append(cDiv);
$("##popDiv").append('<img src="/images/loadingAnimation.gif" class="centeredImage">');
var theFrame = document.createElement('iFrame');
theFrame.id='theFrame';
theFrame.className = 'editFrame';
var ptl="/" + q + ".cfm?collection_object_id=" + #collection_object_id#;
theFrame.src=ptl;
//document.body.appendChild(theFrame);
$("##popDiv").append(theFrame);
$("span[id^='BTN_']").each(function(){
$("##" + this.id).removeClass('activeButton');
$('##' + this.id, window.parent.document).removeClass('activeButton');
});
$("##BTN_" + q).addClass('activeButton');
$('##BTN_' + q, window.parent.document).addClass('activeButton');
}
</script>
<table width="100%">
<tr>
<td align="center">
<form name="incPg" method="post" action="SpecimenDetail.cfm">
<input type="hidden" name="collection_object_id" value="#collection_object_id#">
<input type="hidden" name="suppressHeader" value="true">
<input type="hidden" name="action" value="nothing">
<input type="hidden" name="Srch" value="Part">
<input type="hidden" name="collecting_event_id" value="#detail.collecting_event_id#">
<ul id="navbar">
<li><span onclick="loadEditApp('editIdentification')" class="likeLink" id="BTN_editIdentification">Identification</span></li>
<li>
<span onclick="loadEditApp('addAccn')" class="likeLink" id="BTN_addAccn">Accn</span>
</li>
<li>
<span onclick="loadEditApp('specLocality')" class="likeLink" id="BTN_specLocality">Locality</span>
</li>
<li>
<span onclick="loadEditApp('editColls')" class="likeLink" id="BTN_editColls">Agents</span>
</li>
<li>
<span onclick="loadEditApp('editParts')" class="likeLink" id="BTN_editParts">Parts</span>
</li>
<li>
<span onclick="loadEditApp('findContainer')" class="likeLink" id="BTN_findContainer">Part Locn.</span>
</li>
<li>
<span onclick="loadEditApp('editBiolIndiv')" class="likeLink" id="BTN_editBiolIndiv">Attributes</span>
</li>
<li>
<span onclick="loadEditApp('editIdentifiers')" class="likeLink" id="BTN_editIdentifiers">Other IDs</span>
</li>
<li>
<span onclick="loadEditApp('MediaSearch')" class="likeLink" id="BTN_MediaSearch">Media</span>
</li>
<li>
<span onclick="loadEditApp('Encumbrances')" class="likeLink" id="BTN_Encumbrances">Encumbrances</span>
</li>
<!----
<li>
<span onclick="loadEditApp('catalog')" class="likeLink" id="BTN_catalog">Catalog</span>
</li>
---->
</ul>
</form>
</td>
</tr>
</table>
</cfif>
<cfinclude template="SpecimenDetail_body.cfm">
<cfinclude template="/includes/_footer.cfm">
<cfif isdefined("showAnnotation") and showAnnotation is "true">
<script language="javascript" type="text/javascript">
openAnnotation('collection_object_id=#collection_object_id#');
</script>
</cfif>
</cfoutput>
<cfcatch>
<cf_logError subject="SpecimenDetail error" attributeCollection=#cfcatch#>
<div class="error">
Oh no! Part of this page has failed to load!
<br>This error has been logged. Please <a href="/contact.cfm?ref=specimendetail">contact us</a> with any useful information.
</div>
</cfcatch>
</cftry>