<div xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      py:attrs="attrs" class="discussion_subscription_form">
  <?python from pyforge.lib.security import has_artifact_access?>
  <div class="ui-button-set">
    <div class="clear span-3" py:if="not (allow_create_thread and has_artifact_access('post', value)())">
      &nbsp;
    </div>
    <div class="clear span-3" py:if="allow_create_thread and has_artifact_access('post', value)()">
      <a href="" class="ui-button new_topic"><span class="ui-icon ui-icon-plus"></span>New Topic</a>
    </div>
    <div class="span-16 last tright">
      <a href="${value.email_link(subject=None)}" class="ui-button" 
         py:if="show_discussion_email"><span class="ui-icon ui-icon-mail-closed"></span>Email</a>
      <a href="${value.url()}moderate/" class="ui-button"
         py:if="has_artifact_access('moderate', value)()"><span class="ui-icon ui-icon-check"></span>Moderate</a>
      <a href="" class="ui-button follow"><span class="ui-icon ui-icon-signal-diag"></span>Follow</a>
    </div>
	</div>
  <div class="clear new_topic_form" style="display: none" py:if="allow_create_thread and has_artifact_access('post', value)()">
    <!-- <py:with var="context=c.widget.context_for('new_topic')">
      <py:with var="context['action']=value.url() + 'post'"> -->
        ${fields['new_topic'].display(action=value.url() + 'post',show_subject=show_subject)}
      <!-- </py:with>  
    </py:with> -->
  </div>
  <div class="clear"/>
  <form method="$method" action="$action" enctype="$enctype" class="follow_form">
    ${fields['threads'].display(**c.widget.context_for('threads'))}
  </form>
</div>