[Erp5-report] r24227 - in /erp5/trunk/bt5/erp5_deferred_style: SkinTemplateItem/portal_skin...
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Oct 17 15:21:15 CEST 2008
Author: romain
Date: Fri Oct 17 15:21:12 2008
New Revision: 24227
URL: http://svn.erp5.org?rev=24227&view=rev
Log:
Use portal_notifications to send report to the user.
Modified:
erp5/trunk/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.xml
erp5/trunk/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_report.xml
erp5/trunk/bt5/erp5_deferred_style/bt/revision
Modified: erp5/trunk/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.xml?rev=24227&r1=24226&r2=24227&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.xml (original)
+++ erp5/trunk/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.xml Fri Oct 17 15:21:12 2008
@@ -59,7 +59,7 @@
portal = context.getPortalObject()\n
N_ = portal.Base_translateString\n
active_process = portal.portal_activities.newActiveProcess()\n
-email_to = \'jerome at nexedi.com\' # XXX \n
+user_name = context.portal_membership.getAuthenticatedMember().getUserName()\n
\n
skin_name = \'ODT\' # hardcoded for now\n
tag = \'active-report-%s\' % random.randint(0, 1000)\n
@@ -100,7 +100,7 @@
title=form.getProperty(\'title\'),\n
request_other=request_other,\n
form_path=form.getPhysicalPath(),\n
- email_to=email_to,\n
+ user_name=user_name,\n
)\n
\n
context.activate(after_tag=tag).getTitle()\n
@@ -155,7 +155,7 @@
<string>portal</string>
<string>N_</string>
<string>active_process</string>
- <string>email_to</string>
+ <string>user_name</string>
<string>skin_name</string>
<string>random</string>
<string>tag</string>
Modified: erp5/trunk/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_report.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_report.xml?rev=24227&r1=24226&r2=24227&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_report.xml (original)
+++ erp5/trunk/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_report.xml Fri Oct 17 15:21:12 2008
@@ -53,9 +53,7 @@
</item>
<item>
<key> <string>_body</string> </key>
- <value> <string encoding="cdata"><![CDATA[
-
-request = container.REQUEST\n
+ <value> <string>request = container.REQUEST\n
request.other.update(request_other)\n
portal = context.getPortalObject()\n
ap = portal.restrictedTraverse(active_process_url)\n
@@ -76,52 +74,25 @@
rendered_report_item_list=[r[1] for r in report_section_list],\n
form=portal.restrictedTraverse(form_path)))\n
\n
-email_from = portal.getProperty(\'email_from_address\')\n
-if portal.getProperty(\'email_from_name\'):\n
- email_from = \'"%s" <%s>\' % (portal.getProperty(\'email_from_name\'), email_from)\n
+attachment_list = (\n
+ {\'mime_type\': request.RESPONSE.getHeader(\'content-type\').split(\';\')[0],\n
+ \'content\': report_data,\n
+ \'name\': [x[len(\'filename=\'):] for x in request.RESPONSE.getHeader(\n
+ \'content-disposition\').split(\';\') \\\n
+ if x.startswith(\'filename=\')][0]},)\n
\n
-if 0: # send an email ?\n
- portal.MailHost.send(\'\'\'From:%(mfrom)s\n
-To:%(mto)s\n
-Subject:%(subject)s\n
-Content-Type: Multipart/Mixed;\n
- boundary="Boundary-00=_GJWGGr2lsPnqbw0"\n
-\n
---Boundary-00=_GJWGGr2lsPnqbw0\n
-Content-Type: text/plain;\n
- charset="utf-8"\n
-Content-Transfer-Encoding: 7bit\n
-Content-Disposition: inline\n
-\n
-Your report is attached.\n
-\n
-Maybe here we could sum up the parameters, date, user etc ?\n
-\n
---Boundary-00=_GJWGGr2lsPnqbw0\n
-Content-Type: application/pdf;\n
- name="CasParticuliers.pdf"\n
-Content-Transfer-Encoding: 8bit\n
-Content-Disposition: attachment;\n
-\tfilename="%(subject)s.pdf"\n
-\n
-%(report_data)s\n
-\'\'\' % dict(subject=title,\n
- mfrom=email_from,\n
- mto=email_to,\n
- report_data=report_data))\n
-\n
-# TODO: this should use portal_contributions\n
-doc = portal.document_module.newContent(portal_type=\'File\',\n
- title=N_(title),\n
- language=localizer_language,\n
- data=report_data)\n
-\n
-content_type = request.RESPONSE.getHeader(\'Content-Type\')\n
-if content_type:\n
- doc.setContentType(content_type.split(\';\')[0])\n
-
-
-]]></string> </value>
+# XXX Use notification message to improve message content\n
+portal.portal_notifications.sendMessage(\n
+ recipient=user_name,\n
+ subject=title,\n
+ message=\'\\nYour report is attached.\\n\\n\' \\\n
+ \'Maybe here we could sum up the parameters, date, user etc ?\\n\\n\',\n
+ message_text_format=\'text/plain\',\n
+ notifier_list=(\'Mail Message\',),\n
+ store_as_event=False,\n
+ attachment_list=attachment_list,\n
+ )\n
+</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
@@ -131,7 +102,7 @@
</item>
<item>
<key> <string>_params</string> </key>
- <value> <string>active_process_url, skin_name, localizer_language, title, request_other, form_path, email_to</string> </value>
+ <value> <string>active_process_url, skin_name, localizer_language, title, request_other, form_path, user_name</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -163,7 +134,7 @@
<string>title</string>
<string>request_other</string>
<string>form_path</string>
- <string>email_to</string>
+ <string>user_name</string>
<string>_getattr_</string>
<string>container</string>
<string>request</string>
@@ -180,9 +151,10 @@
<string>dict</string>
<string>_getitem_</string>
<string>report_data</string>
- <string>email_from</string>
- <string>doc</string>
- <string>content_type</string>
+ <string>x</string>
+ <string>len</string>
+ <string>attachment_list</string>
+ <string>False</string>
</tuple>
</value>
</item>
Modified: erp5/trunk/bt5/erp5_deferred_style/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_deferred_style/bt/revision?rev=24227&r1=24226&r2=24227&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_deferred_style/bt/revision (original)
+++ erp5/trunk/bt5/erp5_deferred_style/bt/revision Fri Oct 17 15:21:12 2008
@@ -1,1 +1,1 @@
-19
+20
More information about the Erp5-report
mailing list