<%@ page buffer="8kb" autoFlush="true" %>
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="zm" uri="com.zimbra.zm" %>
<%@ taglib prefix="app" uri="com.zimbra.htmlclient" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:setBundle basename="/msgs/ZhMsg" scope="session"/>
<app:handleError>
    <zm:getMailbox var="mailbox"/>
    <fmt:message var="title" key="attachFiles"/>
    <zm:composeUploader var="uploader"/>
    <c:set var="compose" value="${uploader.compose}"/>
</app:handleError>

<app:view title="${title}" selected='compose' folders="true" tags="true" searches="true" context="${null}" keys="false">

    <c:set var="toolbar">
        <table width=100% cellspacing=0>
            <tr valign='middle'>
                <td>
                    <table cellspacing=2 cellpadding=0 class='Tb'>
                        <tr>
                            <app:button name="actionAttachDone" src="common/Close.gif" tooltip="done" text="done"/>
                            <td><div class='vertSep'></div></td>
                            <app:button name="actionAttachCancel" src="common/Cancel.gif" tooltip="cancel" text="cancel"/>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </c:set>

    <form action="" method="post" enctype="multipart/form-data" accept-charset="utf-8">
        <table width=100% cellpadding="0" cellspacing="0">
            <tr>
                <td class='TbTop'>
                    ${toolbar}
                </td>
            </tr>
            <tr>
                <td class='ZhAppContent'>
                        <table cellpadding=0 cellspacing=10 height=80% width=100% class='Compose'>
                            <tr>
                                <td align='right'><app:img altkey="ALT_ATTACHMENT" src="common/Attachment.gif"/></td>
                                <td colspan=2><b><fmt:message key="selectFilesToAttach"/></b></td>
                            </tr>
                            <c:forEach begin="1" end="10" var="current">
                                <tr>
                                    <td align='right'>${current}.</td>
                                    <td colspan=2><input type=file size="40" name="fileUpload"></td>
                                </tr>
                            </c:forEach>
                        </table>
                </td>
            </tr>
            <tr>
                <td class='TbBottom'>
                    ${toolbar}
                </td>
            </tr>
        </table>
        <input type="hidden" name="to" value="${fn:escapeXml(compose.to)}"/>
        <input type="hidden" name="cc" value="${fn:escapeXml(compose.cc)}"/>
        <input type="hidden" name="bcc" value="${fn:escapeXml(compose.bcc)}"/>
        <input type="hidden" name="subject" value="${fn:escapeXml(compose.subject)}"/>
        <c:forEach var="ma" items="${compose.messageAttachments}">
            <input type="hidden" name="messageAttachment" value="${ma.id}:${fn:escapeXml(ma.subject)}"/>
        </c:forEach>
        <c:forEach var="ca" items="${compose.checkedAttachmentNames}">
            <input type="hidden" name="originalAttachment" value="${fn:escapeXml(ca.key)}"/>
        </c:forEach>
        <input type="hidden" name="body" value="${fn:escapeXml(compose.content)}"/>
        <input type="hidden" name="replyto" value="${fn:escapeXml(compose.replyTo)}"/>
        <input type="hidden" name="from" value="${fn:escapeXml(compose.from)}"/>
        <input type="hidden" name="inreplyto" value="${fn:escapeXml(compose.inReplyTo)}"/>
        <input type="hidden" name="messageid" value="${fn:escapeXml(compose.messageId)}"/>
        <input type="hidden" name="replytype" value="${fn:escapeXml(compose.replyType)}"/>
        <input type="hidden" name="draftid" value="${fn:escapeXml(empty requestScope.draftid ? compose.draftId : requestScope.draftid)}"/>
    </form>
</app:view>
