Commit 381aa4f3 authored by Ivan Tyagov's avatar Ivan Tyagov

Use Web Section's getDocumentValueList API thus turn any Web Section into a...

Use Web Section's getDocumentValueList API thus turn any Web Section into a logical Forum (i.e. matter of configuring predicates on it).
parent be1fbd35
......@@ -26,9 +26,7 @@
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -80,17 +78,4 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python:object is not None and not object.isWebMode()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
<value> <float>0.9</float> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -88,7 +88,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python:object is not None and object.isWebMode()</string> </value>
<value> <string>python:object is not None and object.isWebMode() and not object.isEditableMode()</string> </value>
</item>
</dictionary>
</pickle>
......
<?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>from Products.ERP5Type.Document import newTempBase\n
portal = context.getPortalObject()\n
\n
path_list = []\n
filtered_results = []\n
results = context.portal_catalog(**kw)\n
\n
# we care for parent Discussion Threads only\n
for brain in results:\n
path = brain.getPath()\n
path = \'/\'.join(path.split(\'/\')[:-1])\n
if path not in path_list:\n
path_list.append(path)\n
brain_object = brain.getObject()\n
parent_thread = brain_object.getParentValue()\n
temp_kw = dict(title = parent_thread.getTitle(),\n
reference = parent_thread.getReference(),\n
author = parent_thread.DiscussionThread_viewAuthorWidget(),\n
modification_date = brain_object.getModificationDate(),\n
last_post = parent_thread.DiscussionThread_viewLastPostWidget())\n
temp_object = newTempBase(portal, \n
parent_thread.getTitle(), **temp_kw)\n
#filtered_results.append(temp_object)\n
filtered_results.append(brain)\n
\n
\n
return filtered_results\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getDiscussionPostList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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
Used in listbox to generate proper root link\n
"""\n
return brain.getParentValue().absolute_url()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>brain, selection,selection_name</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ListBox_getDiscussionThreadUrl</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -67,18 +67,27 @@ if group_list in MARKER:\n
group_list = user_assignment_dict[\'group_list\']\n
if site_list in MARKER:\n
site_list = user_assignment_dict[\'site_list\']\n
\n
# set predicate settings for current Web Section\n
membership_criterion_category_list = context.getMembershipCriterionCategoryList()\n
multimembership_criterion_base_category_list = context.getMultimembershipCriterionBaseCategoryList()\n
reference = title.replace(\' \', \'-\')\n
create_kw = dict(title = title,\n
source_value = person,\n
reference = reference,\n
version = version,\n
language = language,\n
description=description,\n
subject_list=subject_list,\n
classification=classification,\n
group_list=group_list,\n
site_list=site_list)\n
for base_category in multimembership_criterion_base_category_list:\n
create_kw[\'%s_list\' %base_category] = [x for x in membership_criterion_category_list if x.startswith(base_category)]\n
\n
discussion_thread = portal.discussion_thread_module.newContent(\n
portal_type = "Discussion Thread",\n
title = title,\n
source_value = person,\n
version = version,\n
language = language,\n
description=description,\n
subject_list=subject_list,\n
classification=classification,\n
group_list=group_list,\n
site_list=site_list,\n
reference=reference)\n
**create_kw)\n
discussion_post = discussion_thread.newContent(\n
portal_type = "Discussion Post",\n
title = title,\n
......@@ -131,7 +140,7 @@ return discussion_thread.Base_redirect(form_id,\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>DiscussionThreadModule_createNewDiscussionThread</string> </value>
<value> <string>WebSection_createNewDiscussionThread</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -35,7 +35,7 @@
</item>
<item>
<key> <string>action</string> </key>
<value> <string>DiscussionThreadModule_createNewDiscussionThread</string> </value>
<value> <string>WebSection_createNewDiscussionThread</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -110,7 +110,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>DiscussionThreadModule_viewCreateNewDiscussionThreadDialog</string> </value>
<value> <string>WebSection_viewCreateNewDiscussionThreadDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......
......@@ -116,7 +116,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_viewDiscussionThreadForm</string> </value>
<value> <string>WebSection_viewDiscussionThreadForm</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......
......@@ -15,10 +15,8 @@
<string>default_params</string>
<string>editable_columns</string>
<string>list_method</string>
<string>portal_types</string>
<string>search</string>
<string>search_columns</string>
<string>selection_name</string>
<string>sort</string>
<string>sort_columns</string>
<string>title</string>
......@@ -92,10 +90,6 @@
<key> <string>list_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>portal_types</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search</string> </key>
<value> <string></string> </value>
......@@ -104,12 +98,6 @@
<key> <string>search_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>selection_name</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>sort</string> </key>
<value> <string></string> </value>
......@@ -204,18 +192,7 @@
<item>
<key> <string>list_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>portal_types</string> </key>
<value>
<list>
<tuple>
<string>Discussion Post</string>
<string>Discussion Post</string>
</tuple>
</list>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
......@@ -233,10 +210,6 @@
</list>
</value>
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>search_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
<value>
......@@ -287,10 +260,6 @@
<string>last_post</string>
<string></string>
</tuple>
<tuple>
<string>title</string>
<string>ListBox_getDiscussionThreadUrl</string>
</tuple>
</list>
</value>
</item>
......@@ -301,22 +270,6 @@
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: \'1_%s_%s_selection\' % (form.getId(), field.getId())</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Method" module="Products.Formulator.MethodField"/>
</pickle>
......@@ -324,7 +277,7 @@
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>ERP5Site_getDiscussionPostList</string> </value>
<value> <string>getDocumentValueList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -128,16 +128,13 @@
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: cell.getParentValue().DiscussionThread_viewAuthorWidget()</string> </value>
<value> <string>python: cell.DiscussionThread_viewAuthorWidget()</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -128,16 +128,13 @@
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: cell.getParentValue().DiscussionThread_viewLastPostWidget()</string> </value>
<value> <string>python: cell.DiscussionThread_viewLastPostWidget()</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -128,16 +128,13 @@
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: \'%s\' %len(cell.getParentValue().objectIds())</string> </value>
<value> <string>python: \'%s\' %len(cell.objectIds())</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -128,16 +128,13 @@
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: cell.getParentValue().getTitle()</string> </value>
<value> <string>python: cell.getTitle()</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -136,7 +136,7 @@
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
python: \'<a class="bt-small" style="width:100px;" href="%s/discussion_thread_module/DiscussionThreadModule_viewCreateNewDiscussionThreadDialog?cancel_url=%s"><span><img src="km_img/icon-add.png" alt="+"/>Post message</span></a>\' %(here.getWebSiteValue().absolute_url(), here.absolute_url())
python: \'<a class="bt-small" style="width:100px;" href="WebSection_viewCreateNewDiscussionThreadDialog?cancel_url=%s"><span><img src="km_img/icon-add.png" alt="+"/>Post message</span></a>\' %(here.absolute_url())
]]></string> </value>
</item>
......
94
\ No newline at end of file
95
\ 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