<%@ page import="com.atlassian.jira.web.util.CookieUtils"%>
<%@ taglib uri="webwork" prefix="webwork" %>
<%@ taglib uri="webwork" prefix="ui" %>
<webwork:bean name="'com.atlassian.core.user.UserUtils'" id="userUtils" />
<html>
<head>
    <meta content="issuesummary" name="decorator" />
    <title>[#<webwork:property value="/issueObject/key" />] <webwork:property value="/issueObject/summary" /></title>
</head>
<body>

<jsp:include page="/includes/errormessages.jsp" />
<webwork:property value="issue">
    <jsp:include page="/includes/panels/issue_headertable.jsp" />
</webwork:property>
	<p>
	<webwork:text name="'manageattachments.description'"/>
	</p>
	<p><center>
		<b><a href="<webwork:property value="issuePath" />"><webwork:text name="'manageattachments.view'"/> <webwork:property value="/issueObject/key" /></a></b>
        <webwork:if test="/attachable == true">
		|
		<b><a href="AttachFile!default.jspa?id=<webwork:url value="/issueObject/id" />"><webwork:text name="'manageattachments.attach.another.file'"/></a></b>
        <webwork:if test="/screenshotAttachable == true">
        |
        <b><a href="<webwork:url value="'AttachFile!screenshot.jspa'" >
                        <webwork:param name="'id'" value="/issueObject/id" />
<%
String sessionId = CookieUtils.getSingleSessionId(request.getCookies());
if (sessionId != null) {
%>                        <webwork:param name="'sessionId'"><%= sessionId %></webwork:param>
<% } %>
                    </webwork:url>" onclick="window.open(this.href, 'screenshot', 'width=800,height=700,scrollbars=yes,status=yes'); return false"><webwork:text name="'manageattachments.attach.another.screenshot'"/></a></b>
        </webwork:if>
		</webwork:if>
	</center></p>
<p>
<center>
<table width="100%" bgcolor="bbbbbb" border="0" cellpadding="0" cellspacing="0"><tr><td>
<table border="0" cellpadding="3" cellspacing="1" width="100%">
	<tr bgcolor=f0f0f0>
		<td class="colHeaderLink">
			&nbsp;
		</td>
        <td class="colHeaderLink">
			&nbsp;
		</td>
		<td class="colHeaderLink">
			<b><webwork:text name="'manageattachments.file.name'"/></b>
		</td>
		<td class="colHeaderLink">
			<b><webwork:text name="'manageattachments.size'"/></b>
		</td>
		<td class="colHeaderLink">
			<b><webwork:text name="'manageattachments.mime.type'"/></b>
		</td>
        <td class="colHeaderLink">
			<b><webwork:text name="'manageattachments.date.attached'"/></b>
		</td>
        <td class="colHeaderLink">
			<b><webwork:text name="'manageattachments.author'"/></b>
		</td>
		<td class="colHeaderLink">
			&nbsp;
		</td>
	</tr>
    <webwork:bean name="'com.atlassian.core.util.FileSize'" id="sizeFormatter" />
	<webwork:iterator value="/issueObject/attachments" status="'status'">
	<tr <webwork:if test="@status/odd == true">bgcolor="#ffffff"</webwork:if>
		<webwork:else>bgcolor="#fffff0"</webwork:else> >
		<td valign=top><webwork:property value="@status/count"/></td>
		<td valign=top><%@ include file="/includes/icons/attachment.jsp" %></td>
		<td valign=top nowrap><a href="<%= request.getContextPath() %>/secure/attachment/<webwork:property value="id" />/<webwork:property value="urlEncoded(filename)" />"><webwork:property value="filename" /></a></td>		<td valign=top><webwork:property value="@sizeFormatter/format(filesize)"/></td>
		<td valign=top nowrap><webwork:property value="mimetype"/></td>
        <td valign=top><webwork:property value="/outlookDate/formatDMYHMS(created)"/></td>
        <td valign=top><webwork:property value="@userUtils/user(author)/fullName"/></td>
		<td valign=top nowrap>
			<a href="<%= request.getContextPath() %>/secure/attachment/<webwork:property value="id" />/<webwork:property value="urlEncoded(filename)" />"><webwork:text name="'manageattachments.download'"/></a>
            <webwork:if test="/hasIssuePermission('delete', /issue) == true">
			|
			<a href="DeleteAttachment.jspa?id=<webwork:url value="/issueObject/id" />&del=<webwork:url value="id" />" id="del_<webwork:url value="id" />"><webwork:text name="'common.words.delete'"/></a>
            </webwork:if>
		</td>
	</tr>
	</webwork:iterator>
</table>
</td></tr></table>
</center>
</p>
</body>
</html>