<!---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.--->
<cfset galleryPath="../Gallery/" />

<!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="index.cfm">Upload New Files</a>
	</p>

	<cfset descriptions=XMLParse("#ExpandPath(galleryPath)#Descriptions.xml") />	

	<cfset totalSourceFileSize = Int(descriptions.files.XmlAttributes.totalSourceFileSize) />
	<cfset totalUploadedFileSize = Int(descriptions.files.XmlAttributes.totalUploadedFileSize) />
		
	<cfif totalSourceFileSize GREATER THAN totalUploadedFileSize >
		<cfset totalUploadedFileSizeColor = "blue" />
	<cfelse>
		<cfset totalUploadedFileSizeColor = "red" />	
	</cfif>

	<cfoutput>
		<p>Total source file size: <strong>#totalSourceFileSize# kb</strong><br />
			Total uploaded file size: <strong><span style="color:#totalUploadedFileSizeColor#">#totalUploadedFileSize#</span> kb</strong><br />
		</p>	
	</cfoutput>

	<cfset descriptionsQuery=QueryNew("name, width, height") />

	<cfset fileCount=#ArrayLen(descriptions.files.file)# />

	<cfset temp=QueryAddRow(descriptionsQuery, #fileCount#) />

	<cfloop index="i" from="1" to=#fileCount# >
		<cfset temp=QuerySetCell(descriptionsQuery, "name", 
				#descriptions.files.file[i].XmlAttributes.name#, #i#) />
		<cfset temp=QuerySetCell(descriptionsQuery, "width", 
				#descriptions.files.file[i].XmlAttributes.width#, #i#) />
		<cfset temp=QuerySetCell(descriptionsQuery, "height", 
				#descriptions.files.file[i].XmlAttributes.height#, #i#) />
	</cfloop>

	<cfset i=0 />

	<table width="100%">
		<cfloop query="descriptionsQuery">
			<cfif i MOD 4 is 0>
				<tr>
			</cfif>
			<td width="25%" align="left" valign="top">
				<cfoutput>
					<a href="#GalleryPath##name#" target="_blank">
						<img border="0" src="#GalleryPath#Thumbnails/#name#.jpg" alt="#HTMLEditFormat(name)#" />
					</a>
					<br />
					<b>Name:</b>
					#HTMLEditFormat(name)#
					<br />
					<b>Dimensions:</b> 
					#HTMLEditFormat(width)# x #HTMLEditFormat(height)#
				</cfoutput>
			</td>
			<cfif (i MOD 4 is 3) or (i is fileCount - 1)>
				</tr>
			</cfif>
			<cfset i=i+1 />
		</cfloop>
	</table>		
</body>
</html>