diff options
| author | Amit Patel (OpenERP) <apa@tinyerp.com> | 2012-04-24 14:59:25 +0530 |
|---|---|---|
| committer | Amit Patel (OpenERP) <apa@tinyerp.com> | 2012-04-24 14:59:25 +0530 |
| commit | dfc4e3fb0979d76e47376680fbefc2a33e38bcd3 (patch) | |
| tree | 148f0e02cda3f890f40f0003d92334a44752e867 /addons/mail | |
| parent | c6bcc6d69fd7a1f8de0ad93baa642d5801b96a32 (diff) | |
| parent | e9f015e217f1ff48d95e9b55a9515b7276240c48 (diff) | |
[MERGE]
bzr revid: apa@tinyerp.com-20120417112722-7rz5vvcg6eo0jf3e
bzr revid: apa@tinyerp.com-20120419051214-j4wvjp9kz1w0zqs7
bzr revid: apa@tinyerp.com-20120423053400-unc6y6lonksopys3
bzr revid: apa@tinyerp.com-20120424092925-ezqfnppvfgocj94t
Diffstat (limited to 'addons/mail')
| -rw-r--r-- | addons/mail/__openerp__.py | 1 | ||||
| -rw-r--r-- | addons/mail/doc/index.rst | 10 | ||||
| -rw-r--r-- | addons/mail/doc/index.rst.inc | 9 | ||||
| -rw-r--r-- | addons/mail/doc/mail_message.rst | 24 | ||||
| -rw-r--r-- | addons/mail/doc/mail_needaction_howto.rst | 15 | ||||
| -rw-r--r-- | addons/mail/doc/mail_openchatter_howto.rst | 155 | ||||
| -rw-r--r-- | addons/mail/doc/mail_thread.rst | 5 | ||||
| -rw-r--r-- | addons/mail/mail_data.xml | 2 | ||||
| -rw-r--r-- | addons/mail/mail_group_data.xml | 13 | ||||
| -rw-r--r-- | addons/mail/mail_group_view.xml | 2 | ||||
| -rw-r--r-- | addons/mail/mail_message_view.xml | 2 | ||||
| -rw-r--r-- | addons/mail/mail_thread_view.xml | 9 | ||||
| -rw-r--r-- | addons/mail/res_users.py | 5 | ||||
| -rw-r--r-- | addons/mail/security/ir.model.access.csv | 9 | ||||
| -rw-r--r-- | addons/mail/static/src/css/mail.css | 189 | ||||
| -rw-r--r-- | addons/mail/static/src/img/feeds-hover.png | bin | 41761 -> 15696 bytes | |||
| -rw-r--r-- | addons/mail/static/src/img/feeds.png | bin | 13316 -> 5647 bytes | |||
| -rw-r--r-- | addons/mail/static/src/img/groupdefault.png | bin | 19910 -> 3092 bytes | |||
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 16 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail.xml | 43 |
20 files changed, 395 insertions, 114 deletions
diff --git a/addons/mail/__openerp__.py b/addons/mail/__openerp__.py index 88e932299e1..81719794f69 100644 --- a/addons/mail/__openerp__.py +++ b/addons/mail/__openerp__.py @@ -66,6 +66,7 @@ The main features are: 'security/mail_security.xml', 'security/ir.model.access.csv', 'mail_data.xml', + 'mail_group_data.xml', 'res_users_view.xml', ], 'installable': True, diff --git a/addons/mail/doc/index.rst b/addons/mail/doc/index.rst index b9217c42443..033b1241af6 100644 --- a/addons/mail/doc/index.rst +++ b/addons/mail/doc/index.rst @@ -1,6 +1,12 @@ -:orphan: - Mail module documentation ========================= +The Mail module holds all models and logic related to messages management. At low-level, it handles messages and offers an API to message queues for email sending. At an higher level, it provides the OpenChatter feature that is a thread management system inside OpenERP. A model that inherits from the mail module adds OpenChatter to its document. Its gives them the following capabilities : + + - messages management with a threaded design + - subscription mechanism tha allow users to follow/unfollow documents + - notifications mechanism; notifications are pushed to users to form a Wall page holding the latest pushed messages + +The mail module also comes with an email composition wizard, along with discussion groups. + .. include:: index.rst.inc diff --git a/addons/mail/doc/index.rst.inc b/addons/mail/doc/index.rst.inc index 700c91c7d4f..4679cd56fdf 100644 --- a/addons/mail/doc/index.rst.inc +++ b/addons/mail/doc/index.rst.inc @@ -1,8 +1,11 @@ -Mail Module -''''''''''' +Mail Module documentation topics +''''''''''''''''''''''''''''''''' .. toctree:: :maxdepth: 1 - + + mail_message mail_thread + mail_openchatter_howto + mail_needaction_howto diff --git a/addons/mail/doc/mail_message.rst b/addons/mail/doc/mail_message.rst new file mode 100644 index 00000000000..e41a772cac8 --- /dev/null +++ b/addons/mail/doc/mail_message.rst @@ -0,0 +1,24 @@ +.. _mail_message: + +mail.message +============ + +TODO + +mail.group +++++++++++ + +A mail_group is a collection of users sharing messages in a discussion group. Group users are users that follow the mail group, using the subscription/follow mechanism of OpenSocial. A mail group has nothing in common wih res.users.group. +Additional information on fields: + + - ``member_ids``: user member of the groups are calculated with ``message_get_subscribers`` method from mail.thread + - ``member_count``: calculated with member_ids + - ``is_subscriber``: calculated with member_ids + +res.users ++++++++++ + +OpenChatter updates the res.users class: + - it adds a preference about sending emails when receiving a notification + - make a new user follow itself automatically + - create a welcome message when creating a new user, to make his arrival in OpenERP more friendly diff --git a/addons/mail/doc/mail_needaction_howto.rst b/addons/mail/doc/mail_needaction_howto.rst new file mode 100644 index 00000000000..8cb41cee374 --- /dev/null +++ b/addons/mail/doc/mail_needaction_howto.rst @@ -0,0 +1,15 @@ + +How to use the need action mechanism in my addon +================================================= + +Make your module inheriting from ir.needaction_mixin class + +Feature integration +++++++++++++++++++++ + +:: + + class my_module(osv.osv): + _name = "my.module" + _description = "My Module" + _inherit = ['ir.needaction_mixin'] diff --git a/addons/mail/doc/mail_openchatter_howto.rst b/addons/mail/doc/mail_openchatter_howto.rst new file mode 100644 index 00000000000..fe28017be83 --- /dev/null +++ b/addons/mail/doc/mail_openchatter_howto.rst @@ -0,0 +1,155 @@ + +How to use OpenChatter in my addon +=================================== + +Running example +++++++++++++++++ + +A small my_task model will be used as example to explain how to use the OpenChatter feature. Being simple, it has only the following fields : + + - a name + - a task responsible + - a related project + +:: + + class my_task(osv.osv): + _name = "my.task" + _description = "My Task" + _columns = { + 'name': fields.char('Name', required=True, size=64), + 'user_id':fields.many2one('res.users', string='Responsible', + ondelete='cascade', required=True, select=1), + 'project_id':fields.many2one('project.project', string='Related project', + ondelete='cascade', required=True, select=1), + } + + +Two-lines feature integration +++++++++++++++++++++++++++++++ + +Make your module inheriting from the ``mail.thread`` class. + +:: + + class my_task(osv.osv): + _name = "my.task" + _description = "My Task" + # inherit from mail.thread allows the use of OpenChatter + _inherit = ['mail.thread'] + +Use the thread viewer widget inside your form view by using the ThreadView widget on the message_ids_social field inherited from mail.thread. + +:: + + <record model="ir.ui.view" id="my_task_form_view"> + <field name="name">My Task</field> + <field name="model">my.task</field> + <field name="type">form</field> + <field name="priority">1</field> + <field name="arch" type="xml"> + <form> + [...] + <field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/> + </form> + </field> + </record> + +Send notifications ++++++++++++++++++++ + +When sending a notification is required in your workflow or business logic, use the ``message_append_note`` method. This method is a shortcut to the ``message_append`` method that takes all ``mail.message`` fields as arguments. This latter method calls ``message_create`` that + + - creates the message + - parses the body to find users you want to push the message to (finding and parsing ``@login`` in the message body) + - pushes a notification to users following the document and requested users of the latetr step + +You should therefore not worry about subscriptions or anything else than sending the notification. Here is a small example of sending a notification when the ``do_something`` method is called : + +:: + + def do_something(self, cr, uid, ids, context=None): + [...] + self.do_something_send_note(cr, uid, ids, context=context) + [...] + return res + + def do_something_send_note(self, cr, uid, ids, context=None): + self.message_append_note(cr, uid, ids, _('My subject'), + _("has received a <b>notification</b> and is happy for it."), context=context) + +Notifications guidelines ++++++++++++++++++++++++++ + +Here are a few guidelines that you should keep in mind during the addition of system notifications : + + - avoid unnecessary content; if a message has no interest, do not implement it + - use short sentences + - do not include the document name, as it is managed by the thread widget + - use a simple and clean style + + - html tags are supported: use <b> or <em> mainly + - put main word(s) in bold + - avoid fancy styles that will break the OpenERP look and feel + - create a separate method for sending your notification + + - use a method name like ``original_method_name_send_note``, that allow to easily spot notification methods in the code + +Subscription management +++++++++++++++++++++++++ + +There are a few default subscription tricks that you should know before playing with subscription: + + - users that click on 'follow' follow the document. An entry in ``mail.subscription`` is created. + - users that click on 'unfollow' are no longer followers to the document. The related entry in ``mail.subscription`` is created. + - users that create or update a document automatically follow it. An entry in ``mail.subscription`` is created. + +If you want to override this default behavior, you should avoid doing it manualle. You should instead override the ``message_get_subscribers`` method from mail.thread. The default implementation looks in the ``mail.suscription`` table for entries matching ``user_id=uid, res_model=self._name, res_id=current_record_id``. You can add subscribers by overriding the ``message_get_subscribers`` and adding user ids to the returned list. This means that they will be considered as followers even if they do not have an entry in the mail.subscription table. + +As an exemple, let us say that you want to automatically add the my_task responsible along with the project manager to the list of followers. The method could look like: + +:: + + def message_get_subscribers(self, cr, uid, ids, context=None): + # get the followers from the mail.subscription table + sub_ids = self.message_get_subscribers_ids(cr, uid, ids, context=context); + # add the employee and its manager if specified to the subscribed users + for obj in self.browse(cr, uid, ids, context=context): + if obj.user_id: + sub_ids.append(obj.user_id) + if obj.project_id and obj.project_id.user_id: + sub_ids.append(obj.project_id.user_id) + return self.pool.get('res.users').read(cr, uid, sub_ids, context=context) + +This method has the advantage of being able to implement a particular behavior with as few code addition as possible. Moreover, when changing the task responsible of the project manager, the subscribers are always correct. This allows to avoid to implement complex corner cases that could obfuscate the code. + +The drawback of this method is that it is no longer possible to those subscribers to unfollow a document. Indeed, as user ids are added directly in a list in ``message_get_subscribers``, it is not possible to unsubscribe to a document. However, this drawback is mitigated by + + - only important users shoudl be added using this method. Important users should not unsubscribe from their documents. + - users can hide the notifications on their Wall + +Messages display management +++++++++++++++++++++++++++++ + +By default, the ThreadView widget shows all messages related to the current document beside the document, in the History and comments section. However, you may want to display other messages in the widget. For example, the OpenChatter on res.users model shows + + - messages related to the user, as usual (messages with ``model = res.users, res_id = current_document_id``) + - messages directly pushed to this user (containing @login) + +The best way to direct the messages that will be displayed in the OpenChatter widget is to override the ``message_load`` method. For example, the following method fetches messages as usual, but also fetches messages linked to the task project that contain the task name. Please refer to the API for more details about the arguments. + +:: + + def message_load(self, cr, uid, ids, limit=100, offset=0, domain=[], ascent=False, root_ids=[False], context=None): + msg_obj = self.pool.get('mail.message') + for my_task in self.browse(cr, uid, ids, context=context): + # search as usual messages related to the current document + msg_ids += msg_obj.search(cr, uid, ['|', '&', ('res_id', '=', my_task.id), ('model', '=', self._name), + # add: search in the current task project messages + '&', '&', ('res_id', '=', my_task.project_id.id), ('model', '=', 'project.project'), + # ... containing the task name + '|', ('body_text', 'like', '%s' % (my_task.name)), ('body_html', 'like', '%s' % (my_task.name)) + ] + domain, limit=limit, offset=offset, context=context) + # if asked: add ancestor ids to have complete threads + if (ascent): msg_ids = self._message_add_ancestor_ids(cr, uid, ids, msg_ids, root_ids, context=context) + return msg_obj.read(cr, uid, msg_ids, context=context) diff --git a/addons/mail/doc/mail_thread.rst b/addons/mail/doc/mail_thread.rst index f21d66da295..f15f78156d3 100644 --- a/addons/mail/doc/mail_thread.rst +++ b/addons/mail/doc/mail_thread.rst @@ -1,7 +1,7 @@ .. _mail_thread: -OpenChatter -=========== +mail.thread and OpenChatter +=========================== TODO @@ -10,6 +10,7 @@ mail.group A mail_group is a collection of users sharing messages in a discussion group. Group users are users that follow the mail group, using the subscription/follow mechanism of OpenSocial. A mail group has nothing in common wih res.users.group. Additional information on fields: + - ``member_ids``: user member of the groups are calculated with ``message_get_subscribers`` method from mail.thread - ``member_count``: calculated with member_ids - ``is_subscriber``: calculated with member_ids diff --git a/addons/mail/mail_data.xml b/addons/mail/mail_data.xml index 964552b951a..c8e8b1a488e 100644 --- a/addons/mail/mail_data.xml +++ b/addons/mail/mail_data.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data noupdate="1"> - <record forcecreate="True" id="ir_cron_mail_scheduler_action" model="ir.cron"> + <record forcecreate="True" id="ir_cron_mail_scheduler_action" model="ir.cron"> <field name="name">Email Queue Manager</field> <field name="user_id" ref="base.user_root"/> <field name="interval_number">1</field> diff --git a/addons/mail/mail_group_data.xml b/addons/mail/mail_group_data.xml new file mode 100644 index 00000000000..c2d1762d6ae --- /dev/null +++ b/addons/mail/mail_group_data.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data noupdate="1"> + + <record model="mail.group" id="group_all_company"> + <field name="name">All Company</field> + </record> + <record model="mail.group" id="group_sales"> + <field name="name">Sales</field> + </record> + + </data> +</openerp> diff --git a/addons/mail/mail_group_view.xml b/addons/mail/mail_group_view.xml index 949dd1cc9b8..ea0dede377d 100644 --- a/addons/mail/mail_group_view.xml +++ b/addons/mail/mail_group_view.xml @@ -112,6 +112,6 @@ </record> <!-- left-side menu: Groups !--> - <menuitem id="mail_allgroups" name="All groups" parent="mail_feeds" sequence="12" action="action_view_groups"/> + <menuitem id="mail_allgroups" name="All Groups" parent="mail_feeds" sequence="12" action="action_view_groups"/> </data> </openerp> diff --git a/addons/mail/mail_message_view.xml b/addons/mail/mail_message_view.xml index 7389f8e5488..ecd106e05e5 100644 --- a/addons/mail/mail_message_view.xml +++ b/addons/mail/mail_message_view.xml @@ -234,7 +234,7 @@ <menuitem name="Feeds" id="menu_email_message_all" parent="base.menu_email" action="action_view_all_messages_short" groups="base.group_no_one"/> <record id="action_mail_all_feeds" model="ir.actions.client"> - <field name="name">All Feeds</field> + <field name="name">Wall</field> <field name="tag">mail.all_feeds</field> <field name="params" eval="{'search_view_id': ref('view_message_search_wall')}"/> </record> diff --git a/addons/mail/mail_thread_view.xml b/addons/mail/mail_thread_view.xml index faa6d24ae2c..35508477009 100644 --- a/addons/mail/mail_thread_view.xml +++ b/addons/mail/mail_thread_view.xml @@ -3,18 +3,17 @@ <data> <!-- toplevel menu --> + <menuitem id="mail_feeds_main" name="Feeds" sequence="0" + web_icon="static/src/img/feeds.png" + web_icon_hover="static/src/img/feeds-hover.png" /> <record id="mail_feeds_main" model="ir.ui.menu"> - <field name="name">Feeds</field> - <field name="sequence">0</field> - <field name="web_icon" eval="static/src/img/feeds.png"/> - <field name="web_icon_hover" eval="static/src/img/feeds-hover.png"/> <field name="action" ref="action_mail_all_feeds"/> </record> <!-- left-side menu: Feeds !--> <menuitem id="mail_feeds" name="Feeds" parent="mail_feeds_main"/> <record id="mail_wallfeeds" model="ir.ui.menu"> - <field name="name">All Feeds</field> + <field name="name">Wall</field> <field name="sequence" eval="10"/> <field name="action" ref="action_mail_all_feeds"/> <field name="parent_id" ref="mail_feeds"/> diff --git a/addons/mail/res_users.py b/addons/mail/res_users.py index 6efb218a658..05bc4213e85 100644 --- a/addons/mail/res_users.py +++ b/addons/mail/res_users.py @@ -41,7 +41,7 @@ class res_users(osv.osv): } _defaults = { - 'notification_email_pref': 'all', + 'notification_email_pref': 'none', } def __init__(self, pool, cr): @@ -63,7 +63,8 @@ class res_users(osv.osv): # create a welcome message to broadcast company_name = user.company_id.name if user.company_id else 'the company' message = _('%s has joined %s! You may leave him/her a message to celebrate a new arrival in the company ! You can help him/her doing its first steps on OpenERP.') % (user.name, company_name) - self.message_broadcast(cr, uid, [user.id], 'Welcome notification', message, context=context) + # TODO: clean the broadcast feature. As this is not cleany specified, temporarily remove the message broadcasting that is not buggy but not very nice. + #self.message_broadcast(cr, uid, [user.id], 'Welcome notification', message, context=context) return user_id def message_load_ids(self, cr, uid, ids, limit=100, offset=0, domain=[], ascent=False, root_ids=[False], context=None): diff --git a/addons/mail/security/ir.model.access.csv b/addons/mail/security/ir.model.access.csv index c305de830c0..3cfd4e88f3d 100644 --- a/addons/mail/security/ir.model.access.csv +++ b/addons/mail/security/ir.model.access.csv @@ -1,7 +1,8 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_mail_message,mail.message,model_mail_message,base.group_user,1,1,1,1
+access_mail_message,mail.message,model_mail_message,,1,0,1,0
+access_mail_message_all,mail.message.all,model_mail_message,base.group_user,1,1,1,1
access_mail_thread,mail.thread,model_mail_thread,base.group_user,1,1,1,0
-access_mail_subscription,mail.subscription,model_mail_subscription,base.group_user,1,1,1,1
-access_mail_notification,mail.notification,model_mail_notification,base.group_user,1,1,1,1
+access_mail_subscription,mail.subscription,model_mail_subscription,,1,1,1,1
+access_mail_notification,mail.notification,model_mail_notification,,1,1,1,1
access_mail_group,mail.group,model_mail_group,base.group_user,1,1,1,1
-access_mail_message_report,mail.message.report,model_mail_message_report,base.group_user,1,0,0,0
+access_mail_message_report,mail.message.report,model_mail_message_report,,1,0,0,0
diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index d920455537f..7f0cc6f222c 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -2,122 +2,171 @@ /* Wall */ /* ------------------------------ */ -div.oe_mail_wall { +.openerp div.oe_mail_wall { overflow: auto; - padding: 5px; + padding: 0; + background: white; } -div.oe_mail_wall_search { - width: 55%; +.openerp div.oe_mail_wall_act:after { + content: ""; + display: block; + clear: both; } /* 2 columns view */ -div.oe_mail_wall_left { +.openerp div.oe_mail_wall_left { float: left; - width: 65%; + width: 560px; + margin: 8px; } -div.oe_mail_wall_right { - float: right; - width: 34%; +.openerp div.oe_mail_wall_right { + margin-left: 565px; + margin: 8px; } -.oe_mail_wall_thread div.oe_mail_thread_act .oe_mail_action_textarea, div.oe_mail_thread_subthread .oe_mail_action_textarea { +.openerp div.oe_mail_wall_threads { + margin-top: 8px; +} + +.openerp textarea.oe_mail_wall_action_textarea { + width: 550px; + height: 60px; + padding: 5px; +} + +.openerp div.oe_mail_wall_threads textarea { height: 20px; padding: 2px; } -.oe_mail_thread_subthread div.oe_mail_thread_act .oe_mail_msg_image, .oe_mail_thread_subthread div.oe_mail_thread_display .oe_mail_msg_image { +.openerp div.oe_mail_thread_subthread img { width: 30px; height: 30px; } -.oe_mail_thread_subthread .oe_mail_msg_content, .oe_mail_thread_subthread .oe_mail_msg_content { +.openerp div.oe_mail_thread_subthread div.oe_mail_msg_content { margin-left: 40px; } -div.oe_mail_wall_more { +.openerp div.oe_mail_wall_more { text-align: center; display: none; } + /* ------------------------------ */ /* RecordThread */ /* ------------------------------ */ -.oe_mail_recthread { +.openerp div.oe_mail_recthread { overflow: auto; - padding: 5px 5px 5px 5px; } /* Left-side CSS */ -.oe_mail_recthread_actions { - margin-bottom: 10px; +.openerp div.oe_mail_recthread_actions { + margin-bottom: 8px; } -.oe_mail_recthread_followers { - margin-bottom: 10px; -} - -.oe_mail_followers_action, .oe_mail_followers_display { +.openerp div.oe_mail_recthread_followers { + margin-bottom: 8px; } /* RecordThread: 2 columns view */ -.oe_mail_recthread_left { +.openerp div.oe_mail_recthread_left { float: left; width: 55%; } -.oe_mail_recthread_right { +.openerp div.oe_mail_recthread_right { float: right; - width: 25%; - margin-right: 5%; + width: 250px; } -.oe_mail_button_follow, .oe_mail_button_unfollow { +.openerp div.oe_mail_recthread_actions button { width: 120px; } -.oe_mail_button_followers { +.openerp button.oe_mail_button_followers { display: inline; - width: 120px; } -.oe_mail_followers h4 { - margin: 0 0 8px; +.openerp button.oe_mail_button_mouseout { + color: white; + background-color: #8a89ba; + background-image: -webkit-gradient(linear, left top, left bottom, from(#8a89ba), to(#807fb4)); + background-image: -webkit-linear-gradient(top, #8a89ba, #807fb4); + background-image: -moz-linear-gradient(top, #8a89ba, #807fb4); + background-image: -ms-linear-gradient(top, #8a89ba, #807fb4); + background-image: -o-linear-gradient(top, #8a89ba, #807fb4); + background-image: linear-gradient(to bottom, #8a89ba, #807fb4); +} + +.openerp button.oe_mail_button_mouseover { + display: none; + color: white; + background-color: #dc5f59; + background-image: -webkit-gradient(linear, left top, left bottom, from(#dc5f59), to(#b33630)); + background-image: -webkit-linear-gradient(top, #dc5f59, #b33630); + background-image: -moz-linear-gradient(top, #dc5f59, #b33630); + background-image: -ms-linear-gradient(top, #dc5f59, #b33630); + background-image: -o-linear-gradient(top, #dc5f59, #b33630); + background-image: linear-gradient(to bottom, #dc5f59, #b33630); +} + +.openerp textarea.oe_mail_action_textarea { + height: 60px; + padding: 5px; } /* ------------------------------ */ /* ThreadDisplay */ /* ------------------------------ */ -div.oe_mail_thread_act { +.openerp div.oe_mail_thread_act { white-space: normal; margin-bottom: 5px; padding: 4px; } -div.oe_mail_thread_display { +.openerp div.oe_mail_thread_act:after { + content: ""; + display: block; + clear: both; +} + +.openerp div.oe_mail_thread_display { white-space: normal; - margin-bottom: 5px; } -div.oe_mail_thread_subthread { +.openerp div.oe_mail_thread_subthread { margin-top: 8px; padding-left: 5%; } -div.oe_mail_thread_more { +.openerp div.oe_mail_thread_more { display: none; border-bottom: 1px solid #D2D9E7; } -li.oe_mail_thread_msg { +.openerp li.oe_mail_thread_msg { padding: 1px; } -.notification, .email { - background: #E0E0E0; +.openerp li.oe_mail_thread_msg:after { + content: ""; + display: block; + clear: both; +} + +.openerp li.oe_mail_thread_msg > div:after { + content: ""; + display: block; + clear: both; +} + +.openerp .oe_mail_msg_notification, .openerp .oe_mail_msg_comment, .openerp .oe_mail_msg_email { padding: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; @@ -126,38 +175,35 @@ li.oe_mail_thread_msg { border-radius: 4px; } -.comment { - padding: 4px; +.openerp li.oe_mail_thread_msg > .oe_mail_msg_comment { + background: #eee; } -.notification:after, .email:after, .comment:after { - content: ""; - display: block; - clear: both; +.openerp div.oe_mail_thread_subthread .oe_mail_msg_comment { + background: white; +} + +.openerp .oe_mail_msg_notification { + background: #eee; } -li.oe_mail_thread_msg:after, div.oe_mail_thread_act:after { +.openerp .oe_mail_msg_notification:after, .openerp .oe_mail_msg_comment:after, .openerp .oe_mail_msg_email:after { content: ""; display: block; clear: both; } -.oe_mail_msg_content { +.openerp .oe_mail_msg_content { margin-left: 60px; } -.oe_mail_msg_content:after { +.openerp .oe_mail_msg_content:after { content: ""; display: block; clear: both; } -.oe_mail_action_textarea { - height: 50px; - padding: 5px; -} - -.oe_mail_msg_image { +.openerp img.oe_mail_msg_image { margin-right: 8px; width: 45px; height: 45px; @@ -175,11 +221,11 @@ li.oe_mail_thread_msg:after, div.oe_mail_thread_act:after { clip: rect(5px, 40px, 45px, 0px); } -p.oe_mail_msg_p_email_header { +.openerp p.oe_mail_msg_p_email_header { border-bottom: 1px solid #D2D9E7; } -.oe_mail_msg_body a.reduce, .oe_mail_msg_body_short a.expand { +.openerp span.oe_mail_msg_body a.reduce, .openerp span.oe_mail_msg_body_short a.expand { color: #4E43E7; } @@ -187,17 +233,17 @@ p.oe_mail_msg_p_email_header { /* Styling (should be openerp) */ /* ------------------------------ */ -ul.oe_mail { +.openerp ul.oe_mail { padding: 0; margin: 0; } -li.oe_mail { +.openerp li.oe_mail { list-style-type: none; margin-bottom: 2px; } -input.oe_mail, textarea.oe_mail { +.openerp input.oe_mail, textarea.oe_mail { width: 100%; padding: 4px; font-size: 12px; @@ -215,7 +261,7 @@ input.oe_mail, textarea.oe_mail { border-radius: 3px; } -input.oe_mail:focus, textarea.oe_mail:focus { +.openerp input.oe_mail:focus, textarea.oe_mail:focus { outline: 0; border-color: rgba(82, 168, 236, 0.8); -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 8px rgba(82, 168, 236, 0.6); @@ -223,37 +269,30 @@ input.oe_mail:focus, textarea.oe_mail:focus { -box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 8px rgba(82, 168, 236, 0.6); } -p.oe_mail_msg { +.openerp p.oe_mail_msg { padding: 0; margin: 0; } -.oe_mail_oe_right { +.openerp .oe_mail_oe_right { float: right; margin-right: 8px; } -.oe_mail_oe_left { +.openerp .oe_mail_oe_left { float: left; margin-right: 8px; } -.oe_mail_oe_fade { - color: #888888; -} - -.oe_mail_oe_bold { - font-weight: bold; -} - -a.oe_mail_oe_intlink { +.openerp a.oe_mail_oe_intlink { color: #8786b7; } -.oe_mail_oe_warning, .oe_mail_oe_warning a { - color: #C03000; +.openerp .oe_mail_oe_bold { + font-weight: bold; } -.oe_mail_oe_space { +.openerp .oe_mail_oe_space { margin-left: 15px; + margin-right: 4px; } diff --git a/addons/mail/static/src/img/feeds-hover.png b/addons/mail/static/src/img/feeds-hover.png Binary files differindex 81f098d35c2..67070d3e7df 100644 --- a/addons/mail/static/src/img/feeds-hover.png +++ b/addons/mail/static/src/img/feeds-hover.png diff --git a/addons/mail/static/src/img/feeds.png b/addons/mail/static/src/img/feeds.png Binary files differindex 5ca849e168c..ac2293c0bf5 100644 --- a/addons/mail/static/src/img/feeds.png +++ b/addons/mail/static/src/img/feeds.png diff --git a/addons/mail/static/src/img/groupdefault.png b/addons/mail/static/src/img/groupdefault.png Binary files differindex fd826837266..cf160022470 100644 --- a/addons/mail/static/src/img/groupdefault.png +++ b/addons/mail/static/src/img/groupdefault.png diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 20ff72645a2..d99674f98a7 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -275,6 +275,8 @@ openerp.mail = function(session) { record.tr_body = this.do_truncate_string(record.body, this.params.msg_more_limit); record.body = this.do_replace_internal_links(record.body); if (record.tr_body) record.tr_body = this.do_replace_internal_links(record.tr_body); + // format date according to the user timezone + record.date = session.web.format_value(record.date, {type:"datetime"}); // render $(session.web.qweb.render('ThreadMsg', {'record': record, 'thread': this, 'params': this.params, 'display': this.display}) ).appendTo(this.$element.children('div.oe_mail_thread_display:first')); @@ -388,6 +390,11 @@ openerp.mail = function(session) { return this.fetch_comments(this.params.limit, this.params.offset, domain); }, + /** + * + * var regex_login = new RegExp(/(^|\s)@((\w|@|\.)*)/g); + * var regex_intlink = new RegExp(/(^|\s)#(\w*[a-zA-Z_]+\w*)\.(\w+[a-zA-Z_]+\w*),(\w+)/g); + */ do_replace_internal_links: function (string) { var self = this; var icon_list = ['al', 'pinky'] @@ -427,7 +434,6 @@ openerp.mail = function(session) { /** * - * var regex_login = new RegExp(/(^|\s)@(\w*[a-zA-Z_.]+\w*\s)/g); * var regex_login = new RegExp(/(^|\s)@((\w|@|\.)*)/g); * var regex_intlink = new RegExp(/(^|\s)#(\w*[a-zA-Z_]+\w*)\.(\w+[a-zA-Z_]+\w*),(\w+)/g); */ @@ -485,11 +491,11 @@ openerp.mail = function(session) { // bind buttons this.$element.find('button.oe_mail_button_followers').click(function () { self.do_toggle_followers(); }).hide(); this.$element.find('button.oe_mail_button_follow').click(function () { self.do_follow(); }) - .mouseover(function () { $(this).html('Follow').addClass('following'); }) - .mouseleave(function () { $(this).html('Not following').removeClass('following'); }); + .mouseover(function () { $(this).html('Follow').removeClass('oe_mail_button_mouseout').addClass('oe_mail_button_mouseover'); }) + .mouseleave(function () { $(this).html('Not following').removeClass('oe_mail_button_mouseover').addClass('oe_mail_button_mouseout'); }); this.$element.find('button.oe_mail_button_unfollow').click(function () { self.do_unfollow(); }) - .mouseover(function () { $(this).html('Unfollow').removeClass('following').addClass('unfollow'); }) - .mouseleave(function () { $(this).html('Following').removeClass('unfollow').addClass('following'); }); + .mouseover(function () { $(this).html('Unfollow').removeClass('oe_mail_button_mouseout').addClass('oe_mail_button_mouseover'); }) + .mouseleave(function () { $(this).html('Following').removeClass('oe_mail_button_mouseover').addClass('oe_mail_button_mouseout'); }); this.reinit(); }, diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 0f49902b6b3..f034b04311d 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -2,13 +2,17 @@ <template> <div t-name="Wall" class="oe_mail_wall"> - <div class="oe_mail_wall_search"> + <div class="oe_view_manager_header"> + <div class="oe_view_manager_row"> + <h2 class="oe_view_title">All Feeds</h2> + </div> </div> <div class="oe_mail_wall_left"> <div class="oe_mail_wall_act"> - <textarea class="oe_mail oe_mail_wall_action_textarea" placeholder="Add a personnal message here..."/><br /> - <button class="oe_mail_wall_button_comment" type="button">Post comment</button> + <textarea class="oe_mail oe_mail_wall_action_textarea" placeholder="Add a personnal message here..."/> + <button class="oe_mail_oe_right oe_mail_wall_button_comment" type="button">Post comment</button> </div> + <div class="oe_clear"></div> <div class="oe_mail_wall_threads"> </div> <div class="oe_mail_wall_more"> @@ -27,8 +31,8 @@ </div> <div class="oe_mail_recthread_right"> <div class="oe_mail_recthread_actions"> - <button type="button" class="oe_mail_button_follow">Not following</button> - <button type="button" class="oe_mail_button_unfollow">Following</button> + <button type="button" class="oe_mail_button_follow oe_mail_button_mouseout">Not following</button> + <button type="button" class="oe_mail_button_unfollow oe_mail_button_mouseout">Following</button> <button type="button" class="oe_mail_button_followers">Display followers</button> </div> <div class="oe_mail_recthread_followers"> @@ -39,11 +43,11 @@ </div> </div> - <ul t-name="Thread" class="oe_mail_thread oe_mail"> + <ul t-name="Thread" class="oe_mail oe_mail_thread"> <div class="oe_mail_thread_act"> <img class="oe_mail_msg_image oe_mail_oe_left" alt="User img"/> <div class="oe_mail_msg_content"> - <textarea class="oe_mail_action_textarea oe_mail" placeholder="Add your comment here..." onfocus="this.value = '';"/><br /> + <textarea class="oe_mail oe_mail_action_textarea" placeholder="Add your comment here..." onfocus="this.value = '';"/><br /> </div> </div> <div class="oe_mail_thread_display"></div> @@ -52,8 +56,8 @@ </div> </ul> - <li t-name="ThreadMsg" t-attf-class="oe_mail_thread_msg oe_mail"> - <div t-attf-class="{record.type}"> + <li t-name="ThreadMsg" t-attf-class="oe_mail oe_mail_thread_msg"> + <div t-attf-class="oe_mail_msg_#{record.type}"> <img class="oe_mail_msg_image oe_mail_oe_left" t-att-src="record.mini_url"/> <div class="oe_mail_msg_content"> <t t-if="record.type == 'email'"><t t-call="EmailDisplay" /></t> @@ -65,7 +69,9 @@ <t t-name="NoteDisplay"> <p class="oe_mail_msg"> - <a href="#" class="intlink oe_mail_oe_intlink" t-attf-data-res-model='{params.res_model}' t-attf-data-res-id='{params.res_id}'><t t-raw="record.record_name"/></a> + <t t-if="params.thread_level > 0"> + <a href="#" class="intlink oe_mail_oe_intlink" t-attf-data-res-model='{params.res_model}' t-attf-data-res-id='{params.res_id}'><t t-raw="record.record_name"/></a> + </t> <span class="oe_mail_msg_body"><t t-raw="record.body"/></span> <t t-if="record.tr_body"><span class="oe_mail_msg_body_short"><t t-raw="record.tr_body"/></span></t> <br /> @@ -73,18 +79,22 @@ <a href="#" class="intlink oe_mail_oe_intlink" data-res-model='res.users' t-attf-data-res-id='{record.user_id[0]}'><t t-raw="record.user_id[1]"/></a> on <t t-raw="record.date"/> </span> - <t t-if="display['show_reply']"><span class="oe_mail_oe_space"><a href="#" class="oe_mail_msg_reply oe_mail_oe_intlink">Reply</a></span></t> + <t t-if="display['show_reply']"><a href="#" class="oe_mail_oe_space oe_mail_msg_reply oe_mail_oe_intlink"> Reply</a> </t> <t t-if="display['show_delete']"> - <t t-if="thread._is_author(record.user_id[0])"><span class="oe_mail_oe_space"><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_delete oe_mail_oe_intlink">Delete</a></span></t> + <t t-if="thread._is_author(record.user_id[0])"><a href="#" t-attf-data-id='{record.id}' class="oe_mail_oe_space oe_mail_msg_delete oe_mail_oe_intlink"> Delete </a></t> </t> <t t-if="display['show_hide']"> - <t t-if="!(thread._is_author(record.user_id[0]))"><span class="oe_mail_oe_space"><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_hide oe_mail_oe_intlink">Hide</a></span></t> + <t t-if="!(thread._is_author(record.user_id[0]))"><a href="#" t-attf-data-id='{record.id}' class="oe_mail_oe_space oe_mail_msg_hide oe_mail_oe_intlink">Hide</a></t> </t> </p> </t> <t t-name="EmailDisplay"> <p class="oe_mail_msg oe_mail_msg_p_email_header"> + <t t-if="params.thread_level > 0"> + <a href="#" class="intlink oe_mail_oe_intlink" t-attf-data-res-model='{params.res_model}' t-attf-data-res-id='{params.res_id}'><t t-raw="record.record_name"/></a> + </t> + <br /> <span class="oe_mail_oe_bold">From:</span> <t t-esc="record.email_from"/> on <span class="oe_mail_oe_fade"><t t-raw="record.date"/></span><br /> <span class="oe_mail_oe_bold">To:</span> <t t-esc="record.email_to"/><br /> <span class="oe_mail_oe_bold">Subject:</span> <t t-esc="record.subject"/><br /> @@ -92,6 +102,13 @@ <p class="oe_mail_msg"> <span class="oe_mail_msg_body"><t t-raw="record.body"/></span> <t t-if="record.tr_body"><span class="oe_mail_msg_body_short"><t t-raw="record.tr_body"/></span></t> + <br /> + <t t-if="display['show_delete']"> + <t t-if="thread._is_author(record.user_id[0])"><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_delete oe_mail_oe_intlink"> Delete </a></t> + </t> + <t t-if="display['show_hide']"> + <t t-if="!(thread._is_author(record.user_id[0]))"><span class="oe_mail_oe_space"><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_hide oe_mail_oe_intlink">Hide</a></span></t> + </t> </p> </t> |
