Commit 2fbcd670 authored by Ivan Tyagov's avatar Ivan Tyagov

Simplify quick new thread dialogs and make it possible for user to specify...

Simplify quick new thread dialogs and make it possible for user to specify list of notified persons when creating a new thread rather than when creating a new post.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34894 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 444b618f
......@@ -93,6 +93,36 @@ portal_status_message = "New discussion created. Your post will be reviewed for
discussion_thread.submit()\n
discussion_post.submit()\n
\n
if send_notification_text not in (\'\', None):\n
# we can send notifications\n
email_list = []\n
notification_list = send_notification_text.split(\'\\r\\n\')\n
for notification in notification_list:\n
if \'@\' in notification:\n
# user specified an email\n
email_list.append(notification)\n
else:\n
# we can assume user wanted to specify Person\'s title\n
person_list = portal.portal_catalog(portal_type=\'Person\',\n
title=notification)\n
email_list.extend([x.getDefaultEmailText() for x in person_list])\n
email_from = portal.email_from_address\n
email_subject = "New forum post"\n
email_template = """\n
\n
New forum post has been created at this url:\n
\n
${url}""" \n
email_body = context.Base_translateString(email_template, mapping={\'url\':discussion_thread.absolute_url()})\n
for email_to in email_list:\n
mail_headers = """\n
To: %s\n
From: %s\n
Subject: %s\n
Date: %s""" %(email_to, email_from, email_subject, DateTime().rfc822())\n
mail_source =\'%s\\n\\n%s\' %(mail_headers, email_body)\n
context.MailHost.send(mail_source)\n
\n
return discussion_thread.Base_redirect(form_id,\n
keep_items = dict(portal_status_message=context.Base_translateString(portal_status_message)))\n
</string> </value>
......@@ -105,7 +135,7 @@ return discussion_thread.Base_redirect(form_id,\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>title, text_content, form_id=\'view\', predecessor=None, description=None, subject_list=None, classification=None, group_list=None, site_list=None, reference=None,**kw</string> </value>
<value> <string>title, text_content, form_id=\'view\', predecessor=None, description=None, subject_list=None, classification=None, group_list=None, site_list=None, send_notification_text=None, reference=None,**kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......@@ -131,7 +161,7 @@ return discussion_thread.Base_redirect(form_id,\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>10</int> </value>
<value> <int>11</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -146,6 +176,7 @@ return discussion_thread.Base_redirect(form_id,\n
<string>classification</string>
<string>group_list</string>
<string>site_list</string>
<string>send_notification_text</string>
<string>reference</string>
<string>kw</string>
<string>None</string>
......@@ -161,6 +192,22 @@ return discussion_thread.Base_redirect(form_id,\n
<string>discussion_thread</string>
<string>discussion_post</string>
<string>portal_status_message</string>
<string>email_list</string>
<string>notification_list</string>
<string>_getiter_</string>
<string>notification</string>
<string>person_list</string>
<string>append</string>
<string>$append0</string>
<string>x</string>
<string>email_from</string>
<string>email_subject</string>
<string>email_template</string>
<string>email_body</string>
<string>email_to</string>
<string>DateTime</string>
<string>mail_headers</string>
<string>mail_source</string>
<string>dict</string>
</tuple>
</value>
......@@ -182,6 +229,7 @@ return discussion_thread.Base_redirect(form_id,\n
<none/>
<none/>
<none/>
<none/>
</tuple>
</value>
</item>
......
......@@ -114,6 +114,7 @@
<value>
<list>
<string>my_subject_list</string>
<string>your_send_notification_text</string>
</list>
</value>
</item>
......
......@@ -12,7 +12,9 @@
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
<list>
<string>enabled</string>
</list>
</value>
</item>
<item>
......@@ -72,6 +74,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_classification</string> </value>
......
......@@ -12,7 +12,9 @@
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
<list>
<string>enabled</string>
</list>
</value>
</item>
<item>
......@@ -72,6 +74,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_description</string> </value>
......
......@@ -15,7 +15,6 @@
<list>
<string>description</string>
<string>editable</string>
<string>enabled</string>
<string>title</string>
</list>
</value>
......@@ -101,10 +100,6 @@
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_text_area_field</string> </value>
......
......@@ -74,35 +74,6 @@ discussion_post = context.newContent(\n
# depending on security model Post can be submited for review\n
portal_status_message = "New post created."\n
discussion_post.release()\n
if send_notification_text not in (\'\', None):\n
# we can send notifications\n
email_list = []\n
notification_list = send_notification_text.split(\'\\r\\n\')\n
for notification in notification_list:\n
if \'@\' in notification:\n
# user specified an email\n
email_list.append(notification)\n
else:\n
# we can assume user wanted to specify Person\'s title\n
person_list = portal.portal_catalog(portal_type=\'Person\',\n
title=notification)\n
email_list.extend([x.getDefaultEmailText() for x in person_list])\n
email_from = portal.email_from_address\n
email_subject = "New forum post"\n
email_template = """\n
\n
New forum post has been created at this url:\n
\n
${url}""" \n
email_body = context.Base_translateString(email_template, mapping={\'url\':discussion_post.absolute_url()})\n
for email_to in email_list:\n
mail_headers = """\n
To: %s\n
From: %s\n
Subject: %s\n
Date: %s""" %(email_to, email_from, email_subject, DateTime().rfc822())\n
mail_source =\'%s\\n\\n%s\' %(mail_headers, email_body)\n
context.MailHost.send(mail_source)\n
\n
return context.Base_redirect(form_id,\n
keep_items = dict(portal_status_message=context.Base_translateString(portal_status_message)))\n
......@@ -116,7 +87,7 @@ return context.Base_redirect(form_id,\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>title, text_content, form_id=\'view\', send_notification_text=None, predecessor=None,**kw</string> </value>
<value> <string>title, text_content, form_id=\'view\', predecessor=None,**kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......@@ -145,7 +116,7 @@ return context.Base_redirect(form_id,\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>5</int> </value>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -154,7 +125,6 @@ return context.Base_redirect(form_id,\n
<string>title</string>
<string>text_content</string>
<string>form_id</string>
<string>send_notification_text</string>
<string>predecessor</string>
<string>kw</string>
<string>DateTime</string>
......@@ -166,22 +136,6 @@ return context.Base_redirect(form_id,\n
<string>language</string>
<string>discussion_post</string>
<string>portal_status_message</string>
<string>None</string>
<string>email_list</string>
<string>notification_list</string>
<string>_getiter_</string>
<string>notification</string>
<string>person_list</string>
<string>append</string>
<string>$append0</string>
<string>x</string>
<string>email_from</string>
<string>email_subject</string>
<string>email_template</string>
<string>email_body</string>
<string>email_to</string>
<string>mail_headers</string>
<string>mail_source</string>
<string>dict</string>
</tuple>
</value>
......@@ -197,7 +151,6 @@ return context.Base_redirect(form_id,\n
<tuple>
<string>view</string>
<none/>
<none/>
</tuple>
</value>
</item>
......
......@@ -100,7 +100,6 @@
<value>
<list>
<string>your_title</string>
<string>your_send_notification_text</string>
</list>
</value>
</item>
......
46
\ No newline at end of file
47
\ No newline at end of file
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