Commit 5d92285c authored by Ivan Tyagov's avatar Ivan Tyagov

Hide all unnecessary fields for adding a simple blog message as adding is done...

Hide all unnecessary fields for adding a simple blog message as adding is done usually by a site member not site manager and it was quite complex (by default blog message is submitted for approval side manager can correct errors if any).
Try to guess all possible values from parent Web Section and generate nice reference from title.
Do not manually set contributor list as this is done in a generic way by a workflow.
parent 46202cb4
......@@ -50,14 +50,26 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
<value> <string>"""\n
Create a blog message for current Web Section.\n
Try to guess as much as possible from current Web Section.\n
"""\n
\n
portal = context.getPortalObject()\n
portal_type = \'Web Page\'\n
module = portal.getDefaultModule(portal_type=portal_type)\n
\n
authenticated_member = context.ERP5Site_getAuthenticatedMemberPersonValue()\n
contributor_list=[]\n
if authenticated_member is not None:\n
contributor_list.append(authenticated_member.getRelativeUrl())\n
# set predicate settings for current Web Section\n
membership_criterion_category_list = context.getMembershipCriterionCategoryList()\n
\n
# generate nice reference from title\n
reference = context.Base_generateReferenceFromString(title)\n
existing_document = context.getDocumentValue(reference)\n
if existing_document is not None:\n
# if there are other document which reference duplicates just add some random part\n
# so we can distinguish)\n
reference = \'%s-%s\' %(context.Base_generateRandomString(), reference)\n
\n
article = module.newContent(portal_type=portal_type,\n
title=title,\n
version=version,\n
......@@ -70,16 +82,25 @@ article = module.newContent(portal_type=portal_type,\n
group_list=group_list,\n
function_list=function_list,\n
effective_date=effective_date,\n
classification=classification,\n
contributor_list=contributor_list,)\n
classification=classification)\n
article.setCategoryList(membership_criterion_category_list)\n
article.submit("Automatic Submit")\n
portal_status_message = context.Base_translateString("New Blog Message created.")\n
return article.Base_redirect(\'\', keep_items = dict(portal_status_message=portal_status_message ))\n
\n
portal_status_message = context.Base_translateString("New Blog Message created. It will be submitted for approval before it becomes visible.")\n
return context.Base_redirect(\'\', keep_items = dict(portal_status_message=portal_status_message ))\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>classification=None, effective_date=None, function_list=None, group_list=None, language=None, publication_section_list=None, reference=None, site_list=None, subject_list=None, text_content=None, title=None, version=None, **kw</string> </value>
<value> <string>classification=None, effective_date=None, function_list=None, group_list=None, language=\'en\', publication_section_list=None, reference=None, site_list=None, subject_list=None, text_content=None, title=None, version=\'001\', **kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Assignor</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -11,6 +11,7 @@
<value>
<list>
<string>default</string>
<string>enabled</string>
<string>items</string>
</list>
</value>
......@@ -86,6 +87,10 @@
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_classification</string> </value>
......
......@@ -11,6 +11,7 @@
<value>
<list>
<string>default_now</string>
<string>enabled</string>
<string>required</string>
</list>
</value>
......@@ -76,6 +77,10 @@
<key> <string>default_now</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_effective_date</string> </value>
......
......@@ -10,6 +10,7 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>enabled</string>
<string>items</string>
</list>
</value>
......@@ -77,6 +78,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_function_list</string> </value>
......
......@@ -10,6 +10,7 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>enabled</string>
<string>items</string>
</list>
</value>
......@@ -77,6 +78,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_group_list</string> </value>
......
......@@ -9,7 +9,9 @@
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
<list>
<string>enabled</string>
</list>
</value>
</item>
<item>
......@@ -70,8 +72,8 @@
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>language of the web page</string> </value>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
......@@ -85,10 +87,6 @@
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Language</string> </value>
</item>
</dictionary>
</value>
</item>
......
......@@ -11,6 +11,7 @@
<value>
<list>
<string>default</string>
<string>enabled</string>
<string>items</string>
</list>
</value>
......@@ -90,6 +91,10 @@
<list/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_publication_section_list</string> </value>
......
......@@ -10,6 +10,7 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>enabled</string>
<string>required</string>
</list>
</value>
......@@ -71,6 +72,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_reference</string> </value>
......
......@@ -10,6 +10,7 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>enabled</string>
<string>items</string>
</list>
</value>
......@@ -77,6 +78,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_site_list</string> </value>
......
......@@ -11,6 +11,7 @@
<value>
<list>
<string>default</string>
<string>enabled</string>
</list>
</value>
</item>
......@@ -75,6 +76,10 @@
<key> <string>default</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_version</string> </value>
......
88
\ No newline at end of file
89
\ 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