[IMP] remove formatting code and unused method
bzr revid: fp@openerp.com-20120819165039-kgs71kkn436753tz
This commit is contained in:
parent
1b8d190829
commit
229096453c
|
@ -251,6 +251,7 @@ class mail_thread(osv.Model):
|
|||
|
||||
Please see message_search for more information about the parameters.
|
||||
"""
|
||||
print 'MSG READ', uid, ids, fetch_ancestors, ancestor_ids, limit, offset, domain, context
|
||||
message_ids = self.message_search(cr, uid, ids, fetch_ancestors, ancestor_ids,
|
||||
limit, offset, domain, context=context)
|
||||
messages = self.pool.get('mail.message').read(cr, uid, message_ids, context=context)
|
||||
|
@ -753,17 +754,6 @@ class mail_thread(osv.Model):
|
|||
# Subscription mechanism
|
||||
#------------------------------------------------------
|
||||
|
||||
# FP Note: replaced by message_follower_ids
|
||||
# def message_get_followers(self, cr, uid, ids, context=None):
|
||||
|
||||
def message_read_followers(self, cr, uid, ids, fields=['id', 'name', 'image_small'], context=None):
|
||||
""" Returns the current document followers as a read result. Used
|
||||
mainly for Chatter having only one method to call to have
|
||||
details about users.
|
||||
"""
|
||||
user_ids = self.message_get_followers(cr, uid, ids, context=context)
|
||||
return self.pool.get('res.users').read(cr, uid, user_ids, fields=fields, context=context)
|
||||
|
||||
def message_is_follower(self, cr, uid, ids, user_id = None, context=None):
|
||||
""" Check if uid or user_id (if set) is a follower to the current
|
||||
document.
|
||||
|
|
|
@ -164,18 +164,6 @@ openerp.mail = function(session) {
|
|||
* 5. 'My Label'
|
||||
*/
|
||||
|
||||
/** Removes html tags, except b, em, br, ul, li */
|
||||
do_text_remove_html_tags: function (string) {
|
||||
var html = $('<div/>').text(string.replace(/\s+/g, ' ')).html().replace(new RegExp('<(/)?(b|em|br|br /|ul|li|div)\\s*>', 'gi'), '<$1$2>');
|
||||
return html;
|
||||
},
|
||||
|
||||
/** Replaces line breaks by html line breaks (br) */
|
||||
do_text_nl2br: function (str, is_xhtml) {
|
||||
var break_tag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br />' : '<br>';
|
||||
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ break_tag +'$2');
|
||||
},
|
||||
|
||||
/* Add a prefix before each new line of the original string */
|
||||
do_text_quote: function (str, prefix) {
|
||||
return str.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ break_tag +'$2' + prefix || '> ');
|
||||
|
@ -191,28 +179,6 @@ openerp.mail = function(session) {
|
|||
do_replace_expressions: function (string) {
|
||||
var self = this;
|
||||
var icon_list = ['al', 'pinky']
|
||||
/* shortcut to user: @login */
|
||||
var regex_login = new RegExp(/(^|\s)@((\w|@|\.)*)/g);
|
||||
var regex_res = regex_login.exec(string);
|
||||
while (regex_res != null) {
|
||||
var login = regex_res[2];
|
||||
string = string.replace(regex_res[0], regex_res[1] + '<a href="#" class="oe_mail_internal_link" data-res-model="res.users" data-res-login = ' + login + '>@' + login + '</a>');
|
||||
regex_res = regex_login.exec(string);
|
||||
}
|
||||
/* shortcut for internal document */
|
||||
var regex_login = new RegExp(/(^|\s)\[(\w+).(\w+),(\d)\|*((\w|[@ .,])*)\]/g);
|
||||
var regex_res = regex_login.exec(string);
|
||||
while (regex_res != null) {
|
||||
var res_model = regex_res[2] + '.' + regex_res[3];
|
||||
var res_id = regex_res[4];
|
||||
if (! regex_res[5]) {
|
||||
var label = res_model + ':' + res_id }
|
||||
else {
|
||||
var label = regex_res[5];
|
||||
}
|
||||
string = string.replace(regex_res[0], regex_res[1] + '<a href="#model=' + res_model + '&id=' + res_id + '>' + label + '</a>');
|
||||
regex_res = regex_login.exec(string);
|
||||
}
|
||||
/* special shortcut: :name, try to find an icon if in list */
|
||||
var regex_login = new RegExp(/(^|\s):((\w)*)/g);
|
||||
var regex_res = regex_login.exec(string);
|
||||
|
@ -741,17 +707,12 @@ openerp.mail = function(session) {
|
|||
|
||||
/** Displays a record, performs text/link formatting */
|
||||
display_comment: function (record) {
|
||||
record.body = mail.ChatterUtils.do_text_nl2br($.trim(record.body), true);
|
||||
// if (record.type == 'email' && record.state == 'received') {
|
||||
if (record.type == 'email') {
|
||||
record.mini_url = ('/mail/static/src/img/email_icon.png');
|
||||
} else {
|
||||
record.mini_url = mail.ChatterUtils.get_image(this.session.prefix, this.session.session_id, 'res.users', 'image_small', record.user_id[0]);
|
||||
}
|
||||
// body text manipulation
|
||||
// if (record.subtype == 'plain') {
|
||||
// record.body = mail.ChatterUtils.do_text_remove_html_tags(record.body);
|
||||
// }
|
||||
// record.body = mail.ChatterUtils.do_replace_expressions(record.body);
|
||||
// format date according to the user timezone
|
||||
record.date = session.web.format_value(record.date, {type:"datetime"});
|
||||
|
|
Loading…
Reference in New Issue