<%@  language="VBScript" %>
<%
Response.Expires = 60
Response.ExpiresAbsolute = Now() - 2
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", "private"
Response.CacheControl = "no-cache"

'This variable specifies relative path to the folder, where the gallery with uploaded files is located.
'Do not forget about the slash in the end of the folder name.
Dim strGalleryPath
strGalleryPath = "../Gallery/"

Function EncodeFileName(value)
	EncodeFileName = Replace(Server.UrlEncode(value), "+", "%20")
End Function
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Aurigma Image Uploader - Uploaded Files</title>
	<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body>
	<p><a href='default.asp?path=<%=Request.QueryString("returnUrl")%>'>Upload New Files</a></p>
	
	<fieldset>
		<legend>Note</legend>
		Watermark is applied on large thumbnails only. So to see it, click a small preview below. 
	</fieldset>
		
	<table width='100%'>
<%	
Dim objDescriptions
Set objDescriptions = Server.CreateObject("Msxml2.DOMDocument.4.0")
objDescriptions.async = False
objDescriptions.load Server.MapPath(strGalleryPath & "Descriptions.xml")
		
Dim intColCount
intColCount = 4

Dim i
For i = 0 To objDescriptions.documentElement.childNodes.length - 1
	Dim objXmlFile
	Set objXmlFile = objDescriptions.documentElement.childNodes(i)
	If i Mod intColCount = 0 Then
%>
		<tr>
<%		
	End If
%>
			<td>
				<a href="<%=strGalleryPath & EncodeFileName(objXmlFile.GetAttribute("name")) %>"
					target="_blank">
					<img src="<%=strGalleryPath & "Thumbnails/" & EncodeFileName(objXmlFile.getAttribute("name")) %>.jpg"
						alt="<%=Server.HTMLEncode(objXmlFile.getAttribute("name"))%>" />
				</a>
				<br />
				<br />
				<b>Name:</b>
				<%=Server.HTMLEncode(objXmlFile.getAttribute("name")) %>
				<br />
				<b>Dimensions:</b>
				<%=Server.HTMLEncode(objXmlFile.getAttribute("width")) %>
				x
				<%=Server.HTMLEncode(objXmlFile.getAttribute("height")) %>
				<br />
				<b>Author:</b>
				<%=Server.HTMLEncode(objXmlFile.getAttribute("author")) %>				
			</td>
<%		
	If (i Mod intColCount = intColCount-1) Or _
		(i = objDescriptions.documentElement.childNodes.length - 1) Then
%>
		</tr>
<%	
	End If
	
Next
%>
	</table>
</body>
</html>