[Erp5-report] r38765 fx.algrain - /experimental/bt5/erp5_credential/SkinTemplateItem/portal...
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Sep 29 17:43:39 CEST 2010
Author: fx.algrain
Date: Wed Sep 29 17:43:33 2010
New Revision: 38765
URL: http://svn.erp5.org?rev=38765&view=rev
Log:
Copy the default image when update person and organisation information.
Missing commit CredentialUpdate_view in the precedent commit
Added:
experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_copyDefaultImage.xml
Modified:
experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_updateOrganisationInformation.xml
experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_updatePersonInformation.xml
experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_view.xml
Added: experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_copyDefaultImage.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_copyDefaultImage.xml?rev=38765&view=auto
==============================================================================
--- experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_copyDefaultImage.xml (added)
+++ experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_copyDefaultImage.xml [utf8] Wed Sep 29 17:43:33 2010
@@ -0,0 +1,180 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+ </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>"""Copy the credential update image to the related entity\n
+Proxy\n
+Manager -- allow to update all image property"""\n
+\n
+if REQUEST is not None:\n
+ raise ValueError, "This script can not be call from url"\n
+\n
+def getAccessor(property):\n
+ return "".join([x.capitalize() for x in property.split(\'_\')])\n
+\n
+def copyValue(source_document, source_accessor,\n
+ destination_document, destination_accessor):\n
+ getter = getattr(source_document, \'get%s\' % source_accessor)\n
+ value = getter() \n
+ setter = getattr(destination_document, \'set%s\' % destination_accessor)\n
+ setter(value)\n
+\n
+def copyDocument(source_document, destination_document, mapping):\n
+ for source_property, destination_property in mapping:\n
+ source_accessor, destination_accessor = getAccessor(source_property), getAccessor(destination_property)\n
+ copyValue(source_document, source_accessor,\n
+ destination_document, destination_accessor)\n
+\n
+new_default_image = context.getDefaultImageValue()\n
+if new_default_image is not None:\n
+ updated_item = context.getDestinationDecisionValue()\n
+ default_image = updated_item.getDefaultImageValue()\n
+ if default_image is None:\n
+ default_image = updated_item.newContent(portal_type="Image",id="default_image")\n
+ \n
+ image_mapping = (\n
+ # (credential image, item image)\n
+ (\'source_reference\', \'source_reference\'),\n
+ (\'content_type\', \'content_type\'),\n
+ (\'content_md5\', \'content_md5\'),\n
+ (\'data\', \'data\'),\n
+ (\'base_data\', \'base_data\'),\n
+ (\'base_content_type\', \'base_content_type\'),\n
+ )\n
+\n
+\n
+ copyDocument(new_default_image,default_image, image_mapping)\n
+</string> </value>
+ </item>
+ <item>
+ <key> <string>_code</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_params</string> </key>
+ <value> <string>REQUEST=None</string> </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>1</int> </value>
+ </item>
+ <item>
+ <key> <string>co_varnames</string> </key>
+ <value>
+ <tuple>
+ <string>REQUEST</string>
+ <string>None</string>
+ <string>ValueError</string>
+ <string>getAccessor</string>
+ <string>copyValue</string>
+ <string>copyDocument</string>
+ <string>_getattr_</string>
+ <string>context</string>
+ <string>new_default_image</string>
+ <string>updated_item</string>
+ <string>default_image</string>
+ <string>image_mapping</string>
+ </tuple>
+ </value>
+ </item>
+ </dictionary>
+ </state>
+ </object>
+ </value>
+ </item>
+ <item>
+ <key> <string>func_defaults</string> </key>
+ <value>
+ <tuple>
+ <none/>
+ </tuple>
+ </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>CredentialUpdate_copyDefaultImage</string> </value>
+ </item>
+ <item>
+ <key> <string>warnings</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Modified: experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_updateOrganisationInformation.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_updateOrganisationInformation.xml?rev=38765&r1=38764&r2=38765&view=diff
==============================================================================
--- experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_updateOrganisationInformation.xml [utf8] (original)
+++ experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_updateOrganisationInformation.xml [utf8] Wed Sep 29 17:43:33 2010
@@ -69,6 +69,9 @@ organisation_mapping = (\n
)\n
\n
context.Credential_copyRegistredInformation(organisation, organisation_mapping)\n
+\n
+#Update the logo\n
+context.CredentialUpdate_copyDefaultImage()\n
</string> </value>
</item>
<item>
Modified: experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_updatePersonInformation.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_updatePersonInformation.xml?rev=38765&r1=38764&r2=38765&view=diff
==============================================================================
--- experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_updatePersonInformation.xml [utf8] (original)
+++ experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_updatePersonInformation.xml [utf8] Wed Sep 29 17:43:33 2010
@@ -97,6 +97,9 @@ for assignment in person.contentValues(p
assignment.update(comment="Credential Updated Accepted")\n
context.Credential_copyRegistredInformation(assignment, assignment_mapping,copy_none_value=False,erase_empty_value=False)\n
assignment.open(comment="Credential Updated Accepted")\n
+\n
+#Update the photo\n
+context.CredentialUpdate_copyDefaultImage()\n
</string> </value>
</item>
<item>
Modified: experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_view.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_view.xml?rev=38765&r1=38764&r2=38765&view=diff
==============================================================================
--- experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_view.xml [utf8] (original)
+++ experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialUpdate_view.xml [utf8] Wed Sep 29 17:43:33 2010
@@ -53,7 +53,7 @@
</item>
<item>
<key> <string>enctype</string> </key>
- <value> <string></string> </value>
+ <value> <string>multipart/form-data</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
@@ -112,6 +112,8 @@
<string>my_default_credential_question_answer</string>
<string>my_default_credential_question_question</string>
<string>my_default_credential_question_question_free_text</string>
+ <string>my_default_image_absolute_url</string>
+ <string>my_default_image_file</string>
</list>
</value>
</item>
More information about the Erp5-report
mailing list