From 9b6b9f21e21041f3e45b078d48fa05d23577727c Mon Sep 17 00:00:00 2001 From: Yusei Tahara <yusei@nexedi.com> Date: Tue, 10 Jun 2008 17:31:39 +0000 Subject: [PATCH] 2008-06-10 yusei * Move Event_send and mail templates from erp5_crm. It supports html email by default. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21477 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../portal_skins/erp5_core/Event_send.xml | 275 ++++++++++++++++++ .../erp5_core/Event_viewHtmlMimeMessage.xml | 79 +++++ .../erp5_core/Event_viewMimeMessage.xml | 79 +++++ .../ERP5/bootstrap/erp5_core/bt/change_log | 3 + product/ERP5/bootstrap/erp5_core/bt/revision | 2 +- 5 files changed, 437 insertions(+), 1 deletion(-) create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Event_send.xml create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Event_viewHtmlMimeMessage.xml create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Event_viewMimeMessage.xml diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Event_send.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Event_send.xml new file mode 100644 index 0000000000..71b6f57bb8 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Event_send.xml @@ -0,0 +1,275 @@ +<?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>Python_magic</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </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 encoding="cdata"><![CDATA[ + +if body is None:\n + body = context.getTextContent() #XXX This does not support structured text format.\n +\n +# Subject\n +if subject is None:\n + subject = context.getTitle()\n +\n +# From\n +if from_url is None:\n + sender = context.getSourceValue()\n + if sender.getTitle():\n + from_url = \'"%s" <%s>\' % (sender.getTitle(),\n + sender.getDefaultEmailText())\n + else:\n + from_url = sender.getDefaultEmailText()\n +\n +# Return-Path\n +if reply_url is None:\n + reply_url = context.portal_preferences.getPreferredEventSenderEmail()\n +additional_headers = None\n +if reply_url:\n + additional_headers = {\'Return-Path\':reply_url}\n +\n +# To (multiple)\n +to_url_list = []\n +if to_url is None:\n + for recipient in context.getDestinationValueList():\n + email = recipient.getDefaultEmailText()\n + if email:\n + if recipient.getTitle():\n + to_url_list.append(\'"%s" <%s>\' % (recipient.getTitle(), email))\n + else:\n + to_url_list.append(email)\n + else:\n + raise ValueError, \'Recipient %s has no defined email\' % recipient\n +elif same_type(to_url, \'\'):\n + to_url_list.append(to_url)\n +\n +# Attachments\n +if attachment_list is None:\n + attachment_list = []\n +document_type_list = context.getPortalDocumentTypeList()\n +for attachment in context.getAggregateValueList():\n + mime_type, content = attachment.getMimeTypeAndContent()\n + name = attachment.getReference()\n +\n + attachment_list.append({\'mime_type\':mime_type,\n + \'content\':content,\n + \'name\':name})\n +\n +# Build message per destination\n +mail_message = None\n +if context.getTextFormat()==\'text/html\':\n + mail_template = context.Event_viewHtmlMimeMessage\n +else:\n + mail_template = context.Event_viewMimeMessage\n +\n +for to_url in to_url_list:\n + multipart = mail_template.as_message(mfrom=from_url,\n + mto=to_url,\n + subject=subject,\n + body=body,\n + encoding=\'utf-8\')\n + for attachment_dict in attachment_list:\n + multipart.add_file(data=attachment_dict[\'content\'],\n + content_type=attachment_dict[\'mime_type\'],\n + filename=attachment_dict[\'name\'])\n + mail_message = str(multipart)\n + context.activate(activity=\'SQLQueue\').sendMailHostMessage(mail_message)\n +\n +context.setData(mail_message)\n +\n +# Transit event workflow\n +if context.getTypeInfo() is not None:\n + context.plan()\n + context.order()\n + context.start()\n +\n +if download:\n + return mail_message\n + + +]]></string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>from_url=None, to_url=None, reply_url=None, subject=None, body=None, attachment_format=None, attachment_list=None, download=None, **kw</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>8</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>from_url</string> + <string>to_url</string> + <string>reply_url</string> + <string>subject</string> + <string>body</string> + <string>attachment_format</string> + <string>attachment_list</string> + <string>download</string> + <string>kw</string> + <string>None</string> + <string>_getattr_</string> + <string>context</string> + <string>sender</string> + <string>additional_headers</string> + <string>to_url_list</string> + <string>_getiter_</string> + <string>recipient</string> + <string>email</string> + <string>ValueError</string> + <string>same_type</string> + <string>document_type_list</string> + <string>attachment</string> + <string>mime_type</string> + <string>content</string> + <string>name</string> + <string>mail_message</string> + <string>mail_template</string> + <string>multipart</string> + <string>attachment_dict</string> + <string>_getitem_</string> + <string>str</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <tuple> + <none/> + <none/> + <none/> + <none/> + <none/> + <none/> + <none/> + <none/> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Event_send</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Event_viewHtmlMimeMessage.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Event_viewHtmlMimeMessage.xml new file mode 100644 index 0000000000..13716b6b81 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Event_viewHtmlMimeMessage.xml @@ -0,0 +1,79 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="MailTemplate" module="Products.MailTemplates.MailTemplate"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </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_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_text</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +<tal:body xmlns:tal="http://xml.zope.org/namespaces/tal"\n + xmlns:metal="http://xml.zope.org/namespaces/metal"\n + ><html><body><tal:x replace="structure options/body"/></body></html></tal:body> + +]]></string> </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>Event_viewHtmlMimeMessage</string> </value> + </item> + <item> + <key> <string>mailhost</string> </key> + <value> <string>MailHost</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Event_viewMimeMessage.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Event_viewMimeMessage.xml new file mode 100644 index 0000000000..8e42674c6a --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Event_viewMimeMessage.xml @@ -0,0 +1,79 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="MailTemplate" module="Products.MailTemplates.MailTemplate"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </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_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_text</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +<tal:body xmlns:tal="http://xml.zope.org/namespaces/tal"\n + xmlns:metal="http://xml.zope.org/namespaces/metal"\n + ><tal:x replace="structure options/body"/></tal:body> + +]]></string> </value> + </item> + <item> + <key> <string>content_type</string> </key> + <value> <string>text/plain</string> </value> + </item> + <item> + <key> <string>expand</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Event_viewMimeMessage</string> </value> + </item> + <item> + <key> <string>mailhost</string> </key> + <value> <string>MailHost</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_core/bt/change_log b/product/ERP5/bootstrap/erp5_core/bt/change_log index e840cf605e..4460ba61d8 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/change_log +++ b/product/ERP5/bootstrap/erp5_core/bt/change_log @@ -1,3 +1,6 @@ +2008-06-10 yusei +* Move Event_send and mail templates from erp5_crm. It supports html email by default. + 2008-06-04 * remove bad commit diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index f3daf1d568..4fe21da97a 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -835 \ No newline at end of file +839 \ No newline at end of file -- 2.30.9