<!-- Post editing -->
<div class="content">
{% for Post in Content %}
  <!-- Begin post {{ Post.id }} ----------------------------------------- -->
  <div class="post" id="post_{{ Post.id }}">
  <form name="post{{ Post.id }}$edit" id="post_{{ Post.id }}$edit" action="{{ Site.url(channel='$site/posts/edit') }}" onsubmit="return Post{{ Post.id }}.publish(this)" method="post" accept-charset="utf-8">
    <input type="hidden" name="required" value="title|the post title,content|the post content,channels|one or more channels in which to place the post" /> 
    <table class="post_bounds" id="post_{{ Post.id }}$bounds">
      <script type="text/javascript">
        Post{{ Post.id }} = new APost({{ Post.id }});
      </script>
<!-- Post header ------------------------------------------------------------->
      <tr>
        <td class="post_title" id="post_{{ Post.id }}$title">
        {% if "title" in Script.Request %}
          <input class="post_title_edited" type="text" name="title" value="{{ Script.Request.title.value }}" />
        {% else %}
          <input class="post_title_edited" type="text" name="title" value="{{ Post.title }}" />
        {% endif %}
        </td> 
        <td valign="top" id="post_{{ Post.id }}$icon" rowspan="3">      
        {% if User.icon %}
          <input type="hidden" name="icon" value="{{ Script.path(User.icon) }}" />
          <a href="{{ Site.url(channel='$site/user/profile', title=User.name) }}" title="View profile for {{ User.name }}"><img class="post_icon" src="{{ Script.path(User.icon) }}" />
        {% else %}
          <input type="hidden" name="icon" value="{{ Script.path(Channel.icon) }}" />
          <img class="post_icon" src="{{ Script.path(Channel.icon) }}" />
        {% endif %}
        </td>
      </tr>
      </tr>
      <tr>
        <td class="post_header" id="post_{{ Post.id }}$header">edited on {{ Time.localString() }} (GMT {{ Time.zoneOffset() }}) by <a href="{{ Site.url(channel='$site/user/profile', title=User.name) }}" title="View profile for {{ User.name }}">{{ User.name }}</a> 
          <div id="post_{{ Post.id }}$draft">
            <em>Not yet saved</em>
            <input type="hidden" name="id" value="{{ Post.id }}" />
          </div>
          <input type="hidden" name="view" value="post/single" />
          <input type="hidden" name="draft" value="n" />
          <input type="hidden" name="template" value="" />
        </td>
      </tr>
<!-- Post content ------------------------------------------------------------>
      <tr>
        <td id="post_{{ Post.id }}$content">
          <textarea class="post_content_edited" name="content" title="Enter the content of your post and click 'Save' when finished, or 'Cancel' to go back to the previous page.">{{ Post.content }}</textarea>
        </td>
      </tr>
<!-- Required post attributes ------------------------------------------------>
     <tr>
       <td>
         <a href="javascript:void(0)" onclick="Post{{ Post.id }}.toggleDisplayOf('requiredAttributes', this);" title="Hide this section"><code>-</code> Required post attributes</a>
         <div class="quote" id="post_{{ Post.id }}$requiredAttributes" style="display:block">
           <table class="post_attributes">
             <tr>
               <td class="field_name" style="width:15%">Post to:</td>
               <td id="post_{{ Post.id }}$channels">
                 <input type="hidden" name="channels" value="" />
                 <div class="post_channels_view" id="post_{{ Post.id }}$channelTree">
                   <p style="text-align: center">
                     Loading channels list...<br/>
                     You must have JavaScript enabled in order to see the list.
                   </p>
                 </div>
                 <script type="text/javascript">
                   Post{{ Post.id }}.buildChannelTree("{{ Site.url(channel='$site/channels/list', rights=Right.toPost) }}", "channelTree");

                 {% for channel in Post.channels %}
                   Post{{ Post.id }}.selectChannel("{{ channel }}");
                 {% endfor %}
                 </script>
               </td>
             </tr>
             <tr>
               <td class="field_name" style="width:15%">New channel:</td>
               <td id="post_{{ Post.id }}$newChannel">
                 <input type="text" name="post_{{ Post.id }}$newChannelName" id="post_{{ Post.id }}$newChannelName" class="post_text_field_edited" style="width: 85%;" value="" />
                 <input type="button" value="Add" onClick="Post{{ Post.id }}.addChannel('newChannelName')" />
               </td>
             </tr>
           </table>
         </div>
       </td>
     </tr>
<!-- Optional post attributes ------------------------------------------------>
      <tr>
        <td>
          <a href="javascript:void(0)" onclick="Post{{ Post.id }}.toggleDisplayOf('optionalAttributes', this);" title="Show this section"><code>+</code> Optional post attributes</a>
          <div class="quote" id="post_{{ Post.id }}$optionalAttributes" style="visibility:hidden; display:none;">
            <table class="post_attributes">
              <tr>
                <td class="field_name">Keywords:</td>
                <td id="post_{{ Post.id }}$keywords">
                  <textarea class="post_text_field_edited" style="height: 28pt;" type="text" name="keywords" title="Enter a comma-separated list of keywords">{{ String.implode(Post.keywords) }}</textarea>
                </td>
              </tr>
              <tr>
                <td class="field_name">Allow&nbsp;comments?</td>
                <td id="post_{{ Post.id }}$comments">
                    <input type="radio" name="comments" value="y" title="Other users will be allowed to comment on this post" checked />Yes &nbsp;
                    <input type="radio" name="comments" value="n" title="Other users will be prohibited from commenting on this post" />No
                </td>
              </tr>
              <tr>
                <td class="field_name">Sticky&nbsp;post?*</td>
                <td id="post_{{ Post.id }}$sticky">
                   <input type="radio" name="sticky" value="y" title="This post will remain at the top of the channel" />Yes &nbsp;
                   <input type="radio" name="sticky" value="n" title="This post will be displayed as usual within the channel" checked />No
                   <em><small>* Note that this attribute only has meaning if the view used to display the channel supports it.</em></small>
                </td>
              </tr>
            </table>
          </div>
        </td>
      </tr>
<!-- Post footer ------------------------------------------------------------->
      <tr>
        <td class="post_footer">
        {% if Post.id > 0 %}
          <input type="hidden" name="do" value="update" />
        {% else %}
          <input type="hidden" name="do" value="publish" />
        {% endif %}
          <a href="javascript:Post{{ Post.id }}.saveDraft(false)" title="Save a draft of this post">Save Draft</a>
          <input type="submit" value="Save" />
          <input type="button" value="Cancel" name="cancel" onclick="javascript:history.back();" />
        </td>
      </tr>
    </table>
  </form>
  </div>
<!-- End post {{ Post.id }} ------------------------------------------------ -->
{% endfor %}
</div>
