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

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

Added visual effects level and some fixes

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