source: products/quintagroup.plonecomments/branches/jquery/quintagroup/plonecomments/browser/comments.pt @ 2598

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

Fixed problem with anonymous commenter and added display commenter email for moderator

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