plone.app.discussion/plone/app/discussion/browser/comments.old.pt
Timo Stollenwerk 424d1c79ed z3c.form form added to commentsviewlet (not fully functional yet).
svn path=/plone.app.discussion/trunk/; revision=28300
2009-08-01 21:47:50 +00:00

338 lines
14 KiB
XML

<tal:block define="userHasReplyPermission view/can_reply;
isDiscussionAllowed view/is_discussion_allowed;
isAnonymousDiscussionAllowed view/anonymous_discussion_allowed;
isAnon view/is_anonymous;
canManage view/can_manage;
replies python:view.get_replies(canManage);
showCommenterImage view/show_commenter_image;
errors options/state/getErrors|nothing;
wtool context/@@plone_tools/workflow"
tal:condition="isDiscussionAllowed"
i18n:domain="plone">
<div class="reply"
tal:condition="python:isAnon and not isAnonymousDiscussionAllowed">
<form tal:attributes="action view/login_action">
<input class="standalone"
style="margin-bottom: 1.25em;"
type="submit"
value="Log in to add comments"
i18n:attributes="value label_login_to_add_comments;"
/>
</form>
</div>
<div class="discussion"
tal:condition="python:replies or (userHasReplyPermission and isDiscussionAllowed) or (isAnon and not userHasReplyPermission and isDiscussionAllowed)">
<tal:getreplies repeat="reply_dict replies">
<div class="comment"
tal:define="reply reply_dict/comment;
depth reply_dict/depth|python:0;
creator reply/Creator;
author_home_url python:view.get_commenter_home_url(username=reply.author_username);
portrait_url python:view.get_commenter_portrait(reply.author_username);
anonymous_creator python:creator in ('Anonymous User', '');
published python:wtool.getInfoFor(reply, 'review_state') == 'published';"
tal:attributes="class python:'comment replyTreeLevel'+str(depth);
style string:margin-left: ${depth}em;
id string:${reply/id}"
tal:condition="python:canManage or published">
<div class="commentImage" tal:condition="showCommenterImage">
<a href="" tal:condition="not:isAnon"
tal:attributes="href author_home_url">
<img src="defaultUser.gif"
alt=""
border="0"
width="75"
tal:attributes="src portrait_url;
alt reply/creator" />
</a>
<img src="defaultUser.gif"
alt=""
border="0"
width="75"
tal:condition="isAnon"
tal:attributes="src portrait_url;
alt reply/creator" />
</div>
<h3>
<a name="comments" tal:attributes="name reply/title">
<span tal:replace="reply/title">Comment title</span>
</a>
</h3>
<div class="documentByLine">
<tal:posted i18n:translate="label_comment_by">Posted by</tal:posted>
<tal:name>
<a href=""
tal:condition="not:isAnon"
tal:content="creator"
tal:attributes="href author_home_url">
Poster Name
</a>
<span tal:condition="isAnon"
tal:replace="creator" />
</tal:name>
<tal:name i18n:translate="label_anonymous_user"
condition="anonymous_creator">Anonymous User</tal:name>
<tal:at i18n:translate="label_commented_at">at</tal:at>
<span tal:replace="python:view.format_time(reply.modification_date)">8/23/2001 12:40:44 PM</span>
</div>
<div class="commentBody"
tal:content="structure reply/text">
This is the body text of the comment.
</div>
<button style="display: inline;"
class="context reply-to-comment-button allowMultiSubmit"
tal:condition="python:userHasReplyPermission and isDiscussionAllowed or isAnonymousDiscussionAllowed"
i18n:translate="label_reply;">
Reply
</button>
<form name="delete"
action=""
method="post"
style="display: inline;"
tal:condition="view/can_manage"
tal:attributes="action string:${reply/absolute_url}/@@moderate-delete-comment">
<input name="form.button.DeleteComment"
class="destructive"
type="submit"
value="Remove"
i18n:attributes="value label_remove;"
/>
</form>
<!-- Workflow actions (e.g. 'publish') -->
<form name=""
action=""
method="get"
style="display: inline;"
tal:repeat="action reply_dict/actions|nothing"
tal:attributes="action string:${reply/absolute_url}/@@moderate-publish-comment;
name action/id">
<input type="hidden" name="workflow_action" tal:attributes="value action/id" />
<input name="form.button.PublishComment"
class="context"
type="submit"
tal:attributes="value action/title"
/>
</form>
</div>
</tal:getreplies>
</div>
<div class="reply"
tal:condition="python: isAnon and not isAnonymousDiscussionAllowed and replies">
<form tal:attributes="action view/login_action">
<input class="standalone"
style="margin-bottom: 1.25em;"
type="submit"
value="Log in to add comments"
i18n:attributes="value label_login_to_add_comments;"
/>
</form>
</div>
<div id="commenting" class="reply"
tal:condition="not:isAnon">
<fieldset>
<legend i18n:translate="legend_add_comment">Add comment</legend>
<p i18n:translate="description_add_comment">
You can add a comment by filling out the form below. Plain text
formatting.
</p>
<form name="reply"
action=""
method="get"
tal:attributes="action string:${context/absolute_url}/++conversation++default/@@add-comment">
<div class="field"
tal:define="error errors/subject|nothing;"
tal:attributes="class python: error and 'field error' or 'field'">
<label for="subject" i18n:translate="label_subject">Subject</label>
<span class="fieldRequired" title="Required"
i18n:attributes="title title_required;"
i18n:translate="label_required">(Required)</span>
<div tal:content="error">Validation error output</div>
<input name="subject"
id="subject"
value=""
size="40"
tal:attributes="value request/subject|request/title_override|nothing;" />
</div>
<div class="field"
tal:define="error errors/body_text|nothing;"
tal:attributes="class python: error and 'field error' or 'field'">
<label for="body_text" i18n:translate="label_comment">Comment</label>
<span class="fieldRequired" title="Required"
i18n:attributes="title title_required;"
i18n:translate="label_required">(Required)</span>
<div tal:content="error">Validation error output</div>
<textarea name="body_text"
id="body_text"
cols="40"
rows="8"
tal:content="request/body_text|request/text_override | nothing"></textarea>
</div>
<div class="formControls">
<input class="context"
type="submit"
value="Add Comment"
name="form.button.AddComment"
i18n:attributes="value label_add_comment;" />
<input class="standalone cancelreplytocomment"
type="submit"
name="form.button.Cancel"
value="Cancel"
i18n:attributes="value label_cancel;" />
</div>
<input type="hidden" name="form.submitted" value="1" />
</form>
</fieldset>
</div>
<div id="commenting" class="reply"
tal:condition="python:isAnon and isAnonymousDiscussionAllowed">
<fieldset>
<legend i18n:translate="legend_add_comment">Add comment</legend>
<p i18n:translate="description_add_comment">
You can add a comment by filling out the form below. Plain text
formatting.
</p>
<form name="reply"
action=""
method="get"
tal:attributes="action string:${context/absolute_url}/++conversation++default/@@add-comment">
<div class="field"
tal:define="error errors/subject|nothing;"
tal:attributes="class python: error and 'field error' or 'field'">
<label for="author_username" i18n:translate="label_author_username">Author username</label>
<span class="fieldRequired" title="Required"
i18n:attributes="title title_required;"
i18n:translate="label_required">(Required)</span>
<div tal:content="error">Validation error output</div>
<input name="author_username"
id="author_username"
value=""
size="40"
tal:attributes="value request/subject|request/title_override|nothing;" />
</div>
<div class="field"
tal:define="error errors/subject|nothing;"
tal:attributes="class python: error and 'field error' or 'field'">
<label for="author_email" i18n:translate="label_author_email">Author email</label>
<span class="fieldRequired" title="Required"
i18n:attributes="title title_required;"
i18n:translate="label_required">(Required)</span>
<div tal:content="error">Validation error output</div>
<input name="author_email"
id="author_email"
value=""
size="40"
tal:attributes="value request/subject|request/title_override|nothing;" />
</div>
<div class="field"
tal:define="error errors/subject|nothing;"
tal:attributes="class python: error and 'field error' or 'field'">
<label for="subject" i18n:translate="label_subject">Subject</label>
<span class="fieldRequired" title="Required"
i18n:attributes="title title_required;"
i18n:translate="label_required">(Required)</span>
<div tal:content="error">Validation error output</div>
<input name="subject"
id="subject"
value=""
size="40"
tal:attributes="value request/subject|request/title_override|nothing;" />
</div>
<div class="field"
tal:define="error errors/body_text|nothing;"
tal:attributes="class python: error and 'field error' or 'field'">
<label for="body_text" i18n:translate="label_comment">Comment</label>
<span class="fieldRequired" title="Required"
i18n:attributes="title title_required;"
i18n:translate="label_required">(Required)</span>
<div tal:content="error">Validation error output</div>
<textarea name="body_text"
id="body_text"
cols="40"
rows="8"
tal:content="request/body_text|request/text_override | nothing"></textarea>
</div>
<div class="formControls">
<input class="context"
type="submit"
value="Add Comment"
name="form.button.AddComment"
i18n:attributes="value label_add_comment;" />
<input class="standalone cancelreplytocomment"
type="submit"
name="form.button.Cancel"
value="Cancel"
i18n:attributes="value label_cancel;" />
</div>
<input type="hidden" name="form.submitted" value="1" />
</form>
</fieldset>
</div>
</tal:block>