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

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

Fixed anchor for comments

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