forked from ArctosDB/arctos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpecimenGraph.cfm
208 lines (196 loc) · 7.33 KB
/
SpecimenGraph.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
<cfinclude template="includes/_header.cfm">
<cfset title="Specimen Graphs">
<cfif action is "nothing">
<cfoutput>
<cfset searchParams = "">
<!--- set up hidden form variables to use when customizing.
Explicitly exclude things we don't want --->
<cfloop list="#StructKeyList(form)#" index="key">
<cfif len(form[key]) gt 0>
<cfif #key# is not "FIELDNAMES"
AND #key# is not "SEARCHPARAMS"
AND #key# is not "mapurl"
AND #key# is not "cbifurl"
and #key# is not "newquery"
and #key# is not "ORDER_ORDER"
and #key# is not "ORDER_BY"
and #key# is not "newsearch"
and #key# is not "STARTROW"
and #key# is not "action"
and #key# is not "detail_level">
<cfif len(#searchParams#) is 0>
<cfset searchParams='<input type="hidden" name="#key#" value="#form[key]#">'>
<cfelse>
<cfset searchParams='#searchParams#<input type="hidden" name="#key#" value="#form[key]#">'>
</cfif>
</cfif>
</cfif>
</cfloop>
<!---- also grab anything from the URL --->
<cfloop list="#StructKeyList(url)#" index="key">
<cfif len(#url[key]#) gt 0>
<cfif #key# is not "FIELDNAMES"
AND #key# is not "SEARCHPARAMS"
AND #key# is not "mapurl"
AND #key# is not "cbifurl"
and #key# is not "newquery"
and #key# is not "ORDER_ORDER"
and #key# is not "ORDER_BY"
and #key# is not "newsearch"
and #key# is not "STARTROW"
and #key# is not "action"
and #key# is not "detail_level">
<cfif len(#searchParams#) is 0>
<cfset searchParams='<input type="hidden" name="#key#" value="#url[key]#">'>
<cfelse>
<cfset searchParams='#searchParams#<input type="hidden" name="#key#" value="#url[key]#">'>
</cfif>
</cfif>
</cfif>
</cfloop>
<cfset searchParams = #replace(searchParams,"'","","all")#>
<table>
<form name="browse" action="SpecimenGraph.cfm" method="post">
<tr>
<td><strong>Chart Settings</strong></td>
<td><strong>Chart Data</strong><sup>1</sup></td>
</tr>
<tr>
<td valign="top">
<table>
<tr>
<td align="right">Format:<sup>2</sup></td>
<td>
<select name="chartType" size="1">
<option value="flash">Flash</option>
<option selected="selected" value="jpg">JPG</option>
<option value="png">PNG</option>
</select>
</td>
</tr>
<tr>
<td align="right">Size:</td>
<td>
<select name="size" size="1">
<option value="240 x 320">240 x 320</option>
<option selected="selected" value="480 x 640">480 x 640</option>
<option value="960 x 1280">960 x 1280</option>
</select>
</td>
</tr>
<tr>
<td align="right">Dimensions:</td>
<td>
<select name="show3D" size="1">
<option value="yes">3D</option>
<option value="no">2D</option>
</select>
</td>
</tr>
<tr>
<td align="right">Type:</td>
<td>
<select name="type" size="1">
<option value="pie">pie</option>
<option value="bar">bar</option>
<option value="line">line</option>
<option value="pyramid">pyramid</option>
<option value="area">area</option>
<option value="horizontalbar">horizontalbar</option>
<option value="cone">cone</option>
<option value="curve">curve</option>
<option value="cylinder">cylinder</option>
<option value="step">step</option>
<option value="scatter">scatter</option>
</select>
</td>
</tr>
</table>
</td>
<td valign="top">
<select required="required" name="graphThis" multiple="multiple" size="10">
<option value="country">Specimens by Country</option>
<option value="state_prov">Specimens by State</option>
<option value="scientific_name">Specimens by Identification</option>
<option value="genus">Specimens by Genus</option>
<option value="family">Specimens by Family</option>
<option value="phylorder">Specimens by Order</option>
<option value="year">Specimens by Year</option>
</select>
</td>
</tr>
#searchparams#
<input type="hidden" name="searchParams" value='#searchParams#'>
<input type="hidden" name="action" value="getGraph">
<tr>
<td colspan="2" align="center">
<input type="submit" value="Get Graphs" class="schBtn">
</td>
</tr>
<tr>
<td colspan="2">
<div style="background-color:##999999; font-size:small; font-style:italic;">
1) CONTROL and click to create multiple charts
<p></p>2) You may save charts to your hard drive as images.
<br />Your browser may act strangely, but it will probably
<br /> work if you can save with an image (not .cfm) extension.
</div>
</td>
</tr>
</form>
</table>
</cfoutput>
</cfif>
<!------------------------------------------------------------------->
<cfif action is "getGraph">
<cfoutput>
<cfset chartHeight = listfirst(size," x ")>
<cfset chartWidth = listlast(size," x ")>
<cfloop list="#graphThis#" index="item">
<cfset x = "#item#">
<cfset y="Specimens">
<cfif listcontains("family,phylorder,genus",#item#)>
<cfset basSelect = "SELECT count(#session.flatTableName#.cat_num) as y_data,
getTaxa(#session.flatTableName#.collection_object_id,'#item#') as x_data">
<cfset basGroup = "GROUP BY getTaxa(#session.flatTableName#.collection_object_id,'#item#')">
<cfelse>
<cfset basSelect = "SELECT count(#session.flatTableName#.cat_num) y_data,
decode(#session.flatTableName#.#item#,
NULL,'not recorded',
#session.flatTableName#.#item#) as x_data">
<cfif #item# is "scientific_name">
<cfset basGroup = "GROUP BY #session.flatTableName#.#item#">
<cfelse>
<cfset basGroup = "GROUP BY #item#">
</cfif>
</cfif>
<cfset basFrom = " FROM #session.flatTableName#">
<cfset basJoin = "INNER JOIN cataloged_item ON (#session.flatTableName#.collection_object_id =cataloged_item.collection_object_id)">
<cfset basWhere = " WHERE #session.flatTableName#.collection_object_id IS NOT NULL ">
<cfset basQual = "">
<cfset mapurl="">
<cfset basOrder = "ORDER BY count(#session.flatTableName#.cat_num) DESC">
<cfinclude template="includes/SearchSql.cfm">
<cfset SqlString = "#basSelect# #basFrom# #basJoin# #basWhere# #basQual# #basGroup# #basOrder#">
<cfquery name="getGraph" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
#preservesinglequotes(SqlString)#
</cfquery>
<cfchart format="#chartType#"
chartHeight = "#chartHeight#"
chartWidth = "#chartWidth#"
xaxistitle="#left(ucase(item),1)##right(lcase(item),len(item)-1)#"
yaxistitle="#y#"
show3D="#show3D#"
title = "Search Results by #left(ucase(item),1)##right(lcase(item),len(item)-1)# (#dateformat(now(),'dd mmm yyyy')#)"
fontBold="yes">
<cfchartseries type="#type#"
query="getGraph"
itemcolumn="x_data"
valuecolumn="y_data"
seriesColor="##0066FF">
</cfchartseries>
</cfchart>
</cfloop>
</cfoutput>
</cfif>
<cfinclude template="includes/_footer.cfm">