<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="master.html" />

<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
    <title>Edit a post - <span py:replace="blog.name">Ponies!!1!one!</span> - <span py:replace="blog.owner.name">Sara Swift</span></title>
    <script src="${tg.url('/static/javascript/toggleselect.js')}" type="text/javascript"></script>
</head>

<body>
  <div>
    URL for this post is: <a href="${tg.url_for('posts', post=post)}"
    py:content="tg.url_for('posts', post=post)">the url</a>
  </div>

  <h2>Edit post</h2>
  <div py:content="tg.ET(post_form.display(action=tg.url_for('updatepost', post = post),
  value=post_form_values, **post_form_params))">Form is
  here...</div>

  <h2>Control Comments</h2>

  <div py:if="post.accept_comments">
    Comments are currently allowed on this post.
    <form method="post" action="${tg.url_for('stop_comments', post=post)}">
    <input type="submit" name="submit" value="Disable comments" />
    </form>
  </div>
  <div py:if="not post.accept_comments">
    Comments are currently <strong>not</strong> allowed on this post.
    <form method="post" action="${tg.url_for('start_comments', post=post)}">
    <input type="submit" name="submit" value="Enable comments" />
    </form>
  </div>

<div py:if="tg.paginate.pages">
  <h2>Existing comments</h2>
<span py:for="page in [1,2,3]">
    <a py:if="page not in tg.paginate.pages and tg.paginate.page_count >= page" href="${tg.paginate.get_href(page)}">${page}</a>
</span>
<span py:if="4 not in tg.paginate.pages and tg.paginate.page_count > 3">
    ...
</span>
<span py:for="page in tg.paginate.pages">
    <a py:if="page != tg.paginate.current_page"
        href="${tg.paginate.get_href(page)}">${page}</a>
    <b py:if="page == tg.paginate.current_page">${page}</b>
</span>
<span py:if="tg.paginate.page_count - 3 not in tg.paginate.pages and tg.paginate.page_count > 3">
    ...
</span>
<span py:if="page > 0" py:for="page in [tg.paginate.page_count - 2, tg.paginate.page_count - 1, tg.paginate.page_count]">
    <a py:if="page not in tg.paginate.pages" href="${tg.paginate.get_href(page)}">${page}</a>
</span>

<form action="${tg.url_for('remove_comments')}" method="post">
<input type="hidden" name="return_url" value="${tg.base_url + tg.paginate.get_href(tg.paginate.current_page)}" />
<table class="gibe_admin_post_comments" cellspacing="0" cellpadding="0">
  <thead>
    <tr>
      <th><input type="checkbox" onclick="toggleSelect('admin_post', this, 'comment_id')" /></th>
      <th>ID</th>
      <th>Name</th>
      <th>Email</th>
      <th>Posted time</th>
    </tr>
  </thead>
  <tbody id="admin_post">
    <div py:for="comment in comments" py:strip="True">
      <tr class="${tg.comment_class(comment)} gibe_admin_post_comments_start" >
        <td><input type="checkbox" name="comment_id"
        value="${comment.comment_id}" /></td>
        <td><a href="${tg.url_for('admincomment', comment=comment)}"
        py:content="comment.comment_id">Post name</a></td>
        <td py:content="comment.author_name" />
        <td py:content="comment.author_email" />
        <td py:content="comment.posted_time" />
      </tr>
      <tr class="${tg.comment_class(comment)} gibe_admin_post_comments_end">
        <td>&nbsp;</td><td colspan="4"><div py:content="HTML(comment.getContentHtml())"
        style="border: 1px solid black; margin: 0.5em 2em; padding:
        0.25em;">Some stuff</div></td>
      </tr>
    </div>
  </tbody>
</table>
<input type="submit" name="submit" value="Delete" />
</form>
</div>

</body>
</html>
