From c5ac7217a867146f6456978713cfe511c7a41966 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 4 Oct 2012 11:09:02 +0200 Subject: [PATCH 01/26] [IMP]mail: follower/partners list on wall posting message form bzr revid: chm@openerp.com-20121004090902-p4b3t4zvs9frc3ky --- addons/mail/mail_message_view.xml | 8 +-- addons/mail/static/src/css/mail.css | 36 +++++++++--- addons/mail/static/src/js/mail.js | 89 +++++++++++++++-------------- addons/mail/static/src/xml/mail.xml | 16 ++++++ 4 files changed, 93 insertions(+), 56 deletions(-) diff --git a/addons/mail/mail_message_view.xml b/addons/mail/mail_message_view.xml index 6d854d4d701..2992868bfcf 100644 --- a/addons/mail/mail_message_view.xml +++ b/addons/mail/mail_message_view.xml @@ -88,28 +88,28 @@ Inbox mail.wall + 'context': {'default_model': 'res.partner', 'default_res_id': uid, 'default_is_private':True} }""/> Wall mail.wall + 'context': {'default_model': 'res.partner', 'default_res_id': uid, 'default_is_private':False} }""/> Archives mail.wall + 'context': {'default_model': 'res.partner', 'default_res_id': uid} }""/> Sent mail.wall + 'context': {'default_model': 'res.partner', 'default_res_id': uid} }""/> diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 4ffb9013496..e5a9ad0c825 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -173,16 +173,41 @@ clear: both; } +.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_header .oe_all_follower { + color: blue; +} +.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_header .oe_partner_follower a { + color: red; +} +.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_header .oe_hidden, +.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_header .oe_more_hidden { + display: none; +} + +.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_bottom button.post { + float: left; +} + +.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_bottom span { + float: right; +} + /* default textarea (oe_mail_compose_textarea), and body textarea for compose form view */ -.openerp .oe_mail_msg_content textarea.oe_mail_compose_textarea, -.openerp .oe_mail_msg_content div.oe_mail_compose_message_body textarea { +.openerp .oe_mail.oe_semantic_html_override .oe_mail_compose_textarea textarea, +.openerp .oe_mail div.oe_mail_compose_message_body textarea { width: 474px; - height: 60px; + min-height: 120px; + height: auto; padding: 4px; font-size: 12px; border: 1px solid #cccccc; } +/* not top textarea */ +.openerp .oe_mail.oe_semantic_html_override .oe_semantic_html_override .oe_mail_compose_textarea textarea { + height: 60px; +} + /* default textarea (oe_mail_compose_textarea), and body textarea for compose form view */ .openerp .oe_mail_msg_content textarea.oe_mail_compose_textarea:focus, .openerp .oe_mail_msg_content div.oe_mail_compose_message_body textarea:focus { @@ -413,11 +438,6 @@ } /* Dropdown menu */ -/*.openerp .oe_mail_msg_content .oe_dropdown_toggle { - position: absolute; - top: 0px; - right: 3px; -}*/ .openerp .oe_mail .oe_semantic_html_override { position: relative; diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 8915f1387e1..b2fa071b191 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -336,13 +336,40 @@ openerp.mail = function(session) { */ init: function(parent, options) { this._super(parent); + + // record parameters + var param = options.parameters; + for(var i in param){ + this[i] = param[i]; + } + this.id = param.id || -1; + this.model = param.model || false; + this.parent_id= param.parent_id || false; + this.res_id = param.res_id || false; + this.type = param.type || false; + this.is_author = param.is_author || false; + this.subject = param.subject || false; + this.name = param.name || false; + this.record_name = param.record_name || false; + this.body = param.body || false; + this.vote_user_ids =param.vote_user_ids || []; + this.has_voted = param.has_voted || false; + + this.vote_user_ids = param.vote_user_ids || []; + + this.unread = param.unread || false; + this._date = param.date; + this.author_id = param.author_id || []; + this.attachment_ids = param.attachment_ids || []; + + // record domain and context this.domain = options.domain || []; this.context = _.extend({ default_model: 'mail.thread', default_res_id: 0, default_parent_id: false }, options.context || {}); - // options + // record options this.options={ 'thread' : options.options.thread, 'message' : { @@ -356,31 +383,9 @@ openerp.mail = function(session) { 'truncate_limit': options.options.message.truncate_limit || 250, } }; + // record options and data - this.parent_thread= parent.messages!= undefined ? parent : options.options.thread._parents[0] ; - - var param = options.parameters; - // record parameters - this.id = param.id || -1; - this.model = param.model || false; - this.parent_id= param.parent_id || false; - this.res_id = param.res_id || false; - this.type = param.type || false; - this.is_author = param.is_author || false; - this.subject = param.subject || false; - this.name = param.name || false; - this.record_name = param.record_name || false; - this.body = param.body || false; - this.vote_user_ids =param.vote_user_ids || []; - this.has_voted = param.has_voted || false; - - this.vote_user_ids = param.vote_user_ids || []; - - this.unread = param.unread || false; - this._date = param.date; - this.author_id = param.author_id || []; - this.attachment_ids = param.attachment_ids || []; - + this.parent_thread= parent.messages!= undefined ? parent : options.options.thread._parents[0]; this.thread = false; if( param.id > 0 ) { @@ -468,6 +473,7 @@ openerp.mail = function(session) { if(this.thread){ return false; } + var param = _.extend(self, {'parent_id': self.id}); /*create thread*/ self.thread = new mail.Thread(self, { 'domain': self.domain, @@ -480,11 +486,7 @@ openerp.mail = function(session) { 'thread' : self.options.thread, 'message' : self.options.message }, - 'parameters':{ - 'model': self.model, - 'id': self.id, - 'parent_id': self.id - } + 'parameters': param } ); /*insert thread in parent message*/ @@ -520,7 +522,7 @@ openerp.mail = function(session) { */ on_message_read_unread: function (event) { event.stopPropagation(); - this.animated_destroy({fadeTime:250}); + if($(event.srcElement).hasClass("oe_read")) this.animated_destroy({fadeTime:250}); // if this message is read, all childs message display is read var ids = [this.id].concat( this.get_child_ids() ); this.ds_notification.call('set_message_read', [ids,$(event.srcElement).hasClass("oe_read")]); @@ -667,6 +669,13 @@ openerp.mail = function(session) { this.id= param.id || false; this.model= param.model || false; this.parent_id= param.parent_id || false; + this.is_private = param.is_private || false; + this.partner_ids = []; + for(var i in param.partner_ids){ + if(param.partner_ids[i][0]!=(param.author_id ? param.author_id[0] : -1)){ + this.partner_ids.push(param.partner_ids[i]); + } + } this.messages = []; @@ -720,17 +729,9 @@ openerp.mail = function(session) { * in the function. */ bind_events: function() { var self = this; - // event: writing in basic textarea of composition form (quick reply) - // event: onblur for hide 'Reply' - this.$('.oe_mail_compose_textarea:first textarea') - .keyup(function (event) { - var charCode = (event.which) ? event.which : window.event.keyCode; - if (event.shiftKey && charCode == 13) { this.value = this.value+"\n"; } - else if (charCode == 13) { return self.message_post(); } - }) - .blur(function (event) { - $(this).parents('.oe_mail_thread_action:first').hide(); - }); + self.$('.oe_mail_compose_textarea:first button.post').click(function () {return self.message_post();}); + self.$('.oe_mail_compose_textarea .oe_more').click(function () { var p=$(this).parent(); p.find('.oe_more_hidden, .oe_hidden').show(); p.find('.oe_more').hide(); }); + self.$('.oe_mail_compose_textarea .oe_more_hidden').click(function () { var p=$(this).parent(); p.find('.oe_more_hidden, .oe_hidden').hide(); p.find('.oe_more').show(); }); }, /* get all child message/thread id linked @@ -1037,7 +1038,7 @@ openerp.mail = function(session) { 'options':{ 'thread':{ 'thread_level': this.options.thread_level, - 'show_header_compose': show_header_compose, + 'show_header_compose': 0, //show_header_compose, 'use_composer': show_header_compose, 'display_on_flat':true }, @@ -1142,7 +1143,7 @@ openerp.mail = function(session) { 'thread' :{ 'thread_level': this.options.thread_level, 'use_composer': true, - 'show_header_compose': 1, + 'show_header_compose': 0, }, 'message': { 'show_reply': this.options.thread_level > 0, diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 1e2e6a970b6..b7eebd0b4d1 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -67,7 +67,23 @@
+
+ Post a message to: + All Followers + and + + + + + , others... + <<< + +