diff --git a/addons/gamification/data/gamification_karma_rank_data.xml b/addons/gamification/data/gamification_karma_rank_data.xml index 25d94ca3739..b91ee3dd4dc 100644 --- a/addons/gamification/data/gamification_karma_rank_data.xml +++ b/addons/gamification/data/gamification_karma_rank_data.xml @@ -15,7 +15,7 @@

You just began the adventure! Welcome!

Keep going !

1 - + diff --git a/addons/gamification/data/gamification_karma_rank_demo.xml b/addons/gamification/data/gamification_karma_rank_demo.xml index 52b1f2c1f50..c34f93b486e 100644 --- a/addons/gamification/data/gamification_karma_rank_demo.xml +++ b/addons/gamification/data/gamification_karma_rank_demo.xml @@ -14,7 +14,7 @@

You begin to understand things ! Keep going!

Keep going !

100 - + @@ -22,7 +22,7 @@

Hey ! You're not so dumb after all !

Keep going !

500 - +
@@ -30,7 +30,7 @@

You're good ! Really Good !

Keep going !

2000 - +
@@ -38,7 +38,7 @@

Ok, RESPECT !

Keep going !

10000 - +
diff --git a/addons/gamification/static/img/rank_bachelor_badge.svg b/addons/gamification/static/img/rank_bachelor_badge.svg new file mode 100644 index 00000000000..6fd78eb62f5 --- /dev/null +++ b/addons/gamification/static/img/rank_bachelor_badge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addons/gamification/static/img/rank_doctor_badge.svg b/addons/gamification/static/img/rank_doctor_badge.svg new file mode 100644 index 00000000000..91964edd417 --- /dev/null +++ b/addons/gamification/static/img/rank_doctor_badge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addons/gamification/static/img/rank_master_badge.svg b/addons/gamification/static/img/rank_master_badge.svg new file mode 100644 index 00000000000..feb63293ce1 --- /dev/null +++ b/addons/gamification/static/img/rank_master_badge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addons/gamification/static/img/rank_newbie_badge.svg b/addons/gamification/static/img/rank_newbie_badge.svg new file mode 100644 index 00000000000..66720ce62df --- /dev/null +++ b/addons/gamification/static/img/rank_newbie_badge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addons/gamification/static/img/rank_student_badge.svg b/addons/gamification/static/img/rank_student_badge.svg new file mode 100644 index 00000000000..561ea368fc6 --- /dev/null +++ b/addons/gamification/static/img/rank_student_badge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addons/website_partner/data/website_partner_demo.xml b/addons/website_partner/data/website_partner_demo.xml index d0127fef0a9..a139e80be94 100644 --- a/addons/website_partner/data/website_partner_demo.xml +++ b/addons/website_partner/data/website_partner_demo.xml @@ -7,6 +7,9 @@ True + + True + True diff --git a/addons/website_profile/__init__.py b/addons/website_profile/__init__.py index 8c67f893b37..632e0b78318 100644 --- a/addons/website_profile/__init__.py +++ b/addons/website_profile/__init__.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +from . import controllers from . import models from . import controllers diff --git a/addons/website_profile/controllers/main.py b/addons/website_profile/controllers/main.py index b1a29efe708..92c69ae4c34 100644 --- a/addons/website_profile/controllers/main.py +++ b/addons/website_profile/controllers/main.py @@ -2,18 +2,34 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. import base64 +import werkzeug import werkzeug.exceptions import werkzeug.urls import werkzeug.wrappers -from odoo import http +from odoo import http, modules, tools from odoo.http import request from odoo.osv import expression +from odoo.tools import limited_image_resize class WebsiteProfile(http.Controller): + # Profile # --------------------------------------------------- + + def _check_avatar_access(self, user_id, **post): + """ Base condition to see user avatar independently form access rights + is to see published users having karma, meaning they participated to + frontend applications like forum or elearning. """ + try: + user = request.env['res.users'].sudo().browse(user_id).exists() + except: + return False + if user: + return user.website_published and user.karma > 0 + return False + def _check_user_profile_access(self, user_id): user_sudo = request.env['res.users'].sudo().browse(user_id) if user_sudo.karma == 0 or not user_sudo.website_published or \ @@ -41,6 +57,47 @@ class WebsiteProfile(http.Controller): 'edit_button_url_param': '', } + @http.route([ + '/profile/avatar/', + ], type='http', auth="public", website=True, sitemap=False) + def get_user_profile_avatar(self, user_id=0, width=0, height=0, crop=False, avoid_if_small=False, upper_limit=False, **post): + can_sudo = self._check_avatar_access(user_id, **post) + fname = post.get('field', 'image_medium') + if can_sudo: + status, headers, content = request.env['ir.http'].sudo().binary_content( + model='res.users', id=user_id, field=fname, + default_mimetype='image/png') + else: + status, headers, content = request.env['ir.http'].binary_content( + model='res.users', id=user_id, field=fname, + default_mimetype='image/png') + if status == 301: + return request.env['ir.http']._response_by_status(status, headers, content) + if status == 304: + return werkzeug.wrappers.Response(status=304) + + if not content: + img_path = modules.get_module_resource('web', 'static/src/img', 'placeholder.png') + with open(img_path, 'rb') as f: + image = f.read() + content = base64.b64encode(image) + dictheaders = dict(headers) if headers else {} + dictheaders['Content-Type'] = 'image/png' + headers = list(dictheaders.items()) + if not (width or height): + suffix = fname.split('_')[-1] + if suffix in ('small', 'medium', 'big'): + content = getattr(tools, 'image_resize_image_%s' % suffix)(content) + + content = limited_image_resize( + content, width=width, height=height, crop=crop, upper_limit=upper_limit, avoid_if_small=avoid_if_small) + + image_base64 = base64.b64decode(content) + headers.append(('Content-Length', len(image_base64))) + response = request.make_response(image_base64, headers) + response.status_code = status + return response + @http.route(['/profile/user/'], type='http', auth="public", website=True) def view_user_profile(self, user_id, **post): user = self._check_user_profile_access(user_id) diff --git a/addons/website_rating/static/src/xml/portal_chatter.xml b/addons/website_rating/static/src/xml/portal_chatter.xml index 78b1b64baae..e331c0393cc 100644 --- a/addons/website_rating/static/src/xml/portal_chatter.xml +++ b/addons/website_rating/static/src/xml/portal_chatter.xml @@ -44,8 +44,17 @@ It can alse be used to modify a message --> -
- -
- - - - - - () - -
- +
- suggest_slide.name + suggest_slide.name @@ -73,7 +73,7 @@
- suggest_slide.name + suggest_slide.name

Loading ...

diff --git a/addons/website_slides/views/website_slides_templates.xml b/addons/website_slides/views/website_slides_templates.xml index 661db6c0297..6bbd8d91292 100644 --- a/addons/website_slides/views/website_slides_templates.xml +++ b/addons/website_slides/views/website_slides_templates.xml @@ -5,85 +5,12 @@ - - - - - - -