-
Notifications
You must be signed in to change notification settings - Fork 0
/
createConfig.cfm
354 lines (304 loc) · 12.2 KB
/
createConfig.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
<!---
Copyright 2012 Ryan Guill
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--->
<cfsilent>
<cfinclude template="#application.settings.appBaseDir#/inc/preProcess.cfm" />
<cfif application.objs.global.doesConfigXMLExist()>
<cflocation url="#application.settings.appBaseDir#/index.cfm" />
</cfif>
<cfparam name="session.tempFormVars" default="#structNew()#" />
<cfparam name="session.tempFormVars.createConfigForm" default="#structNew()#" />
<cfif NOT structKeyExists(session.tempFormVars.createConfigForm,"populateTime") OR abs(dateDiff("n",now(),session.tempFormVars.createConfigForm.populateTime)) GT 7>
<cfset structClear(session.tempFormVars.createConfigForm) />
</cfif>
<cfset variables.appBaseDirDepth = listLen(expandPath(application.settings.appBaseDir),application.settings.pathSeperator)>
<cfset variables.databaseDefaultPath = listDeleteAt(expandPath(application.settings.appBaseDir),variables.appBaseDirDepth,application.settings.pathSeperator) & application.settings.pathSeperator & "db" & application.settings.pathSeperator />
<cfparam name="session.tempFormVars.createConfigForm.servername" default="" />
<cfparam name="session.tempFormVars.createConfigForm.firstname" default="" />
<cfparam name="session.tempFormVars.createConfigForm.lastname" default="" />
<cfparam name="session.tempFormVars.createConfigForm.username" default="" />
<cfparam name="session.tempFormVars.createConfigForm.email" default="" />
<cfparam name="session.tempFormVars.createConfigForm.showPasswords" default="false" />
<cfparam name="session.tempFormVars.createConfigForm.password" default="" />
<cfparam name="session.tempFormVars.createConfigForm.password2" default="" />
<cfparam name="session.tempFormVars.createConfigForm.archiveDirectory" default="" />
<cfparam name="session.tempFormVars.createConfigForm.cfAdminPassword" default="" />
<cfparam name="session.tempFormVars.createConfigForm.dsnName" default="cascade" />
<cfparam name="session.tempFormVars.createConfigForm.databaseName" default="cascade" />
<cfparam name="session.tempFormVars.createConfigForm.databaseDirectory" default="#variables.databaseDefaultPath#" />
</cfsilent>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<cfinclude template="#application.settings.appBaseDir#/inc/head.cfm" />
<cfoutput>
<title>#application.settings.appTitle# - Create Config</title>
</cfoutput>
<script type="text/javascript">
Event.observe(window, 'load', init, false);
function init() {
$('showPasswords').observe('change',showPasswords_onChange);
$('password2').observe('keyup',checkPasswords);
$('password').observe('keyup',checkPasswords);
$('firstname').observe('keyup',onAdminNameChanges);
$('lastname').observe('keyup',onAdminNameChanges);
$('dsnName').observe('keyup',onDSNNameChange);
$('password2').observe('blur',checkPasswords);
$('password').observe('blur',checkPasswords);
$('firstname').observe('blur',onAdminNameChanges);
$('lastname').observe('blur',onAdminNameChanges);
$('databaseName').observe('keyup',onDatabaseFullPathChange);
$('databaseDirectory').observe('keyup',onDatabaseFullPathChange);
showPasswords_onChange();
onDatabaseFullPathChange();
$('serverName').focus();
}
function showPasswords_onChange ( )
{
if ( $('showPasswords').checked == true )
{
$('password').type = 'text';
$('password2').type = 'text';
$('cfAdminPassword').type = 'text';
}
else
{
$('password').type = 'password';
$('password2').type = 'password';
$('cfAdminPassword').type = 'password';
}
}
function checkPasswords(){
doPasswordsMatch = true;
if ($('password').value.length > 0 && $('password2').value.length > 0) {
if ($('password').value != $('password2').value) {
doPasswordsMatch = false;
}
}
if ( !doPasswordsMatch )
{
$('password2_cell').addClassName('fail');
}
else
{
$('password2_cell').removeClassName('fail');
}
}
function onAdminNameChanges ( )
{
$('username').value = $('firstname').value.toLowerCase() + $('lastname').value.toLowerCase();
}
function onDSNNameChange ( )
{
$('databaseName').value = $('dsnName').value;
}
function onDatabaseFullPathChange ( )
{
$('databaseFullPath').update($('databaseDirectory').value + $('databaseName').value);
}
</script>
<style type="text/css">
</style>
</head>
<body>
<div id="container">
<cfinclude template="#application.settings.appBaseDir#/inc/header.cfm" />
<div id="main" class="clearfix">
<cfinclude template="#application.settings.appBaseDir#/inc/nav.cfm" />
<div id="content">
<cfinclude template="#application.settings.appBaseDir#/inc/notice.cfm" />
<cfoutput>
<div id="projectHeading">
<h1>Welcome to #application.settings.appTitle#!</h1>
</div>
<div class="contentSection">
<p>Since this is the first run of this application, you will be asked for some initial configuration settings. If you do not know what these values should be, please exit the application and refer to the documentation. You will be asked for these values again the next time.</p>
<!---<p>Don't worry though, if you do something wrong you will always be able to change these values later, just dont forget the admin username and password!</p>--->
</div>
<div id="configFormDiv" class="contentSection">
<h2 class="sectionTitle">Create Initial Configuration</h2>
<cfoutput>
<form action="action.cfm" method="post">
<table class="formTable" width="100%">
<tr>
<th valign="top">
Server Name:
</th>
<td valign="top">
<input type="text" name="serverName" id="serverName" value="#session.tempFormVars.createConfigForm.servername#" size="60" />
</td>
<td class="note" width="30%">
<em>This name will be on all archives created, and is how remote systems will identify this installation.</em>
</td>
</tr>
<tr>
<th valign="top">
Admin User Firstname:
</th>
<td valign="top">
<input type="text" name="firstname" id="firstname" value="#session.tempFormVars.createConfigForm.firstname#" size="45" />
</td>
<td class="note">
</td>
</tr>
<tr>
<th valign="top">
Admin User Lastname:
</th>
<td valign="top">
<input type="text" name="lastname" id="lastname" value="#session.tempFormVars.createConfigForm.lastname#" size="45" />
</td>
<td class="note">
</td>
</tr>
<tr>
<th valign="top">
Admin Username:
</th>
<td valign="top">
<input type="text" name="username" id="username" value="#session.tempFormVars.createConfigForm.username#" size="45" />
</td>
<td class="note">
</td>
</tr>
<tr>
<th valign="top">
Admin Email:
</th>
<td valign="top">
<input type="text" name="email" id="email" value="#session.tempFormVars.createConfigForm.email#" size="45" />
</td>
<td class="note">
</td>
</tr>
<tr>
<th valign="top">
</th>
<td valign="top">
<input type="checkbox" name="showPasswords" id="showPasswords" value="true" <cfif session.tempFormVars.createConfigForm.showPasswords>checked="true"</cfif> />
<label for="showPasswords">Show Passwords</label>
</td>
<td class="note">
<em>Check this box to see the passwords as you type them in.</em>
</td>
</tr>
<tr>
<th valign="top">
Admin Password:
</th>
<td valign="top">
<input type="password" name="password" id="password" value="#session.tempFormVars.createConfigForm.password#" size="45" />
</td>
<td class="note">
</td>
</tr>
<tr>
<th valign="top">
Admin Password again:
</th>
<td id="password2_cell" valign="top">
<input type="password" name="password2" id="password2" value="#session.tempFormVars.createConfigForm.password2#" size="45" />
</td>
<td class="note">
</td>
</tr>
<tr>
<th valign="top">
Archive Directory:
</th>
<td valign="top">
<input type="text" name="archiveDirectory" id="archiveDirectory" value="#session.tempFormVars.createConfigForm.archiveDirectory#" size="60" />
</td>
<td class="note">
<em>This is the directory where the archive files will be stored. It is suggested to not have this directory in your webroot.</em>
</td>
</tr>
<tr>
<th valign="top">
ColdFusion Administrator Password:
</th>
<td valign="top">
<input type="password" name="cfAdminPassword" id="cfAdminPassword" value="#session.tempFormVars.createConfigForm.cfAdminPassword#" size="45" />
</td>
<td class="note">
<em>This is the only time you will be asked to enter this password. It is only used to create the derby database and set up the DSN. It is not stored.</em>
</td>
</tr>
<tr>
<th valign="top">
DerbyDB DSN Name:
</th>
<td valign="top">
<input type="text" name="dsnName" id="dsnName" value="#session.tempFormVars.createConfigForm.dsnName#" size="45" />
</td>
<td class="note">
</td>
</tr>
<tr>
<th valign="top">
DerbyDB Database Name:
</th>
<td valign="top">
<input type="text" name="databaseName" id="databaseName" value="#session.tempFormVars.createConfigForm.databaseName#" size="45" />
</td>
<td class="note">
</td>
</tr>
<tr>
<th valign="top">
DerbyDB Database Directory:
</th>
<td valign="top">
<input type="text" name="databaseDirectory" id="databaseDirectory" value="#session.tempFormVars.createConfigForm.databaseDirectory#" size="60" />
</td>
<td class="note">
<em>This is the directory the DerbyDB will be created in. It is suggested to not have this directory in your webroot.</em>
</td>
</tr>
<tr>
<th valign="top">
Full Path To Derby DB:
</th>
<td valign="top">
<span id="databaseFullPath" style="font-weight:bold;"></span>
</td>
</tr>
<tr>
<th valign="top">
</th>
<td>
<input type="hidden" name="action" value="createConfig" />
<input type="hidden" name="referringPage" value="#request.currentPage#" />
<input type="submit" value="Create Config" class="button" />
</td>
</tr>
</table>
</cfoutput>
</form>
</div>
</cfoutput>
</div>
</div>
</div>
<cfinclude template="#application.settings.appBaseDir#/inc/footer.cfm" />
</body>
</html>