Commit 622ad2e3 authored by Ivan Tyagov's avatar Ivan Tyagov

Use portal_preferences API when possible.

Use property sheets. Clean up citing a post.
parent 32a990ef
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Sheet" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ForumPreference</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Sheet</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>mode</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/boolean</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Should we cite when replying parent post.</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>preferred_forum_quote_original_message_property</string> </value>
</item>
<item>
<key> <string>mode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>preference</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value> <string>python: False</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>mode</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/string</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Forum signature</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>preferred_forum_signature_property</string> </value>
</item>
<item>
<key> <string>mode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>preference</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value> <string>python: None</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -53,8 +53,7 @@
<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
preferred_forum_quote_original_message= portal.ERP5Site_getUserPreferredForumSettingsDict()[\'preferred_forum_quote_original_message\']\n
\n
if discussion_post_uid is not None:\n
# set title & text_content\n
......@@ -63,7 +62,7 @@ if discussion_post_uid is not None:\n
context.REQUEST.set(\'discussion_post_title\', title)\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
text_content = \'<blockquote style="background-color: #E9E9E9;border: 1px solid #8CACBB;margin: 5px;padding: 10px 15px;">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
......
......@@ -56,6 +56,7 @@
from Products.ERP5Type.Cache import CachingMethod\n
\n
portal = context.getPortalObject()\n
\n
def getPreferredForumSignature(username):\n
result = {\'preferred_forum_signature\': None,\n
\'preferred_forum_quote_original_message\': False}\n
......@@ -64,19 +65,27 @@ def getPreferredForumSignature(username):\n
owner = username,\n
preference_state=\'enabled\')\n
if preference is not None:\n
result[\'preferred_forum_signature\'] = preference.getProperty(\'preferred_forum_signature\', None)\n
result[\'preferred_forum_quote_original_message\'] = preference.getProperty(\'preferred_forum_quote_original_message\', True)\n
result[\'preferred_forum_signature\'] = preference.getPreferredForumSignature()\n
result[\'preferred_forum_quote_original_message\'] = preference.getPreferredForumQuoteOriginalMessage()\n
\n
return result\n
\n
\n
getPreferredForumSignature = CachingMethod(getPreferredForumSignature,\n
("ERP5Site_getUserPreferredForumSettingsDict", username),\n
cache_factory=\'erp5_ui_short\')\n
return getPreferredForumSignature(username)\n
if username is None:\n
# assume current logged in user\n
result = {\'preferred_forum_signature\': portal.portal_preferences.getPreferredForumSignature(),\n
\'preferred_forum_quote_original_message\': portal.portal_preferences.getPreferredForumQuoteOriginalMessage()}\n
else:\n
result = getPreferredForumSignature(username)\n
\n
return result\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>username</string> </value>
<value> <string>username=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......
109
\ No newline at end of file
110
\ No newline at end of file
DiscussionPost
\ No newline at end of file
DiscussionPost
ForumPreference
\ 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