<tal:block define="userHasReplyPermission view/can_reply;
                   isDiscussionAllowed view/is_discussion_allowed;
                   replies view/get_replies;
                   isAnon view/is_anonymous"
           i18n:domain="plone">
    <div class="discussion"
         tal:condition="python:replies or (userHasReplyPermission and isDiscussionAllowed) or (isAnon and not userHasReplyPermission and isDiscussionAllowed)">
        <form name="reply"
              action=""
              method="post"
              tal:condition="python:userHasReplyPermission and isDiscussionAllowed"
              tal:attributes="action string:${context/absolute_url}/discussion_reply_form">

              <input class="standalone"
                     style="margin-bottom: 1.25em;"
                     type="submit"
                     value="Add Comment"
                     i18n:attributes="value label_add_comment;"
                     />
        </form>
        <form tal:condition="python:isAnon and not userHasReplyPermission and isDiscussionAllowed"
              tal:attributes="action view/login_action">
            <input class="standalone"
                   style="margin-bottom: 1.25em;"
                   type="submit"
                   value="Log in to add comments"
                   i18n:attributes="value label_login_to_add_comments;"
                   />
        </form>

        <tal:getreplies repeat="reply_dict replies">
            <div class="comment" style=""
                tal:define="indent python:reply_dict['depth']*2;
                            reply python:reply_dict['object']"
                tal:attributes="style string:margin-left:${indent}em;">
                
                <h3>
                    <a name="comments" tal:attributes="name reply/id">
                    <span tal:replace="reply/pretty_title_or_id">Comment title</span>
                    </a>
                </h3>
                <div class="documentByLine"
                     tal:define="creator reply/Creator;
                                 anonymous_creator python:creator=='Anonymous User';
                                 mi python:not anonymous_creator and view.member_info(creator);
                                 fullname python: mi and mi['fullname'] or creator;" >
                    <span i18n:translate="label_comment_by">Posted by</span>
                    <span tal:content="fullname"
                          tal:condition="not:anonymous_creator">Poster Name</span>
                    <span i18n:translate="label_anonymous_user"
                          tal:condition="anonymous_creator">Anonymous User</span>
                    <span i18n:translate="label_commented_at">at</span> 
                    <span tal:replace="python:view.format_time(reply.ModificationDate())">8/23/2001 12:40:44 PM</span>
                </div>
                <div class="commentBody"
                     tal:content="structure reply/CookedBody">
                     This is the body text of the comment.
                </div>
                <form name="reply"
                      action="discussion_reply_form"
                      method="post"
                      style="display: inline;"
                      tal:attributes="action string:${reply/absolute_url}/discussion_reply_form"
                      tal:condition="python:userHasReplyPermission and isDiscussionAllowed">
                    <input class="standalone"
                           type="submit"
                           value="Reply"
                           i18n:attributes="value label_reply;"
                           />
                </form>
                <form name="delete"
                      action=""
                      method="post"
                      style="display: inline;"
                      tal:condition="view/can_manage"
                      tal:attributes="action string:${reply/absolute_url}/deleteDiscussion">
                    <input class="destructive"
                           type="submit"
                           value="Remove"
                           i18n:attributes="value label_remove;"
                           />
                </form>
            </div>
        </tal:getreplies>
    </div>
</tal:block>