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

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

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

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