Commit cc185d8d authored by Ivan Tyagov's avatar Ivan Tyagov

Show only one button under a post.

Control quote policy with an user preference.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36273 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c9cf1da7
......@@ -65,7 +65,7 @@ result = {\'author_url\': \'#\',\n
\n
if author is not None:\n
result[\'author_url\'] = \'%s/view\' %author.getAbsoluteUrl()\n
result[\'author_signature\'] = portal.ERP5Site_getUserPreferredForumSignature(author.getReference())\n
result[\'author_signature\'] = portal.ERP5Site_getUserPreferredForumSettingsDict(author.getReference())[\'preferred_forum_signature\']\n
result[\'author_title\'] = author.getTitle()\n
\n
return result\n
......@@ -116,6 +116,7 @@ return result\n
<string>None</string>
<string>result</string>
<string>_write_</string>
<string>_getitem_</string>
</tuple>
</value>
</item>
......
......@@ -72,7 +72,7 @@ discussion_post = context.newContent(\n
language = language)\n
\n
# depending on security model Post can be submited for review\n
portal_status_message = "New post created."\n
portal_status_message = "New post created in background."\n
discussion_post.release()\n
\n
return context.Base_redirect(form_id,\n
......
......@@ -55,15 +55,20 @@
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
portal = context.getPortalObject()\n
user = str(portal.portal_membership.getAuthenticatedMember())\n
preferred_forum_quote_original_message= portal.ERP5Site_getUserPreferredForumSettingsDict(user)[\'preferred_forum_quote_original_message\']\n
\n
if discussion_post_uid is not None:\n
# set title & text_content\n
discussion_post = getattr(context, discussion_post_uid)\n
author_dict = discussion_post.DiscussionPost_getAuthorDict()\n
title = \'Re: %s\' %discussion_post.getTitle()\n
text_content = \'<blockquote>From: %s<br/>%s</blockquote>\' %(author_dict[\'author_title\'],\n
discussion_post.getTextContent())\n
context.REQUEST.set(\'discussion_post_title\', title)\n
context.REQUEST.set(\'discussion_post_text_content\', text_content)\n
if preferred_forum_quote_original_message:\n
author_dict = discussion_post.DiscussionPost_getAuthorDict()\n
text_content = \'<blockquote>From: %s<br/>%s</blockquote>\' %(author_dict[\'author_title\'],\n
discussion_post.getTextContent())\n
context.REQUEST.set(\'discussion_post_text_content\', text_content)\n
\n
return context.DiscussionThread_viewCreateNewDiscussionPostDialog()\n
......@@ -105,14 +110,18 @@ return context.DiscussionThread_viewCreateNewDiscussionPostDialog()\n
<value>
<tuple>
<string>discussion_post_uid</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>str</string>
<string>user</string>
<string>_getitem_</string>
<string>preferred_forum_quote_original_message</string>
<string>None</string>
<string>getattr</string>
<string>context</string>
<string>discussion_post</string>
<string>_getattr_</string>
<string>author_dict</string>
<string>title</string>
<string>_getitem_</string>
<string>author_dict</string>
<string>text_content</string>
</tuple>
</value>
......
......@@ -65,10 +65,12 @@ def getPreferredForumSignature(username):\n
owner = username,\n
preference_state=\'enabled\')\n
if preference is not None:\n
return preference.getProperty(\'preferred_forum_signature\', None)\n
return {\'preferred_forum_signature\': preference.getProperty(\'preferred_forum_signature\', None),\n
\'preferred_forum_quote_original_message\': preference.getProperty(\'preferred_forum_quote_original_message\', None),\n
}\n
\n
getPreferredForumSignature = CachingMethod(getPreferredForumSignature,\n
("ERP5Site_getUserPreferredForumSignature", username),\n
("ERP5Site_getUserPreferredForumSettingsDict", username),\n
cache_factory=\'erp5_ui_short\')\n
return getPreferredForumSignature(username)\n
</string> </value>
......@@ -138,7 +140,7 @@ return getPreferredForumSignature(username)\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getUserPreferredForumSignature</string> </value>
<value> <string>ERP5Site_getUserPreferredForumSettingsDict</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
......
......@@ -149,22 +149,16 @@
tal:content="author_signature"/>\n
<hr/>\n
</tal:block>\n
<button tal:condition="isUserAllowedToPost" \n
type="submit" \n
title="Reply" \n
name="DiscussionThread_viewCreateNewDiscussionPostDialog:method"\n
class="discussion-post-action-button"\n
tal:attributes="onClick python: \'redirectCreateCitedNewDiscussionPost(\\\'%s\\\')\' %event_id">\n
Cited Reply\n
</button>\n
\n
<button tal:condition="isUserAllowedToPost" \n
type="submit" \n
title="Reply" \n
name="DiscussionThread_redirectCreateNewDiscussionPost:method"\n
tal:attributes="onClick python: \'redirectCreateCitedNewDiscussionPost(\\\'%s\\\')\' %event_id"\n
class="discussion-post-action-button">\n
New Reply\n
Reply\n
</button>\n
\n
<!-- \n
<tal:block tal:condition="python:real_context.portal_membership.checkPermission(\'Delete objects\', event_object)">\n
<button type="submit" \n
title="Delete" \n
......@@ -174,6 +168,7 @@
Delete\n
</button>\n
</tal:block>\n
-->\n
</div>\n
</tal:block>\n
<div class="discussion-post-listbox-navigation">\n
......
......@@ -77,6 +77,7 @@
<value>
<list>
<string>my_preferred_forum_signature</string>
<string>my_preferred_forum_quote_original_message</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_preferred_forum_quote_original_message</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Quote original message when replying</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
60
\ No newline at end of file
61
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment