source: products/quintagroup.plonecomments/trunk/quintagroup/plonecomments/browser/comments.pt @ 1840

Last change on this file since 1840 was 1840, checked in by kroman0, 14 years ago

Rewrite comments anchor

File size: 8.3 KB
Line 
1<tal:block define="userHasReplyPermission view/can_reply;
2                   isDiscussionAllowed view/is_discussion_allowed;
3                   replies view/get_replies;
4                   here_url context/@@plone_context_state/object_url;
5                   current_page_url context/@@plone_context_state/current_page_url;
6                   member context/@@plone_portal_state/member;
7                   isAnon view/is_anonymous;
8                   ifModerate view/is_moderation_enabled;
9                   isModerationAllowed view/can_moderate;
10                   isAuthenticatedReportAbuseEnabled view/authenticated_report_abuse_enabled;
11                   isAjaxReportAbuseEnabled view/ajax_report_abuse_enabled;
12                   isAnonymousReportAbuseEnabled view/anonymous_report_abuse_enabled;
13                   isReportAbuseEnabled python:isAnonymousReportAbuseEnabled or not isAnon and isAuthenticatedReportAbuseEnabled;
14                   props_sheet here/portal_properties/qPloneComments;
15                   require_email python:props_sheet.getProperty('require_email');"
16                   i18n:domain="plone">
17    <div class="discussion"
18         tal:condition="python:replies or (userHasReplyPermission and isDiscussionAllowed) or (isAnon and not userHasReplyPermission and isDiscussionAllowed)">
19
20        <tal:getreplies repeat="reply_dict replies">
21            <div class="comment" style=""
22                tal:condition="python:isModerationAllowed or isPublished"
23                tal:define="indent python:reply_dict['depth']*2;
24                            reply python:reply_dict['object'];
25                            comment_id python:reply_dict['object'].id;
26                            isPublished python:reply.review_state=='published';"
27                tal:attributes="style string:margin-left:${indent}em;">
28
29                <h3 tal:attributes="id reply/id">
30                    <span tal:replace="reply/pretty_title_or_id">Comment title</span>
31                    <a class="anchor" tal:attributes="href string:#${reply/id};
32                    title reply/pretty_title_or_id">#</a>
33                </h3>
34                <div class="documentByLine"
35                     tal:define="creator reply/Creator;
36                                 anonymous_creator python:creator=='Anonymous User';
37                                 mi python:not anonymous_creator and view.member_info(creator);
38                                 fullname python: mi and mi['fullname'] or creator;
39                                 gavatar_src python:view.getGravatar(reply)" >
40                    <img alt="Avatar" class="avatar" height="40" width="40"
41                         src="http://default.gavatar.gif"
42                         tal:attributes="src gavatar_src">
43                    <span i18n:translate="label_comment_by">Posted by</span>
44                    <span tal:content="fullname"
45                          tal:condition="not:anonymous_creator">Poster Name</span>
46                    <span i18n:translate="label_anonymous_user"
47                          tal:condition="anonymous_creator">Anonymous User</span>
48                    <span i18n:translate="label_commented_at">at</span>
49                    <span tal:replace="python:view.format_time(reply.ModificationDate())">8/23/2001 12:40:44 PM</span>
50                    <span tal:condition="python:ifModerate and not isPublished">[pending]</span>
51                </div>
52                <div class="commentBody"
53                     tal:content="structure reply/CookedBody">
54                     This is the body text of the comment.
55                </div>
56                <form name="reply"
57                      action="discussion_reply_form"
58                      method="post"
59                      style="display: inline;"
60                      tal:attributes="action string:${reply/absolute_url}/discussion_reply_form"
61                      tal:condition="python:userHasReplyPermission and isPublished">
62                    <input class="standalone"
63                           type="submit"
64                           value="Reply"
65                           i18n:attributes="value label_reply;"
66                           />
67                </form>
68                <form name="edit"
69                      action="discussion_edit_form"
70                      method="post"
71                      style="display: inline;"
72                      tal:attributes="action string:${reply/absolute_url}/discussion_edit_form"
73                      tal:condition="isModerationAllowed">
74                    <input class="standalone"
75                           type="submit"
76                           value="Edit"
77                           i18n:attributes="value label_edit;"
78                           />
79                </form>
80                <form name="delete"
81                      action=""
82                      method="post"
83                      style="display: inline;"
84                      tal:condition="isModerationAllowed"
85                      tal:attributes="action string:${reply/absolute_url}/deleteDiscussion">
86                    <input class="destructive"
87                           type="submit"
88                           value="Remove"
89                           i18n:attributes="value label_remove;"
90                           />
91                </form>
92                <tal:if tal:condition="python:isReportAbuseEnabled and isPublished">
93                    <form class="report_abuse"
94                          name="report_abuse"
95                          method="post"
96                          style="display: inline;"
97                          i18n:domain="quintagroup.plonecomments"
98                          tal:attributes="action string:${reply/absolute_url}/report_abuse_form#discussion">
99                        <input type="hidden" name="comment_id" tal:attributes="value comment_id" />
100                        <input class="standalone"
101                            type="submit"
102                            value="Report Abuse"
103                            tal:define="onclick string:javascript:render_abuse_report_form(${comment_id})"
104                            tal:attributes="onclick python:not isAnon and isAjaxReportAbuseEnabled and onclick or '';
105                                            id string:input-render-abuse-cancel-${comment_id}"
106                            i18n:attributes="value label_report_abuse;"
107                            />
108                    </form>
109                    <span tal:attributes="id string:span-reply-form-holder-${comment_id}"
110                            tal:condition="isReportAbuseEnabled">
111                        <metal:macro use-macro="here/report_abuse_form/macros/form"/>
112                    </span>
113                    <span tal:attributes="id string:span-abuse-count-holder-${comment_id}"></span>
114                </tal:if>
115                <form name="publish_discussion"
116                      action=""
117                      method="post"
118                      style="display: inline;"
119                      tal:condition="not:isPublished"
120                      tal:attributes="action string:${reply/absolute_url}/discussion_publish_comment">
121
122                    <input class="standalone"
123                           type="submit"
124                           value="Publish"
125                           i18n:attributes="value"
126                           />
127                </form>
128                <br/>
129                <div class="documentByLine"
130                     i18n:translate="text_no_add_reply"
131                     i18n:domain="quintagroup.plonecomments"
132                     tal:condition="not:isPublished">Comment must be approved before replies to comment accepted.</div>
133            </div>
134        </tal:getreplies>
135
136        <!-- Start of Adding comment form-->
137        <tal:addcomment define="template_id string:discussion_reply_form;">
138            <metal:block metal:use-macro="here/discussion_reply_form/macros/add-comment-form" />
139        </tal:addcomment>
140        <!-- End of Adding comment form -->
141
142        <form tal:condition="python:isAnon and not userHasReplyPermission and isDiscussionAllowed"
143              tal:attributes="action view/login_action">
144            <input class="standalone"
145                   style="margin-bottom: 1.25em;"
146                   type="submit"
147                   value="Log in to add comments"
148                   i18n:attributes="value label_login_to_add_comments;"
149                   />
150        </form>
151
152    </div>
153</tal:block>
Note: See TracBrowser for help on using the repository browser.