-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdownload_agree.cfm
213 lines (199 loc) · 6.12 KB
/
download_agree.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
<cfinclude template="/includes/_header.cfm">
<cfset title="Download Agreement">
<!--- make sure they have an account --->
<cfif not isdefined("cnt") OR len(#cnt#) is 0>
<cfset cnt=0>
</cfif>
<cfif not isdefined("session.username") OR len(#session.username#) is 0>
<span style="color: #FF0000">You must be a registered user to download data!</span> <br>
Click <a href="/login.cfm">here</a> to log in or create a user account.
<cfabort>
</cfif>
<cfif #action# is "nothing">
<cfquery name="getUserData" datasource="cf_dbuser">
SELECT
cf_users.user_id,
first_name,
middle_name,
last_name,
affiliation,
email
FROM
cf_user_data,
cf_users
WHERE
cf_users.user_id = cf_user_data.user_id (+) AND
username = '#session.username#'
</cfquery>
<cfoutput>
<table>
<form method="post" action="download_agree.cfm" name="dlForm">
<input type="hidden" name="user_id" value="#getUserData.user_id#">
<input type="hidden" name="downloadFile" value="#downloadFile#">
<input type="hidden" name="action" value="continue">
<input type="hidden" name="cnt" value="#cnt#">
<tr>
<td colspan="2"><span style="font-weight: bold; font-style: italic;">
You must fill out this form before you may download data. Fields with a
<input type="text" size="2" class="reqdClr">
background color are required.
</span></td>
</tr>
<tr>
<td align="right" width="20%">First Name</td>
<td> <input type="text" name="first_name" value="#getUserData.first_name#" class="reqdClr"></td>
</tr>
<tr>
<td align="right">Middle Name</td>
<td><input type="text" name="middle_name" value="#getUserData.middle_name#"></td>
</tr>
<tr>
<td align="right">Last Name</td>
<td><input type="text" name="last_name" value="#getUserData.last_name#" class="reqdClr"></td>
</tr>
<tr>
<td align="right">Affiliation</td>
<td><input type="text" name="affiliation" value="#getUserData.affiliation#" class="reqdClr"></td>
</tr>
<tr>
<td align="right">Purpose of Download</td>
<cfquery name="ctPurpose" datasource="cf_dbuser">
select * from ctdownload_purpose
</cfquery>
<td>
<select name="download_purpose" size="1" class="reqdClr">
<cfloop query="ctPurpose">
<option value="#ctPurpose.download_purpose#">#ctPurpose.download_purpose#</option>
</cfloop>
</select>
</td>
</tr>
<tr>
<td align="right">Email</td>
<td><input type="text" name="email" value="#getUserData.email#"></td>
</tr>
<tr>
<td colspan="2">
These data are <a href="javascript:void(0);"
onClick="getLegal('copyright'); return false;"
onMouseOver="self.status='Click for copyright.';return true;"
onmouseout="self.status='';return true;">copyrighted</a> and may not be
repackaged, redistributed, or sold without prior written consent from
the Museum.
</td>
</tr>
<tr>
<td colspan="2">
<input type="radio" name="agree" value="yes">
<a href="javascript: void(0);" onClick="dlForm.agree[0].checked='true'"><font color="##00FF00" size="+1">I agree that the data that I am now downloading are for my own use
and will not be repackaged, redistributed, or sold.</font></a>
</td>
</tr>
<tr>
<td colspan="2">
<input type="radio" name="agree" value="no" checked>
<a href="javascript: void(0);" onClick="dlForm.agree[1].checked='true'"><font color="##FF0000" size="+1">I
do not agree</font>.</a>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Continue"
class="savBtn"
onmouseover="this.className='savBtn btnhov'"
onmouseout="this.className='savBtn'">
</td>
</tr>
</form>
</table>
</cfoutput>
</cfif>
<cfif #action# is "continue">
<!--- get the values they filled in --->
<cfif len(#first_name#) is 0 OR
len(#last_name#) is 0 OR
len(#download_purpose#) is 0 OR
len(#affiliation#) is 0>
You haven't filled in all required values! Please use your browser's back button to try again.
<cfabort>
</cfif>
<cfquery name="dl" datasource="cf_dbuser">
INSERT INTO cf_download (
user_id,
download_purpose,
download_date,
num_records,
agree_to_terms)
VALUES (
#user_id#,
'#download_purpose#',
sysdate,
#cnt#,
'#agree#')
</cfquery>
<cfquery name="isUser" datasource="cf_dbuser">
select * from cf_user_data where user_id=#user_id#
</cfquery>
<!---- already have a user_data entry --->
<cfif #isUser.recordcount# is 1>
<cfquery name="upUser" datasource="cf_dbuser">
UPDATE cf_user_data SET
first_name = '#first_name#',
last_name = '#last_name#',
affiliation = '#affiliation#'
<cfif len(#middle_name#) gt 0>
,middle_name = '#middle_name#'
</cfif>
<cfif len(#email#) gt 0>
,email = '#email#'
</cfif>
WHERE
user_id = #user_id#
</cfquery>
</cfif>
<cfif #isUser.recordcount# is not 1>
<cfquery name="newUser" datasource="cf_dbuser">
INSERT INTO cf_user_data (
user_id,
first_name,
last_name,
affiliation
<cfif len(#middle_name#) gt 0>
,middle_name
</cfif>
<cfif len(#email#) gt 0>
,email
</cfif>
)
VALUES (
#user_id#,
'#first_name#',
'#last_name#',
'#affiliation#'
<cfif len(#middle_name#) gt 0>
,'#middle_name#'
</cfif>
<cfif len(#email#) gt 0>
,'#email#'
</cfif>
)
</cfquery>
</cfif>
<!--- if they agree to the terms, send them to their download --->
<cfif #agree# is "yes">
<cflocation url="#downloadFile#">
</cfif>
<cfif #agree# is "no">
You must agree to the terms of usage to download these data.
<ul>
<li>Click <a href="/home.cfm">here</a> to return to the home page.</li>
<li>Use your browser's back button or click <a href="javascript: history.back();">here</a>
if you wish to agree to the terms and proceed with the download.</li>
<li><cfoutput><a href="mailto:#application.technicalEmail#">Contact us</a></cfoutput> if you wish to discuss the terms of
usage.</li>
</ul>
<br>
<br>
</cfif>
</cfif>
<cfinclude template="/includes/_footer.cfm">