Commit 84badd85 authored by Rafael Monnerat's avatar Rafael Monnerat Committed by Xiaowu Zhang

Clean up and Refactor Person Handling

Use web_view instead a web section to view person information
Simplify Person_viewAsWeb and drop usage of websection
Updated Persion_editPersonalInformation (Done by JP mostly)
parent ef0df502
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_web_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_web_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>web_view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>0.9</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Web View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Person_viewAsWeb</string> </value>
</item>
</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 object.isWebMode()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
TODO:\n TODO:\n
- handle form validation errors after the call to\n - handle form validation errors after the call to\n
Base_edit (not the case currently)\n Base_edit (not the case currently)\n
- handle security in a better way that proxy (if possible) \n
for password change for example\n
\n \n
BUG:\n BUG:\n
- make sure personal address can be updated from\n - make sure personal address can be updated from\n
...@@ -64,16 +66,33 @@ ...@@ -64,16 +66,33 @@
"""\n """\n
translateString = context.Base_translateString \n translateString = context.Base_translateString \n
\n \n
context.Base_edit(form_id=\'Person_viewAsWeb\')\n # Call Base_edit\n
result, result_type = context.Base_edit(\'Person_viewAsWeb\', silent_mode=1, field_prefix=\'my_\')\n
\n \n
context.ERP5Site_redirect(\'%s/account\' % context.getWebSiteValue().absolute_url(), \\\n # Return if not appropriate\n
keep_items={\'portal_status_message\': translateString("Your personal informations are now updated.", mapping = dict())})\n if result_type != \'edit\':\n
return result # XXX add support for editable in this call\n
\n
# Update data\n
kw, encapsulated_editor_list = result\n
context.edit(**kw)\n
\n
return context.Base_redirect(context.REQUEST.get("form_id", ""), \\\n
keep_items={\'portal_status_message\': translateString("Your personal informations are now updated.")})\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>*args, **kw</string> </value> <value> <string>*args, **kw</string> </value>
</item> </item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Person_editPersonalInformation</string> </value> <value> <string>Person_editPersonalInformation</string> </value>
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</item> </item>
<item> <item>
<key> <string>action</string> </key> <key> <string>action</string> </key>
<value> <string>Base_edit</string> </value> <value> <string>Person_editPersonalInformation</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
<value> <value>
<list> <list>
<string>listbox</string> <string>listbox</string>
<string>submit_buttom</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -133,7 +134,7 @@ ...@@ -133,7 +134,7 @@
</item> </item>
<item> <item>
<key> <string>pt</string> </key> <key> <string>pt</string> </key>
<value> <string>ecommerce_form_list</string> </value> <value> <string>form_view_editable</string> </value>
</item> </item>
<item> <item>
<key> <string>row_length</string> </key> <key> <string>row_length</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InputButtonField" module="Products.ERP5Form.InputButtonField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>submit_buttom</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<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>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>image</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<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>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>image</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>name</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>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string>hidden_label ecommerce_submit</string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string>Submit</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>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>image</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Person_editPersonalInformation:method</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Submit</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -67,8 +67,7 @@ ...@@ -67,8 +67,7 @@
</tal:block>\n </tal:block>\n
\n \n
<tal:block tal:condition="not: isAnon"\n <tal:block tal:condition="not: isAnon"\n
tal:define="shopping_cart here/SaleOrder_getShoppingCart;\n tal:define="customer here/ERP5Site_getAuthenticatedMemberPersonValue;\n
customer shopping_cart/SaleOrder_getShoppingCartCustomer;\n
website here/getWebSiteValue">\n website here/getWebSiteValue">\n
\n \n
<p class="article">\n <p class="article">\n
...@@ -79,7 +78,7 @@ ...@@ -79,7 +78,7 @@
<span tal:replace="python: here.Base_translateString(\'My Orders\')"/>\n <span tal:replace="python: here.Base_translateString(\'My Orders\')"/>\n
</a> &nbsp;\n </a> &nbsp;\n
<a class="articlelink" \n <a class="articlelink" \n
tal:attributes="href python: \'%s/account\' % website.absolute_url()"> \n tal:attributes="href python: \'%s\' % customer.absolute_url()"> \n
<span tal:replace="python: here.Base_translateString(\'My Account\')"/>\n <span tal:replace="python: here.Base_translateString(\'My Account\')"/>\n
</a> &nbsp;\n </a> &nbsp;\n
<a class="articlelink" \n <a class="articlelink" \n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal"\n
xmlns:i18n="http://xml.zope.org/namespaces/i18n">\n
<tal:block metal:use-macro="here/ecommerce_list_main/macros/master">\n
<tal:block metal:fill-slot="main">\n
<tal:block metal:use-macro="here/form_render/macros/master" />\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ecommerce_form_list</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal"\n
xmlns:i18n="http://xml.zope.org/namespaces/i18n">\n
<tal:block metal:define-macro="master">\n
<tal:block tal:define="form_action string:Base_doSelect;\n
form_id form/id;\n
list_mode python: True;\n
listmode_default_listbox python:getattr(form, \'listbox\', None);\n
selection_name listmode_default_listbox/selection_name | nothing;\n
selection_index request/selection_index | python:0;\n
dummy python: selection_name and request.set(\'selection_name\', selection_name);\n
local_parameter_list local_parameter_list | python: {};\n
dummy python: local_parameter_list.update({\'selection_name\': selection_name, \'selection_index\': selection_index, \'form_id\': form_id});\n
title here/getTranslatedTitle | here/Title">\n
<tal:block metal:use-macro="here/main_template/macros/master">\n
<tal:block metal:fill-slot="main">\n
<tal:block metal:define-slot="main" />\n
<input type="submit" name="Person_editPersonalInformation:method" value="Submit" class="ecommerce_submit"/>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ecommerce_list_main</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
291 292
\ No newline at end of file \ No newline at end of file
Person | web_view
Sale Order Module | web_view Sale Order Module | web_view
Sale Order | web_view Sale Order | web_view
Web Section | ecommerce_configuration Web Section | ecommerce_configuration
......
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