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

Last change on this file since 1222 was 1222, checked in by mylan, 15 years ago

Merged changes from qPloneComments/branches/plone3_extend: added comment editing, updated comments viewlet - now comment form present without needing to push on 'Add comment' button

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