Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Frederic Thoma
erp5
Commits
1cb54350
Commit
1cb54350
authored
Dec 14, 2015
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_discussion: add predecessor handling to enable showing discussion related to document
parent
1e205572
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
207 additions
and
16 deletions
+207
-16
bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/WebSection_createNewDiscussionThread.xml
.../erp5_discussion/WebSection_createNewDiscussionThread.xml
+37
-16
bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/WebSection_viewCreateNewDiscussionThreadDialog.xml
...ussion/WebSection_viewCreateNewDiscussionThreadDialog.xml
+1
-0
bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/WebSection_viewCreateNewDiscussionThreadDialog/your_predecessor.xml
..._viewCreateNewDiscussionThreadDialog/your_predecessor.xml
+169
-0
No files found.
bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/WebSection_createNewDiscussionThread.xml
View file @
1cb54350
...
@@ -62,6 +62,7 @@ person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
...
@@ -62,6 +62,7 @@ person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
\n
\n
version = \'001\'\n
version = \'001\'\n
language = portal.Localizer.get_selected_language()\n
language = portal.Localizer.get_selected_language()\n
has_website = context.getWebSiteValue()\n
\n
\n
try:\n
try:\n
user_assignment_dict = portal.ERP5Site_getPersonAssignmentDict()\n
user_assignment_dict = portal.ERP5Site_getPersonAssignmentDict()\n
...
@@ -75,21 +76,23 @@ if site_list in MARKER:\n
...
@@ -75,21 +76,23 @@ if site_list in MARKER:\n
site_list = user_assignment_dict[\'site_list\']\n
site_list = user_assignment_dict[\'site_list\']\n
\n
\n
# set predicate settings for current Web Section\n
# set predicate settings for current Web Section\n
membership_criterion_category_list = context.getMembershipCriterionCategoryList()\n
if has_website is not None:\n
multimembership_criterion_base_category_list = context.getMultimembershipCriterionBaseCategoryList()\n
membership_criterion_category_list = context.getMembershipCriterionCategoryList()\n
multimembership_criterion_base_category_list = context.getMultimembershipCriterionBaseCategoryList()\n
\n
\n
reference = context.Base_generateReferenceFromString(title)\n
reference = context.Base_generateReferenceFromString(title)\n
\n
\n
existing_document = context.getDocumentValue(reference)\n
if has_website is not None:\n
existing_web_section_list = portal.portal_catalog(id=reference, portal_type=[\'Web Site\', \'Web Section\'])\n
existing_document = context.getDocumentValue(reference)\n
existing_module_list = portal.portal_catalog(id=reference, parent_uid=portal.getUid())\n
existing_web_section_list = portal.portal_catalog(id=reference, portal_type=[\'Web Site\', \'Web Section\'])\n
if existing_document is not None \\\n
existing_module_list = portal.portal_catalog(id=reference, parent_uid=portal.getUid())\n
or len(existing_web_section_list) \\\n
if existing_document is not None \\\n
or len(existing_module_list):\n
or len(existing_web_section_list) \\\n
# if there are other document or any tarversal objects (module, web section)\n
or len(existing_module_list):\n
# which ID or reference duplicates just add some random part\n
# if there are other document or any tarversal objects (module, web section)\n
# so we can distinguish)\n
# which ID or reference duplicates just add some random part\n
reference = \'%s-%s\' %(context.Base_generateRandomString(), reference)\n
# so we can distinguish)\n
reference = \'%s-%s\' %(context.Base_generateRandomString(), reference)\n
\n
\n
category_list = []\n
category_list = []\n
create_kw = dict(title = title,\n
create_kw = dict(title = title,\n
...
@@ -103,9 +106,10 @@ create_kw = dict(title = title,\n
...
@@ -103,9 +106,10 @@ create_kw = dict(title = title,\n
group_list=group_list,\n
group_list=group_list,\n
site_list=site_list)\n
site_list=site_list)\n
\n
\n
for base_category in multimembership_criterion_base_category_list:\n
if has_website is not None:\n
#create_kw[\'%s_list\' %base_category] = [x for x in membership_criterion_category_list if x.startswith(base_category)]\n
for base_category in multimembership_criterion_base_category_list:\n
category_list.extend([x for x in membership_criterion_category_list if x.startswith(base_category)])\n
#create_kw[\'%s_list\' %base_category] = [x for x in membership_criterion_category_list if x.startswith(base_category)]\n
category_list.extend([x for x in membership_criterion_category_list if x.startswith(base_category)])\n
\n
\n
discussion_thread = portal.discussion_thread_module.newContent(\n
discussion_thread = portal.discussion_thread_module.newContent(\n
portal_type = "Discussion Thread",\n
portal_type = "Discussion Thread",\n
...
@@ -115,6 +119,23 @@ discussion_thread = portal.discussion_thread_module.newContent(\n
...
@@ -115,6 +119,23 @@ discussion_thread = portal.discussion_thread_module.newContent(\n
# of web section (through getDocumentValue API)\n
# of web section (through getDocumentValue API)\n
discussion_thread.setCategoryList(category_list)\n
discussion_thread.setCategoryList(category_list)\n
\n
\n
# predecessor\n
if predecessor is not None:\n
predecessor_object = context.restrictedTraverse(predecessor)\n
predecessor_portal_type = predecessor_object.getPortalType()\n
predecessor_absolute_url = predecessor_object.getAbsoluteUrl()\n
\n
# predecessor will only be set on document = web section default page\n
if predecessor_portal_type == \'Web Section\':\n
predecessor_default_page = predecessor_object.getAggregate()\n
if predecessor_default_page is not None:\n
predecessor_document = context.restrictedTraverse(predecessor_default_page)\n
discussion_thread.setPredecessorValueList([predecessor_document])\n
\n
# set predecessor on document\n
if predecessor_portal_type == \'Web Page\':\n
discussion_thread.setPredecessorValueList([predecessor_object])\n
\n
discussion_post = discussion_thread.newContent(\n
discussion_post = discussion_thread.newContent(\n
portal_type = "Discussion Post",\n
portal_type = "Discussion Post",\n
title = title,\n
title = title,\n
...
@@ -177,7 +198,7 @@ if send_notification_text not in (\'\', None):\n
...
@@ -177,7 +198,7 @@ if send_notification_text not in (\'\', None):\n
message_text_format=notification_message.getContentType(),\n
message_text_format=notification_message.getContentType(),\n
store_as_event=False)\n
store_as_event=False)\n
\n
\n
return context.Base_redirect(redirect_url=
context.absolute_u
rl(),\n
return context.Base_redirect(redirect_url=
predecessor_absolute_url or context.getAbsoluteU
rl(),\n
keep_items = dict(portal_status_message=context.Base_translateString(portal_status_message),\n
keep_items = dict(portal_status_message=context.Base_translateString(portal_status_message),\n
thread_relative_url=discussion_thread.getRelativeUrl()))\n
thread_relative_url=discussion_thread.getRelativeUrl()))\n
</string>
</value>
</string>
</value>
...
...
bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/WebSection_viewCreateNewDiscussionThreadDialog.xml
View file @
1cb54350
...
@@ -98,6 +98,7 @@
...
@@ -98,6 +98,7 @@
<string>
your_text_content
</string>
<string>
your_text_content
</string>
<string>
your_file
</string>
<string>
your_file
</string>
<string>
your_captcha
</string>
<string>
your_captcha
</string>
<string>
your_predecessor
</string>
<string>
your_warning
</string>
<string>
your_warning
</string>
</list>
</list>
</value>
</value>
...
...
bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/WebSection_viewCreateNewDiscussionThreadDialog/your_predecessor.xml
0 → 100644
View file @
1cb54350
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
css_class
</string>
<string>
default
</string>
<string>
description
</string>
<string>
display_width
</string>
<string>
enabled
</string>
<string>
input_type
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_predecessor
</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>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<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>
input_type
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string>
hidden_label
</string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
The url of the predecessor document
</string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<int>
40
</int>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_title
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
input_type
</string>
</key>
<value>
<string>
hidden
</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>
Predecessor
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: here.REQUEST.get(\'predecessor_url\', None)
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment