Commit acca4efd authored by Ivan Tyagov's avatar Ivan Tyagov

Show author information from first post.

Allow that not index (yet ) discussion posts to be show under a discussion thread view using passed from request new unindex discussion post url.
parent e570810c
......@@ -50,7 +50,9 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
<value> <string encoding="cdata"><![CDATA[
"""\n
This script allows to create a new Discussion Post in context.\n
"""\n
from DateTime import DateTime\n
......@@ -76,21 +78,29 @@ discussion_post = discussion_thread.newContent(\n
language = portal.Localizer.get_selected_language(),\n
text_format = \'text/html\')\n
\n
# depending on security model Post can be submited for review\n
portal_status_message = context.Base_translateString("New post created in background.")\n
# depending on security model Post can be submitted for review\n
portal_status_message = context.Base_translateString("New post created.")\n
\n
# a parent thread is actually just a logical container so it\'s modified\n
# whenever a new post is done\n
discussion_thread.edit(modification_date = DateTime())\n
\n
# pass current post\'s relative url in request so next view\n
# is able to show it without waiting for indexation\n
post_relative_url = discussion_post.getRelativeUrl()\n
\n
if not is_temp_object:\n
return discussion_thread.Base_redirect(form_id,\n
keep_items = dict(portal_status_message=portal_status_message))\n
keep_items = dict(portal_status_message=portal_status_message,\n
post_relative_url = post_relative_url))\n
else:\n
# redirect using again reference\n
redirect_url = \'%s?portal_status_message=%s\' %(context.REQUEST[\'URL1\'],portal_status_message)\n
redirect_url = \'%s?portal_status_message=%s&post_relative_url=%s\' \\\n
%(context.REQUEST[\'URL1\'],portal_status_message,post_relative_url)\n
context.REQUEST.RESPONSE.redirect(redirect_url)\n
</string> </value>
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
This script gets list of Discussion Posts for a Discussion Thread \n
using catalog. \n
Due to asynchronous nature of catalog it can use\n
passed from REQUEST not index yet posts.\n
"""\n
post_relative_url = context.REQUEST.get(\'post_relative_url\')\n
discussion_post_list = [x.getObject() for x in context.searchFolder(**kw)]\n
\n
if post_relative_url is not None:\n
post = context.restrictedTraverse(post_relative_url)\n
if post is not None and post not in discussion_post_list:\n
discussion_post_list.append(post)\n
return discussion_post_list\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>DiscussionThread_getDiscussionPostList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -178,7 +178,7 @@
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>searchFolder</string> </value>
<value> <string>DiscussionThread_getDiscussionPostList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -36,7 +36,7 @@
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<tal:block tal:define="author_dict python: here.DiscussionPost_getAuthorDict();\n
<tal:block tal:define="author_dict python: here.objectValues()[0].DiscussionPost_getAuthorDict();\n
is_author_link_available python:author_dict[\'author_url\'] is not None;">\n
\n
<a class="listbox-row-discussion-thread-author-link"\n
......
124
\ No newline at end of file
125
\ 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