<%~if preview%>
<div class="post-preview">Preview:</div>
<%~elsif reply_view%>
<div class="post-reply-view">Replying to:</div>
<%~endif%>

<div id="p<%msg_id || 'preview'%>" class="post-wrapper">
  <div id="post_header_<%post_id || 'preview'%>" class="post-header clearfix">
    <span class="post-subject">
      <%msg_subject%>
    </span>
    <div class="post-actions">
      <%unless preview or reply_view%>
      <%~unless sent_message%>
      <a href="<%GForum::SEO::url(params => "do=message_reply_write;message=$msg_id")%>" title="Reply">Reply</a>
      <%~if config.message_style % 2%>
      | <a href="<%GForum::SEO::url(params => "do=message_reply_write;quote=1;message=$msg_id")%>" title="Quote">Quote</a>
      <%~endif%>
      <%endunless%>
      | <a href="#" onclick="return confirm('Are you sure you want to delete this private message?') ? submitForm(document.getElementById('message_action_form'), ['do','message_delete',  '<%if sent_message%>sent_<%endif%>delete','<%msg_id%>']) : false" title="Delete">Delete</a>
      <%endunless%>
    </div>
  </div>
</div>
<div id="m<%msg_id || 'preview'%>" class="post-wrapper">
  <div class="post-body-wrapper">
    <div class="dtable">
      <div class="drow">
        <div class="dcell">
          <%include include_message_display_infobar.html%>
        </div>
        <div class="dcell">
          <div id="message_body_<%message_id || 'preview'%>" class="post-body">
            <%msg_body%>
          </div>

          <%~if sent_message and msg_has_attachments%>
          <%~set show_attachments = 1%>
          <%~else%>
          <%~loop msg_attachments%>
          <%~if messatt_inline and config.allow_message_inline%><%nextloop%><%endif%>
          <%~set show_attachments = 1%>
          <%~lastloop%>
          <%~endloop%>
          <%~endif%>

          <%~if show_attachments%>
          <div class="top-spacer">
            <div class="message-footer">
              <%~if sent_message and msg_has_attachments%>
              <h4>The message contained <%msg_has_attachments%> attachment<%if msg_has_attachments != 1%>s<%endif%></h4>
              <%~else%>
              <h4>Attached Files:</h4>
              <ul class="attachments">
                <%~loop msg_attachments%>
                <%~if messatt_inline and config.allow_message_inline%><%nextloop%><%endif%>
                <li>
                  <img src="<%GForum::Attachment::icon($messatt_content, $messatt_filename)%>" alt="<%messatt_content%>" />
                   <a href="<%GForum::SEO::url(params => "do=message_attachment;messatt_id=$messatt_id")%>" target="_blank"><%messatt_filename%></a> (<%GForum::Attachment::friendly_size($messatt_size)%>)
                </li>
                <%~endloop%>
              </ul>
              <%~endif%>
            </div>
          </div>
          <%~endif%>

        </div>
      </div> <%-- drow --%>
    </div> <%-- dtable --%>
    <div class="post-actions mobile">
      <%unless preview or reply_view%>
      <%~unless sent_message%>
      <a href="<%GForum::SEO::url(params => "do=message_reply_write;message=$msg_id")%>" title="Reply" class="btn">Reply</a>
      <%~if config.message_style % 2%>
      <a href="<%GForum::SEO::url(params => "do=message_reply_write;quote=1;message=$msg_id")%>" title="Quote" class="btn">Quote</a>
      <%~endif%>
      <%endunless%>
      <a href="#" onclick="return confirm('Are you sure you want to delete this private message?') ? submitForm(document.getElementById('message_action_form'), ['do','message_delete',  '<%if sent_message%>sent_<%endif%>delete','<%msg_id%>']) : false" title="Delete" class="btn">Delete</a>
      <%endunless%>
    </div>
  </div>
</div>
