Commit c091c3e9 authored by Ivan Tyagov's avatar Ivan Tyagov

Proxify form.

Hide some fields ( group & site) from intial thread creation form and use user's assignment to determine them.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34243 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8ae12eb5
......@@ -56,12 +56,18 @@
<value> <string>"""\n
This script allows to create a new Discussion Thread.\n
"""\n
MARKER = [\'\', None, []]\n
\n
portal = context.getPortalObject()\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
\n
version = \'001\'\n
language = portal.Localizer.get_selected_language()\n
user_assignment_dict = portal.ERP5Site_getUserAssignmentDict()\n
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
discussion_thread = portal.discussion_thread_module.newContent(\n
portal_type = "Discussion Thread",\n
title = title,\n
......@@ -72,6 +78,7 @@ discussion_thread = portal.discussion_thread_module.newContent(\n
subject_list=subject_list,\n
classification=classification,\n
group_list=group_list,\n
site_list=site_list,\n
reference=reference)\n
discussion_post = discussion_thread.newContent(\n
portal_type = "Discussion Post",\n
......@@ -80,6 +87,7 @@ discussion_post = discussion_thread.newContent(\n
source_value = person,\n
version = version,\n
language = language)\n
\n
# depending on security model Thread and Post can be directly published or shared\n
portal_status_message = "New discussion created. Your post will be reviewed for approval."\n
discussion_thread.submit()\n
......@@ -97,7 +105,7 @@ return discussion_thread.Base_redirect(form_id,\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>title, text_content, form_id, predecessor=None, description=None, subject_list=None, classification=None, group_list=None, reference=None,**kw</string> </value>
<value> <string>title, text_content, form_id, predecessor=None, description=None, subject_list=None, classification=None, group_list=None, site_list=None, reference=None,**kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......@@ -123,7 +131,7 @@ return discussion_thread.Base_redirect(form_id,\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>9</int> </value>
<value> <int>10</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -137,14 +145,19 @@ return discussion_thread.Base_redirect(form_id,\n
<string>subject_list</string>
<string>classification</string>
<string>group_list</string>
<string>site_list</string>
<string>reference</string>
<string>kw</string>
<string>None</string>
<string>MARKER</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>person</string>
<string>version</string>
<string>language</string>
<string>user_assignment_dict</string>
<string>_getitem_</string>
<string>discussion_thread</string>
<string>discussion_post</string>
<string>portal_status_message</string>
......@@ -167,6 +180,7 @@ return discussion_thread.Base_redirect(form_id,\n
<none/>
<none/>
<none/>
<none/>
</tuple>
</value>
</item>
......
......@@ -12,7 +12,9 @@
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
<list>
<string>enabled</string>
</list>
</value>
</item>
<item>
......@@ -72,6 +74,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>
......
......@@ -12,7 +12,9 @@
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
<list>
<string>enabled</string>
</list>
</value>
</item>
<item>
......@@ -72,6 +74,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>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</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
Get user assignment details.\n
"""\n
from Products.ERP5Type.Cache import CachingMethod\n
\n
portal = context.getPortalObject()\n
result = {\'group_list\': [],\n
\'site_list\': [],\n
\'function_list\': [],\n
\'destination_trade_relative_url\': None}\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
if person is None:\n
return result\n
\n
def getAssignmentDict(username):\n
person = portal.restrictedTraverse(person_relative_url)\n
assignment_list = person.searchFolder(portal_type = \'Assignment\', \\\n
validation_state = \'open\')\n
for assignment in assignment_list:\n
assignment = assignment.getObject()\n
result[\'group_list\'].extend(assignment.getGroupList())\n
result[\'function_list\'].extend(assignment.getFunctionList())\n
result[\'site_list\'].extend(assignment.getSiteList())\n
result[\'destination_trade_relative_url\'] = assignment.getDestinationTradeRelativeUrl()\n
return result\n
\n
person_relative_url = person.getRelativeUrl()\n
getAssignmentDict = CachingMethod(getAssignmentDict,\n
("ERP5Site_getUserAssignmentDict",),\n
cache_factory=\'erp5_ui_short\')\n
return getAssignmentDict(person_relative_url)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>None</string>
<string>result</string>
<string>person</string>
<string>person_relative_url</string>
<string>getAssignmentDict</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getUserAssignmentDict</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -3,12 +3,20 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="TextAreaField" module="Products.Formulator.StandardFields"/>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_preferred_forum_signature</string> </value>
......@@ -21,22 +29,6 @@
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>line_too_long</string> </key>
<value> <string>A line was too long.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>You entered too many characters.</string> </value>
</item>
<item>
<key> <string>too_many_lines</string> </key>
<value> <string>You entered too many lines.</string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -45,75 +37,15 @@
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
......@@ -124,75 +56,15 @@
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
......@@ -203,77 +75,21 @@
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
<key> <string>field_id</string> </key>
<value> <string>my_text_area_field</string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>5</int> </value>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Signature</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>40</int> </value>
</item>
</dictionary>
</value>
</item>
......
34
\ No newline at end of file
36
\ 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