[FIX] and IMP also. Fixed a bug in regexp about finding logins beginning with @ (was not taking into account @ inside logins). Also added a :al and :pinky tags in messages, replaced by nice short images.

bzr revid: tde@openerp.com-20120406102759-q47zqi3rndponiyh
This commit is contained in:
Thibault Delavallée
2012-04-06 12:27:59 +02:00
parent 576ce50356
commit d177d00fb2
3 changed files with 26 additions and 7 deletions
+4
View File
@@ -76,6 +76,10 @@ The main features are:
'images/messages_form.jpeg',
'images/messages_list.jpeg',
'static/src/img/email_icong.png',
'static/src/img/_al.png',
'static/src/img/_pincky.png',
'static/src/img/feeds.png',
'static/src/img/feeds-hover.png',
'static/src/img/groupdefault.png',
],
'css': [
+5 -3
View File
@@ -4,9 +4,11 @@
<!-- toplevel menu -->
<record id="mail_feeds_main" model="ir.ui.menu">
<field name="name">Feeds</field>
<field name="sequence">0</field>
<field name="action" ref="action_mail_all_feeds"/>
<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 !-->
+17 -4
View File
@@ -392,12 +392,25 @@ openerp.mail = function(session) {
do_replace_internal_links: function (string) {
var self = this;
var icon_list = ['al', 'pinky']
/* shortcut to user: @login */
var regex_login = new RegExp(/(^|\s)@(\w*)/g);
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], '<a href="#" class="intlink oe_mail_oe_intlink" data-res-model="res.users" data-res-login = ' + login + '>@' + login + '</a>');
string = string.replace(regex_res[0], regex_res[1] + '<a href="#" class="intlink oe_mail_oe_intlink" data-res-model="res.users" data-res-login = ' + login + '>@' + login + '</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);
while (regex_res != null) {
var icon_name = regex_res[2];
console.log(regex_res);
console.log(icon_name);
console.log(icon_list);
if (_.include(icon_list, icon_name))
string = string.replace(regex_res[0], regex_res[1] + '<img src="/mail/static/src/img/_' + icon_name + '.png" width="22px" height="22px" alt="' + icon_name + '"/>');
regex_res = regex_login.exec(string);
}
return string;
@@ -420,12 +433,12 @@ 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_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_check_internal_links: function(string) {
/* shortcut to user: @login */
var regex_login = new RegExp(/(^|\s)@(\w*)/g);
var regex_login = new RegExp(/(^|\s)@((\w|@|\.)*)/g);
var regex_res = regex_login.exec(string);
while (regex_res != null) {
var login = regex_res[2];