diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py
index 904481096d3..1c5c9693c79 100644
--- a/addons/email_template/email_template.py
+++ b/addons/email_template/email_template.py
@@ -176,7 +176,7 @@ class email_template(osv.osv):
'mail_server_id': fields.many2one('ir.mail_server', 'Outgoing Mail Server', readonly=False,
help="Optional preferred server for outgoing mails. If not set, the highest "
"priority one will be used."),
- 'body_html': fields.text('Body', translate=True, help="Rich-text/HTML version of the message (placeholders may be used here)"),
+ 'body_html': fields.html('Body', translate=True, help="Rich-text/HTML version of the message (placeholders may be used here)"),
'report_name': fields.char('Report Filename', translate=True,
help="Name to use for the generated report file (may contain placeholders)\n"
"The extension can be omitted and will then come from the report type."),
diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js
index 6c0a062125d..ee4b0caf90e 100644
--- a/addons/website/static/src/js/website.snippets.editor.js
+++ b/addons/website/static/src/js/website.snippets.editor.js
@@ -148,10 +148,13 @@
});
self.$el.css('top', this.parent.get('height'));
},
+ _get_snippet_url: function () {
+ return '/website/snippets';
+ },
fetch_snippet_templates: function () {
var self = this;
- openerp.jsonRpc("/website/snippets", 'call', {})
+ openerp.jsonRpc(this._get_snippet_url(), 'call', {})
.then(function (html) {
var $html = $(html);
diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml
index 14defa7bc1a..9682d2f17e2 100644
--- a/addons/website/views/website_templates.xml
+++ b/addons/website/views/website_templates.xml
@@ -75,7 +75,7 @@
-
+
@@ -196,7 +196,7 @@
-
+
diff --git a/addons/website_mail/__openerp__.py b/addons/website_mail/__openerp__.py
index 55efcf01dbf..400411ed329 100644
--- a/addons/website_mail/__openerp__.py
+++ b/addons/website_mail/__openerp__.py
@@ -28,7 +28,10 @@
'author': 'OpenERP SA',
'depends': ['website', 'mail'],
'data': [
+ 'views/snippets.xml',
'views/website_mail.xml',
+ 'views/website_email_designer.xml',
+ 'views/email_template_view.xml',
'security/website_mail.xml',
],
'css': [
diff --git a/addons/website_mail/controllers/__init__.py b/addons/website_mail/controllers/__init__.py
index 8ee9bae18d9..d70eef6b8ee 100644
--- a/addons/website_mail/controllers/__init__.py
+++ b/addons/website_mail/controllers/__init__.py
@@ -1 +1,2 @@
+import email_designer
import main
diff --git a/addons/website_mail/controllers/email_designer.py b/addons/website_mail/controllers/email_designer.py
new file mode 100644
index 00000000000..a7f6ef8d287
--- /dev/null
+++ b/addons/website_mail/controllers/email_designer.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+
+# from openerp import SUPERUSER_ID
+from openerp.addons.web import http
+from openerp.addons.web.http import request
+from openerp.addons.website.models import website
+
+
+class WebsiteEmailDesigner(http.Controller):
+
+ @website.route('/website_mail/email_designer//', type='http', auth="public", multilang=True)
+ def index(self, template, **kw):
+ values = {
+ 'template': template,
+ }
+ print template
+ return request.website.render("website_mail.designer_index", values)
+
+ @website.route(['/website_mail/snippets'], type='json', auth="public")
+ def snippets(self):
+ return request.website._render('website_mail.email_designer_snippets')
diff --git a/addons/website_mail/models/__init__.py b/addons/website_mail/models/__init__.py
index f8d603716a2..e60de014149 100644
--- a/addons/website_mail/models/__init__.py
+++ b/addons/website_mail/models/__init__.py
@@ -1,2 +1,3 @@
import mail_message
import mail_thread
+import email_template
diff --git a/addons/website_mail/models/email_template.py b/addons/website_mail/models/email_template.py
new file mode 100644
index 00000000000..720ac8bfb0e
--- /dev/null
+++ b/addons/website_mail/models/email_template.py
@@ -0,0 +1,87 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2014-Today OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import lxml
+import urlparse
+
+from openerp.osv import osv, fields
+from openerp.tools.translate import _
+
+
+class EmailTemplate(osv.Model):
+ _inherit = 'email.template'
+
+ def _get_website_link(self, cr, uid, ids, name, args, context=None):
+ return dict((id, _('Edit in Website') % id) for id in ids)
+
+ _columns = {
+ 'website_link': fields.function(
+ _get_website_link, type='text',
+ string='Website Link',
+ help='Link to the website',
+ ),
+ }
+
+ def _postprocess_html_replace_links(self, cr, uid, body_html, context=None):
+ """ Post-processing of body_html. Indeed the content generated by the
+ website builder contains references to local addresses, for example
+ for images. This method changes those addresses to absolute addresses. """
+ html = body_html
+ if not body_html:
+ return html
+
+ # form a tree
+ root = lxml.html.fromstring(html)
+ if not len(root) and root.text is None and root.tail is None:
+ html = '
+ Write one or two paragraphs describing your product,
+ services or a specific feature. To be successful
+ your content needs to be useful to your readers.
+
+ Start with the customer – find out what they want
+ and give it to them.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Image-Text
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
A Section Subtitle
+
+ Write one or two paragraphs describing your product,
+ services or a specific feature. To be successful
+ your content needs to be useful to your readers.
+
+ Start with the customer – find out what they want
+ and give it to them.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Big Message
+
+
+
+
+
+
+
+
Sell Online. Easily.
+
+ Write one sentence to convince visitor about your message.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Text Block
+
+
+
+
+
+
+
+ A Great Headline
+
+
+ A good subtitle
+
+
+
+
+
+
+
+ A great way to catch your reader's attention is to tell a story.
+ Everything you consider writing can be told as a story.
+
+
+ Great stories have personality. Consider telling
+ a great story that provides personality. Writing a story
+ with personality for potential clients will asist with
+ making a relationship connection. This shows up in small
+ quirks like word choices or phrases. Write from your point
+ of view, not from someone else's experience.
+
+
+ Great stories are for everyone even when only written for
+ just one person. If you try to write with a wide general
+ audience in mind, your story will ring false and be bland.
+ No one will be interested. Write for one person. If it’s genuine
+ for the one, it’s genuine for the rest.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Separator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Big Picture
+
+
+
+
+
+
+
A Punchy Headline
+
+
+
+
+
+
+
+
+
+
+
A Small Subtitle
+
+
+ Choose a vibrant image and write an inspiring paragraph
+ about it. It does not have to be long, but it should
+ reinforce your image.
+
+
+
+
+
+
+
+
+
+
+
+
+ Three Columns
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Feature One
+
+ Choose a vibrant image and write an inspiring paragraph
+ about it. It does not have to be long, but it should
+ reinforce your image.
+
+
+
+
Feature Two
+
+ Choose a vibrant image and write an inspiring paragraph
+ about it. It does not have to be long, but it should
+ reinforce your image.
+
+
+
+
Feature Three
+
+ Choose a vibrant image and write an inspiring paragraph
+ about it. It does not have to be long, but it should
+ reinforce your image.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Comparisons
+
+
+
+
Our Offers
+
+
+
+
+
+
Beginner
+
Starter Package
+
+
+
Professional
+
Enterprise package
+
+
+
Expert
+
The top of the top
+
+
+
+
+
$450.00
+
per month
+
+
+
$590.00
+
per month
+
+
+
$890.00
+
per month
+
+
+
+
+
+
Battery: 8 hours
+
Screen: 2.5 inch
+
Weight: 1.1 ounces
+
No support
+
+
+
+
+
Battery: 12 hours
+
Screen: 2.8 inch
+
Weight: 1.2 ounces
+
Limited support
+
+
+
+
+
Battery: 20 hours
+
Screen: 2.8 inch
+
Weight: 1.2 ounces
+
Unlimited support
+
+
+
+
+
+
+ Free shipping, satisfied or reimbursed.
+ Order now
+
+
+
+
+ Free shipping, satisfied or reimbursed.
+ Order now
+
+
+
+
+ Free shipping, satisfied or reimbursed.
+ Contact us
+