<div xmlns="http://www.w3.org/1999/xhtml"
     xmlns:py="http://genshi.edgewall.org/"
     xmlns:xi="http://www.w3.org/2001/XInclude"
     py:strip="True">
     <xi:include href="${g.pyforge_templates}/lib.html" />
  <?python from pyforge.lib.security import has_artifact_access?>

  <div class="discussion-post">
	<div class="push-$indent span-3 clear tcenter">
		<p class="gravatar">
			<a href="${value.author().url()}">${gravatar(value.author().preferences.email_address)}</a><br />
			<a href="${value.author().url()}">${value.author().display_name}</a><br />${h.ago(value.timestamp)}
		</p>

		<p>
		  <input type="submit" value="Reply" py:if="has_artifact_access('post', value.thread)()" class="reply_post" /><br />
		  <a href="${value.url()}">Permalink</a>
      </p>
	</div>
	<div class="span-${16-indent} last">
		<div class="display_post content clear">${Markup(g.markdown.convert(value.text))}</div>
	<div class="edit_post_form content clear" style="display:none" py:if="has_artifact_access('post', value.thread)()">
	  ${widgets.edit_post.display(value=value, submit_text='Edit Post', action=value.url())}
	</div>
    <div py:for="att in value.attachments">
      ${widgets.attachment.display(post=value, value=att)}
    </div>
	</div>
	<div class="push-$indent clear span-3">&nbsp;</div>
	<div class="span-2" py:if="has_artifact_access('moderate', value)()">
	  ${widgets.moderate_post.display(value=value, action=value.url()+'moderate')}
	</div>
	<div class="span-2" py:if="has_artifact_access('post', value.thread)()">
	  <a href="" class="edit_post"><span class="ui-icon ui-icon-pencil"></span>Edit</a>
    </div>
	<div class="span-2" py:if="has_artifact_access('post', value.thread)()">
	  <a href="" class="add_attachment"><span class="ui-icon ui-icon-document"></span>Attach</a>
	</div>
	<div class="span-2 last" py:if="has_artifact_access('moderate', value)()">
	  ${widgets.flag_post.display(value=value, action=value.url()+'flag')}
	</div>
	<div class="span-2" py:if="has_artifact_access('moderate', value.thread)() and 'promote_to_thread' in widgets and not supress_promote">
	  <a href="" class="promote_to_thread"><span class="ui-icon ui-icon-arrowthick-1-n"></span>Promote</a>
	</div>

	<div class="add_attachment_form push-${3+indent}  span-${16-indent} last clear" style="display:none" py:if="has_artifact_access('post', value.thread)()">
      ${widgets.attach_post.display(value=value, action=value.url() + 'attach')}
	</div>
	<div class="reply_post_form span-19 last clear" style="display:none" py:if="has_artifact_access('post', value.thread)()">
	  ${widgets.edit_post.display(
          value=value,
          submit_text='Post Reply',
          action=value.url()+'reply',
          value=dict(
              text='',
              subject=value.reply_subject()),
          )}
	</div>
  <div class="promote_to_thread_form push-${3+indent} span-${16-indent} last clear" style="display:none"
       py:if="has_artifact_access('moderate', value.thread)() and 'promote_to_thread' in widgets and not supress_promote">
    ${widgets.promote_to_thread.display(value=value, action=value.url()+'moderate')}
  </div>
  </div>
  <hr class="clear clearfix space"/>
  <hr class="clear clearfix" />
</div>
