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

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

Rewrite anchor for comments

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