Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Iliya Manolov
erp5
Commits
f98d2752
Commit
f98d2752
authored
Mar 19, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CRM: Introduce a script to choose the content type of response events
parent
a178f661
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
401 additions
and
28 deletions
+401
-28
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createResponse.xml
...mplateItem/portal_skins/erp5_crm/Event_createResponse.xml
+2
-2
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_getPreferredResponseEventContentType.xml
...s/erp5_crm/Event_getPreferredResponseEventContentType.xml
+72
-0
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewCreateResponseDialog.xml
.../portal_skins/erp5_crm/Event_viewCreateResponseDialog.xml
+1
-0
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewCreateResponseDialog/your_response_event_content_type.xml
...CreateResponseDialog/your_response_event_content_type.xml
+275
-0
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewCreateResponseDialog/your_response_event_text_content.xml
...CreateResponseDialog/your_response_event_text_content.xml
+25
-1
bt5/erp5_crm/bt/revision
bt5/erp5_crm/bt/revision
+1
-1
product/ERP5/Document/EmailDocument.py
product/ERP5/Document/EmailDocument.py
+12
-10
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getEditorFieldPreferredTextEditor.xml
...kins/erp5_core/Base_getEditorFieldPreferredTextEditor.xml
+12
-13
product/ERP5/bootstrap/erp5_core/bt/revision
product/ERP5/bootstrap/erp5_core/bt/revision
+1
-1
No files found.
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createResponse.xml
View file @
f98d2752
...
@@ -64,7 +64,7 @@ response = module.newContent(portal_type=response_event_portal_type,\n
...
@@ -64,7 +64,7 @@ response = module.newContent(portal_type=response_event_portal_type,\n
start_date=response_event_start_date,\n
start_date=response_event_start_date,\n
causality_value=context,\n
causality_value=context,\n
follow_up_list=context.getFollowUpList(),\n
follow_up_list=context.getFollowUpList(),\n
content_type=context.getContentType())\n
content_type=
response_event_content_type or
context.getContentType())\n
\n
\n
if response_event_notification_message:\n
if response_event_notification_message:\n
response.Event_setTextContentFromNotificationMessage(\n
response.Event_setTextContentFromNotificationMessage(\n
...
@@ -87,7 +87,7 @@ else:\n
...
@@ -87,7 +87,7 @@ else:\n
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
form_id=None, response_event_portal_type=None, response_event_resource=None, response_event_title=None, response_event_text_content=None, response_event_start_date=None, response_workflow_action=None, response_event_notification_message=None, **kw
</string>
</value>
<value>
<string>
form_id=None, response_event_portal_type=None, response_event_resource=None, response_event_title=None, response_event_text_content=None, response_event_start_date=None, response_workflow_action=None, response_event_notification_message=None,
response_event_content_type=None,
**kw
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_getPreferredResponseEventContentType.xml
0 → 100644
View file @
f98d2752
<?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>
"""Returns the default text format for response events.\n
\n
This script is here so that we can easily customized depending on the context event, ticket or user preferences.\n
"""\n
return context.getTextFormat()\\\n
or context.getPortalObject().portal_preferences.getPreferredTextFormat()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Event_getPreferredResponseEventContentType
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewCreateResponseDialog.xml
View file @
f98d2752
...
@@ -87,6 +87,7 @@
...
@@ -87,6 +87,7 @@
<string>
your_response_event_portal_type
</string>
<string>
your_response_event_portal_type
</string>
<string>
your_response_event_resource
</string>
<string>
your_response_event_resource
</string>
<string>
your_response_event_start_date
</string>
<string>
your_response_event_start_date
</string>
<string>
your_response_event_content_type
</string>
</list>
</list>
</value>
</value>
</item>
</item>
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewCreateResponseDialog/your_response_event_content_type.xml
0 → 100644
View file @
f98d2752
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"StringField"
module=
"Products.Formulator.StandardFields"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_response_event_content_type
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
<item>
<key>
<string>
required_not_found
</string>
</key>
<value>
<string>
Input is required but no input given.
</string>
</value>
</item>
<item>
<key>
<string>
too_long
</string>
</key>
<value>
<string>
Too much input was given.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_maxwidth
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
max_length
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
required
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
truncate
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
unicode
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
whitespace_preserve
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_maxwidth
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
max_length
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
required
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
truncate
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
unicode
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
whitespace_preserve
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string>
hidden_label
</string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_maxwidth
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<int>
20
</int>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
max_length
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
required
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Content Type
</string>
</value>
</item>
<item>
<key>
<string>
truncate
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
unicode
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
whitespace_preserve
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
context/Event_getPreferredResponseEventContentType
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewCreateResponseDialog/your_response_event_text_content.xml
View file @
f98d2752
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
<string>
css_class
</string>
<string>
css_class
</string>
<string>
default
</string>
<string>
default
</string>
<string>
editable
</string>
<string>
editable
</string>
<string>
text_editor
</string>
<string>
title
</string>
<string>
title
</string>
</list>
</list>
</value>
</value>
...
@@ -81,6 +82,12 @@
...
@@ -81,6 +82,12 @@
<key>
<string>
target
</string>
</key>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
</item>
</item>
<item>
<key>
<string>
text_editor
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
@@ -116,6 +123,10 @@
...
@@ -116,6 +123,10 @@
<key>
<string>
target
</string>
</key>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
</item>
<item>
<key>
<string>
text_editor
</string>
</key>
<value>
<string>
text_area
</string>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string>
Message
</string>
</value>
<value>
<string>
Message
</string>
</value>
...
@@ -134,7 +145,20 @@
...
@@ -134,7 +145,20 @@
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
_text
</string>
</key>
<key>
<string>
_text
</string>
</key>
<value>
<string>
here/getReplyBody
</string>
</value>
<value>
<string>
python: context.getReplyBody(content_type=context.Event_getPreferredResponseEventContentType())
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: context.Base_getEditorFieldPreferredTextEditor(content_type=context.Event_getPreferredResponseEventContentType())
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
bt5/erp5_crm/bt/revision
View file @
f98d2752
691
694
\ No newline at end of file
\ No newline at end of file
product/ERP5/Document/EmailDocument.py
View file @
f98d2752
...
@@ -529,20 +529,22 @@ class EmailDocument(TextDocument):
...
@@ -529,20 +529,22 @@ class EmailDocument(TextDocument):
# Methods which can be useful to prepare a reply by email to an event
# Methods which can be useful to prepare a reply by email to an event
security.declareProtected(Permissions.AccessContentsInformation, '
getReplyBody
')
security.declareProtected(Permissions.AccessContentsInformation, '
getReplyBody
')
def getReplyBody(self):
def getReplyBody(self, content_type=None):
"""This is used in order to respond to a mail, this put a '
>
' before each
line of the body.
"""
"""
This is used in order to respond to a mail,
if not content_type:
this put a '
>
' before each line of the body
content_type = self.getContentType()
"""
if content_type == '
text
/
plain
':
if self.getContentType() == '
text
/
plain
':
body = self.asText()
body = self.asText()
if body:
if body:
return '
>
' + str(body).replace('
\
n
', '
\
n
>
')
return '
>
' + str(body).replace('
\
n
', '
\
n
>
')
elif self.getContentType() == '
text
/
html
':
elif content_type == '
text
/
html
':
# XXX we add an empty <p> to be able to enter text before the quoted
# XXX we add some empty <p> to be able to enter text before the quoted
# content in CKEditor
# content in CKEditor.
return '
<
p
>&
nbsp
;
</
p
><
blockquote
type
=
"cite"
>
\
n
%
s
\
n
</
blockquote
>
' %
\
return '''<p> </p><blockquote type="cite">
self.asStrippedHTML()
%s
</blockquote><p> </p>''' % self.asStrippedHTML()
return ''
return ''
security.declareProtected(Permissions.AccessContentsInformation, '
getReplySubject
')
security.declareProtected(Permissions.AccessContentsInformation, '
getReplySubject
')
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getEditorFieldPreferredTextEditor.xml
View file @
f98d2752
...
@@ -50,19 +50,18 @@
...
@@ -50,19 +50,18 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
<value>
<string>
"""Returns the preferred text editor and tries to take into account a default\n
Returns the preferred text editor and tries to take into \n
content type if any.\n
account a default content type if any.\n
The content type can also be passed, for example to use the editor in a dialog\n
that will create a document of this target content type.\n
"""\n
"""\n
# By default, everthing related to EditorField is HTML\n
if not content_type:\n
content_type = \'text/html\'\n
# By default, everthing related to EditorField is HTML\n
\n
# If this document provide a text format property, \n
# get the content type from the property\n
if getattr(context, \'getContentType\', None) is not None:\n
content_type = context.getContentType()\n
if not content_type:\n
content_type = \'text/html\'\n
content_type = \'text/html\'\n
\n
# If this document has a content type we use this information\n
if getattr(context, \'getContentType\', None) is not None:\n
content_type = context.getContentType() or \'text/html\'\n
\n
\n
# If this is not HTML, fallback to TextArea\n
# If this is not HTML, fallback to TextArea\n
if content_type != \'text/html\':\n
if content_type != \'text/html\':\n
...
@@ -74,7 +73,7 @@ return context.portal_preferences.getPreferredTextEditor() or \'text_area\'\n
...
@@ -74,7 +73,7 @@ return context.portal_preferences.getPreferredTextEditor() or \'text_area\'\n
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
content_type=None
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
product/ERP5/bootstrap/erp5_core/bt/revision
View file @
f98d2752
41155
41156
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment