source: products/quintagroup.plonecomments/brunches/wald/quintagroup/plonecomments/browser/comments.pt @ 1378

Last change on this file since 1378 was 1378, checked in by wald, 14 years ago

Avatar image logic changed

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