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

Last change on this file since 3106 was 3106, checked in by kroman0, 13 years ago

Merged changes from trunk and last fixes in templates

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