<%~if hide_post%>
<div id="p<%post_id || 'preview'%>_hide" class="post-wrapper hidden-post">
  <div id="post_header_<%post_id || 'preview'%>" class="post-header clearfix">
    <span class="post-subject">Ignored Post</span>
    <div class="post-actions">
      <a href="#" class="show_post" id="show_post_<%post_id%>">Show This Post</a>
    </div>
  </div>
  <div class="post-body-wrapper">
    <div class="dtable">
      <div class="drow">
        <div class="dcell">
          <div id="post_info_<%post_id || 'preview'%>" class="post-info<%if post_user_is_moderator%> moderator<%endif%><%loop user_groups%> ug-<%if group_id == $config.id_group_guest%>guest<%elsif group_id == $config.id_group_moderator%>moderator<%elsif group_id == $config.id_group_not_validated%>not-validated<%elsif group_id == $config.id_group_registered%>registered<%else%><%group_id%><%endif%><%endloop%>">
            <div class="username">
              <%~set include_username_display = $post_username%>
              <%~include include_username.html~%>
            </div>
          </div>
        </div>
        <div class="dcell">
        </div>
      </div>
    </div>
  </div>
</div>
<%endif%><%-- if hide_post --%>

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

<div id="p<%post_id || 'preview'%>" class="post-wrapper<%if hide_post%> hide<%endif%><%if post_id == $root_post_id%> root-post<%endif%>">
  <div id="post_header_<%post_id || 'preview'%>" class="post-header clearfix">
    <%if last%><a name="last"></a><%endif%><%if first_new%><a name="unread"></a><%endif%>
    <span class="post-subject">
      <%~if post_deleted%>
      Post deleted by <%post_deleted_by%><%if user_perm_moderator%>: <%post_subject%><%endif%>
      <%~else%>
      <%~if post_moved%><span class="post-moved">Moved:</span> <%endif%>
      <%if post_subject%><%~post_subject%><%else%>&nbsp;<%endif%>
      <%~if post_new%><span class="post-new"><span> -</span> NEW</span><%endif%>
      <%~endif~%>

      <%if not preview and not hide_post_menu and post_father_id%>
      <%~ifnot post_father_on_page%>
      <%~set do = ''%>
      <%~if in.do%>
      <%~set do = "do=$this_do"%>
      <%~endif%>
      [ <a href="<%GForum::SEO::url(type => "post", id => $post_father_id, params => "$do$hidden_sort", anchor => "p$post_father_id")%>" rel="nofollow">In reply to</a> ]
      <%~else%>
      [ <a href="#p<%post_father_id%>" rel="nofollow">In reply to</a> ]
      <%~endif%>
      <%endif%>
    </span>

    <div class="post-actions">
      <%GForum::GUI::draw(
        draw          => post_display_options,
        edit          => "Edit",
        delete        => "Delete",
        cant_post     => "Can't Post",
        quote         => "Quote",
        reply         => "Reply",
        order         => "edit,delete,quote,reply",
        a_attribs     => "",
        separator     => " | ",
      )%>
    </div>
  </div>

  <div class="post-body-wrapper">
    <div class="dtable">
      <div class="drow">
        <div class="dcell">
          <%include include_post_display_infobar.html%>
        </div>
        <div class="dcell">
          <div id="post_body_<%post_id || 'preview'%>" class="post-body">
            <%~if not post_deleted or user_perm_moderator%>
            <%Slowtwitch::Post::parse_youtube($post_message)%>
            <%post_message%>
            <%~endif%>
          </div>
          <%~set show_post_notes = 0%><%-- Determine whether or not we need the "post-notes" div --%>
          <%~if this_do eq post_preview and in.redo eq post_edit and preview%><%set show_post_notes = 1%>
          <%~elsif post_deleted and user_perm_moderator%><%set show_post_notes = 1%>
          <%~elsif post_keep and user_perm_moderator%><%set show_post_notes = 1%>
          <%~elsif post_moved or post_last_edit_username%><%set show_post_notes = 1%>
          <%~endif%>

          <%~if show_post_notes%>
          <div class="post-notes">
            <%~if this_do eq post_preview and in.redo eq post_edit and preview%>
            <div class="post-edited">
              <%~set escaped_username = escape_url unescape_html $current.user_username%>
              <b>Last edited by:</b> <a href="<%GForum::SEO::url(params => "username=$escaped_username")%>"><%current.user_username%></a>: <%GForum::date($TIME)%>
            </div>
            <%~elsif post_last_edit_username%>
            <div class="post-edited">
              <%~set escaped_username = escape_url $post_last_edit_username%>
              <b>Last <a href="<%GForum::SEO::url(params => "do=post_editlog;post=$post_id")%>" rel="nofollow">edited</a> by: </b>
              <a href="<%GForum::SEO::url(params => "username=$escaped_username"%>"><%post_last_edit_username%></a>: <%post_last_edit_date%>
            </div>
            <%~endif%>
            <%~if post_deleted and user_perm_moderator%>
            <div class="post-edited">
              <b>Deleted by: </b>
              <%~set escaped_username = escape_url $post_deleted_by%>
              <a href="<%GForum::SEO::url(params => "username=$escaped_username")%>"><%post_deleted_by%></a><%if post_deleted_time%>: <%post_deleted_date%><%endif%>
            </div>
            <%~endif%>
            <%~if post_moved%><%-- An empty pointer to the moved post --%>
            <div class="post-edited">
              <h4>Moved: </h4>
              <a href="<%GForum::SEO::url(type => "post", id => $post_moved_id)%>">Original post</a>
            </div>
            <%~endif%>
          </div>
          <%~endif%>

          <%~set post_attachments_count = 0%>
          <%~loop post_attachments%>
          <%~if postatt_inline%><%if forum_attachment_inline or not forum_id%><%nextloop%><%endif%><%endif%>
          <%~set post_attachments_count += 1%>
          <%~endloop%>
          <%~if tags.length or post_attachments_count%>
          <div class="top-spacer">
            <div class="post-footer">
              <%~if tags.length%>
              <h4>Tags:</h4>
              <div class="content">
                <%~loop tags%>
                <a href="<%GForum::SEO::url(params => "do=tags;tags=$tag_name")%>"><%tag_name%></a><%unless last%>,<%endunless%>
                <%~endloop~%>
              </div>
              <%~endif%>

              <%~if post_attachments_count%>
              <h4>Attached Files:</h4>
              <ul class="attachments">
                <%~loop post_attachments%>
                <%~if postatt_inline%><%if forum_attachment_inline or not forum_id%><%nextloop%><%endif%><%endif%>
                <li>
                  <img src="<%GForum::Attachment::icon($postatt_content, $postatt_filename)%>" alt="<%postatt_content%>" />
                  <a href="<%GForum::SEO::url(params => "do=post_attachment;postatt_id=$postatt_id")%>"><%postatt_filename%></a> (<%GForum::Attachment::friendly_size($postatt_size)%>)
                </li>
                <%~endloop%>
              </ul>
              <%~endif%>
            </div><%~-- /div class="post-footer" --%>
          </div><%~-- /div class="top-spacer" --%>
          <%~endif%>
        </div>
      </div> <%-- drow --%>
    </div> <%-- dtable --%>

    <div class="post-actions mobile">
      <%GForum::GUI::draw(
        draw          => post_display_options,
        edit          => "Edit",
        delete        => "Delete",
        cant_post     => "Can't Post",
        quote         => "Quote",
        reply         => "Reply",
        order         => "edit,delete,quote,reply",
        a_attribs     => "class='btn'",
        separator     => " ",
      )%>
    </div>
  </div>

</div>
