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 @@ ...@@ -50,14 +50,26 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <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 portal_type = \'Web Page\'\n
module = portal.getDefaultModule(portal_type=portal_type)\n module = portal.getDefaultModule(portal_type=portal_type)\n
\n \n
authenticated_member = context.ERP5Site_getAuthenticatedMemberPersonValue()\n # set predicate settings for current Web Section\n
contributor_list=[]\n membership_criterion_category_list = context.getMembershipCriterionCategoryList()\n
if authenticated_member is not None:\n \n
contributor_list.append(authenticated_member.getRelativeUrl())\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 article = module.newContent(portal_type=portal_type,\n
title=title,\n title=title,\n
version=version,\n version=version,\n
...@@ -70,16 +82,25 @@ article = module.newContent(portal_type=portal_type,\n ...@@ -70,16 +82,25 @@ article = module.newContent(portal_type=portal_type,\n
group_list=group_list,\n group_list=group_list,\n
function_list=function_list,\n function_list=function_list,\n
effective_date=effective_date,\n effective_date=effective_date,\n
classification=classification,\n classification=classification)\n
contributor_list=contributor_list,)\n article.setCategoryList(membership_criterion_category_list)\n
article.submit("Automatic Submit")\n article.submit("Automatic Submit")\n
portal_status_message = context.Base_translateString("New Blog Message created.")\n \n
return article.Base_redirect(\'\', keep_items = dict(portal_status_message=portal_status_message ))\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> </string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<value> <value>
<list> <list>
<string>default</string> <string>default</string>
<string>enabled</string>
<string>items</string> <string>items</string>
</list> </list>
</value> </value>
...@@ -86,6 +87,10 @@ ...@@ -86,6 +87,10 @@
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_classification</string> </value> <value> <string>my_classification</string> </value>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<value> <value>
<list> <list>
<string>default_now</string> <string>default_now</string>
<string>enabled</string>
<string>required</string> <string>required</string>
</list> </list>
</value> </value>
...@@ -76,6 +77,10 @@ ...@@ -76,6 +77,10 @@
<key> <string>default_now</string> </key> <key> <string>default_now</string> </key>
<value> <int>1</int> </value> <value> <int>1</int> </value>
</item> </item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_effective_date</string> </value> <value> <string>my_effective_date</string> </value>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<key> <string>delegated_list</string> </key> <key> <string>delegated_list</string> </key>
<value> <value>
<list> <list>
<string>enabled</string>
<string>items</string> <string>items</string>
</list> </list>
</value> </value>
...@@ -77,6 +78,10 @@ ...@@ -77,6 +78,10 @@
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_function_list</string> </value> <value> <string>my_function_list</string> </value>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<key> <string>delegated_list</string> </key> <key> <string>delegated_list</string> </key>
<value> <value>
<list> <list>
<string>enabled</string>
<string>items</string> <string>items</string>
</list> </list>
</value> </value>
...@@ -77,6 +78,10 @@ ...@@ -77,6 +78,10 @@
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_group_list</string> </value> <value> <string>my_group_list</string> </value>
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
<item> <item>
<key> <string>delegated_list</string> </key> <key> <string>delegated_list</string> </key>
<value> <value>
<list/> <list>
<string>enabled</string>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -70,8 +72,8 @@ ...@@ -70,8 +72,8 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>description</string> </key> <key> <string>enabled</string> </key>
<value> <string>language of the web page</string> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
...@@ -85,10 +87,6 @@ ...@@ -85,10 +87,6 @@
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value> <value> <string>Click to edit the target</string> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value> <string>Language</string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<value> <value>
<list> <list>
<string>default</string> <string>default</string>
<string>enabled</string>
<string>items</string> <string>items</string>
</list> </list>
</value> </value>
...@@ -90,6 +91,10 @@ ...@@ -90,6 +91,10 @@
<list/> <list/>
</value> </value>
</item> </item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_publication_section_list</string> </value> <value> <string>my_publication_section_list</string> </value>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<key> <string>delegated_list</string> </key> <key> <string>delegated_list</string> </key>
<value> <value>
<list> <list>
<string>enabled</string>
<string>required</string> <string>required</string>
</list> </list>
</value> </value>
...@@ -71,6 +72,10 @@ ...@@ -71,6 +72,10 @@
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_reference</string> </value> <value> <string>my_reference</string> </value>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<key> <string>delegated_list</string> </key> <key> <string>delegated_list</string> </key>
<value> <value>
<list> <list>
<string>enabled</string>
<string>items</string> <string>items</string>
</list> </list>
</value> </value>
...@@ -77,6 +78,10 @@ ...@@ -77,6 +78,10 @@
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_site_list</string> </value> <value> <string>my_site_list</string> </value>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<value> <value>
<list> <list>
<string>default</string> <string>default</string>
<string>enabled</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -75,6 +76,10 @@ ...@@ -75,6 +76,10 @@
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <string>001</string> </value> <value> <string>001</string> </value>
</item> </item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_version</string> </value> <value> <string>my_version</string> </value>
......
88 89
\ No newline at end of file \ 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