<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript" src="/common/scripts/jquery.js"></script>
<HEAD>

	<TITLE>View Attachment Revisions</TITLE>
	<META content="application/xhtml+xml; charset=UTF-8" http-equiv=content-type>
	<SCRIPT>
	</SCRIPT>
</HEAD>

<BODY>
<script>
	function communicate(methodType, url)
	{
		jQuery.ajax({
		   type: methodType,
		   url: url,
		   success: function(data){
			alert(data)
		   },
		   error: function(XMLHttpRequest, textStatus, errorThrown){
				alert("Failed to complete the request. Reason: "+textStatus+"/"+errorThrown)
		   },
		   complete:function(XMLHttpRequest,textStatus){
		   }
		 });
	}

</script>
<div>
	<table class="versions">
	<tr style="background-color:#E7E8E9;font-family:calibri;font-size:14px">
	<th colspan=4>
	Versions of the model: {{modelName}}
	</th>
	</tr>
	<tr style="background-color:#E7E8E9;font-family:calibri;font-size:14px">
		<th>Sno</th>
		<th>&nbsp;Versioned By&nbsp;</th>
		<th>&nbsp;Versioned At&nbsp;</th>
		<th>&nbsp;Comments&nbsp;</th>
	</tr>
	   {% for version in versionList %}
	   	<tr style="background-color:${['#F4F5F5','#FFFFFF'][({{forloop.counter}})%2]}">
	   		<td style="padding-left:2px;font-family:calibri;font-size:12px">{{forloop.counter}}</td>
	   		<td style="padding-left:2px;font-family:calibri;font-size:12px">{{version.versionedBy}}</td>
	   		<td style="padding-left:2px;font-family:calibri;font-size:12px">{{version.versionedAt}}</td>
	   		<td style="padding-left:2px;font-family:calibri;font-size:12px">{{version.comments}}</td>
			<td align="center">
				<!--img src="/runtime/images/delete.png" onClick = "communicate('GET','{{downloadurl}}'+'?versionid='+'{{version.key}}')" style="cursor:pointer">
				 <a href='{{downloadurl}}?versionid={{version.key}}' target="_blank" style="padding-left:2px;font-family:calibri;font-size:12px">Download</a-->
				 <img src="/runtime/images/download.png" onClick = "window.location.href='{{downloadurl}}?versionid={{version.key}}'" style="cursor:pointer">
			</td>
			<td align="center">
				<!--img src="/runtime/images/delete.png" onClick = "communicate('PUT','{{replaceurl}}'+'?versionid='+'{{version.key}}')" style="cursor:pointer"-->
				<img src="/runtime/images/replace.png" onClick = "confirm('Are you sure you Replace the current version with this?')?communicate('PUT','{{replaceurl}}?versionid={{version.key}}'):''" style="cursor:pointer">
			</td>
		<tr>
	    {% endfor %}

	<table>
</div>

</BODY>
</HTML>