Hjælp til CMS
Jeg vil gerne have tilføjet nogle data til mit billede upload. På nuværende tidsunkt skriver den kun <img> koden jeg vil gerne gerne kunne tilføje en class samt alignment.Det her har jeg selv tilføjet:
<select name="alignment" class="form">
<option value="right" selected>Venstre</option>
<option value="right">Højre</option>
<option value="center">Centreret</option>
</select>
Koden ser sådan her ud:
strAlignment = Request.form("alignment")
'Intiliase variables
blnExtensionOK = True
'read in the message box type
strMessageBoxType = Request.QueryString("MSG")
'If this is a post back then upload the image
If Request.QueryString("PB") = "Y" Then
'Get the image types to upload
saryFileUploadTypes = Split(Trim(strImageTypes), ";")
'Call upoload file function
strImageName = fileUpload(strFileUploadPath, saryFileUploadTypes, intMaxImageSize, strUploadComponent, lngErrorFileSize, blnExtensionOK)
End If
%>
<html>
<head>
<meta name="copyright" content="Copyright (C) 2002-2004 Bruce Corkhill" />
<title>Image Upload</title>
<!-- Web Wiz Rich Text Editor ver. <% = strRTEversion %> is written and produced by Bruce Corkhill ©2002-2004
If you want your own Rich Text Editor then goto http://www.richtexteditor.org -->
<script language="JavaScript">
<%
'If the image has been saved then place it in the post
If lngErrorFileSize = 0 AND blnExtensionOK = True AND strImageName <> "" Then
'If this is Rich text editor and IE5.0 use the exeCommand to place it in the editor
If strMessageBoxType = "RTE" AND RTEenabled = "winIE5" Then
%>
window.opener.frames.message.document.focus();
window.opener.frames.message.document.execCommand('InsertImage', false, '<% = strFileUploadPath & "/" & strImageName %>');
window.close();
<%
'If this is Rich text editor use the exeCommand to place it in the editor
ElseIf strMessageBoxType = "RTE" Then
%>
window.opener.document.getElementById("message").contentWindow.focus();
window.opener.document.getElementById("message").contentWindow.document.execCommand('InsertImage', false, '<% = strFileUploadPath & "/" & strImageName %>');
window.close();
<%
'Else if they are using the basic editor place the image path into it
ElseIf strMessageBoxType = "BSC" Then
%>
window.opener.document.frmAddMessage.message.focus();
window.opener.document.frmAddMessage.message.value += '<img src="<% = strFileUploadPath & "/" & strImageName %>"/>';
window.close();
<%
End If
End If
%>
</script>
<link href="includes/default_style.css" rel="stylesheet" type="text/css" />
</head>
<body OnLoad="self.focus(); document.forms.frmImageUp.Submit.disabled=true;"><%
'If the user is allowed to upload then show them the form
If blnImageUpload Then
%>
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="0">
<form action="upload_images.asp?MSG=<% = strMessageBoxType %>&PB=Y" method="post" enctype="multipart/form-data" name="frmImageUp" target="_self" id="frmImageUp" onSubmit="alert('<% = strTxtPleaseWaitWhileImageIsUploaded %>')">
<tr>
<td width="100%">
<fieldset>
<legend><% = strTxtImageUpload %></legend>
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="10%" align="right" class="text"><% = strTxtImage %>:</td>
<td width="90%"><input name="file" class="form" type="file" size="35" onFocus="document.forms.frmImageUp.Submit.disabled=false;" onChange="document.forms.frmImageUp.Submit.disabled=false;" />
</td>
</tr>
<tr>
<td width="10%" align="right" class="text">Justering:</td>
<td width="90%"><select name="alignment" class="form">
<option value="right" selected>Venstre</option>
<option value="right">Højre</option>
<option value="center">Centreret</option>
</select>
</td>
</tr>
<tr align="center">
<td colspan="2" class="text"><br /><%
'If the file upload has failed becuase of the wrong extension display an error message
If blnExtensionOK = False Then
Response.Write("<span class=""error"">" & strTxtImageOfTheWrongFileType & ".<br />" & strTxtImagesMustBeOfTheType & ", " & Replace(strImageTypes, ";", ", ", 1, -1, 1) & "</span>")
'Else if the file upload has failed becuase the size is to large display an error message
ElseIf lngErrorFileSize <> 0 Then
Response.Write("<span class=""error"">" & strTxtImageFileSizeToLarge & " " & lngErrorFileSize & "KB.<br />" & strTxtMaximumFileSizeMustBe & " " & intMaxImageSize & "KB</span>")
'Else display a message of the image types that can be uploaded
Else
Response.Write(strTxtImagesMustBeOfTheType & ", " & Replace(strImageTypes, ";", ", ", 1, -1, 1) & ", " & strTxtAndHaveMaximumFileSizeOf & " " & intMaxImageSize & "KB")
End If
%></td>
</tr>
</table>
</fieldset></td>
</tr>
<tr align="right">
<td> <input type="submit" class="formular" name="Submit" value=" <% = strTxtOK %> "> <input type="button" class="formular" name="cancel" value=" <% = strTxtCancel %> " onClick="window.close()"></td>
</tr>
</form>
</table><%
End If
%>
