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
| <%@LANGUAGE="VBSCRIPT"%>
<!--#include file="dit heb ik weggehaald, want hierin staan meer 'belangrijke' dingen... ;)" -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="fail.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
' *** Edit Operations: declare variables
MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) <> "") Then
MM_editConnection = MM_MainCoreConnection_STRING
MM_editTable = "Fotocollectie"
MM_editRedirectUrl = "add_succes.asp"
MM_fieldsStr = "collectienaam|value|mapnaam|value|omschrijving|value"
MM_columnsStr = "collectienaam|',none,''|mapnaam|',none,''|omschrijving|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
If (CStr(Request("MM_insert")) <> "") Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),",")
Delim = MM_typeArray(0)
If (Delim = "none") Then Delim = ""
AltVal = MM_typeArray(1)
If (AltVal = "none") Then AltVal = ""
EmptyVal = MM_typeArray(2)
If (EmptyVal = "none") Then EmptyVal = ""
If (FormVal = "") Then
FormVal = EmptyVal
Else
If (AltVal <> "") Then
FormVal = AltVal
ElseIf (Delim = "'") Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''") & "'"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
set fotogegevens = Server.CreateObject("ADODB.Recordset")
fotogegevens.ActiveConnection = MM_MainCoreConnection_STRING
fotogegevens.Source = "SELECT * FROM Fotocollectie"
fotogegevens.CursorType = 0
fotogegevens.CursorLocation = 2
fotogegevens.LockType = 3
fotogegevens.Open()
fotogegevens_numRows = 0
%>
<html>
<head>
<title>Foto's een naam geven</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function FDK_Validate(FormName, stopOnFailure, AutoSubmit, ErrorHeader)
{
var theFormName = FormName;
var theElementName = "";
if (theFormName.indexOf(".")>=0)
{
theElementName = theFormName.substring(theFormName.indexOf(".")+1)
theFormName = theFormName.substring(0,theFormName.indexOf("."))
}
var ValidationCheck = eval("document."+theFormName+".ValidateForm")
if (ValidationCheck)
{
var theNameArray = eval(theFormName+"NameArray")
var theValidationArray = eval(theFormName+"ValidationArray")
var theFocusArray = eval(theFormName+"FocusArray")
var ErrorMsg = "";
var FocusSet = false;
var i
var msg
// Go through the Validate Array that may or may not exist
// and call the Validate function for all elements that have one.
if (String(theNameArray)!="undefined")
{
for (i = 0; i < theNameArray.length; i ++)
{
msg="";
if (theNameArray[i].name == theElementName || theElementName == "")
{
msg = eval(theValidationArray[i]);
}
if (msg != "")
{
ErrorMsg += "\n"+msg;
if (stopOnFailure == "1")
{
if (theFocusArray[i] && !FocusSet)
{
FocusSet=true;
theNameArray[i].focus();
}
alert(ErrorHeader+ErrorMsg);
document.MM_returnValue = false;
break;
}
else
{
if (theFocusArray[i] && !FocusSet)
{
FocusSet=true;
theNameArray[i].focus();
}
}
}
}
}
if (ErrorMsg!="" && stopOnFailure != "1")
{
alert(ErrorHeader+ErrorMsg);
}
document.MM_returnValue = (ErrorMsg=="");
if (document.MM_returnValue && AutoSubmit)
{
eval("document."+FormName+".submit()")
}
}
}
function FDK_StripChars(theFilter,theString)
{
var strOut,i,curChar
strOut = ""
for (i=0;i < theString.length; i++)
{
curChar = theString.charAt(i)
if (theFilter.indexOf(curChar) < 0) // if it's not in the filter, send it thru
strOut += curChar
}
return strOut
}
function FDK_AddToValidateArray(FormName,FormElement,Validation,SetFocus)
{
var TheRoot=eval("document."+FormName);
if (!TheRoot.ValidateForm)
{
TheRoot.ValidateForm = true;
eval(FormName+"NameArray = new Array()")
eval(FormName+"ValidationArray = new Array()")
eval(FormName+"FocusArray = new Array()")
}
var ArrayIndex = eval(FormName+"NameArray.length");
eval(FormName+"NameArray[ArrayIndex] = FormElement");
eval(FormName+"ValidationArray[ArrayIndex] = Validation");
eval(FormName+"FocusArray[ArrayIndex] = SetFocus");
}
function FDK_ValidateAlphaNum(FormElement,Required,ErrorMsg)
{
var msg = "";
var i, m, s, firstNonWhite
var theString = FormElement.value;
var msgInvalid = ErrorMsg;
if (FDK_StripChars(" ",theString).length == 0) {
if (!Required) {
return "";
}
else {
return msgInvalid;
}
}
//Strip spaces off of the sides of the string
theString = FDK_Trim(theString);
for (var n=0; n<theString.length; n++) {
theChar = theString.substring(n,n+1);
if (!FDK_AllInRange("0","9",theChar) && !FDK_AllInRange("A","Z",theChar.toUpperCase()) && !(theChar == " ")) {
return msgInvalid;
}
}
return "";
}
function FDK_Trim(theString)
{
var i,firstNonWhite
if (FDK_StripChars(" \n\r\t",theString).length == 0 ) return ""
i = -1
while (1)
{
i++
if (theString.charAt(i) != " ")
break
}
firstNonWhite = i
//Count the spaces at the end
i = theString.length
while (1)
{
i--
if (theString.charAt(i) != " ")
break
}
return theString.substring(firstNonWhite,i + 1)
}
function FDK_AllInRange(x,y,theString)
{
var i, curChar
for (i=0; i < theString.length; i++)
{
curChar = theString.charAt(i)
if (curChar < x || curChar > y) //the char is not in range
return false
}
return true
}
function FDK_AddAlphaNumericValidation(FormName,FormElementName,Required,SetFocus,ErrorMsg) {
var ValString = "FDK_ValidateAlphaNum("+FormElementName+","+Required+","+ErrorMsg+")"
FDK_AddToValidateArray(FormName,eval(FormElementName),ValString,SetFocus)
}
function FDK_ValidateNonBlank(FormElement,ErrorMsg)
{
var msg = ErrorMsg;
var val = FormElement.value;
if (!(FDK_StripChars(" \n\t\r",val).length == 0))
{
msg="";
}
return msg;
}
function FDK_AddNonBlankValidation(FormName,FormElementName,SetFocus,ErrorMsg) {
var ValString = "FDK_ValidateNonBlank("+FormElementName+","+ErrorMsg+")"
FDK_AddToValidateArray(FormName,eval(FormElementName),ValString,SetFocus)
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" background="../illustraties/beige182.jpg" link="#0000FF" vlink="#0000FF" alink="#0000FF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><table width="98%" border="0" height="98%" align="center">
<table width="98%" border="0" height="98%" align="center">
<tr>
<td align="center" valign="middle">
<table width="75%" border="5" bordercolor="#0099FF" cellpadding="2" cellspacing="0">
<tr>
<td bgcolor="#0000FF" width="97%"><b><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif">Foto's
een naam geven</font></b></td>
<td bgcolor="#0000FF" width="3%">
<div align="right"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><i><b><font color="#0099FF" size="1">WE
</font></b></i></font></div>
</td>
</tr>
<tr bgcolor="#D5F0FF">
<td colspan="2"> <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">U
wilt de foto's een naam geven. Let op: dit kunt u pas doen als u
op de vorige pagina stap 1 heeft doorlopen.<br>
<br>
[img]"../illustraties/arrows_blue_054.gif"[/img]
<a href="add_1.asp">Ik wil terug naar de vorige pagina om stap 1
uit te voeren...</a></font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Heeft
u stap 1 doorlopen en zijn de foto's gekopiëerd? Vul dan de
onderstaande velden in:</font> </p>
<form action="<%=MM_editAction%>" method="POST" name="form1">
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Collectienaam</b><br>
Bedenk een leuke pakkende naam voor uw nieuwe fotocollectie:<br>
<!--Created by Willem L. Middelkoop willem@detoekomst.com www.WEwebdesign.tk -->
<%'
Dim objFSO
Dim objFolder
Dim objItem
' Create our FSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
' Get a handle on our folder
Set objFolder = objFSO.GetFolder(Server.MapPath(("/fotomap/")))
%>
<input type="text" name="collectienaam" size="50">
<br>
</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Mapnaam</b><br>
Kies hier de naam van de map op waarin de foto's staan:<br>
<select name="mapnaam" id="mapnaam">
<% For Each objItem In objFolder.SubFolders
%>
<option value="<%= objItem.Name %>"><%= objItem.Name %></option>
<%
next
' killer variables
Set objItem = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
%> </select>
<br>
[img]"../illustraties/arrows_blue_054.gif"[/img]
<a href="add_uitlegfotomap.asp">Ik snap het niet en ik wil uitleg...
(opent zich in een nieuw venster)</a> </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Omschrijving</b><br>
Hier kunt u een omschrijving plaatsen, dat is echter niet verplicht.<br>
<textarea name="omschrijving" cols="50" rows="7" wrap="VIRTUAL"></textarea>
</font></p>
<p> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">Klik
op OPSLAAN als u alle gegevens correct heeft ingevuld:<br>
<input type="submit" name="Submit" value="Opslaan" onClick="FDK_AddNonBlankValidation('form1','document.form1.collectienaam',true,'\'Het is verplicht om een collectienaam op te geven voor een juiste indexering!\'');FDK_AddAlphaNumericValidation('form1','document.form1.mapnaam',true,true,'\'De naam van de map mag alleen uit letters en of cijfers bestaan. Dus geen punten of comma\\\'s en spaties.\'');FDK_Validate('form1',true,false,'De nieuwe invoer kon niet gemaakt worden:\n\n');return document.MM_returnValue">
</font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<input type="hidden" name="MM_insert" value="form1">
</font> </p>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<%
fotogegevens.Close()
%> |