forked from ArctosDB/arctos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpecimenResultsSummary.cfm
139 lines (138 loc) · 5.27 KB
/
SpecimenResultsSummary.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
<cfinclude template = "/includes/_header.cfm">
<script type='text/javascript' language="javascript" src='/includes/jtable/jquery.jtable.min.js'></script>
<link rel="stylesheet" title="lightcolor-blue" href="/includes/jtable/themes/lightcolor/blue/jtable.min.css" type="text/css">
<cfset title="Specimen Results Summary">
<!---
Bad things? Last standalone copy of this form is in v6.11
---->
<script>
function getDownload(){
$("#getDownload").html("<img src='/images/indicator.gif'>");
$.getJSON("/component/SpecimenResults.cfc",
{
method : "downloadSpecimenSummary",
returnformat : "json"
},
function(r) {
$("#getDownload").prop('onclick',null).off('click')
.text("Save File")
.attr("href",'/download.cfm?file=ArctosSpecimenSummary.csv');
window.location='/download.cfm?file=ArctosSpecimenSummary.csv';
}
);
}
</script>
<style>
#specresults{
display: inline-block;
}
</style>
<cfoutput>
<cfif not isdefined("groupBy") or len(groupBy) is 0>
<cfset groupBy='scientific_name'>
</cfif>
<cfif listcontainsnocase(groupBy,"collection_object_id")>
<cfset groupBy=listdeleteat(groupby,listfindnocase(groupby,"collection_object_id"))>
</cfif>
<cfif not listcontainsnocase(groupBy,"scientific_name")>
<cfset groupBy=listprepend(groupby,'scientific_name')>
</cfif>
<!---- now pull everything that's NOT groupby out of wherever it came from ---->
<cfset querystring="">
<cfloop list="#StructKeyList(form)#" index="key">
<cfif len(form[key]) gt 0 and key is not "groupby">
<cfset querystring=listappend(querystring,"#key#=#form[key]#","&")>
</cfif>
</cfloop>
<cfloop list="#StructKeyList(url)#" index="key">
<cfif len(url[key]) gt 0 and key is not "groupby">
<cfset querystring=listappend(querystring,"#key#=#url[key]#","&")>
</cfif>
</cfloop>
<cfset equerystring=URLEncodedFormat(querystring)>
<div>
<a class="likeLink" id="getDownload" onclick="getDownload();">Download</a>
<br><span class="likeLink"
onclick="saveSearch('#Application.ServerRootUrl#/SpecimenResultsSummary.cfm?#querystring#&groupBy=#groupBy#');">
Save Search</span>
<br><a href="/saveSearch.cfm?action=manage">View/Manage Saved Searches</a>
</div>
<cfset sortby="">
<cfloop list="#groupby#" index="c">
<cfset sortby=listappend(sortby,'#ucase(c)# ASC')>
</cfloop>
<script type="text/javascript">
$(document).ready(function () {
$.getJSON("/component/SpecimenResults.cfc",
{
method : "getSpecimenSummary",
returnformat : "json",
querystring : "#equerystring#",
groupBy: "#groupBy#"
},
function(r) {
if (r.Result !='OK'){
$('##msgdiv').html(r.Message).addClass('error');
return false;
}
$('##specresults').jtable({
title: 'Specimen Summary: ' + r.TotalSpecimenCount + ' Specimens grouped into ' + r.TotalRecordCount + ' records.',
paging: true, //Enable paging
pageSize: 100, //Set page size (default: 10)
sorting: true, //Enable sorting
defaultSorting: '#sortby#', //Set default sorting
columnResizable: true,
multiSorting: true,
columnSelectable: false,
//recordsLoaded: getPostLoadJunk,
multiselect: true,
selectingCheckboxes: false,
selecting: true, //Enable selecting
selectingCheckboxes: false, //Show checkboxes on first column
selectOnRowClick: false, //Enable this to only select using checkboxes
pageSizes: [10, 25, 50, 100, 250, 500,5000],
actions: {
listAction: '/component/SpecimenResults.cfc?method=getSpecimenSummary&totalRecordCount=' + r.TotalRecordCount + '&TotalSpecimenCount=' + r.TotalSpecimenCount + '&qid=' + r.qid
},
fields: {
COUNTOFCATALOGEDITEM:{title: 'Count'},
LINKTOSPECIMENS: {title: 'Specimens'},
<cfset thisLoopNum=1>
<cfset numFlds=listlen(groupby)>
<cfloop list="#groupby#" index="col">
<cfif col is "phylclass">
<cfset x="Class">
<cfelseif col is "phylorder">
<cfset x="Order">
<cfelseif col is "scientific_name">
<cfset x="ScientificName">
<cfelseif col is "formatted_scientific_name">
<cfset x="FormattedScientificName">
<cfelseif col is "state_prov">
<cfset x="StateOrProvince">
<cfelseif col is "island_group">
<cfset x="IslandGroup">
<cfelseif col is "spec_locality">
<cfset x="SpecificLocality">
<cfelseif col is "continent_ocean">
<cfset x="ContinentOrOcean">
<cfelse>
<cfset x=toProperCase(col)>
</cfif>
#ucase(COL)#: {title: '#x#'}
<cfif thisLoopNum lt numFlds>,</cfif>
<cfset thisLoopNum=thisLoopNum+1>
</cfloop>
}
});
$('##specresults').jtable('load');
$('##msgdiv').removeClass().hide();
}
);
});
</script>
<div id="msgdiv"><img src="/images/indicator.gif"> Processing request</div>
<label for="specresults">Control-Click in order of desired result to sort by multiple columns</label>
<div id="specresults"></div>
</cfoutput>
<cfinclude template = "includes/_footer.cfm">