<%@ 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 Demos &rarr; Optimized Upload Demo &rarr; Uploaded Files</title>
	<link href="../common.css" type="text/css" rel="stylesheet" />
</head>
<body>
	<form>
		<h1><a href="../default.asp">Aurigma Image Uploader Demos</a> &rarr; <a href="default.asp">Optimized Upload Demo</a> &rarr; Uploaded Files</h1>		
<%
Dim objDescriptions
Set objDescriptions = Server.CreateObject("Msxml2.DOMDocument.4.0")
objDescriptions.async = False
objDescriptions.load Server.MapPath(strGalleryPath & "Descriptions.xml")	

Dim lngTotalSourceFileSize, lngTotalUploadedFileSize, strTotalUploadedFileSizeColor
lngTotalSourceFileSize = CLng(objDescriptions.documentElement.getAttribute("totalSourceFileSize"))
lngTotalUploadedFileSize = CLng(objDescriptions.documentElement.getAttribute("totalUploadedFileSize"))
		
If lngTotalSourceFileSize > lngTotalUploadedFileSize Then
	strTotalUploadedFileSizeColor = "blue"
Else
	strTotalUploadedFileSizeColor = "red"		
End If
%>
		<p>Total source file size: <strong><%=lngTotalSourceFileSize%> kb</strong><br />
		Total uploaded file size: <strong><span style="color:<%=strTotalUploadedFileSizeColor%>"><%=lngTotalUploadedFileSize%></span> kb</strong><br />
		</p>
		
		<table width='100%'>
<%			
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")) %>
				</td>
<%		
	If (i Mod intColCount = intColCount-1) Or _
		(i = objDescriptions.documentElement.childNodes.length - 1) Then
%>
			</tr>
<%	
	End If
	
Next
%>
		</table>
	</form>
</body>
</html>
