Changeset 1445


Ignore:
Timestamp:
09/23/09 16:58:54 (15 years ago)
Author:
niltonneto
Message:

Ticket #651 - Melhorias na função que visualiza cartão/email do remetente.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/js/InfoContact.js

    r1440 r1445  
    3030                this.td = td; 
    3131                clearTimeout(this.timeout); 
    32                 this.timeout = setTimeout("InfoContact.search('"+email+"')",1000); 
    33         }        
     32        } 
     33        this.timeout = setTimeout("InfoContact.search('"+email+"')",1000);               
    3434} 
    3535 
     
    6969        var _this = this; 
    7070        var card = Element("card_cc"); 
     71        card.style.left = findPosX(this.td) + 20; 
     72        var y = findPosY(this.td) + 20 - Element("divScrollMain_"+numBox).scrollTop; 
     73        var w_height = is_ie ? document.body.clientHeight + document.body.scrollTop : window.innerHeight + window.pageYOffset; 
     74        if(y + 160 > w_height) 
     75                card.style.top =  y - 160;       
     76        else 
     77                card.style.top = y;              
     78        card.style.display = ''; 
     79        var cn = data.cn; 
     80        if(cn && cn.toString().length > 35) 
     81                cn = cn.toString().substring(0,30) + "..."; 
     82         
     83        var phoneUser = data.telefone; 
     84        if(preferences.voip_enabled && phoneUser) { 
     85                phoneUser = "<a title=\""+get_lang("Call to Comercial Number")+"\" href=\"#\" onclick=\"InfoContact.connectVoip('"+phoneUser+"', 'com')\">"+phoneUser+"</a>"; 
     86                if(data.mobile){ 
     87                        phoneUser += " / <a title=\""+get_lang("Call to Mobile Number")+"\" href=\"#\" onclick=\"InfoContact.connectVoip('"+data.mobile+"', 'mob')\">"+data.mobile+"</a>"; 
     88                } 
     89        } 
    7190 
    72         //if(card.style.display != '') 
    73          { 
    74                 card.style.left = findPosX(this.td) + 20; 
    75                 var y = findPosY(this.td) + 20 - Element("divScrollMain_"+numBox).scrollTop; 
    76                 var w_height = is_ie ? document.body.clientHeight + document.body.scrollTop : window.innerHeight + window.pageYOffset; 
    77                 if(y + 160 > w_height) 
    78                         card.style.top =  y - 160;       
    79                 else 
    80                         card.style.top = y;              
    81                 card.style.display = ''; 
    82                 var cn = data.cn; 
    83                 if(cn && cn.toString().length > 35) 
    84                         cn = cn.toString().substring(0,30) + "..."; 
    85                  
    86                 var phoneUser = data.telefone; 
    87                 if(preferences.voip_enabled && phoneUser) { 
    88                         phoneUser = "<a title=\""+get_lang("Call to Comercial Number")+"\" href=\"#\" onclick=\"InfoContact.connectVoip('"+phoneUser+"', 'com')\">"+phoneUser+"</a>"; 
    89                         if(data.mobile){ 
    90                                 phoneUser += " / <a title=\""+get_lang("Call to Mobile Number")+"\" href=\"#\" onclick=\"InfoContact.connectVoip('"+data.mobile+"', 'mob')\">"+data.mobile+"</a>"; 
    91                         } 
    92                 } 
    93  
    94                 Element("card_cc_td").innerHTML = "<table cellpadding=0 cellspacing=0 border=0 height='100%' width='100%'><tr><td width='70' height='93' style='padding-top:5px;padding-left:6px' align='center' valign='center'>"+ 
    95                                                                                         "<img src='./inc/show_img.php?email="+data.email+"'></td><td style='padding-left:2px' align='left' valign='top'>"+ 
    96                                                                                         "<br><img align='center' src='templates/"+template+"/images/"+(data.type)+"_catalog.png'><font size=1 color=BLACK>&nbsp;<b>"+get_lang("Sender's Information")+"</b></font>"+ 
    97                                                                                         _this.verifyIM(data.uid,data.email)+ 
    98                                                                                         "<br><img align='center' src='templates/"+template+"/images/phone.gif'>&nbsp;<font  size=1  color=BLACK>"+(phoneUser ? phoneUser : get_lang("None") )+"</font>"+ 
    99                                                                                         "</td></tr><tr><td valign='top' align='center' colspan='2'>"+ 
    100                                                                                         "<font size=1 color=BLACK>"+cn+"</font>"+ 
    101                                                                                         "<br><span title='"+get_lang("Write message")+"' style='cursor:pointer' onclick='InfoContact.sendMail(\""+cn+"\",\""+data.email+"\")'><font size=1 color=DARKBLUE><u>"+data.email+"</u></font></span>"+ 
    102                                                                                         "</td></tr></table>"; 
     91        Element("card_cc_td").innerHTML = "<table cellpadding=0 cellspacing=0 border=0 height='100%' width='100%'><tr><td width='70' height='93' style='padding-top:5px;padding-left:6px' align='center' valign='center'>"+ 
     92                                                                                "<img src='./inc/show_img.php?email="+data.email+"'></td><td style='padding-left:2px' align='left' valign='top'>"+ 
     93                                                                                "<br><img align='center' src='templates/"+template+"/images/"+(data.type)+"_catalog.png'><font size=1 color=BLACK>&nbsp;<b>"+get_lang("Sender's Information")+"</b></font>"+ 
     94                                                                                _this.verifyIM(data.uid,data.email)+ 
     95                                                                                "<br><img align='center' src='templates/"+template+"/images/phone.gif'>&nbsp;<font  size=1  color=BLACK>"+(phoneUser ? phoneUser : get_lang("None") )+"</font>"+ 
     96                                                                                "</td></tr><tr><td valign='top' align='center' colspan='2'>"+ 
     97                                                                                "<font size=1 color=BLACK>"+cn+"</font>"+ 
     98                                                                                "<br><span title='"+get_lang("Write message")+"' style='cursor:pointer' onclick='InfoContact.sendMail(\""+cn+"\",\""+data.email+"\")'><font size=1 color=DARKBLUE><u>"+data.email+"</u></font></span>"+ 
     99                                                                                "</td></tr></table>"; 
    103100 
    104101 
    105         this.timeout_hide = setTimeout("InfoContact.hide()",1000); 
    106         } 
     102        this.timeout_hide = setTimeout("InfoContact.hide()",1000);       
    107103} 
    108104 
    109105emInfoContact.prototype.search = function (email){ 
    110106        var _this = this; 
    111         var ldapSearched = false; 
     107        var trustedDomain = false; 
     108        //      If "preferences.notification_domains" was setted, then verify if "mail" has a trusted domain.    
     109        if (preferences.notification_domains != undefined && preferences.notification_domains != "") { 
     110                var domains = preferences.notification_domains.split(','); 
     111                for (var i = 0; i < domains.length; i++) { 
     112                        if (email.toString().match(domains[i])) 
     113                                trustedDomain = true; 
     114                } 
     115        } 
     116        else 
     117                trustedDomain = true; 
     118 
    112119        var handler_search = function(data){ 
    113                 if(data != null){                        
     120                if(data != null){ 
    114121                        _this.show(data); 
    115122                } 
    116                 else if(!ldapSearched) { 
    117                         ldapSearched = true; 
    118                         var domains = ''; 
    119                         var blocked = true; 
    120                         if (preferences.notification_domains != undefined && preferences.notification_domains != "") 
    121                                 domains = preferences.notification_domains.split(','); 
    122                         for (var i = 0; i < domains.length; i++) 
    123                         { 
    124                                 if (email.toString().match(domains[i])) 
    125                                         blocked=false; 
    126                         } 
    127                         if (!blocked) 
    128                                 cExecute ("$this.ldap_functions.getUserByEmail&email="+email, handler_search); 
    129                         else 
    130                                 _this.label(email); 
    131                 } 
    132123                else 
    133                         _this.label(email); 
    134                          
     124                        _this.label(email);                      
    135125        } 
    136  
    137         if(findPosX(_this.td) == 0) { 
    138                 _this.hide(); 
    139                 return; 
    140         } 
    141  
    142         handler_search(); 
    143         //cExecute ("$this.db_functions.getUserByEmail&email="+email, handler_search); 
     126         
     127        if (trustedDomain) 
     128                cExecute ("$this.ldap_functions.getUserByEmail&email="+email, handler_search); 
     129        else 
     130                _this.label(email); 
    144131} 
    145132 
    146133emInfoContact.prototype.hide = function(){ 
    147134        this.email = ""; 
    148         clearTimeout(this.timeout); 
    149135        if(Element("div_label")) 
    150136                Element("div_label").style.display = 'none'; 
Note: See TracChangeset for help on using the changeset viewer.