File: D:/HostingSpaces/RImmers/duitsedog.tk/wwwroot/onderhoud/wijzig_herplaatsing.asp
<%
option explicit
Response.Expires = -1
Server.ScriptTimeout = 600
%>
<!-- #INCLUDE VIRTUAL="/includes/inc_default.asp" -->
<!-- #INCLUDE VIRTUAL="/includes/inc_auth.asp" -->
<%
Const uploadsDirVar = "D:\HostingSpaces\RImmers\duitsedog.tk\wwwroot\fotos\herplaatsing"
Dim Rs, strSql, intId, strMsg, strActie, i, intMode, blnNew, strThispage, strNextPage,_
strTitel, strTekst, strTekst_UK, blnActief, strPrijsOms, strBestandsnaam, objFSO, Upload, ks, fileKey, intAantalBytes, imgFullSize
If Request.ServerVariables("CONTENT_LENGTH") <> 0 Then
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set Upload = New FreeASPUpload
Upload.Save(uploadsDirVar)
intId = FormToInt(Upload.Form("txtId"))
blnActief = Upload.Form("cbActief") <> ""
strTitel = FormToStr(Upload.Form("txtTitel"))
strTekst = FormToStr(Upload.Form("txtTekst"))
strTekst_UK = FormToStr(Upload.Form("txtTekstUk"))
ks = Upload.UploadedFiles.keys
if (UBound(ks) <> -1) then
for each fileKey in Upload.UploadedFiles.keys
strBestandsnaam = Upload.UploadedFiles(fileKey).FileName
intAantalBytes = Upload.UploadedFiles(fileKey).Length
next
Else
strBestandsnaam = FormToStr(Upload.Form("txtBestandsnaam"))
intAantalBytes = FormToInt(Upload.Form("txtAantalBytes"))
End If
blnNew = Upload.Form("txtId") = "" And Request.QueryString("id") = ""
Response.Write("id:" & intId & " | strTitel:" & strTitel & " | strBestandsnaam:" & strBestandsnaam & " | intAantalBytes:" & intAantalBytes)
If blnNew Then
intId = VoegHerplaatsingToe(blnActief, strTitel, strTekst, strTekst_UK, intAantalBytes, strBestandsnaam)
strMsg = "Herplaatsing <b>" & strTitel & "</b> toegevoegd."
Else
Call WijzigHerplaatsing(intId, blnActief, strTitel, strTekst, strTekst_UK ,intAantalBytes, strBestandsnaam)
strMsg = "Herplaatsing <b>" & strTitel & "</b> gewijzigd."
End If
Response.Redirect("herplaatsingen.asp?msg=" & strMsg)
Response.Flush
Response.End
Else
If Request.QueryString("id") <> "" Then
intId = FormToInt(Request.QueryString("id"))
strSQL = "SELECT DD_HERPLAATSINGEN.*, DD_FOTOS.grootte, DD_FOTOS.bestandsnaam FROM DD_HERPLAATSINGEN LEFT JOIN DD_FOTOS ON DD_HERPLAATSINGEN.foto_id = DD_FOTOS.id WHERE DD_HERPLAATSINGEN.ID = " & IntToSQL(intId)
Set Rs = GetRs(strSql)
If Not Rs.EOF Then
blnActief = SqlToBool(Rs("ind_actief"))
strTitel = SqlToStr(Rs("titel"))
strTekst = SqlToStr(Rs("tekst"))
strTekst_UK = SqlToStr(Rs("tekst_uk"))
strBestandsnaam = SqlToStr(Rs("bestandsnaam"))
intAantalBytes = SqlToInt(Rs("grootte"))
End If
Rs.Close
Else
blnActief = True
strTitel = Null
strTekst = Null
strTekst_UK = Null
strBestandsnaam = Null
intAantalBytes = Null
End If
End If
If blnNew Then
strActie = "Herplaatsing toevoegen"
Else
strActie = "Herplaatsing """ & strTitel & """ wijzigen"
End If
%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../css/onderhoud.css">
<base target="main">
<!-- #INCLUDE VIRTUAL="includes/scripts/inc_validdate.asp" -->
<script language="JavaScript">
function doCheck(){
if(!(document.form1.txtTitel.value)){
alert('Voer een Titel in!');
document.form1.txtTitel.focus();
return false;
}
else if(!document.form1.txtTekst.value){
alert('Voer een tekst in!');
document.form1.txtTekst.focus();
return false;
}
else {
return true;
}
}
</script>
</head>
<body>
<h2><%=StrToHTML(strActie)%></h2>
<%
If strMsg<>"" Then Response.Write("<p>" & strMsg & "</p>") End If
%>
<form id="form1" name="form1" action="wijzig_herplaatsing.asp" enctype="multipart/form-data" method="post" onsubmit="document.form1.cmdSave.disabled=true;">
<input type="hidden" name="txtId" size="5" value="<%=intId%>">
<input type="hidden" name="txtBestandsnaam" value="<%=strBestandsnaam%>">
<input type="hidden" name="txtAantalBytes" value="<%=intAantalBytes%>">
<table class="clsBorder" cellspacing="2" cellpadding="1" width="700">
<tr>
<td><b>Tonen op website</b></td>
<td><input type="checkbox" name="cbActief" <%If blnActief Then %>checked<%End If%>></td>
</tr>
<tr>
<td><b>Titel<IMG SRC="../../images/icons/requiredfield.gif" height="5" width="5" align="textTop"></b></td>
<td><input type="text" name="txtTitel" maxLength="50" size="50" value="<%=strTitel%>"></td>
</tr>
<tr>
<td valign="top"><b>Tekst NLD<IMG SRC="../../images/icons/requiredfield.gif" height="5" width="5" align="textTop"></b></td>
<td><TEXTAREA rows="10" cols="100" name="txtTekst"><%=StrToForm(strTekst)%></TEXTAREA></td>
</tr>
<tr>
<td valign="top"><b>Tekst ENG</b></td>
<td><TEXTAREA rows="10" cols="100" name="txtTekstUk" ID="Textarea1"><%=StrToForm(strTekst_UK)%></TEXTAREA></td>
</tr>
<tr>
<td valign="top"><b>Bestand</b></td>
<td>
<%
If Not IsNull(strBestandsnaam) Then
%>
<div><img border="0" src="Resize_Image.aspx?ImgWd=500&CrpYN=Y&IptFl=/fotos/herplaatsing/<%=strBestandsnaam%>"/></div>
<%
End If
%>
<br/>
<input type="file" style="height=20" name="txtFoto" size="70" value="">
</td>
<tr>
</table>
<p>
<input type="submit" style="width:100" name="cmdSave" value="Opslaan" class="clsBtn" onclick="return doCheck();">
<input type="button" style="width:100" value="Annuleren" class="clsBtn" onclick="document.location.href='herplaatsingen.asp';" name="button1">
</p>
</form>
<%
Set Rs = Nothing
%>
</body>
</html>