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

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

Rewrited kss to jquery and added some features

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                   isAjaxReportAbuseEnabled view/ajax_report_abuse_enabled;
12                   isAnonymousReportAbuseEnabled view/anonymous_report_abuse_enabled;
13                   isReportAbuseEnabled python:isAnonymousReportAbuseEnabled or not isAnon and isAuthenticatedReportAbuseEnabled;
14                   props_sheet here/portal_properties/qPloneComments;
15                   require_email python:props_sheet.getProperty('require_email');"
16                   i18n:domain="plone">
17    <div class="discussion"
18         tal:condition="python:replies or (userHasReplyPermission and isDiscussionAllowed) or (isAnon and not userHasReplyPermission and isDiscussionAllowed)">
19
20        <tal:getreplies repeat="reply_dict replies">
21            <div class="comment" style=""
22                tal:condition="python:isModerationAllowed or isPublished"
23                tal:define="indent python:reply_dict['depth']*2;
24                            reply python:reply_dict['object'];
25                            comment_id python:reply_dict['object'].id;
26                            isPublished python:reply.review_state=='published';"
27                tal:attributes="style string:margin-left:${indent}em;">
28
29                <h3 tal:attributes="id reply/id">
30                    <span tal:replace="reply/pretty_title_or_id">Comment title</span>
31                    <a class="anchor" tal:attributes="href string:#${reply/id};
32                    title reply/pretty_title_or_id">#</a>
33                </h3>
34                <div class="documentByLine"
35                     tal:define="creator reply/Creator;
36                                 anonymous_creator python:creator=='Anonymous User';
37                                 mi python:not anonymous_creator and view.member_info(creator);
38                                 fullname python: mi and mi['fullname'] or creator;
39                                 gavatar_src python:view.getGravatar(reply)" >
40                    <img alt="Avatar" class="avatar" height="40" width="40"
41                         src="http://default.gavatar.gif"
42                         tal:attributes="src gavatar_src">
43                    <span i18n:translate="label_comment_by">Posted by</span>
44                    <span tal:content="fullname"
45                          tal:condition="not:anonymous_creator">Poster Name</span>
46                    <span i18n:translate="label_anonymous_user"
47                          tal:condition="anonymous_creator">Anonymous User</span>
48                    <span i18n:translate="label_commented_at">at</span>
49                    <span tal:replace="python:view.format_time(reply.ModificationDate())">8/23/2001 12:40:44 PM</span>
50                    <span i18n:domain="quintagroup.plonecomments"
51                          i18n:translate="label_pending_state"
52                          tal:condition="python:ifModerate and not isPublished">[pending]</span>
53                </div>
54                <div class="commentBody"
55                     tal:content="structure reply/CookedBody">
56                     This is the body text of the comment.
57                </div>
58                <form name="reply"
59                      action="discussion_reply_form"
60                      method="post"
61                      style="display: inline;"
62                      tal:attributes="action string:${reply/absolute_url}/discussion_reply_form"
63                      tal:condition="python:userHasReplyPermission and isPublished">
64                    <input class="standalone"
65                           type="submit"
66                           value="Reply"
67                           tal:define="onclick string:javascript:render_edit_form(${comment_id},'reply')"
68                           tal:attributes="onclick python:isAjaxReportAbuseEnabled and onclick or ''"
69                           i18n:attributes="value label_reply;"
70                           />
71                </form>
72                <form name="edit"
73                      action="discussion_edit_form"
74                      method="post"
75                      style="display: inline;"
76                      tal:attributes="action string:${reply/absolute_url}/discussion_edit_form"
77                      tal:condition="isModerationAllowed">
78                    <input class="standalone"
79                           type="submit"
80                           value="Edit"
81                           tal:define="onclick string:javascript:render_edit_form(${comment_id},'edit')"
82                           tal:attributes="onclick python:isAjaxReportAbuseEnabled and onclick or ''"
83                           i18n:attributes="value label_edit;"
84                           />
85                </form>
86                <form name="delete"
87                      action=""
88                      method="post"
89                      style="display: inline;"
90                      tal:condition="isModerationAllowed"
91                      tal:attributes="action string:${reply/absolute_url}/deleteDiscussion">
92                    <input class="destructive"
93                           type="submit"
94                           value="Remove"
95                           tal:define="onclick string:javascript:render_delete_comment(${comment_id})"
96                           tal:attributes="onclick python:isAjaxReportAbuseEnabled and onclick or ''"
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:isAjaxReportAbuseEnabled 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        <form id="reply"
139              name="reply"
140              action=""
141              method="post"
142              tal:condition="python:isAjaxReportAbuseEnabled and userHasReplyPermission and isDiscussionAllowed"
143              tal:attributes="action string:${context/absolute_url}/discussion_reply_form">
144
145              <input class="standalone"
146                     style="margin-bottom: 1.25em;"
147                     type="button"
148                     value="Add Comment"
149                     tal:attributes="onclick string:javascript:render_comment_form()"
150                     i18n:attributes="value label_add_comment;"
151                     />
152        </form>
153
154        <tal:addcomment condition="python:not isAjaxReportAbuseEnabled"
155                        define="template_id string:discussion_reply_form;">
156            <metal:block metal:use-macro="here/discussion_reply_form/macros/add-comment-form" />
157        </tal:addcomment>
158        <!-- End of Adding comment form -->
159
160        <form tal:condition="python:isAnon and not userHasReplyPermission and isDiscussionAllowed"
161              tal:attributes="action view/login_action">
162            <input class="standalone"
163                   style="margin-bottom: 1.25em;"
164                   type="submit"
165                   value="Log in to add comments"
166                   i18n:attributes="value label_login_to_add_comments;"
167                   />
168        </form>
169
170    </div>
171</tal:block>
Note: See TracBrowser for help on using the repository browser.