Changeset 2722


Ignore:
Timestamp:
05/06/10 15:25:02 (14 years ago)
Author:
amuller
Message:

Ticket #1059 - Tornando draw_messages orientado a objetos

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/js/jscode/draw_api_messages.js

    r2718 r2722  
    147147{ 
    148148    expresso.connector.loadScript("jscode/ccQuickAdd"); 
     149    var id=this.id; 
    149150 
    150151    var array_addrs = ''; 
     
    176177    var sm_envelope_img1 = '<img style="cursor:'+ (is_ie ? 'hand' : 'pointer') +'" title="' + get_lang("Add Contact") + 
    177178    '" onclick="ccQuickAddOne.showList(\''+cc_data+'\')" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/user_card.png">'; 
    178     var to_addybook_add = "<SPAN id='insert_plugin_"+idx_cc+"_"+this.id+"'>"; 
     179    var to_addybook_add = "<SPAN id='insert_plugin_"+idx_cc+"_"+id+"'>"; 
    179180    to_addybook_add += addrs; 
    180181    to_addybook_add +=  sm_envelope_img1; 
     
    265266        else 
    266267                _name = info_msg.from.email.length > _maxChar ? info_msg.from.email.substring(0,_maxChar) + "..." : info_msg.from.email; 
    267  
     268        var id = this.id; 
    268269        td.innerHTML = _name.bold() + ', ' + info_msg.udate; 
    269270        if (info_msg.attachment.names.length > 0) 
    270                 td.innerHTML += "&nbsp<img style='cursor:pointer' onclick='javascript:Element(\"option_hide_more_"+this.id+"\").onclick()' src ='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/clip.gif' title='"+info_msg.attachment.names+"'>"; 
     271                td.innerHTML += "&nbsp<img style='cursor:pointer' onclick='javascript:Element(\"option_hide_more_"+id+"\").onclick()' src ='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/clip.gif' title='"+info_msg.attachment.names+"'>"; 
    271272 
    272273        if (typeof(info_msg.signature) == 'string') 
     
    287288        { 
    288289                var options = createAndSet("TD",['noWrap','width','align'],['true','30%','right']); 
    289                 var option_hide_more = createAndSet("SPAN",['class','value','id'],['message_options','more_options','option_hide_more_'+this.id],get_lang('show details')); 
     290                var option_hide_more = createAndSet("SPAN",['class','value','id'],['message_options','more_options','option_hide_more_'+id],get_lang('show details')); 
    290291                option_hide_more.onclick = function(){ 
    291292                        try{ 
    292                                 var _height = Element("div_message_scroll_"+this.id).style.height; 
     293                                var _height = Element("div_message_scroll_"+id).style.height; 
    293294                        } 
    294295                        catch(e){ 
     
    300301                                this.innerHTML = "<b><u>"+get_lang('hide details')+"</u></b>"; 
    301302                                this.value = 'hide_options'; 
    302                                 Element("div_message_scroll_"+this.id).style.height = (_height - _offset)+"px"; 
    303                                 Element('table_msg_details_'+this.id).style.display = ''; 
     303                                Element("div_message_scroll_"+id).style.height = (_height - _offset)+"px"; 
     304                                Element('table_msg_details_'+id).style.display = ''; 
    304305 
    305306                        } 
     
    307308                                this.innerHTML = get_lang('show details'); 
    308309                                this.value = 'more_options'; 
    309                                 Element("div_message_scroll_"+this.id).style.height = (_height + _offset)+"px"; 
    310                                 Element('table_msg_details_'+this.id).style.display = 'none'; 
     310                                Element("div_message_scroll_"+id).style.height = (_height + _offset)+"px"; 
     311                                Element('table_msg_details_'+id).style.display = 'none'; 
    311312                        } 
    312313                }; 
     
    409410                var option_hide_more = createAndSet("SPAN",['class','value','id'],['message_options','more_options','option_hide_more_'+this.id],get_lang('Show details')); 
    410411                option_hide_more.onclick = function(){ 
    411                         var _height = Element("div_message_scroll_"+this.id).style.height; 
     412                        var _height = Element("div_message_scroll_"+id).style.height; 
    412413                        _height = parseInt(_height.replace("px","")); 
    413414                        var _offset = 35; 
     
    415416                                this.innerHTML = "<b><u>"+get_lang('Hide details')+"</u></b>"; 
    416417                                this.value = 'hide_options'; 
    417                                 Element("div_message_scroll_"+this.id).style.height = (_height - _offset)+"px"; 
    418                                 Element('table_msg_details_'+this.id).style.display = ''; 
     418                                Element("div_message_scroll_"+id).style.height = (_height - _offset)+"px"; 
     419                                Element('table_msg_details_'+id).style.display = ''; 
    419420                        } 
    420421                        else{ 
    421422                                this.innerHTML = get_lang('show details'); 
    422423                                this.value = 'more_options'; 
    423                                 Element("div_message_scroll_"+this.id).style.height = (_height + _offset)+"px"; 
    424                                 Element('table_msg_details_'+this.id).style.display = 'none'; 
     424                                Element("div_message_scroll_"+id).style.height = (_height + _offset)+"px"; 
     425                                Element('table_msg_details_'+id).style.display = 'none'; 
    425426                        } 
    426427                }; 
     
    470471        var td1 = createAndSet('TD',['width'],['7%'],get_lang("From: ")); 
    471472        td1.appendChild(deny_email(info_msg.from.email)); 
     473        var id=this.id; 
    472474 
    473475        if (info_msg.sender){ 
     
    478480                var sender = document.createElement("TD"); 
    479481                sender.className = "header_message_field"; 
    480                 sender.id = "sender_"+this.id; 
    481                 sender.innerHTML += this.draw_plugin_cc(this.id, info_msg.sender.full); 
    482                 var sender_values = createAndSet("INPUT",['id','type','value'],["sender_values_"+this.id,"HIDDEN",info_msg.sender.full]); 
     482                sender.id = "sender_"+id; 
     483                sender.innerHTML += this.draw_plugin_cc(info_msg.sender.full); 
     484                var sender_values = createAndSet("INPUT",['id','type','value'],["sender_values_"+id,"HIDDEN",info_msg.sender.full]); 
    483485 
    484486                tbody_message_others_options.appendChild(appendChilds(tr111, td111, sender, sender_values)); 
     
    488490 
    489491        if (info_msg.Draft != "X"){ 
    490                 from.innerHTML += this.draw_plugin_cc(this.id, info_msg.from); 
     492                from.innerHTML += this.draw_plugin_cc(info_msg.from); 
    491493                tbody_message_others_options.appendChild(tr1); 
    492494        } 
     
    499501                tr11.className = "tr_message_header"; 
    500502                var _td11 = createAndSet('TD',['noWrap'],['true'],get_lang("Reply to")+": "); 
    501                 var _reply_to = createAndSet('TD',['id', 'class'],["reply_to_"+this.id, "header_message_field"],this.draw_plugin_cc(this.id, info_msg.reply_to)); 
    502                 var _reply_to_values = createAndSet('INPUT',['id', 'type', 'value'],["reply_to_values_"+this.id,"HIDDEN",info_msg.reply_to]); 
     503                var _reply_to = createAndSet('TD',['id', 'class'],["reply_to_"+id, "header_message_field"],this.draw_plugin_cc(info_msg.reply_to)); 
     504                var _reply_to_values = createAndSet('INPUT',['id', 'type', 'value'],["reply_to_values_"+id,"HIDDEN",info_msg.reply_to]); 
    503505                tbody_message_others_options.appendChild(appendChilds(tr11,_td11,_reply_to,_reply_to_values)); 
    504506        } 
     
    509511        td2.innerHTML = get_lang("To: "); 
    510512        var to = document.createElement("TD"); 
    511         to.id = "to_"+this.id; 
    512  
    513         var _to_values = createAndSet('INPUT',['id', 'type', 'value'],["to_values_"+this.id, "HIDDEN", info_msg.toaddress2]); 
     513        to.id = "to_"+id; 
     514 
     515        var _to_values = createAndSet('INPUT',['id', 'type', 'value'],["to_values_"+id, "HIDDEN", info_msg.toaddress2]); 
    514516        // Salva a pasta da mensagem 
    515         var _input_cfolder = createAndSet('INPUT',['id', 'name', 'type', 'value'],["input_folder_"+this.id, "input_folder", "hidden", info_msg.msg_folder]); 
     517        var _input_cfolder = createAndSet('INPUT',['id', 'name', 'type', 'value'],["input_folder_"+id, "input_folder", "hidden", info_msg.msg_folder]); 
    516518        td2.appendChild(_input_cfolder); 
    517519 
    518         toaddress_array[this.id] = info_msg.toaddress2.split(","); 
    519         if (toaddress_array[this.id].length > 1){ 
    520                 to.innerHTML += this.draw_plugin_cc(this.id, toaddress_array[this.id][0]); 
    521                 var _div_toaddrs = createAndSet('SPAN',['id','style'],["div_toaddress_"+this.id,'display: inline']," (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+this.id+"','to');>"+get_lang('more')+"</a>)"); 
     520        toaddress_array[id] = info_msg.toaddress2.split(","); 
     521        if (toaddress_array[id].length > 1){ 
     522                to.innerHTML += this.draw_plugin_cc(toaddress_array[id][0]); 
     523                var _div_toaddrs = createAndSet('SPAN',['id','style'],["div_toaddress_"+id,'display: inline']," (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+id+"','to');>"+get_lang('more')+"</a>)"); 
    522524                to.appendChild(_div_toaddrs); 
    523525        } 
    524526        else { 
    525                 to.innerHTML += this.draw_plugin_cc(this.id,toaddress_array[this.id]); 
     527                to.innerHTML += this.draw_plugin_cc(toaddress_array[id]); 
    526528        } 
    527529        to.className = "header_message_field"; 
     
    541543                        div_ccaddress.id = "div_ccaddress_"+this.id; 
    542544                        var div_ccaddress_full = createAndSet("SPAN",['id', 'style'],["div_ccaddress_full_"+this.id, "display: inline"]); 
    543                         cc.innerHTML = this.draw_plugin_cc(this.id, ccaddress_array[this.id][0]); 
     545                        cc.innerHTML = this.draw_plugin_cc(ccaddress_array[this.id][0]); 
    544546                        div_ccaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+this.id+"','cc');>"+get_lang('more')+"</a>)"; 
    545547                        cc.appendChild(div_ccaddress); 
    546548                } 
    547549                else{ 
    548                         cc.innerHTML = this.draw_plugin_cc(this.id, info_msg.cc); 
     550                        cc.innerHTML = this.draw_plugin_cc(info_msg.cc); 
    549551                } 
    550552                tbody_message_others_options.appendChild(appendChilds(tr3,td3,cc,cc_values)); 
     
    16331635 
    16341636                for(var idx = 1 ; idx  < _address.length;idx++) { 
    1635                         div_address_full.innerHTML += isOverLimit ?  '<br>'+_address[idx] : ','+this.draw_plugin_cc(id,_address[idx]); 
     1637                        div_address_full.innerHTML += isOverLimit ?  '<br>'+_address[idx] : ','+this.draw_plugin_cc(_address[idx]); 
    16361638                }                
    16371639                div_address_full.innerHTML += " (<a STYLE='color: RED;' onclick=document.getElementById('div_"+type+"address_full_"+id+"').style.display='none';document.getElementById('div_"+type+"address_"+id+"').style.display='';>"+get_lang('less')+"</a>)"; 
Note: See TracChangeset for help on using the changeset viewer.