source: products/quintagroup.plonecomments/trunk/quintagroup/plonecomments/skins/quintagroup_plonecomments/discussion_reply_form.cpt @ 1222

Last change on this file since 1222 was 1222, checked in by mylan, 15 years ago

Merged changes from qPloneComments/branches/plone3_extend: added comment editing, updated comments viewlet - now comment form present without needing to push on 'Add comment' button

File size: 9.7 KB
Line 
1<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
2      xmlns:tal="http://xml.zope.org/namespaces/tal"
3      xmlns:metal="http://xml.zope.org/namespaces/metal"
4      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
5      metal:use-macro="here/main_template/macros/master"
6      i18n:domain="plone">
7<body>
8
9<metal:block fill-slot="top_slot"
10             tal:define="dummy python:request.set('disable_border',1)" />
11
12<metal:block fill-slot="sub" />
13
14<div metal:fill-slot="main"
15     tal:define="errors options/state/getErrors;
16                 thread python:putils.getDiscussionThread(here);
17                 discussable python:thread[0];
18                 replies python:thread[1:];
19                 props_sheet here/portal_properties/qPloneComments;
20                 require_email python:props_sheet.getProperty('require_email')">
21
22    <tal:discussable define="template python:getattr(here, discussable.getLayout(), None);
23                             macros template/macros | nothing;
24                             main_macro macros/main | nothing;
25                             showDiscussable python:main_macro;">
26
27        <div class="comment"
28             tal:condition="showDiscussable"
29             tal:define="here python:discussable">
30            <div metal:use-macro="main_macro"/>
31        </div>
32    </tal:discussable>
33
34    <tal:thread tal:repeat="reply replies">
35        <tal:block tal:define="level repeat/reply/index">
36            <div class="comment"
37                 tal:attributes="style python:'margin-left:'+str((int(level)+1)*2)+'em'">
38               <h3>
39                   <tal:block replace="structure portal/discussionitem_icon.gif"/>
40                   <span tal:replace="reply/pretty_title_or_id">Comment title</span>
41               </h3>
42               <div class="documentByLine"
43                    tal:define="anonymous_creator python:reply.Creator()=='Anonymous User'">
44                   <span i18n:translate="label_comment_by">Posted by</span>
45                   <span tal:content="reply/Creator"
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:toLocalizedTime(reply.ModificationDate(),
51                                      long_format=1)">8/23/2001 12:40:44 PM</span>
52               </div>
53               <div class="commentBody"
54                    tal:content="structure reply/CookedBody">
55                    This is the body text of the comment.
56               </div>
57           </div>
58
59        </tal:block>
60    </tal:thread>
61
62    <a name="discussion"></a>
63
64    <metal:block metal:define-macro="add-comment-form">
65
66    <form name="edit_form"
67          class="enableAutoFocus"
68          method="post"
69          action="talkback"
70          tal:attributes="action string:$here_url/$template_id"
71          tal:define="isForAnonymous python:here.portal_properties.qPloneComments.getProperty('enable_anonymous_commenting', 0)">
72
73        <fieldset>
74
75            <legend i18n:translate="legend_add_comment">Add comment</legend>
76
77            <p i18n:translate="description_add_comment">
78                You can add a comment by filling out the form below. Plain text
79                formatting.
80            </p>
81
82            <input type="hidden" name="Creator" value=""
83                   tal:attributes="value member/getUserName"
84                   tal:condition="not:isForAnonymous"/>
85
86            <div tal:condition="isForAnonymous">
87
88                <input type="hidden"
89                       name="Creator"
90                       tal:condition="not:isAnon"
91                       tal:attributes="value member/getUserName" />
92
93                 <div class="field"
94                     tal:condition="isAnon"
95                     tal:define="error errors/Creator|nothing;"
96                     tal:attributes="class python:test(error, 'field error', 'field');">
97
98                    <label for="username" i18n:translate="label_name">Name</label>
99
100                    <span class="fieldRequired" title="Required"
101                          tal:condition="isAnon"
102                          i18n:attributes="title"
103                          i18n:translate="label_required">(Required)</span>
104
105                    <div class="formHelp" i18n:translate="help_name"
106                         i18n:domain="quintagroup.plonecomments">
107                        Tell us your name.
108                    </div>
109
110                    <div tal:content="error">Validation error output</div>
111
112                    <div>
113                        <input name="Creator"
114                               id="username"
115                               value="" alt="Submitter" title="Name"
116                               size="40"
117                               i18n:attributes="alt; title"
118                               tal:attributes="value request/Creator | nothing" />
119                    </div>
120
121                </div>
122
123                <div class="field"
124                     tal:define="error errors/email|nothing;"
125                     tal:attributes="class python:test(error, 'field error', 'field')"
126                     tal:condition="python:require_email and isAnon">
127
128                    <label for="email" i18n:translate="label_email">E-Mail</label>
129
130                    <span class="fieldRequired" title="Required"
131                          i18n:attributes="title title_required;"
132                          i18n:translate="label_required">(Required)
133                    </span>
134
135                    <div class="formHelp" i18n:translate="help_email"
136                         i18n:domain="quintagroup.plonecomments">
137                        Enter your e-mail address.
138                    </div>
139
140                    <div tal:content="error">Validation error output</div>
141
142                    <input name="email" value="" size="40" />
143
144                </div>
145
146            </div>
147
148            <div tal:condition="python:(not isForAnonymous) and isAnon">
149                <dl class="portalMessage warning">
150                    <dt i18n:translate="">
151                        Info
152                    </dt>
153                    <dd i18n:translate="legend_note_reply_anonymous">
154                        You are not logged in. You may optionally enter your
155                        username and password below. If you don't enter anything,
156                        this comment will be posted as 'Anonymous User'.
157                    </dd>
158                </dl>
159
160                <div class="field">
161
162                    <label for="username" i18n:translate="label_name">Name</label>
163
164                    <input name="username"
165                           id="username"
166                           value="" alt="Username" title="Name"
167                           size="40"
168                           i18n:attributes="title label_name; alt label_username;" />
169
170                </div>
171
172                <div class="field">
173
174                    <label for="password" i18n:translate="label_password">Password</label>
175
176                    <input type="password"
177                           id="password"
178                           name="password"
179                           value="" alt="Password" title="Password"
180                           size="40"
181                           i18n:attributes="title label_password; alt label_password;" />
182
183                </div>
184        </div>
185
186        <div class="field"
187        tal:define="error errors/subject|nothing;"
188        tal:attributes="class python:test(error, 'field error', 'field')">
189
190                <label for="subject" i18n:translate="label_subject">Subject</label>
191
192        <span class="fieldRequired" title="Required"
193              i18n:attributes="title title_required;"
194              i18n:translate="label_required">(Required)</span>
195
196            <div tal:content="error">Validation error output</div>
197
198                <input name="subject"
199                       id="subject"
200                       value=""
201                       size="40"
202                       tal:attributes="value request/subject|request/title_override|nothing;" />
203
204            </div>
205
206        <div class="field"
207        tal:define="error errors/body_text|nothing;"
208        tal:attributes="class python:test(error, 'field error', 'field')">
209
210          <label for="body_text" i18n:translate="label_comment">Comment</label>
211
212        <span class="fieldRequired" title="Required"
213              i18n:attributes="title title_required;"
214              i18n:translate="label_required">(Required)</span>
215
216            <div tal:content="error">Validation error output</div>
217
218                <textarea name="body_text"
219                          id="body_text"
220                          cols="40"
221                          rows="8"
222                          tal:content="request/body_text|request/text_override | nothing"
223                        ></textarea>
224
225            </div>
226
227             <div tal:condition="nocall:here/captcha_widget|nothing"
228                  tal:omit-tag="">
229                <div metal:use-macro="here/captcha_widget/macros/captcha" />
230             </div>
231
232            <div class="formControls">
233
234                <input type="hidden" name="form.submitted" value="1" />
235
236                <input type="hidden" name="require_email:boolean" value=""
237                       tal:attributes="value python:require_email and isAnon" />
238
239                <input class="context"
240                       type="submit"
241                       value="Save"
242                       name="form.button.Save"
243                       i18n:attributes="value label_save;"
244                       tal:attributes="name string:discussion_reply:method;" />
245
246            </div>
247
248        </fieldset>
249
250    </form>
251
252    </metal:block>
253
254</div>
255
256</body>
257</html>
Note: See TracBrowser for help on using the repository browser.