[Erp5-report] r38682 fx.algrain - /experimental/bt5/erp5_credential/SkinTemplateItem/portal...
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Sep 27 17:14:34 CEST 2010
Author: fx.algrain
Date: Mon Sep 27 17:14:31 2010
New Revision: 38682
URL: http://svn.erp5.org?rev=38682&view=rev
Log:
Use notification to send the login and the password.
Use the preference to define the notifier when send the mail
Modified:
experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_sendAcceptedNotification.xml
Modified: experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_sendAcceptedNotification.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_sendAcceptedNotification.xml?rev=38682&r1=38681&r2=38682&view=diff
==============================================================================
--- experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_sendAcceptedNotification.xml [utf8] (original)
+++ experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_sendAcceptedNotification.xml [utf8] Mon Sep 27 17:14:31 2010
@@ -51,26 +51,44 @@
<item>
<key> <string>_body</string> </key>
<value> <string>"""Send an email (after accept a credential request"""\n
+""""Exemple of notification message\n
+ Congratulation, the creation of you new Instance Name account \'${login_name}\' is finished.\\nYour password is \'${login_password}\'\\nThank you"))\n
+\n
+ Congratulation, the creation of you new Instance Name account \'${user_id}\' is finished.\\n\\nThank you",\n
+"""\n
portal = context.getPortalObject()\n
-Base_translateString = context.Base_translateString\n
-person = context.getDestinationDecisionValue(portal_type=\'Person\')\n
+recipient = context.getDestinationDecisionValue(portal_type="Person")\n
\n
-subject = Base_translateString("${instance_name} account created",\n
- mapping=dict(instance_name=portal.getTitle()))\n
\n
-message = ""\n
+#Define the type of notification\n
+notification_type = "without-password"\n
if password:\n
- message = Base_translateString("\\nCongratulation, the creation of you new " \\\n
- "${instance_name} account \'${user_id}\' is finished.\\nYour password is \'${password}\'\\nThank you",\n
- mapping=dict(instance_name=portal.getTitle(), user_id=login, password=password))\n
-\n
-else:\n
- message = Base_translateString("\\nCongratulation, the creation of you new " \\\n
- "${instance_name} account \'${user_id}\' is finished.\\n\\nThank you",\n
- mapping=dict(instance_name=portal.getTitle(), user_id=login))\n
+ notification_type = "with-password"\n
+\n
+#Get message from catalog\n
+notification_reference = \'crendential_request-confirmation-%s\' % notification_type\n
+notification_message = context.NotificationTool_getDocumentValue(notification_reference, recipient.getLanguage())\n
+\n
+#Set notification mapping\n
+notification_mapping_dict = {\'login_name\': login}\n
+if password:\n
+ notification_mapping_dict.update(\n
+ {\'login_password\' : password})\n
+\n
+mail_text = notification_message.asText(\n
+ substitution_method_parameter_dict={\'mapping_dict\':notification_mapping_dict})\n
\n
-portal.portal_notifications.sendMessage(sender=None,\n
- recipient=[person,], subject=subject, message=message)\n
+#Send email\n
+portal.portal_notifications.sendMessage(\n
+ sender=None,\n
+ recipient=recipient,\n
+ subject=notification_message.getTitle(),\n
+ message=mail_text,\n
+ message_text_format=notification_message.getTextFormat(),\n
+ notifier_list=(context.getPreferredLoginAndPasswordNotifier(),),\n
+ store_as_event=True,\n
+ event_keyword_argument_dict={\'follow_up\':context.getRelativeUrl()},\n
+ )\n
</string> </value>
</item>
<item>
@@ -112,12 +130,14 @@ portal.portal_notifications.sendMessage(
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
- <string>Base_translateString</string>
- <string>person</string>
- <string>dict</string>
- <string>subject</string>
- <string>message</string>
+ <string>recipient</string>
+ <string>notification_type</string>
+ <string>notification_reference</string>
+ <string>notification_message</string>
+ <string>notification_mapping_dict</string>
+ <string>mail_text</string>
<string>None</string>
+ <string>True</string>
</tuple>
</value>
</item>
More information about the Erp5-report
mailing list