+
+
+
+
diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py
index 5b29ff743fe..d2666ab8ab8 100644
--- a/addons/website/controllers/main.py
+++ b/addons/website/controllers/main.py
@@ -273,46 +273,51 @@ class Website(openerp.addons.web.controllers.main.Home):
@http.route('/website/attach', type='http', auth='user', methods=['POST'], website=True)
def attach(self, func, upload=None, url=None):
- Attachments = request.registry['ir.attachment']
+ # the upload argument doesn't allow us to access the files if more than
+ # one file is uploaded, as upload references the first file
+ # therefore we have to recover the files from the request object
+ Attachments = request.registry['ir.attachment'] # registry for the attachment table
- website_url = message = None
- if not upload:
- website_url = url
- name = url.split("/").pop()
+ uploads = []
+ message = None
+ if not upload: # no image provided, storing the link and the image name
+ uploads.append({'website_url': url})
+ name = url.split("/").pop() # recover filename
attachment_id = Attachments.create(request.cr, request.uid, {
'name':name,
'type': 'url',
'url': url,
'res_model': 'ir.ui.view',
}, request.context)
- else:
+ else: # images provided
try:
- image_data = upload.read()
- image = Image.open(cStringIO.StringIO(image_data))
- w, h = image.size
- if w*h > 42e6: # Nokia Lumia 1020 photo resolution
- raise ValueError(
- u"Image size excessive, uploaded images must be smaller "
- u"than 42 million pixel")
-
- attachment_id = Attachments.create(request.cr, request.uid, {
- 'name': upload.filename,
- 'datas': image_data.encode('base64'),
- 'datas_fname': upload.filename,
- 'res_model': 'ir.ui.view',
- }, request.context)
-
- [attachment] = Attachments.read(
- request.cr, request.uid, [attachment_id], ['website_url'],
- context=request.context)
- website_url = attachment['website_url']
+ for c_file in request.httprequest.files.getlist('upload'):
+ image_data = c_file.read()
+ image = Image.open(cStringIO.StringIO(image_data))
+ w, h = image.size
+ if w*h > 42e6: # Nokia Lumia 1020 photo resolution
+ raise ValueError(
+ u"Image size excessive, uploaded images must be smaller "
+ u"than 42 million pixel")
+
+ attachment_id = Attachments.create(request.cr, request.uid, {
+ 'name': c_file.filename,
+ 'datas': image_data.encode('base64'),
+ 'datas_fname': c_file.filename,
+ 'res_model': 'ir.ui.view',
+ }, request.context)
+
+ [attachment] = Attachments.read(
+ request.cr, request.uid, [attachment_id], ['website_url'],
+ context=request.context)
+ uploads.append(attachment)
except Exception, e:
logger.exception("Failed to upload image to attachment")
message = unicode(e)
return """""" % (func, json.dumps(website_url), json.dumps(message))
+ """ % (func, json.dumps(uploads), json.dumps(message))
@http.route(['/website/publish'], type='json', auth="public", website=True)
def publish(self, id, object):
diff --git a/addons/website/data/data.xml b/addons/website/data/data.xml
index c5254d65c0f..08ef965104c 100644
--- a/addons/website/data/data.xml
+++ b/addons/website/data/data.xml
@@ -52,6 +52,18 @@
+
+ Website Theme
+ ir.module.module
+ form
+ kanban,form
+
+
+
No theme module found!
+
You should try others search criteria.
+
+
+
Website/
diff --git a/addons/website/doc/website.snippet.rst b/addons/website/doc/website.snippet.rst
new file mode 100644
index 00000000000..9eec8431fcc
--- /dev/null
+++ b/addons/website/doc/website.snippet.rst
@@ -0,0 +1,134 @@
+Website Snippet & Blocks
+========================
+
+The building blocks appear in the edit bar website. These prebuilt html block
+allowing the designer to easily generate content on a page (drag and drop).
+Snippets bind javascript object on custom part html code according to their
+selector (jQuery) and javascript object. The snippets is also used to create
+the drop zone.
+
+
+Building Blocks
++++++++++++++++
+
+Overwrite ``_get_snippet_url`` to set an other file to load the snippets (use by
+website_mail for example)
+Overwrite ``_add_check_selector`` to enable or disable other snippets. By default
+the builder check if the node or his parent have the attribute data-oe-model
+
+Trigger:
+- ``snippet-dropped`` is triggered on ``#oe_snippets`` whith $target as attribute when a snippet is dropped
+- ``snippet-activated`` is triggered on ``#oe_snippets`` (and on snippet) when a snippet is activated
+
+
+Blocks
+++++++
+
+The ``blocks`` are the HTML code that can be drop in the page. The blocks consist
+of a body and a thumbnail:
+ - thumbnail:
+ (have class ``oe_snippet_thumbnail``) contains a picture and a text used to
+ display a preview in the edit bar that contains all the block list
+ - body:
+ (have class ``oe_snippet_body``) is the real part dropped in the page. The class
+ ``oe_snippet_body`` is removed before inserting the block in the page.
+e.g.:
+
+
+
+ ...Block Name...
+
+
+
+
+
+
+
+Editor
+++++++
+
+The ``editor`` is the frame placed above the block being edited who contains buttons
+(move, delete, clone) and customize menu. The ``editor`` load ``options`` based on
+selectors defined in snippets
+
+
+Options
++++++++
+
+The ``option`` is the javascript object used to customize the HTML code.
+
+Object:
+ - this.``$target``:
+ block html inserted inside the page
+ - this.``$el``:
+ html li list of this options
+ - this.``$overlay``:
+ html editor overlay who content resize bar, customize menu...
+
+Methods:
+ - ``set_active``:
+ highlight the customize menu item when the user click on customize, and click on
+ an item.
+ - ``start``:
+ called when the editor is created on the DOM
+ - ``on_focus``:
+ called when the user click inside the block inserted in page and when the
+ user drop on block into the page
+ - ``on_blur``:
+ called when the user click outside the block inserted in page, if the block
+ is focused
+ - ``on_clone``:
+ called when the snippet is duplicate
+ @variables: $clone is allready inserted is the page
+ - ``on_remove``:
+ called when the snippet is removed (dom is removing after this tigger)
+ - ``drop_and_build_snippet:
+ called just after that a thumbnail is drag and dropped into a drop zone.
+ The content is already inserted in the page.
+ - ``clean_for_save``:
+ is called just before to save the vue. Sometime it's important to remove or add
+ some datas (contentEditable, added classes to a running animation...)
+
+Customize Methods:
+All javascript option can defiend method call from the template on mouse over, on
+click or to reset the default value (
).
+The method receive the variable type (``over``, ``click`` or ``reset``), the method
+value and the jQuery object of the HTML li item. (can be use for multi methods)
+
+By default to custom method are defined:
+
+ - ``check_class(type, className, $li)``:
+ li must have data-check_class="a_classname_for_test" to call this method. This method
+ toggle the className on $target
+ - ``select_class(type, className, $li)``:
+ This method remove all other select_class value (for this option) and add this current ClassName
+
+
+Snippet
++++++++
+
+The ``snippets`` are the HTML code to defined the drop zone and the linked javascript object.
+All HTML li tag defined inside the snippets HTML are insert into the customize menu. All
+data attributes is optional:
+
+- ``data-selector``:
+ Apply options on all The part of html who match with this jQuery selector.
+ E.g.: If the selector is div, all div will be selected and can be highlighted and assigned an editor.
+- ``data-option``:
+ javascript ``option`` to call when the ``editor`` is loaded
+- ``data-drop-in``:
+ The html part can be insert or move beside the selected html block (jQuery selector)
+- ``data-drop-near``:
+ The html part can be insert or move inside the selected html block (jQuery selector)
+- ``data-drop-in-vertical``:
+ The html part can be insert or move inside the selected html block. The drop zone is displayed
+ vertically (jQuery selector)
+- HTML content like
This course is dedicated to developers who need to grasp knowledge of the business applications development process. This course is for new developers or for IT professionals eager to learn more about technical aspects.
@@ -38,11 +38,11 @@
-
+
What you will learn?
-
+
Day 1
@@ -62,7 +62,7 @@
-
+
Day 2
@@ -83,7 +83,7 @@
-
+
Day 3
@@ -108,11 +108,11 @@
-
+
Requirements
-
+
Objectives:
Having attended this course, participants should be able to:
@@ -144,20 +144,20 @@
-
+
Read Great Contents
What do people say about this course?
-
-
+
+
I did not expect such a great learning experience. I feel like I can develop anything now.
John Doe, CEO
-
-
+
+
This course help me build my first application within a month. Definetly worth its price.
John Doe, CEO
@@ -172,7 +172,7 @@
Trueopenerp
+
@@ -188,11 +188,11 @@
-
+
Course Summary
-
+
This course is dedicated to developers who need to grasp knowledge of the business applications development process. This course is for new developers or for IT professionals eager to learn more about technical aspects.
@@ -200,11 +200,11 @@
-
+
What you will learn?
-
+
Day 1
@@ -224,7 +224,7 @@
-
+
Day 2
@@ -245,7 +245,7 @@
-
+
Day 3
@@ -270,11 +270,11 @@
-
+
Requirements
-
+
Objectives:
Having attended this course, participants should be able to:
@@ -306,20 +306,20 @@
-
+
Read Great Contents
What do people say about this course?
-
-
+
+
I did not expect such a great learning experience. I feel like I can develop anything now.
John Doe, CEO
-
-
+
+
This course help me build my first application within a month. Definetly worth its price.
John Doe, CEO
@@ -346,7 +346,7 @@
Trueopenerp
+
@@ -363,11 +363,11 @@
-
+
Course Summary
-
+
This course is dedicated to developers who need to grasp knowledge of the business applications development process. This course is for new developers or for IT professionals eager to learn more about technical aspects.
@@ -375,11 +375,11 @@
-
+
What you will learn?
-
+
Day 1
@@ -399,7 +399,7 @@
-
+
Day 2
@@ -420,7 +420,7 @@
-
+
Day 3
@@ -445,11 +445,11 @@
-
+
Requirements
-
+
Objectives:
Having attended this course, participants should be able to:
@@ -481,20 +481,20 @@
-
+
Read Great Contents
What do people say about this course?
-
-
+
+
I did not expect such a great learning experience. I feel like I can develop anything now.
John Doe, CEO
-
-
+
+
This course help me build my first application within a month. Definetly worth its price.
@@ -294,7 +294,7 @@
inclusion in the programme.
-
+
Application
Fill this form to propose your talk.
diff --git a/addons/website_hr_recruitment/data/hr_job_demo.xml b/addons/website_hr_recruitment/data/hr_job_demo.xml
index 9f5433ee07c..962f468b2f9 100644
--- a/addons/website_hr_recruitment/data/hr_job_demo.xml
+++ b/addons/website_hr_recruitment/data/hr_job_demo.xml
@@ -5,7 +5,7 @@
True
-
+