<%~GForum::Post::View::get($in.post_id)%>
<%~unless post_id%><%set error = GForum::language('POST_DOES_NOT_EXIST')%><%include error.html%><%endparse%><%endunless~%>
<%~set search_widget = 1%>
<!DOCTYPE html >
<html lang="en">
<head>
  <title><%cat_full_name%>: <%forum_name%>: <%if post_deleted%>Post deleted by <%post_deleted_by%>: <%endif%><%post_subject%>: Detach &amp; Move Thread</title>
<%include include_common_head.html%>
</head>


<%~set content_header_title = 'Detach &amp; Move Thread'%>
<%~set content_header_subtitle = 'This post and any replies will be made into a new thread.'%>
<%~set show_subject_crumb = 1%>

<body class="page-<%page_id%>">
  <div class="container-b">
    <%include include_header.html%>

    <div class="main">
      <div class="contentwrapper clearfix">
        <div class="sidebar">
            <%include include_sidebar.html%>
        </div>

        <%~set content_header_title = 'Detach &amp; Move Post'%>
        <%~init array breadcrumbs%><%init hash breadcrumbs.0%><%init hash breadcrumbs.1%>
        <%~set breadcrumbs.0.name = $forum_name%>
        <%~set breadcrumbs.0.url  = GForum::SEO::url(params => "forum=$forum_id")%>
        <%~set breadcrumbs.1.name = $content_header_title%>

        <%include include_breadcrumb.html%>

        <div class="content"><%-- start content--%>
          <%include include_content_header.html%>
          <p>
            You have chosen to detach the post '<a href="<%GForum::SEO::url(type => "post", id => $post_id, anchor => "p$post_id")%>"><%post_subject%></a>'
            <%~if post_replies%> and its <%post_replies%> repl<%if post_replies == 1%>y<%else%>ies<%endif%>,<%endif%>
            authored by
            <%set include_username_display = $post_username~%>
            <%include include_username.html%>
            on <%post_date%>.
          </p>

          <p>
            Detaching a post will turn that post and any replies into a new thread.
            You also have the option now to place the new thread in another forum or
            leave it in the same forum by selecting the forum below.
          </p>

          <form action="<%GForum::SEO::url()%>" method="post">
            <%hidden_form%>
            <input type="hidden" name="post_id" value="<%post_id%>" />
            <input type="hidden" name="do" value="post_detach" />
            <%GForum::Forum::moderator_tpl_options(without => $forum_id)%>
            <div class="simple-form">
              <select name="forum_id" onchange="document.getElementById('detach_thread_submit').value = this.options[this.selectedIndex].value == <%forum_id%> ? 'Detach Thread' : 'Detach &amp; Move Thread'">
                <option value="<%forum_id%>">Detach only; don't move</option>
                  <%~set last_cat_id = -1%>
                  <%~loop moderator_tpl_loop%>
                <%~if cat_id != $last_cat_id%>
                  <%~unless last_cat_id == -1%>
                </optgroup>
                  <%~endunless%>
                <%~set last_cat_id = $cat_id%>
                <optgroup label="<%cat_full_name%>">
                <%~endif%>
                <option value="<%forum_id%>"><%forum_name%></option>
                <%~endloop%>
                </optgroup>
              </select>
              <input type="submit" id="detach_thread_submit" value="Detach Thread" class="btn" />
            </div>
        </form>

        </div><%-- end content --%>
      </div>
    </div>
    <%include include_footer.html%>
  </div>
</body>
<%~include include_global_js.html%>
</html>
