Changeset 5911


Ignore:
Timestamp:
04/11/12 11:35:15 (12 years ago)
Author:
gustavo
Message:

Ticket #2611 - Refatorar interface de criação de nova mensagem

Location:
trunk
Files:
4 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/index.php

    r5869 r5911  
    4646                 
    4747                <link rel="stylesheet" type="text/css" href="../prototype/plugins/contextmenu/jquery.contextMenu.css"></link> 
    48                 <link rel="stylesheet" type="text/css" href="../prototype/plugins/zebradialog/css/zebra_dialog.css"></link> 
    49                 <link rel="stylesheet" type="text/css" href="../prototype/plugins/fileupload/jquery.fileupload-ui.css"></link> 
     48                <link rel="stylesheet" type="text/css" href="../prototype/plugins/zebradialog/css/zebra_dialog.css"></link>              
    5049                 
    5150                <link rel="stylesheet" href="../prototype/plugins/farbtastic/farbtastic.css" type="text/css" > 
     
    5958                <script type="text/javascript" src="../prototype/plugins/alphanumeric/jquery.alphanumeric.js"></script> 
    6059                 
    61                 <script type="text/javascript" src="../prototype/plugins/jquery-elastic/jquery.elastic.source.js"></script> 
    62                  
    6360                <script type="text/javascript" src="../prototype/plugins/qtip/jquery.qtip-1.0.0-rc3.min.js"></script> 
    6461                <script type="text/javascript" src="../prototype/plugins/contextmenu/jquery.contextMenu.js"></script> 
    65                 <script type="text/javascript" src="../prototype/plugins/fileupload/jquery.fileupload.js"></script> 
    66                 <script type="text/javascript" src="../prototype/plugins/fileupload/jquery.iframe-transport.js"></script> 
    6762                <!-- <script type="text/javascript" src="../prototype/plugins/contextmenu/jquery.ui.position.js"></script> --> 
    6863                 
  • trunk/expressoMail1_2/js/QuickCatalogSearch.js

    r5786 r5911  
    2222        begin_ = begin; 
    2323        end_   = end; 
    24  
     24                content = $("#content_id_"+ID); 
     25                 
    2526                keypress_read(data); 
    2627                configure_slider(data); 
     
    253254                        var signal = "+"; 
    254255                        var btnClass = "add"; 
    255                         var emailList = $("#" + field_ + "_" + id_).val(); 
     256                        var emailList = content.find(field_).val(); 
    256257                        var emails_adicionados = emailList.split(","); 
    257258                        for(aux=0; aux<emails_adicionados.length -1; aux++) { 
     
    594595                final_contact = "\""+nome +"\" <"+email+">, "; 
    595596                 
    596                 var emailList      = document.getElementById(field_ + "_" + id_).value; 
     597                var emailList      = content.find(field_).val(); 
    597598                //remove os caracteres da busca 
    598599                emailList = emailList.substr(0,emailList.lastIndexOf(',')+1);  
     
    611612                final_contact = final_contact.replace(/\/n/, ""); 
    612613                new_emailList = emailList + final_contact;     
    613         document.getElementById(field_ + "_" + id_).value = new_emailList; 
    614                  
    615                 $("#"+field_+"_"+id_+"").trigger("update"); 
     614        content.find(field_).val(new_emailList); 
     615                 
     616                content.find(field_).trigger("update"); 
    616617                 
    617618                button.onclick = function(){ 
     
    635636                var exist = false; 
    636637                 
    637                 var emailList = $("#" + field_ + "_" + id_).val(); 
     638                var emailList = content.find(field_).val(); 
    638639                var emails_adicionados = emailList.split(","); 
    639640                 
     
    659660                var novos_contatos = emails_adicionados.join(",");   
    660661                novos_contatos = novos_contatos.replace(/%,/g, ""); 
    661                 $("#" + field_ + "_" + id_).val(novos_contatos); 
     662                content.find(field_).val(novos_contatos); 
    662663                 
    663664                button.onclick = function(){ 
     
    671672                }; 
    672673                 
    673                 $("#"+field_+"_"+id_+"").trigger("update"); 
     674                content.find(field_).trigger("update"); 
    674675                button.innerHTML = '<span class="ui-button-text" style="">+</span>'; 
    675676        } 
     
    737738                                $(this).unbind('keydown'); 
    738739                                if (is_ie) {  
    739                                         var range= document.getElementById(field_ + "_" + id_).createTextRange();  
     740                                        var range= content.find(field_).createTextRange();  
    740741                                        range.collapse(false);  
    741742                                        range.select();  
    742743                                } else {  
    743                                         document.getElementById(field_ + "_" + id_).focus();     
     744                                        content.find(field_).focus();     
    744745                                }  
    745746                        }, 
     
    762763                                                                                                $(this).dialog("close"); 
    763764                                                                                                if (is_ie) {  
    764                                                                                                         var range= document.getElementById(field_ + "_" + id_).createTextRange();  
     765                                                                                                        var range= content.find(field_).createTextRange();  
    765766                                                                                                        range.collapse(false);  
    766767                                                                                                        range.select();  
    767768                                                                                                } else {  
    768                                                                                                                 document.getElementById(field_ + "_" + id_).focus();     
     769                                                                                                        content.find(field_).focus();     
    769770                                                                                                }  
    770771                                                                                         }, 
  • trunk/expressoMail1_2/js/abas.js

    r5765 r5911  
    473473function editTest(ID){ 
    474474    var body = document.getElementById('body_'+ ID); 
     475        var content = $('#content_id_'+ ID); 
    475476    if (body) 
    476477    { 
    477         var save_link = Element("save_message_options_"+ID); 
     478        var save_link = content.find(".save"); 
    478479        if (openTab.toPreserve[ID] == undefined) 
    479480                openTab.toPreserve[ID] = false; 
     
    554555        //Caso for uma mensagem anexada tem que deletar ela da lixeira apos fechar a aba 
    555556            var isPartMsg = false; 
     557                        if(!parseInt(id2)) 
     558                                return; 
    556559            var id2 = ID.replace('_r',''); 
    557560            for(var ii = 0; ii < partMsgs.length; ii++) 
  • trunk/expressoMail1_2/js/draw_api.js

    r5882 r5911  
    34523452} 
    34533453 
     3454function mySplit( val ) { 
     3455        return val.split( /,\s*/ ); 
     3456} 
     3457 
     3458function extractLast( term ) { 
     3459        return mySplit( term ).pop(); 
     3460} 
     3461                 
    34543462function draw_new_message(border_ID){ 
    34553463        connector.loadScript("color_palette"); 
    34563464        connector.loadScript('wfolders'); 
     3465         
    34573466        if(typeof(RichTextEditor) == 'undefined' || typeof(ColorPalette) == 'undefined' || typeof(wfolders) == 'undefined') 
    34583467                return false; 
    34593468 
     3469        if(typeof($.fn.elastic) == "undefined"){ 
     3470                $.lazy({ 
     3471                        src: '../prototype/plugins/jquery-elastic/jquery.elastic.source.js', 
     3472                        name: 'elastic' 
     3473                });      
     3474        } 
     3475        if(typeof($.fn.fileupload) == "undefined"){ 
     3476                $.lazy({ 
     3477                        src: '../prototype/plugins/fileupload/jquery.fileupload.js', 
     3478                        name: 'fileupload', 
     3479                        dependencies: { 
     3480                                js: ['../prototype/plugins/fileupload/jquery.iframe-transport.js'], 
     3481                                css: ['../prototype/plugins/fileupload/jquery.fileupload-ui.css'] 
     3482                        } 
     3483                });      
     3484        } 
    34603485        var ID = create_border("",border_ID); 
     3486         
    34613487        if (ID == 0) 
    34623488                return 0; 
    34633489        else if(ID == 'maximo') 
    34643490                return 'maximo'; 
     3491                 
    34653492        hold_session = true; 
    34663493 
    3467         var footer_menu = Element("footer_menu"); 
    3468         if (footer_menu) { 
    3469                 footer_menu.style.display = 'none'; 
    3470         } 
    3471 ///////////////////////////////////////////////////////////////////////////////////////////////////////// 
    3472         var form = document.createElement("FORM"); 
    3473         form.name = "form_message_"+ID; 
    3474         form.id = "form_message_"+ID; 
    3475         form.method = "POST"; 
    3476         form.action = "message:detail"; 
    3477         form.onsubmit = function(){return false;} 
    3478         if(!is_ie) 
    3479                 form.enctype="multipart/form-data"; 
    3480         else 
    3481                 form.encoding="multipart/form-data"; 
    3482         
    3483         var aba_id = document.createElement("INPUT"); 
    3484         aba_id.style.display='none'; 
    3485         aba_id.name = "abaID"; 
    3486         aba_id.value = ID; 
    3487         form.appendChild(aba_id);         
    3488 ///////////////////////////////////////////////////////////////////////////////////////////////////////// 
    3489         //ConstructMenuNewMessage(ID); 
    3490 //////////////////////////////////////////////////////////////////////////////////////////////////////// 
    3491         var content = Element('content_id_' + ID); 
    3492         var table_message = document.createElement("TABLE"); 
    3493         table_message.width = "100%"; 
    3494         var tbody_message = document.createElement("TBODY"); 
    3495         var tr0 = document.createElement("TR"); 
    3496         tr0.className = "tr_message_header"; 
    3497         var td0 = document.createElement("TD"); 
    3498         td0.colSpan = '2'; 
    3499  
    3500         var table_menu_new_message = document.createElement("TABLE"); 
    3501         table_menu_new_message.width = "100%"; 
    3502         table_menu_new_message.border = '0'; 
    3503         table_menu_new_message.className = 'table_message'; 
    3504         var tbody_menu_new_message = document.createElement("TBODY"); 
    3505         var tr_menu_new_message = document.createElement("TR"); 
    3506         tr_menu_new_message.width = "100%"; 
    3507         var td_menu_new_message = document.createElement("TD"); 
    3508         //td_menu_new_message.setAttribute("noWrap","true"); 
    3509         td_menu_new_message.className = "new-message-menu"; 
    3510         td_menu_new_message.width = "100%"; 
    3511         td_menu_new_message.height = "30px"; 
    3512         if ((preferences.save_in_folder == '-1') || (preferences.save_in_folder == '')){ 
    3513                 var option_send = '<button title="Enviar Email" id="send_button_'+ID+'" class="header-button button small" onclick=send_message("'+ID+'","null","null");>'+get_lang("Send")+'</button>'; 
    3514                 //var option_send   = '<input type="button" id="send_button_'+ID+'" class="em_button_like_span" tabindex="1" value="'+get_lang("Send and not file")+'" onclick=send_message("'+ID+'","null","null");>' + ' | '; 
    3515                 if(!expresso_offline) 
    3516                         var option_send_and_file= '<button id="send_and_custom_save_'+ID+'" class="header-button button small" onclick=wfolders.makeWindow("'+ID+'","send_and_file");>'+get_lang("Send and file")+'</button>'; 
    3517                 else 
    3518                         var option_send_and_file=''; 
    3519         } 
    3520         else{ 
    3521                 var option_send = '<button title="'+get_lang("Send Mail")+'" id="send_button_'+ID+'" class="header-button button small" onclick="send_message(\''+ID+'\',\''+preferences.save_in_folder+'\',\'null\');">'+get_lang("Send")+'</button>'; 
    3522                 //var option_send   = '<input type="button" id="send_button_'+ID+'" class="em_button_like_span" tabindex="1" value="'+get_lang("Send")+'" onclick="send_message(\''+ID+'\',\''+preferences.save_in_folder+'\',\'null\');">' + ' | '; 
    3523                 var option_send_and_file=''; 
    3524                 wfolders.alert = true; 
    3525         } 
    3526 //      var option_save_as              = '<span class="message_options" onclick=wfolders.makeWindow("'+ID+'","save");>'+get_lang("Save as")+'</span> | '; 
     3494        if ($("#footer_menu").length){ 
     3495                $("#footer_menu").css('display','none'); 
     3496        } 
     3497        var content = $("#content_id_"+ID).html(DataLayer.render("../prototype/modules/mail/templates/new_message.ejs", {id: ID}));     
     3498        RichTextEditor.loadEditor2(ID); 
    35273499         
    3528         if (!expresso_offline) { 
    3529                 var option_save = '<button title="'+get_lang("Save Mail")+'" id="save_message_options_'+ID+'" class="header-button button small" onclick="save_msg('+ID+');">'+get_lang("Save")+'</button>'; 
    3530                 //var option_search = '<button class="header-button" onclick=openListUsers("'+ID+'");>'+get_lang("Search")+'</button>'; 
    3531         } 
    3532         else { 
    3533                 var option_save = '<input type="hidden" id="save_message_options_'+ID+'">'; 
    3534                 //var option_search = ''; 
    3535         } 
    3536         if (parseInt(preferences.use_important_flag)) 
    3537                 var option_important = '<button title="'+get_lang("Important message")+'" name="important_message_'+ID+'" id="important_message_options_'+ID+'" class="send_option header-button button small">&nbsp;</button>'; 
    3538                  
    3539         var option_confLeitura = '<button title="'+get_lang("Return receipt")+'" name="return_receipt_'+ID+'" id="conf_leitura_message_options_'+ID+'" class="send_option header-button button small">&nbsp;</button>'; 
     3500        //if(!expresso_offline) 
     3501        //      draw_from_field(sel_from,tr1_1); 
    35403502         
    3541         td_menu_new_message.innerHTML = option_send +  option_save + option_send_and_file + (option_important ? option_important: "") +option_confLeitura; //+ option_search; 
     3503        //content.find('name="input_to"').elastic().elastic("destroy"); 
     3504        draw_from_field(content.find(".from-select")[0], content.find(".from-tr")[0]); 
    35423505         
    3543         td_menu_another_adress = document.createElement("TD"); 
    3544         td_menu_another_adress.id = "another_adress_"+ID; 
    3545         //td_menu_another_adress.style.position = "absolute"; 
    3546         td_menu_another_adress.style.width = "1%"; 
    3547         td_menu_another_adress.setAttribute("noWrap","true"); 
    3548         $(td_menu_another_adress).css("text-align","right"); 
    3549         //td_menu_new_message.setAttribute("noWrap","true"); 
     3506        var check_input = function(field){ 
     3507                var check = field.attr("checked"); 
     3508                field.attr("checked", (!check ? true : false)); 
     3509                return (!check ? true : false); 
     3510        } 
    35503511         
    3551         tr_menu_new_message.appendChild(td_menu_new_message); 
    3552         tr_menu_new_message.appendChild(td_menu_another_adress); 
     3512        //AÇÃO GENERICA PARA ADICIONAR/REMOVER 
     3513        var change_text = function(field, text, to_text){ 
     3514                var text = (field.html() == text ? to_text : text); 
     3515                field.html(text); 
     3516        } 
    35533517         
     3518        //AÇÃO GENERICA PARA ADICIONAR/REMOVER CC & CCO 
     3519        var show_hide = function(field, button){ 
     3520                button.toggleClass("expressomail-button-icon-ative"); 
     3521                field.toggle(); 
     3522                field.find("textarea").val(""); 
     3523                if(!field.find("textarea").hasClass("elastic")){ 
     3524                        field.find("textarea").addClass("elastic").elastic().unbind('blur');     
     3525                        input_binds(field.find("textarea")); 
     3526                } 
     3527        }  
    35543528         
    3555         tbody_menu_new_message.appendChild(tr_menu_new_message); 
    3556         table_menu_new_message.appendChild(tbody_menu_new_message); 
    3557  
    3558         content.appendChild(table_menu_new_message); 
    3559         tr0.appendChild(td0); 
    3560         tbody_message.appendChild(tr0); 
    3561 //////////////////////////////////////////////////////////////////////////////////////////////////////// 
    3562         var tr1_1 = document.createElement("TR"); 
    3563         tr1_1.style.display = 'none'; 
    3564         var td1_1 = document.createElement("TD"); 
    3565         td1_1.innerHTML = get_lang("From")+":"; 
    3566         //td1_1.setAttribute("noWrap","noWrap"); 
    3567         //td1_1.style.width = "1%"; 
     3529        var input_binds = function(input){ 
     3530                var mySource = new Array(); 
     3531                var myArray = contacts.split(","); 
     3532                for(var i in myArray){ 
     3533                        var teste = myArray[i].split(";"); 
     3534                        if(teste.length > 1) 
     3535                                mySource.push({name : teste[0], email: teste[1], value : (teste[0] +" - "+teste[1])}); 
     3536                        else 
     3537                                mySource.push({name : "", email: teste[0], value :teste[0]}); 
     3538                } 
     3539                input.bind( "keydown", function( event ) { 
     3540                        if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { 
     3541                                event.preventDefault(); 
     3542                        } 
     3543                        if(event.keyCode == 13){ 
     3544                                event.preventDefault(); 
     3545                        }else if((event.keyCode) == 120){ 
     3546                                emQuickSearch($(this).val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true); 
     3547                        } 
     3548                }).autocomplete({ 
     3549                        minLength: 0,                    
     3550                        source: function( request, response ) { 
     3551                                response( $.ui.autocomplete.filter( 
     3552                                        mySource, extractLast( request.term ) ) ); 
     3553                        }, 
     3554                        focus: function() { 
     3555                                return false; 
     3556                        }, 
     3557                        select: function( event, ui ) { 
     3558                                var terms = mySplit( this.value ); 
     3559                                terms.pop(); 
     3560                                terms.push( (ui.item.name != "" ? "\""+ui.item.name+"\" " : "") + (ui.item.email ? "<"+ui.item.email+">" : "")); 
     3561                                terms.push( "" ); 
     3562                                this.value = terms.join( ", " ); 
     3563                                return false; 
     3564                        } 
     3565                }).data( "autocomplete" )._renderItem = function( ul, item ) { 
     3566                        ul.css({"max-height" : "115px", "overflow-y" : "auto"}); 
     3567                        if( $(ul).find("li").length > 10 ){ 
     3568                                return; 
     3569                        } 
     3570                        return $( "<li></li>" ) 
     3571                                .data( "item.autocomplete", item ) 
     3572                                .append( "<a>" + item.name + " - " + item.email + "</a>" ) 
     3573                                .appendTo( ul ); 
     3574                }; 
     3575                input.parents("tr:first").find("button").click(function(){ 
     3576                        emQuickSearch($(this).parents("tr:first").find("textarea").val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true); 
     3577                }); 
     3578        } 
    35683579         
    3569         var td_from = document.createElement("TD"); 
    3570         //td_from.setAttribute("noWrap","noWrap"); 
    3571         td_from.style.width = "100%"; 
    3572         //td_from.colSpan = "2"; 
    3573         var sel_from = document.createElement('SELECT'); 
    3574         sel_from.id = "from_"+ID; 
    3575         sel_from.name = "input_from"; 
    3576         sel_from.style.width = "100%"; 
    3577         //sel_from.setAttribute("wrap","soft"); 
    3578         td_from.appendChild(sel_from); 
    3579         tr1_1.appendChild(td1_1); 
    3580         tr1_1.appendChild(td_from); 
    3581         tbody_message.appendChild(tr1_1); 
    3582 /////////////////////////////////////////////////////////////////////// 
    3583         var tr1_2 = document.createElement("TR"); 
    3584         tr1_2.id = "tr_replyto_"+ID; 
    3585         var td1_2 = document.createElement("TD"); 
    3586         tr1_2.style.display = 'none'; 
    3587     td1_2.innerHTML = get_lang("Reply to")+":"; 
    3588         //td1_2.setAttribute("noWrap","true"); 
    3589         //td1_2.style.width = "1%"; 
    3590  
    3591         var td_replyto = document.createElement("TD"); 
    3592     //td_replyto.setAttribute("noWrap","true"); 
    3593         td_replyto.style.width = "100%"; 
    3594         //td_replyto.colSpan = "2"; 
    3595         var input_replyto = document.createElement('INPUT'); 
    3596         input_replyto.id = "replyto_"+ID; 
    3597         input_replyto.name = "input_replyto"; 
    3598         //input_replyto.setAttribute("tabIndex","1"); 
    3599     input_replyto.style.width = "100%"; 
    3600         //input_replyto.setAttribute("wrap","soft"); 
    3601     input_replyto.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer));search_contacts('onfocus', this.id);}; 
    3602         input_replyto.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; 
    3603  
    3604         if (!is_ie) 
    3605         { 
    3606         input_replyto.rows = 2; 
    3607             input_replyto.onkeydown = function (e) 
    3608                 { 
    3609             if ((e.keyCode) == 120) //F9 
    3610                         { 
    3611                 emQuickSearch(input_replyto.value, 'replyto', ID, undefined, true); 
    3612                         } 
    3613                         else 
    3614                         { 
    3615                                 if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden')) 
    3616                                 { 
    3617                                         e.preventDefault(); 
    3618                     search_contacts(e.keyCode,this.id); 
    3619                 } 
    3620                         } 
    3621         } 
    3622         input_replyto.onkeyup = function (e) 
    3623         { 
    3624                         if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40)) 
    3625                         { 
    3626                                 search_contacts(e.keyCode,this.id); 
    3627             } 
    3628         } 
    3629         } 
    3630         else 
    3631     { 
    3632                 input_replyto.rows = 3; 
    3633         input_replyto.onkeyup = function (e) 
    3634                 { 
    3635                         if ((window.event.keyCode) == 120) //F9 
    3636                         { 
    3637                                         emQuickSearch(input_replyto.value, 'replyto', ID, undefined, true); 
    3638                         } 
    3639                         else 
    3640                         { 
    3641                 search_contacts(window.event.keyCode,this.id); 
    3642             } 
    3643                 } 
    3644         } 
    3645         td_replyto.appendChild(input_replyto); 
    3646         tr1_2.appendChild(td1_2); 
    3647         tr1_2.appendChild(td_replyto); 
    3648         tbody_message.appendChild(tr1_2); 
    3649 //////////////////////////////////////////////////////////////////////////////////////////////////////// 
    3650         var tr1 = document.createElement("TR"); 
    3651         var td1 = document.createElement("TD"); 
    3652         td1.innerHTML = '<button title="'+get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.')+'" id="to_button_'+ID+'" name="to" class="button small adress_button">'+get_lang("To")+':</button>'; 
    3653         //td1.setAttribute("noWrap","true"); 
    3654         td1.style.width = "70px"; 
    3655  
    3656         var td_to = document.createElement("TD"); 
    3657         //td_to.setAttribute("noWrap","true"); 
    3658         td_to.style.width = "100%"; 
    3659  
    3660         var input_to = document.createElement('TEXTAREA'); 
    3661         input_to.id = "to_"+ID; 
    3662         input_to.name = "input_to"; 
    3663         //input_to.setAttribute("tabIndex","1"); 
    3664         input_to.style.width = "100%"; 
    3665         input_to.style.padding = "1px"; 
    3666         input_to.className = "mail_fields"; 
    3667         //input_to.style.wrap="off"; 
    3668         //input_to.setAttribute("wrap","off"); 
    3669         input_to.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer));search_contacts('onfocus', this.id);}; 
    3670         input_to.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; 
    3671         if (!is_ie) 
    3672         { 
    3673                 input_to.rows = 1; 
    3674                 input_to.onkeydown = function (e) 
    3675                 { 
    3676                         if ((e.keyCode) == 120) //F9 
    3677                         { 
    3678                                 emQuickSearch(input_to.value, 'to', ID, undefined, true); 
    3679                         } 
    3680                         else 
    3681                         { 
    3682                                 if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden')) 
    3683                                 { 
    3684                                         e.preventDefault(); 
    3685                                         search_contacts(e.keyCode,this.id); 
    3686                                 } 
    3687                         } 
    3688                 } 
    3689                 input_to.onkeyup = function (e) 
    3690                 { 
    3691                         if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40)) 
    3692                         { 
    3693                                 search_contacts(e.keyCode,this.id); 
    3694                         } 
    3695                 } 
    3696         } 
    3697         else 
    3698         { 
    3699                 input_to.rows = 1; 
    3700                 input_to.onkeyup = function (e) 
    3701                 { 
    3702                         if ((window.event.keyCode) == 120) //F9 
    3703                         { 
    3704                                 emQuickSearch(input_to.value, 'to', ID, undefined, true); 
    3705                         } 
    3706                         else 
    3707                         { 
    3708                                 search_contacts(window.event.keyCode,this.id); 
    3709                         } 
    3710                 } 
    3711         } 
    3712         td_to.appendChild(input_to); 
    3713  
    3714         var forwarded_local_message = document.createElement("INPUT"); //Hidden para indicar se é um forward de uma mensagem local 
    3715         forwarded_local_message.id = "is_local_forward"+ID; 
    3716         forwarded_local_message.name = "is_local_forward"; 
    3717         forwarded_local_message.type = "HIDDEN"; 
    3718         forwarded_local_message.value = "0"; 
    3719         td_to.appendChild(forwarded_local_message); 
     3580        input_binds(content.find('[name="input_to"]').addClass("elastic").elastic().unbind('blur'));     
    37203581         
    3721         //var td_to2 = document.createElement("TD"); 
    3722         //td_to2.id = "another_adress_"+ID; 
    3723         //td_to2.style.width = "200px"; 
    3724         //td_to2.setAttribute("noWrap","true"); 
     3582        //Botão TextoRico/TextoSimples 
     3583        content.find(".new-msg-head-right-buttons").find(".button").button().filter(".rich-button").click(function(){ 
     3584                RichTextEditor.setPlain(check_input(content.find('[name="textplain_rt_checkbox"]')), ID); 
     3585                change_text($(this).find(".ui-button-text"), get_lang("Rich Text"), get_lang("Simple Text")); 
     3586        }) 
    37253587         
    3726         tr1.appendChild(td1); 
    3727         tr1.appendChild(td_to); 
    3728         //tr1.appendChild(td_to2); 
    3729         tbody_message.appendChild(tr1); 
    3730 ////////////////////////////////////////////////////////////////////////////////////////////////////// 
    3731         var tr2 = document.createElement("TR"); 
    3732         tr2.id = "tr_cc_"+ID; 
    3733         tr2.style.display = 'none'; 
    3734         var td2 = document.createElement("TD"); 
    3735         td2.innerHTML = '<button title="'+get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.')+'" id="cc_button_'+ID+'" name="cc" class="button small adress_button">Cc:</button>'; 
    3736         //td2.setAttribute("noWrap","true"); 
    3737         //td2.style.width = "1%"; 
    3738  
    3739         var td_cc = document.createElement("TD"); 
    3740         //td_cc.setAttribute("noWrap","true"); 
    3741         td_cc.style.width = "100%"; 
    3742         //td_cc.colSpan = "2"; 
    3743          
    3744         var input_cc = document.createElement('TEXTAREA'); 
    3745         input_cc.id = "cc_"+ID; 
    3746         input_cc.name = "input_cc"; 
    3747         //input_cc.setAttribute("tabIndex","1"); 
    3748         input_cc.style.width = "100%"; 
    3749         input_cc.className = "mail_fields"; 
    3750         input_cc.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer));search_contacts('onfocus',this.id);}; 
    3751         input_cc.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; 
    3752         input_cc.rows = 1; 
    3753         //td_cc.setAttribute("noWrap","true"); 
    3754         if (!is_ie) 
    3755         { 
    3756                 //input_cc.rows = 1; 
    3757                 input_cc.onkeydown = function (e) 
    3758                 { 
    3759                         if ((e.keyCode) == 120) //F9 
    3760                         { 
    3761                                 emQuickSearch(input_cc.value, 'cc', ID, undefined, true); 
    3762                         } 
    3763                         else 
    3764                         { 
    3765                                 if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden')) 
    3766                                 { 
    3767                                         e.preventDefault(); 
    3768                                         search_contacts(e.keyCode,this.id); 
    3769                                 } 
    3770                         } 
    3771                 } 
    3772                 input_cc.onkeyup = function (e) 
    3773                 { 
    3774                         if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40)) 
    3775                         { 
    3776                                 search_contacts(e.keyCode,this.id); 
    3777                         } 
    3778                 } 
    3779         } 
    3780         else if (is_ie) 
    3781         { 
    3782                 //input_cc.rows = 1; 
    3783                 input_cc.onkeyup = function (e) 
    3784                 { 
    3785                         if ((window.event.keyCode) == 120) //F9 
    3786                         { 
    3787                                 emQuickSearch(input_cc.value, 'cc', ID, undefined, true); 
    3788                         } 
    3789                         else 
    3790                         { 
    3791                                 search_contacts(window.event.keyCode,this.id); 
    3792                         } 
    3793                 } 
    3794         } 
    3795         td_cc.appendChild(input_cc); 
    3796         tr2.appendChild(td2); 
    3797         tr2.appendChild(td_cc); 
    3798         tbody_message.appendChild(tr2); 
    3799 ////////////////////////////////////////////////////////////////////////////////////////////////////// 
    3800          
    3801         if( allow_hidden_copy )  
    3802         {  
    3803                   
    3804                 var tr3 = document.createElement("TR"); 
    3805                 tr3.id = "tr_cco_"+ID; 
    3806                 tr3.style.display = 'none'; 
    3807                 var td3 = document.createElement("TD"); 
    3808                 //td3.setAttribute("noWrap","true"); 
    3809                 td3.innerHTML = '<button title="'+get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.')+'" id="cc_button_'+ID+'" name="cco" class="button small adress_button">'+get_lang("CCo")+':</button>'; 
    3810                 //td3.style.width = "1%"; 
    3811  
    3812                 var td_cco = document.createElement("TD"); 
    3813                 //td_cco.colSpan = "2"; 
    3814                 //td_cco.setAttribute("noWrap","true"); 
    3815                 td_cco.style.width = "100%"; 
    3816  
    3817                 var input_cco = document.createElement('TEXTAREA'); 
    3818                 input_cco.id = "cco_"+ID; 
    3819                 input_cco.name = "input_cco"; 
    3820                 //input_cco.setAttribute("tabIndex","1"); 
    3821                 input_cco.style.width = "100%"; 
    3822                 input_cco.className = "mail_fields"; 
    3823                 input_cco.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer));search_contacts('onfocus',this.id);}; 
    3824                 input_cco.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; 
    3825                 input_cco.rows = 1; 
    3826                 if (!is_ie) 
    3827                 { 
    3828                          
    3829                         input_cco.onkeydown  = function (e)  
    3830                         { 
    3831                                 if ((e.keyCode) == 120) //F9 
    3832                                 { 
    3833                                         emQuickSearch(input_cco.value, 'cco', ID, undefined, true); 
    3834                                 } 
    3835                                 else 
    3836                                 { 
    3837                                         if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden')) 
    3838                                         { 
    3839                                                 e.preventDefault(); 
    3840                                                 search_contacts(e.keyCode,this.id); 
    3841                                         } 
    3842                                 } 
    3843                         } 
    3844                         input_cco.onkeyup = function (e) 
    3845                         { 
    3846                                 if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40)) 
    3847                                 { 
    3848                                         search_contacts(e.keyCode,this.id); 
    3849                                 } 
    3850                         } 
    3851                 } 
    3852                 else if (is_ie) 
    3853                 { 
    3854                         input_cco.onkeyup = function (e) 
    3855                         { 
    3856                                 if ((window.event.keyCode) == 120) //F9 
    3857                                 { 
    3858                                         emQuickSearch(input_cco.value, 'cco', ID, undefined, true); 
    3859                                 } 
    3860                                 else 
    3861                                 { 
    3862                                         search_contacts(window.event.keyCode,this.id); 
    3863                                 } 
    3864                         } 
    3865                 } 
    3866  
    3867                 td_cco.appendChild(input_cco); 
    3868  
    3869                 tr3.appendChild(td3); 
    3870                 tr3.appendChild(td_cco); 
    3871                 tbody_message.appendChild(tr3); 
    3872         }  
    3873 ////////////////////////////////////////////////////////////////////////////////////////////////////// 
    3874         var a_cc_link = document.createElement('button'); 
    3875         a_cc_link.innerHTML = get_lang('Add CC'); 
    3876         a_cc_link.id = "a_cc_link_"+ID; 
    3877         a_cc_link.className = "button small another_adress"; 
    3878         //a_cc_link.setAttribute("tabIndex","-1"); 
    3879         var cc_load = ""; 
    3880         a_cc_link.onclick = function () { 
    3881                 var rm = false; 
    3882                 var remove = function(){ 
    3883                         document.getElementById('tr_cc_'+ID).style.display = 'none'; 
    3884                         $("#cc_"+ID).parent().find("div").remove(); 
    3885                         $("#cc_"+ID).val(""); 
    3886                         $("#a_cc_link_"+ID).toggleClass("expressomail-button-icon-ative"); 
    3887                         rm = true; 
    3888                 } 
    3889                 if(!($("#cc_"+ID).parent().find("div")[0])){ 
    3890                         document.getElementById('tr_cc_'+ID).style.display = ''; 
    3891                         document.getElementById('cc_'+ID).style.width = "100%"; 
    3892                         $(this).find("span").html(get_lang('Remove CC')); 
    3893                         $("#cc_"+ID).elastic().unbind('blur'); 
    3894                         $(this).toggleClass("expressomail-button-icon-ative"); 
    3895                 } 
    3896                 else{ 
    3897                         if($("#cc_"+ID).val() != ""){ 
    3898                                 if(confirm("Tem certeza que deseja remover o campo CC")){ 
    3899                                         remove(); 
    3900                                         $(this).find("span").html(get_lang('Add CC')); 
    3901                                 } 
    3902                         }else{ 
    3903                                 remove(); 
    3904                                 $(this).find("span").html(get_lang('Add CC')); 
    3905                         } 
    3906                 } 
    3907                 if (rm)  
    3908                         input_to.focus();  
    3909                 else      
    3910                         input_cc.focus();                
    3911                 return false; 
    3912         }; 
    3913          
    3914         if( allow_hidden_copy )  
    3915         {  
    3916                 var a_cco_link = document.createElement('button');  
    3917                 a_cco_link.innerHTML = get_lang('Add BCC');  
    3918                 a_cco_link.id = "a_cco_link_"+ID;  
    3919                 a_cco_link.className = "button small another_adress"; 
    3920                 //a_cco_link.setAttribute("tabIndex","-1");  
    3921                 var cco_load = ""; 
    3922                 a_cco_link.onclick = function () { 
    3923                         var rm = false; 
    3924                         var remove = function(){ 
    3925                                 document.getElementById('tr_cco_'+ID).style.display = 'none'; 
    3926                                 $("#cco_"+ID).parent().find("div").remove(); 
    3927                                 $("#cco_"+ID).val(""); 
    3928                                 $("#a_cco_link_"+ID).toggleClass("expressomail-button-icon-ative"); 
    3929                                 rm = true; 
    3930                         } 
    3931                         if(!($("#cco_"+ID).parent().find("div")[0])){ 
    3932                                 document.getElementById('tr_cco_'+ID).style.display=''; 
    3933                                 document.getElementById('cco_'+ID).style.width = "100%"; 
    3934                                 $(this).find("span").html(get_lang('Remove CCo')); 
    3935                                 $("#cco_"+ID).elastic().unbind('blur'); 
    3936                                 $(this).toggleClass("expressomail-button-icon-ative"); 
    3937                         } 
    3938                         else{ 
    3939                         if($("#cco_"+ID).val() != ""){ 
    3940                                 if(confirm("Tem certeza que deseja remover o campo CCO")){ 
    3941                                         remove(); 
    3942                                         $(this).find("span").html(get_lang('Add BCC')); 
    3943                                 } 
    3944                         }else{ 
    3945                                 remove(); 
    3946                                 $(this).find("span").html(get_lang('Add BCC')); 
    3947                         } 
    3948                 } 
    3949                         if (rm) { 
    3950                                 if (Element('tr_cc_'+ID).style.display != 'none') 
    3951                                    input_cc.focus(); 
    3952                                 else 
    3953                                         input_to.focus(); 
    3954                         } 
    3955                         else 
    3956                                 input_cco.focus(); 
    3957                 };  
    3958                 //td2_link.appendChild(a_cco_link);  
    3959         } 
    3960          
    3961 ////////////////////////////////////////////////////////////////////////////////////////////////////// 
    3962         var tr4 = document.createElement("TR"); 
    3963         var td4 = document.createElement("TD"); 
    3964         td4.innerHTML = get_lang("Subject")+":"; 
    3965         //td4.style.width = "1%"; 
    3966         var td_subject = document.createElement("TD"); 
    3967         var input_subject = document.createElement('input'); 
    3968         input_subject.id = "subject_"+ID; 
    3969         input_subject.name = "input_subject"; 
    3970         //input_subject.setAttribute("tabIndex","1"); 
    3971         input_subject.style.width = "100%"; 
    3972         input_subject.setAttribute("autocomplete","off"); 
    3973         input_subject.onkeydown = function(event){   
    3974                 var k;   
    3975                 var e = event || window.event; 
    3976                 if(window.event){ 
    3977                         k = window.event.keyCode;   
    3978                 }else{ 
    3979                         k = event.keyCode;   
    3980                 } 
    3981                 if (k == 9){ 
    3982                         if (e.shiftKey){ 
    3983                                 if (Element('tr_cco_'+ID).style.display != 'none'){ 
    3984                                         input_cco.focus(); 
    3985                                 } 
    3986                                 else if (Element('tr_cc_'+ID).style.display != 'none'){ 
    3987                                         input_cc.focus(); 
    3988                                 } 
    3989                                 else { 
    3990                                         Element("to_"+ID).focus(); 
    3991                                 } 
    3992                                 e.preventDefault(); 
    3993                         } 
    3994                         else{           
    3995                                 RichTextEditor.focus(ID);   
    3996                                 return false;   
    3997                         } 
    3998                 }    
    3999         }  
    4000         //td_subject.colSpan = "2"; 
    4001         td_subject.appendChild(input_subject); 
    4002         tr4.appendChild(td4); 
    4003         tr4.appendChild(td_subject); 
    4004         tbody_message.appendChild(tr4); 
    4005 ////////////////////////////////////////////////////////////////////////////////////////////////////// 
    4006         var tr5 = document.createElement("TR"); 
    4007         var td_content = ''; 
    4008  
    4009         if((preferences.use_assinar_criptografar != '0')) { 
    4010                 if(parseInt(preferences.use_signature_digital_cripto)==1) { 
    4011                         var input_return_digital_chk = (parseInt(preferences.use_signature_digital)==1) ? 'checked="checked"' : ''; 
    4012                         var input_return_digital = '<input type="checkbox" class="checkbox" name="input_return_digital" id="return_digital_'+ID+'" '+input_return_digital_chk+' />'; 
    4013                         var label_return_digital = '<label for="return_digital_'+ID+'">'+get_lang("Digitally sign message?")+'</label>'; 
    4014                         var button_return_digital = '<button title="'+get_lang("Include digital signature")+'" class="send_option header-button button small '+(input_return_digital_chk != "" ? "expressomail-button-icon-ative" : "")+'" name="return_digital_'+ID+'" id="return_digital_options_'+ID+'">&nbsp;</button>'; 
    4015                         td_content += input_return_digital + label_return_digital; 
    4016                         $("#content_id_"+ID).find(".new-message-menu").append(button_return_digital); 
    4017                          
    4018                         var input_return_cripto_chk = (parseInt(preferences.use_signature_cripto)==1) ? 'checked="checked"' : ''; 
    4019                         var input_return_cripto = '<input type="checkbox" class="checkbox" name="input_return_cripto" id="return_cripto_'+ID+' '+input_return_cripto_chk+' />'; 
    4020                         var label_return_cripto = '<label for="return_cripto_'+ID+'">'+get_lang("Digitally crypt message?")+'</label>'; 
    4021                         var button_return_cripto = '<button title="'+get_lang("Encrypted email")+'" class="send_option header-button button small '+(input_return_cripto_chk != "" ? "expressomail-button-icon-ative" : "")+'" name="return_cripto_'+ID+'" id="return_cripto_options_'+ID+'">&nbsp;</button>'; 
    4022                         $("#content_id_"+ID).find(".new-message-menu").append(button_return_cripto); 
    4023                         td_content += input_return_cripto + label_return_cripto; 
    4024                 } 
    4025         } 
    4026  
    4027         var input_return_receipt_chk = (preferences.return_recipient_deafault != '0') ? 'checked="checked"' : ''; 
    4028         var input_return_receipt = '<input type="checkbox" class="checkbox" name="input_return_receipt" id="return_receipt_'+ID+'" '+input_return_receipt_chk+' />'; 
    4029         var label_return_receipt = '<label for="return_receipt_'+ID+'">'+get_lang("Return receipt")+'</label>'; 
    4030         if(input_return_receipt_chk != ''){ 
    4031                 $("#conf_leitura_message_options_"+ID).toggleClass("expressomail-button-icon-ative"); 
    4032         } 
    4033         td_content += input_return_receipt + label_return_receipt; 
    4034  
    4035         if (parseInt(preferences.use_important_flag)) 
    4036                             { 
    4037                 var input_important = '<input type="checkbox" class="checkbox" id="important_message_'+ID+'" name="input_important_message" />'; 
    4038                 var label_important = '<label for="important_message_'+ID+'">'+get_lang("Important message")+'</label>'; 
    4039                 //jQuery(tbody_message).append('<tr><td> </td><td>'+input_important+label_important+'</td</tr>'); 
    4040  
    4041                 td_content += input_important + label_important; 
    4042         } 
    4043  
    4044         if (!expresso_offline) { 
    4045                 var onclk_text_plain = 'javascript:RichTextEditor.setPlain(this.checked, '+ID+');'; 
    4046                 var input_text_plain = '<input type="checkbox" class="checkbox" name="textplain_rt_checkbox" id="textplain_rt_checkbox_'+ID+'" onclick="'+onclk_text_plain+'"/>'; 
    4047                 var label_text_plain = '<label for="textplain_rt_checkbox_'+ID+'">'+get_lang('Simple text mode')+'</label>'; 
    4048                          
    4049                 td_content += input_text_plain + label_text_plain; 
    4050         } 
    4051  
    4052         jQuery(tr5).append('<td>&nbsp;</td><td class="message-general-options" colspan="2">'+td_content+'</td>'); 
    4053         tr5.style.display = "none" 
    4054         tbody_message.appendChild(tr5); 
    4055  
    4056         var tr5 = document.createElement("TR"); 
    4057         var td5_link = document.createElement("TD"); 
    4058         var td5_input = document.createElement("TD"); 
    4059         td5_input.innerHTML = "&nbsp;" 
    4060         td5_link.setAttribute("valign","top"); 
    4061         $(td5_link).append('<div id="message-attach-dialog" title="'+get_lang('Select messages to attach...')+'"> </div>'); 
    4062         $(td5_link).prepend(DataLayer.render("../prototype/modules/mail/templates/attachment.ejs", {ID:ID})); 
    4063         tr5.appendChild(td5_input); 
    4064         tr5.appendChild(td5_link); 
    4065          
    4066         tbody_message.appendChild(tr5); 
    4067         var tr6 = document.createElement("TR"); 
    4068         var td6_link  = document.createElement("TD"); 
    4069         var td6_input = document.createElement("TD"); 
    4070         tr6.appendChild(td6_link); 
    4071          
    4072         tr6.appendChild(td6_input); 
    4073         tbody_message.appendChild(tr6); 
    4074  
    4075         var tr7 = document.createElement("TR"); 
    4076         //var td5 = document.createElement("TD"); 
    4077         //td5.innerHTML = "&nbsp;"; 
    4078         var td_body = document.createElement("TD"); 
    4079         td_body.setAttribute("colSpan","2"); 
    4080         var div_body_position = document.createElement("DIV"); 
    4081         div_body_position.id = "body_position_" + ID; 
    4082         td_body.appendChild(div_body_position); 
    4083         //tr5.appendChild(td5); 
    4084         tr7.appendChild(td_body); 
    4085         tbody_message.appendChild(tr7); 
    4086         var _div = document.createElement("DIV"); 
    4087         _div.id = "div_message_scroll_"+ID; 
    4088         _div.style.overflow = "auto"; 
    4089         _div.style.width = "100%"; 
    4090  
    4091         // Hide the contac tips and re-position the pallete color. 
    4092         _div.onscroll = function() { 
    4093                 var intElemScrollTop = Element("div_message_scroll_"+ID).scrollTop; 
    4094                 if (!is_ie) 
    4095                         ColorPalette.repos(intElemScrollTop); 
    4096                 Tooltip.scrollChanged(); 
    4097         }; 
    4098 ////////////////////////////////////////////////////////////////////////////////////////////////////// 
    4099         _div.appendChild(form); 
    4100         content.appendChild(_div); 
    4101         table_message.appendChild(tbody_message); 
    4102         form.appendChild(table_message); 
    4103                  
    4104         var attDisposition = document.createElement("INPUT"); 
    4105         attDisposition.style.display='none'; 
    4106         attDisposition.id = 'attDisposition'+ID; 
    4107         attDisposition.name = 'attDisposition'+ID; 
    4108         attDisposition.value = 'attachment'; 
    4109         form.appendChild(attDisposition); 
    4110          
    4111         RichTextEditor.loadEditor(ID); 
    4112          
    4113         var rich_button = document.createElement("button"); 
    4114          
    4115         if(preferences.plain_text_editor == 1){ 
    4116                 var texto = get_lang("Rich Text"); 
    4117         }else{ 
    4118                 var texto = get_lang("Simple Text"); 
    4119         } 
    4120                  
    4121         rich_button.innerHTML = texto; 
    4122         rich_button.className = "button small rich-button"; 
    4123         rich_button.name = "textplain_rt_checkbox_"+ID; 
    4124          
    4125 ////////////////////////////////////////////////////////////////////////////////////////////////////// 
    4126         if(!expresso_offline) 
    4127                 draw_from_field(sel_from,tr1_1); 
    4128                  
    4129         resizeWindow(); 
    4130  
    4131         if ( ! expresso_offline ) 
    4132         { 
    4133                         if ( mobile_device ) 
    4134                         { 
    4135                                         text_plain.click( ); 
    4136                                         text_plain.parentNode.style.display = 'none'; 
    4137                         } 
    4138         } 
    4139         //var a_cc_link2 = document.createElement("button"); 
    4140          
    4141         $("#another_adress_"+ID).append(a_cc_link); 
    4142          
    4143         if(a_cco_link != undefined) 
    4144                 $("#another_adress_"+ID).append(a_cco_link); 
    4145                  
    4146         $("#another_adress_"+ID).append(rich_button); 
    4147          
    4148         $("#to_"+ID).elastic().unbind('blur');   
    4149         $(".another_adress").button(); 
    4150         $(".rich-button").button(); 
    4151         $(".rich-button").click(function(){ 
    4152                 //TO-DO : Se o usuário clicar varias vezes no botão, a função de iniciar o ckeditor se perde e morre. 
    4153                 $(this).button({disabled: true}); 
    4154                 if($(this).find("span:first-child").html() == get_lang("Rich text")){ 
    4155                         $(this).find("span:first-child").html(get_lang("Simple Text")); 
    4156                 }else{ 
    4157                         $(this).find("span:first-child").html(get_lang("Rich Text")); 
    4158                 } 
    4159                  
    4160                 var check = $("#"+$(this).attr("name")).attr("checked"); 
    4161                 $("#"+$(this).attr("name")).attr("checked", (!check ? true : false)); 
    4162                 $("#"+$(this).attr("name")).trigger('click'); 
    4163                 $("#"+$(this).attr("name")).attr("checked", (!check ? true : false)); 
    4164                 //$(this).button({ disabled: false }); 
    4165                 if (RichTextEditor.plain[id] != true)  
    4166                         setTimeout("RichTextEditor.focus("+ID+")",100);                   
    4167                 else   
    4168                         $('#body_'+ID).focus(); 
     3588        //Botão Adicionar/Remover CCO 
     3589        .end().filter(".cco-button").click(function(){ 
     3590                show_hide(content.find(".cco-tr"), $(this)); 
     3591                change_text($(this).find(".ui-button-text"), get_lang("Add BCC"), get_lang('Remove CCo')); 
     3592        }) 
     3593        //Botão Adicionar/Remover CC 
     3594        .end().filter(".cc-button").click(function(){ 
     3595                show_hide(content.find(".cc-tr"), $(this)); 
     3596                change_text($(this).find(".ui-button-text"), get_lang("Add CC"), get_lang('Remove CC')); 
    41693597        }); 
    41703598         
    4171         if($("#send_and_custom_save_"+ID)[0]) 
    4172                 $("#send_and_custom_save_"+ID).button({ 
    4173                         icons : { 
    4174                                 primary :"expressomail-icon-save_and_send" 
    4175                         } 
    4176                 }) 
    4177         $("#content_id_"+ID).find(".adress_button").button().click(function(){ 
    4178                 emQuickSearch($("#"+($(this).attr("name"))+"_"+ID).val(), $(this).attr("name"), ID, undefined, true); 
     3599        //Botão Para, CC, CCO 
     3600        content.find(".adress_button").button().click(function(){ 
     3601                //var search_for = $(this).parents("tr:first").find(".new-message-input").val(); 
    41793602        }); 
    41803603         
    4181         $("#send_button_"+ID).button({ 
     3604        //BOTAO ENVIAR 
     3605        content.find(".send").button({ 
    41823606                icons : { 
    41833607                        primary : "expressomail-icon-send" 
    41843608                } 
    4185         }).next().button({ 
     3609        }).click(function(){ 
     3610                send_message(ID,preferences.save_in_folder,null); 
     3611        }) 
     3612        //BOTAO SALVAR E ENVIAR 
     3613        .end().find(".save-and-send").button({ 
     3614                icons : { 
     3615                        primary : "expressomail-icon-send" 
     3616                } 
     3617        }).click(function(){ 
     3618                wfolders.makeWindow(ID,"send_and_file"); 
     3619        }) 
     3620        //BOTAO SALVAR 
     3621        .end().find(".save").button({ 
    41863622                icons : { 
    41873623                        primary : "expressomail-icon-save" 
    41883624                } 
    4189         }); 
    4190         $("#content_id_"+ID).find("[name=return_receipt_"+ID+"]").button({ 
     3625        }).click(function(){ 
     3626                save_msg(ID); 
     3627        }) 
     3628        //BOTAO CONF. LEITURA 
     3629        .end().find(".return-recept").button({ 
    41913630                icons : { 
    41923631                        primary : "expressomail-icon-read-confirmation" 
    41933632                } 
    4194         }); 
    4195         $("#important_message_options_"+ID).button({ 
     3633        }).click(function(){ 
     3634                check_input(content.find('[name="input_return_receipt"]')); 
     3635                $(this).toggleClass("expressomail-button-icon-ative"); 
     3636        }) 
     3637        //BOTAO IMPORTANTE 
     3638        .end().find(".important").button({ 
    41963639                icons : { 
    41973640                        primary : "expressomail-icon-important" 
    41983641                } 
    4199         }); 
    4200         $("#return_digital_options_"+ID).button({ 
     3642        }).click(function(){ 
     3643                check_input(content.find('[name="input_important_message"]')); 
     3644                $(this).toggleClass("expressomail-button-icon-ative"); 
     3645        }) 
     3646        //BOTAO ASS. DIGITAL 
     3647        .end().find(".return_digital").button({ 
    42013648                icons : { 
    42023649                        primary : "expressomail-icon-signature" 
    42033650                } 
    4204         }); 
    4205         $("#return_cripto_options_"+ID).button({ 
     3651        }).click(function(){ 
     3652                check_input(content.find('[name="input_return_digital"]')); 
     3653                $(this).toggleClass("expressomail-button-icon-ative"); 
     3654        }) 
     3655        //BOTAO EMAIL CRYPT 
     3656        .end().find(".return_cripto").button({ 
    42063657                icons : { 
    42073658                        primary : "expressomail-icon-encryption" 
    42083659                } 
     3660        }).click(function(){ 
     3661                check_input(content.find('[name="input_return_cripto"]')); 
     3662                $(this).toggleClass("expressomail-button-icon-ative"); 
    42093663        }); 
    42103664         
    4211         $("#content_id_"+ID).find(".send_option").click(function(){ 
    4212                 var check = $("#"+$(this).attr("name")).attr("checked"); 
    4213                 $("#"+$(this).attr("name")).attr("checked", (!check ? true : false)); 
    4214                 $(this).toggleClass("expressomail-button-icon-ative"); 
    4215         }); 
    4216          
    4217         var fileUploadMSG = $('#fileupload_msg'+ID); 
    4218         var maxAttachmentSise = (preferences.max_attachment_size !== "" && preferences.max_attachment_size != 0) ? (parseInt(preferences.max_attachment_size.replace('M', '')) * 1048576 ) : false; 
     3665        content.find(".attachment td").filter(".value").prepend(DataLayer.render("../prototype/modules/mail/templates/attachment.ejs", {ID:ID})); 
     3666        var fileUploadMSG = $('#fileupload_msg'+ID); 
     3667        var maxAttachmentSise = (preferences.max_attachment_size !== "" && preferences.max_attachment_size != 0) ? (parseInt(preferences.max_attachment_size.replace('M', '')) * 1048576 ) : false; 
    42193668 
    42203669        fileUploadMSG.find(".button-files-upload").fileupload({ 
     
    42243673                                setTimeout(function() { 
    42253674                                        $('#attDisposition'+ID).val('attachment'); 
    4226                                         delete data.fileInput;  
    42273675                                        data.submit(); 
    42283676                                }, 5000); 
    4229                         }                
    4230                         var attach = {}; 
    4231                         attach.fullFileName = data.files[0].name; 
    4232                         attach.fileName = data.files[0].name; 
    4233                         if(data.files[0].name.length > 50) 
    4234                                 attach.fileName = data.files[0].name.substr(0, 32) + " ... " + data.files[0].name.substr(data.files[0].name.length-9, data.files[0].name.length); 
    4235                         attach.fileSize = formatBytes(data.files[0].size); 
    4236                         if(maxAttachmentSise && data.files[0].size > maxAttachmentSise) 
    4237                                 attach.error = 'Tamanho de arquivo nao permitido!!' 
    4238  
    4239                         var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach}));                            
    4240                         upload.find('.button.close').button({ 
    4241                                 icons: { 
    4242                                         primary: "ui-icon-close" 
    4243                                 }, 
    4244                                 text: false 
    4245                         }).click(function(){ 
    4246                                 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
    4247                                 fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); 
    4248                                 delAttachment(ID, idAttach) 
    4249                                 $(this).parent().remove(); 
    4250                         }); 
    4251  
    4252                         fileUploadMSG.find('.attachments-list').append(upload); 
    4253  
    4254                         if(!maxAttachmentSise || data.files[0].size < maxAttachmentSise) 
    4255                             fileUploadMSG.find('.attachments-list').find('[type=file]').addClass('hidden');      
    4256                         else 
    4257                             fileUploadMSG.find(' .fileinput-button.new').removeClass('new'); 
     3677                        } 
    42583678                }, 
     3679                change: function (e, data) { 
     3680                        $.each(data.files, function (index, file) { 
     3681                                var attach = {}; 
     3682                                attach.fullFileName = file.name; 
     3683                                attach.fileName = file.name; 
     3684                                if(file.name.length > 50) 
     3685                                        attach.fileName = file.name.substr(0, 32) + " ... " + file.name.substr(file.name.length-9, file.name.length); 
     3686                                attach.fileSize = formatBytes(file.size); 
     3687                                if(maxAttachmentSise && file.size > maxAttachmentSise) 
     3688                                        attach.error = 'Tamanho de arquivo nao permitido!!' 
     3689                                 
     3690                                var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach}));                            
     3691                                upload.find('.button.close').button({ 
     3692                                        icons: { 
     3693                                                primary: "ui-icon-close" 
     3694                                        }, 
     3695                                        text: false 
     3696                                }).click(function(){ 
     3697                                        var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
     3698                                        fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); 
     3699                                        delAttachment(ID, idAttach) 
     3700                                        $(this).parent().remove(); 
     3701                                }); 
     3702                                 
     3703                                fileUploadMSG.find('.attachments-list').append(upload); 
     3704 
     3705                                if(!maxAttachmentSise || file.size < maxAttachmentSise){ 
     3706                                        fileUploadMSG.find('.fileinput-button.new').append(data.fileInput[0]).removeClass('new'); 
     3707                                        fileUploadMSG.find('.attachments-list').find('[type=file]').addClass('hidden');  
     3708                                }else 
     3709                                        fileUploadMSG.find(' .fileinput-button.new').removeClass('new'); 
     3710 
     3711                })}, 
     3712 
    42593713                done: function(e, data){ 
    42603714                        if(!!data.result && data.result != "[]" ){ 
     
    42763730                } 
    42773731        }).find('[name="files[]"]').css({"height" : "20px", "width": "100px", "border-width": "0 0 0px 0px", "-moz-transform" : "none","-o-transform" : 'none'}); 
    4278          
     3732 
     3733                 
    42793734       fileUploadMSG.find("span.message-attach-link").click(function(event){ 
    42803735                jQuery('#message-attach-dialog').html(DataLayer.render("../prototype/modules/attach_message/attach_message.ejs", {})); 
  • trunk/expressoMail1_2/js/main.js

    r5891 r5911  
    283283                { 
    284284                        away=false; 
    285                         var save_link = Element("save_message_options_"+border_id); 
     285                        var save_link = content.find(".save"); 
    286286                        save_link.onclick = function onclick(event) {openTab.toPreserve[border_id] = true;save_msg(border_id);} ; 
    287                         $("#save_message_options_"+border_id).button({disabled: false}); 
     287                        save_link.button({disabled: false}); 
    288288                        $(".header-button").button(); 
    289289                }; 
    290  
    291                 var subject_obj = document.getElementById('subject_'+border_id); 
     290                var content = $("#content_id_"+border_id); 
     291                 
     292                var subject_obj = content.find(".subject"); 
    292293                if ( subject_obj.addEventListener ) 
    293294                                subject_obj.addEventListener('keypress', keypress_handler, false); 
     
    295296                        subject_obj.attachEvent('onkeypress', keypress_handler); 
    296297 
    297                 var to_obj = document.getElementById('to_'+border_id); 
     298                var to_obj = content.find('[name="input_to"]'); 
    298299                if ( to_obj.addEventListener ) 
    299300                                to_obj.addEventListener('keypress', keypress_handler, false); 
     
    301302                        to_obj.attachEvent('onkeypress', keypress_handler); 
    302303                         
    303                 var cc_obj = document.getElementById('cc_'+border_id); 
     304                var cc_obj = content.find('[name="input_cc"]'); 
    304305                if ( cc_obj.addEventListener ) 
    305306                                cc_obj.addEventListener('keypress', keypress_handler, false); 
     
    307308                        cc_obj.attachEvent('onkeypress', keypress_handler); 
    308309                 
    309                 if(document.getElementById('cco_'+border_id)){ 
    310                         var cco_obj = document.getElementById('cco_'+border_id); 
     310                if(content.find('[name="input_cco"]').length){ 
     311                        var cco_obj = content.find('[name="input_cco"]'); 
    311312                        if ( cco_obj.addEventListener ) 
    312313                                cco_obj.addEventListener('keypress', keypress_handler, false); 
     
    14551456                    if (type != 'edit') 
    14561457                    { 
    1457                         return new_border_ID; 
     1458                                                delete_border(currentTab); 
     1459                                                new_border_ID = draw_new_message(parseInt(border_ID)); 
    14581460                    }                    
    14591461                } else { 
     
    15601562        if(type!="new" && type!="edit" && document.getElementById("is_local_"+border_ID) != null) 
    15611563                data.is_local_message = (document.getElementById("is_local_"+border_ID).value=="1")?true:false; 
    1562         switch(type){ 
     1564                 
     1565        if(typeof($.fn.elastic) == "undefined"){ 
     1566                $.lazy({ 
     1567                        src: '../prototype/plugins/jquery-elastic/jquery.elastic.source.js', 
     1568                        name: 'elastic' 
     1569                }); 
     1570        } 
     1571        var content = $("#content_id_"+new_border_ID); 
     1572        content.find('[name="msg_reply_from"]').val($("#msg_number_" + border_ID).val()); 
     1573         
     1574switch(type){ 
    15631575                case "reply_without_history": 
    15641576                        RichTextEditor.replyController = true; //Seta o editor como modo reply 
    1565                         Element("to_" + new_border_ID).value = data.to; 
     1577                        content.find('[name="input_to"]').val(data.to); 
    15661578                        title = "Re: " + data.subject; 
    1567                         Element("subject_" + new_border_ID).value = "Re: " + data.subject;                       
    1568                         useOriginalAttachments(new_border_ID,border_ID);                         
    1569                                
     1579                        content.find(".subject").val("Re: " + data.subject);                     
     1580                        useOriginalAttachments(new_border_ID,border_ID);                         
    15701581 
    15711582                        // Insert the signature automaticaly at message body if use_signature preference is set 
    15721583                        if (preferences.use_signature == "1"){   
    1573                                                 RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>' + signature ,true) ;       
    1574                                         }  
    1575                         msg_reply_from = document.createElement('input'); 
    1576                         msg_reply_from.id = "msg_reply_from_" + new_border_ID; 
    1577                         msg_reply_from.type = "hidden"; 
    1578                         msg_reply_from.value = Element("msg_number_" + border_ID).value; 
    1579                         Element("content_id_" + new_border_ID).appendChild(msg_reply_from); 
     1584                                RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>' + signature ,true) ;       
     1585                        }  
    15801586                        break; 
    15811587                case "reply_with_history": 
     
    15831589                        RichTextEditor.replyController = true; //Seta o editor como modo reply  
    15841590                        title = "Re: " + data.subject; 
    1585                         Element("subject_" + new_border_ID).value = "Re: " + data.subject; 
    1586                         Element("to_" + new_border_ID).value = data.to; 
     1591                        content.find(".subject").val("Re: " + data.subject); 
     1592                        content.find('[name="input_to"]').val(data.to); 
    15871593 
    15881594                        useOriginalAttachments(new_border_ID,border_ID); 
     
    15941600                        else 
    15951601                                RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>'+ block_quoted_body,true); 
    1596                         msg_reply_from = document.createElement('input'); 
    1597                         msg_reply_from.id = "msg_reply_from_" + new_border_ID; 
    1598                         msg_reply_from.type = "hidden"; 
    1599                         msg_reply_from.value = Element("msg_number_" + border_ID).value; 
    1600                         Element("content_id_" + new_border_ID).appendChild(msg_reply_from); 
    16011602                        break; 
    16021603                case "reply_to_all_without_history": 
     
    16101611 
    16111612                        title = "Re: " + data.subject; 
    1612                         Element("subject_" + new_border_ID).value = "Re: " + data.subject; 
     1613                        content.find(".subject").val("Re: " + data.subject); 
    16131614                         
    16141615                        if (data.to.indexOf(Element("user_email").value) > 0 ) 
    1615                                 Element("to_" + new_border_ID).value = data.to_all; 
     1616                                content.find('[name="input_to"]').val(data.to_all); 
    16161617                        else 
    1617                                 Element("to_" + new_border_ID).value = data.to + ',' + data.to_all; 
    1618                         //Element("to_" + new_border_ID).value = data.to; 
    1619                         //Element("to_" + new_border_ID).value += ', ' + data.to_all; 
     1618                                content.find('[name="input_to"]').val(data.to + ',' + data.to_all); 
     1619                                 
     1620                        if (data.cc){ 
     1621                                data.cc = new Array(); 
     1622                                data.cc = removeUserEmail(_array_cc); 
     1623                                data.cc = removeAlternative(data.cc,_array_to_alternative); 
     1624                                        if (data.cc != get_lang("undisclosed-recipient")) 
     1625                                                data.cc = data.cc.join(","); 
     1626                                        else 
     1627                                                data.cc = "";    
     1628                                if(data.cc != ""){ 
     1629                                        content.find('[name="input_cc"]').val(data.cc); 
     1630                                        content.find(".cc-tr").css("display"," ");//cc-button 
     1631                                        //document.getElementById("a_cc_link" + new_border_ID).value = data.cc; 
     1632                                        content.find(".cc-button").toggleClass("expressomail-button-icon-ative"); 
     1633                                        content.find(".cc-button").find("span").html("Remover CC"); 
     1634                                        content.find('[name="input_cc"]').elastic().unbind('blur'); 
     1635                                        content.find('[name="input_cc"]').trigger("update"); 
     1636                                } 
     1637                        } 
     1638                         
     1639                        useOriginalAttachments(new_border_ID,border_ID);   
     1640                        if (preferences.use_signature == "1")   
     1641                                RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>' + signature,true); 
     1642                                 
     1643                        break; 
     1644                case "reply_to_all_with_history": 
     1645                        RichTextEditor.replyController = true; //Seta o editor como modo reply  
     1646                        //delete user email from to_all array. 
     1647                        data.to_all = new Array(); 
     1648                        data.to_all = removeUserEmail(_array_to_all); 
     1649                        data.to_all = removeAlternative(data.to_all,_array_to_alternative); 
     1650                 
     1651                        if (data.to_all != get_lang("undisclosed-recipient")) 
     1652                                data.to_all = data.to_all.join(","); 
     1653                        else 
     1654                                data.to_all = ""; 
     1655                        title = "Re: " + data.subject; 
    16201656                         
     1657                        if (data.to.indexOf(Element("user_email").value) > 0 ) 
     1658                                content.find('[name="input_to"]').val(data.to_all); 
     1659                        else 
     1660                                content.find('[name="input_to"]').val(data.to + ',' + data.to_all);                      
    16211661                        if (data.cc){ 
    16221662                                data.cc = new Array(); 
     
    16271667                                        else 
    16281668                                                data.cc = "";                    
    1629                                 if(data.cc == ""){ 
    1630                                         //document.getElementById("cc_" + new_border_ID).value = data.cc; 
    1631                                         document.getElementById("tr_cc_" + new_border_ID).style.display='none'; 
    1632                                 }else{ 
    1633                                         document.getElementById("cc_" + new_border_ID).value = data.cc; 
    1634                                         document.getElementById("tr_cc_" + new_border_ID).style.display=''; 
    1635                                         //document.getElementById("a_cc_link" + new_border_ID).value = data.cc; 
    1636                                         $("#a_cc_link_"+new_border_ID).toggleClass("expressomail-button-icon-ative"); 
    1637                                         $("#a_cc_link_"+new_border_ID).find("span").html("Remover CC"); 
    1638                                         $("#cc_"+new_border_ID).elastic().unbind('blur'); 
    1639                                         $("#cc_"+new_border_ID).trigger("update"); 
     1669                                if(data.cc != ""){ 
     1670                                        content.find('[name="input_cc"]').val(data.cc); 
     1671                                        content.find(".cc-tr").show(); 
     1672                                        content.find(".cc-button").toggleClass("expressomail-button-icon-ative"); 
     1673                                        content.find(".cc-button").find("span").html("Remover CC"); 
     1674                                        content.find('[name="input_cc"]').elastic().unbind('blur'); 
     1675                                        content.find('[name="input_cc"]').trigger("update"); 
    16401676                                } 
    16411677                        } 
    1642                          
    1643                         useOriginalAttachments(new_border_ID,border_ID);   
    1644  
    1645                         // Insert the signature automaticaly at message body if use_signature preference is set 
    1646                         if (preferences.use_signature == "1")   
    1647                                 RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>' + signature,true);  
    1648                         msg_reply_from = document.createElement('input'); 
    1649                         msg_reply_from.id = "msg_reply_from_" + new_border_ID; 
    1650                         msg_reply_from.type = "hidden"; 
    1651                         msg_reply_from.value = Element("msg_number_" + border_ID).value; 
    1652                         Element("content_id_" + new_border_ID).appendChild(msg_reply_from); 
    1653                         break; 
    1654                 case "reply_to_all_with_history": 
    1655                         RichTextEditor.replyController = true; //Seta o editor como modo reply  
    1656                         //delete user email from to_all array. 
    1657                         data.to_all = new Array(); 
    1658                         data.to_all = removeUserEmail(_array_to_all); 
    1659                         data.to_all = removeAlternative(data.to_all,_array_to_alternative); 
    1660                  
    1661                         if (data.to_all != get_lang("undisclosed-recipient")) 
    1662                                 data.to_all = data.to_all.join(","); 
    1663                         else 
    1664                                 data.to_all = ""; 
    1665                         title = "Re: " + data.subject; 
    1666                          
    1667                         if (data.to.indexOf(Element("user_email").value) > 0 ) 
    1668                                 Element("to_" + new_border_ID).value = data.to_all; 
    1669                         else 
    1670                                 Element("to_" + new_border_ID).value = data.to + ',' + data.to_all;                      
    1671                         if (data.cc){ 
    1672                                 data.cc = new Array(); 
    1673                                 data.cc = removeUserEmail(_array_cc); 
    1674                                 data.cc = removeAlternative(data.cc,_array_to_alternative); 
    1675                                         if (data.cc != get_lang("undisclosed-recipient")) 
    1676                                                 data.cc = data.cc.join(","); 
    1677                                         else 
    1678                                                 data.cc = "";                    
    1679                                 if(data.cc == ""){ 
    1680                                         //document.getElementById("cc_" + new_border_ID).value = data.cc; 
    1681                                         document.getElementById("tr_cc_" + new_border_ID).style.display='none'; 
    1682                                 }else{ 
    1683                                         document.getElementById("cc_" + new_border_ID).value = data.cc; 
    1684                                         document.getElementById("tr_cc_" + new_border_ID).style.display=''; 
    1685                                         //document.getElementById("a_cc_link" + new_border_ID).value = data.cc; 
    1686                                         $("#a_cc_link_"+new_border_ID).toggleClass("expressomail-button-icon-ative"); 
    1687                                         $("#a_cc_link_"+new_border_ID).find("span").html("Remover CC"); 
    1688                                         $("#cc_"+new_border_ID).elastic().unbind('blur'); 
    1689                                         $("#cc_"+new_border_ID).trigger("update"); 
    1690                                 } 
    1691                         } 
    1692                         document.getElementById("subject_" + new_border_ID).value = "Re: " + data.subject; 
     1678                        content.find(".subject").val("Re: " + data.subject); 
    16931679                        useOriginalAttachments(new_border_ID,border_ID); 
    16941680                        block_quoted_body = make_body_reply(data.body, data.to, data.date_day, data.date_hour); 
    1695                         // Insert the signature automaticaly at message body if use_signature preference is set 
     1681                         
    16961682                        if (preferences.use_signature == "1")   
    1697                                                                         RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>' + signature + '<div><br type="_moz"></div>'+ block_quoted_body,true);  
    1698                                         else                    
    1699                                             RichTextEditor.setInitData(new_border_ID,block_quoted_body,true);      
    1700                         msg_reply_from = document.createElement('input'); 
    1701                         msg_reply_from.id = "msg_reply_from_" + new_border_ID; 
    1702                         msg_reply_from.type = "hidden"; 
    1703                         msg_reply_from.value = Element("msg_number_" + border_ID).value; 
    1704                         Element("content_id_" + new_border_ID).appendChild(msg_reply_from); 
     1683                                RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>' + signature + '<div><br type="_moz"></div>'+ block_quoted_body,true);  
     1684                        else                    
     1685                                RichTextEditor.setInitData(new_border_ID,block_quoted_body,true);  
     1686                                 
    17051687                        break; 
    17061688                case "forward": 
    1707                          
    1708                         msg_forward_from = document.createElement('input'); 
    1709                         msg_forward_from.id = "msg_forward_from_" + new_border_ID; 
    1710                         msg_forward_from.type = "hidden"; 
    1711                         msg_forward_from.value = Element("msg_number_" + border_ID).value; 
    1712                         Element("content_id_" + new_border_ID).appendChild(msg_forward_from); 
    17131689                        title = "Fw: " + data.subject; 
    1714                         document.getElementById("subject_" + new_border_ID).value = "Fw: " + data.subject; 
     1690                        content.find(".subject").val("Fw: " + data.subject); 
    17151691                        var divFiles = Element("divFiles_"+new_border_ID); 
    17161692                        var campo_arquivo; 
     
    17411717                                        } 
    17421718                                } 
    1743                                 Element("to_" + new_border_ID).value = _to +','; 
     1719                                content.find('[name="input_to"]').val(_to +','); 
    17441720                                Element('msg_number').value = ''; 
    17451721                        } 
     
    17491725                                RichTextEditor.setInitData(new_border_ID, '<div><br type="_moz"></div>' + signature); 
    17501726                         else 
    1751                            $('#to_'+new_border_ID).focus();  
     1727                           content.find('[name="input_to"]').focus();  
    17521728                        break; 
    17531729                case "edit": 
     
    17641740                        } 
    17651741 
    1766                         Element("to_" + new_border_ID).value = data.to; 
     1742                        content.find('[name="input_to"]').val(data.to); 
    17671743                        if (data.cc){ 
    17681744                                data.cc = data.cc.replace(/&lt;/gi,"<"); 
    17691745                                data.cc = data.cc.replace(/&gt;/gi,">"); 
    1770                                 Element("cc_" + new_border_ID).value = data.cc; 
    1771                                 Element("cc_" + new_border_ID).style.display = ""; 
    1772                                 Element("tr_cc_"+ new_border_ID).style.display = ''; 
    1773                                 Element("cc_" + new_border_ID).style.width = "100%"; 
    1774                                 $("#a_cc_link_"+new_border_ID).toggleClass("expressomail-button-icon-ative"); 
    1775                                 $("#a_cc_link_"+new_border_ID).find("span").html("Remover CC"); 
    1776                                 $("#cc_"+new_border_ID).elastic().unbind('blur'); 
    1777                                 $("#cc_"+new_border_ID).trigger("update"); 
    1778                                 //Element("a_cc_link_" + new_border_ID).style.display = 'none'; 
    1779                                 //if(Element("cco_" + new_border_ID) != null) 
    1780                                 //      Element("space_link_" + new_border_ID).style.display = 'none'; 
     1746                                content.find('[name="input_cc"]').val(data.cc); 
     1747                                content.find(".cc-tr").show(); 
     1748                                content.find(".cc-button").toggleClass("expressomail-button-icon-ative"); 
     1749                                content.find(".cc-button").find("span").html(get_lang('Remove CC')); 
     1750                                content.find('[name="input_cc"]').elastic().unbind('blur'); 
     1751                                content.find('[name="input_cc"]').trigger("update"); 
    17811752                        } 
    17821753                        if (data.cco){ 
    1783                                 if(Element("cco_" + new_border_ID) != null){ 
    1784                                 Element("cco_" + new_border_ID).value = data.cco; 
    1785                                 Element("cco_" + new_border_ID).style.display = ''; 
    1786                                 Element("cco_" + new_border_ID).style.width = "100%"; 
    1787                                 Element("tr_cco_"+ new_border_ID).style.display = ''; 
    1788                                 $("#a_cco_link_"+new_border_ID).toggleClass("expressomail-button-icon-ative"); 
    1789                                 $("#a_cco_link_"+new_border_ID).find("span").html("Remover CC"); 
    1790                                 $("#cco_"+new_border_ID).elastic().unbind('blur'); 
    1791                                 $("#cco_"+new_border_ID).trigger("update"); 
    1792                                 //Element("space_link_" + new_border_ID).style.display = 'none'; 
    1793                                 //Element("a_cco_link_" + new_border_ID).style.display = 'none'; 
    1794                                 Element("tr_cco_"+ new_border_ID).style.display = ''; 
    1795                         } 
    1796                         } 
    1797                         Element("subject_" + new_border_ID).value = data.subject; 
     1754                                if(content.find('[name="input_cco"]').length){ 
     1755                                        content.find('[name="input_cco"]').val(data.cco); 
     1756                                        content.find(".cco-tr").show(); 
     1757                                        content.find(".cco-button").toggleClass("expressomail-button-icon-ative"); 
     1758                                        content.find(".cco-button").find("span").html(get_lang('Remove CCo')); 
     1759                                        content.find('[name="input_cco"]').elastic().unbind('blur'); 
     1760                                        content.find('[name="input_cco"]').trigger("update"); 
     1761                                } 
     1762                        } 
     1763                        content.find(".subject").val(data.subject); 
    17981764                         
    1799                         if( Element("disposition_notification_" + border_ID) ){ 
    1800                                 $("#return_receipt_"+new_border_ID).attr("checked", true); 
    1801                                 $("[name=return_receipt_"+new_border_ID+"]").toggleClass("expressomail-button-icon-ative"); 
     1765                        if( $("#disposition_notification_" + border_ID).length ){ 
     1766                                content.find('[name="input_return_receipt"]').attr("checked", true); 
     1767                                content.find(".return-recept").toggleClass("expressomail-button-icon-ative"); 
    18021768                                //Element("return_receipt_" + new_border_ID).checked = true; 
    18031769                        } 
     
    18061772                        if(element_important_message) { 
    18071773                                         
    1808                                 if(Element("disposition_important_" + border_ID)){ 
    1809                                         $("#important_message_"+new_border_ID).attr("checked", true); 
    1810                                         $("[name=important_message_"+new_border_ID+"]").toggleClass("expressomail-button-icon-ative"); 
    1811                                         //element_important_message.checked = true;              
     1774                                if($("#disposition_important_" + border_ID).length){ 
     1775                                        content.find('[name="input_important_message"]').attr("checked", true); 
     1776                                        content.find(".important").toggleClass("expressomail-button-icon-ative");        
    18121777                                } 
    18131778                        } 
    18141779 
    18151780                        if (Element("attachments_" + border_ID)) 
    1816                                addOriginalAttachments(new_border_ID,border_ID); 
     1781                                addOriginalAttachments(new_border_ID,border_ID); 
    18171782                          
    18181783                        RichTextEditor.setInitData(new_border_ID, data.body, 'edit'); 
     
    18221787        } 
    18231788         
    1824         $("#to_"+new_border_ID).trigger("update");       
    1825         var txtarea = Element('body_'+new_border_ID); 
     1789        content.find('[name="input_to"]').trigger("update");     
     1790        var txtarea = $('#body_'+new_border_ID); 
    18261791        var height = document.body.scrollHeight - 330; 
    1827         txtarea.style.overflowY = "auto"; 
    1828         txtarea.style.height = height; 
     1792        txtarea.css("overflowY","auto"); 
     1793        txtarea.css("height",height); 
    18291794        //Insere o conteúdo da mensagem e a assinatura no editor de texto simples 
    1830      if (preferences.plain_text_editor == 1){ 
    1831            Element('textplain_rt_checkbox_'+new_border_ID).checked = true; 
    1832            if (txtarea != null){ 
    1833                   if (data.body != undefined) 
    1834                     txtarea.value = data.body.replace( new RegExp('<pre>((.\n*)*)</pre>'),'$1'); 
    1835               if (preferences.use_signature == "1") 
    1836             txtarea.value += '\n' + signature;      
    1837        } 
    1838          }  
     1795        if (preferences.plain_text_editor == 1){ 
     1796                Element('textplain_rt_checkbox_'+new_border_ID).checked = true; 
     1797                if (txtarea != null){ 
     1798                        if (data.body != undefined) 
     1799                                txtarea.val(data.body.replace( new RegExp('<pre>((.\n*)*)</pre>'),'$1')); 
     1800                        if (preferences.use_signature == "1") 
     1801                                txtarea.val(txtarea.val + '\n' + signature);      
     1802                } 
     1803        }  
    18391804        Element("border_id_" + new_border_ID).title = title; 
    18401805        set_border_caption("border_id_" + new_border_ID, title); 
     
    18431808        return new_border_ID; //Preciso retornar o ID da nova mensagem. 
    18441809} 
    1845  
    18461810 
    18471811//Remove o email do usuario ao responder a todos 
     
    22042168function send_valided_message(ID, folder, folder_name) 
    22052169{  
    2206          
    2207        if (preferences.auto_save_draft == 1) 
    2208            autoSaveControl.status[ID] = true; 
    2209          
    2210         var save_link = Element("save_message_options_"+ID); 
    2211         var onClick = save_link.onclick; 
     2170        if (preferences.auto_save_draft == 1) 
     2171           autoSaveControl.status[ID] = true; 
     2172        var content = $("#content_id_"+ID); 
     2173        var save_link = $("#content_id_"+ID).find(".save"); 
     2174        var onClick = save_link.onclick; 
    22122175        save_link.onclick = ''; 
    2213         $("#save_message_options_"+ID).button({disabled: true}); 
     2176        save_link.button({disabled: true}); 
    22142177 
    22152178        ID_tmp = ID; 
     
    22942257        form.parentNode.appendChild(mail_type); 
    22952258 
    2296         var _subject = trim(Element("subject_"+ID).value); 
     2259        var _subject = trim(content.find(".subject").val()); 
    22972260        if((_subject.length == 0) && !confirm(get_lang("Send this message without a subject?"))) { 
    2298                 save_link.onclick = onClick; 
    2299                 Element("subject_"+ID).focus(); 
     2261                save_link.click(onClick); 
     2262                content.find(".subject").focus(); 
    23002263                return; 
    23012264        } 
    2302         stringEmail = Element("to_"+ID).value; 
     2265        stringEmail = content.find('[name="input_to"]').val(); 
    23032266         
    2304         if ( Element("cco_"+ID) != null) 
    2305                 if(Element("tr_cco_"+ID).style.display != "none") 
    2306                         stringEmail += Element("cco_"+ID).value =='' ? "":", "+Element("cco_"+ID).value; 
     2267        if ( content.find('[name="input_cco"]').length) 
     2268                if(content.find(".cco-tr").css("display") != "none") 
     2269                        stringEmail += content.find('[name="input_cco"]').val() =='' ? "":", "+content.find('[name="input_cco"]').val(); 
    23072270                         
    2308         if(Element("tr_cc_"+ID).style.display != "none") 
    2309                 stringEmail += Element("cc_"+ID).value =='' ? "":", "+Element("cc_"+ID).value; 
     2271        if(content.find(".cc-tr").css("display") != "none") 
     2272                stringEmail += content.find('[name="input_cc"]').val() =='' ? "":", "+content.find('[name="input_cc"]').val(); 
    23102273                 
    23112274        if (expresso_offline) { 
    23122275                 
    23132276                var invalidEmail = searchEmail(stringEmail); 
    2314                 if(Element("to_"+ID).value=="" && Element("cco_"+ID).value=="" && Element("cc_"+ID).value=="") { 
     2277                if(content.find('[name="input_to"]').val()=="" && content.find('[name="input_cco"]').val()=="" && content.find('[name="input_cc"]').val()=="") { 
    23152278                        write_msg(get_lang("message without receiver")); 
    23162279                        return; 
  • trunk/expressoMail1_2/js/rich_text_editor.js

    r5745 r5911  
    5555cRichTextEditor.prototype.fromJSON = function( value ) 
    5656{ 
    57     return (new Function( "return " + this.decode64( value )))(); 
     57        if(!value) 
     58                return ''; 
     59        return (new Function( "return " + this.decode64( value )))(); 
    5860} 
    5961 
     
    111113                        RichTextEditor.active(pObj); 
    112114} 
     115 
     116cRichTextEditor.prototype.loadEditor2 = function(ID) {       
     117                var pObj = "body_" + ID; 
     118        RichTextEditor.plain[ID] = false;  
     119         
     120        if(preferences.plain_text_editor == 1) 
     121                { 
     122                        RichTextEditor.plain[ID] = true;   
     123                        RichTextEditor.editorReady = true; 
     124                } 
     125        else  
     126                        RichTextEditor.active(pObj); 
     127} 
     128 
    113129 
    114130cRichTextEditor.prototype.getSignaturesOptions = function() { 
     
    152168        var editor =  CKEDITOR.instances[inst];  
    153169        var id = inst.replace('body_',''); 
     170        var content = $("#content_id_"+id) 
    154171        editor.document.on('keydown', function(event) 
    155172        { 
    156173                away = false; 
    157                 var save_link = Element("save_message_options_"+id); 
    158                 save_link.onclick = function onclick() {openTab.toPreserve[id] = true;save_msg(id);} ; 
    159                 $("#save_message_options_"+id).button({ disabled: false }); 
     174                var save_link = content.find(".save"); 
     175                save_link.click(function(){ 
     176                        openTab.toPreserve[id] = true;save_msg(id); 
     177                }); 
     178                save_link.button({ disabled: false }); 
    160179        }); 
    161180         
     
    186205cRichTextEditor.prototype.setPlain = function (active,id){ 
    187206      RichTextEditor.plain[id] = active; 
     207          var content = $("#content_id_"+id); 
    188208      if(active === true) 
    189209      { 
     
    194214            $('#body_'+id).keydown(function(event) { 
    195215                away = false; 
    196                 var save_link = Element("save_message_options_"+id); 
     216                save_link = content.find(".save")[0]; 
    197217                save_link.onclick = function onclick() {openTab.toPreserve[id] = true;save_msg(id);} ; 
    198218                                $("#save_message_options_"+id).button({ disabled: false }); 
     
    305325     height -= 375; 
    306326     $('#'+id).ckeditor(  
    307           function() {RichTextEditor.execPosInstance(id)}, 
    308           { 
    309               toolbar:'mail', 
    310               height: height 
    311           });  
    312         $("[name=textplain_rt_checkbox_"+just_id+"]").button({ disabled: false }); 
     327                function() { 
     328                        RichTextEditor.execPosInstance(id) 
     329                }, 
     330                { 
     331                        toolbar:'mail', 
     332                        height: height 
     333                } 
     334        );  
     335        //$("[name=textplain_rt_checkbox_"+just_id+"]").button({ disabled: false }); 
    313336} 
    314337cRichTextEditor.prototype.focus = function(id) 
  • trunk/expressoMail1_2/js/shortcut.js

    r5904 r5911  
    324324{ 
    325325//********************** 
    326 shortcut.add('up', function() 
     326shortcut.add('up', function(e) 
    327327        { 
    328328                var search_in_focus = false; 
     
    340340 
    341341 
    342         shortcut.add('down', function() 
     342        shortcut.add('down', function(e) 
    343343        { 
    344344                var search_in_focus = false; 
  • trunk/expressoMail1_2/templates/default/main.css

    r5877 r5911  
    4242/* todo o resto */ 
    4343table.expressomail-message-body {width:100%; height:100%;} 
    44 table.table_message { 
     44table.table_message, div.table_message { 
    4545background: #96b3d3; /* Old browsers */ 
    4646background: -moz-linear-gradient(top, #96b3d3 0%, #b4c9e4 30%, #d9e6ef 65%, #e2e9f1 70%, #e9f0f8 78%, #e8f1fa 83%, #dbe5ef 96%, #d9e3ed 100%); /* FF3.6+ */ 
Note: See TracChangeset for help on using the changeset viewer.