Ignore:
Timestamp:
06/15/12 17:00:17 (12 years ago)
Author:
gustavo
Message:

Ticket #2766 - Merge do branch das novas funcionalidaes para o trunk

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/expressoMail1_2/js/draw_api.js

    r6487 r6528  
    14951495                if ((headers_msgs.Forwarded == 'F')  || (headers_msgs.Draft == 'X' && headers_msgs.Answered == 'A')){ 
    14961496                        td_element21.onclick=function(){search_emails(headers_msgs.subject.replace(/^(re: ?|fw: ?|enc: ?|res: ?|fwd: ?)*/gi,''),true);}; 
    1497                         td_element21.innerHTML = "<img src ='templates/"+template+"/images/forwarded.gif' title='"+get_lang('Forwarded')+"'>"; 
     1497                        td_element21.innerHTML = "<img src ='templates/"+template+"/images/forwarded.png' title='"+get_lang('Forwarded')+"'>"; 
    14981498                        headers_msgs.Draft = '' 
    14991499                        headers_msgs.Answered = ''; 
     
    15011501                } 
    15021502                else if (headers_msgs.Draft == 'X') 
    1503                         td_element21.innerHTML = "<img src ='templates/"+template+"/images/draft.gif' title='"+get_lang('Draft')+"'>"; 
     1503                        td_element21.innerHTML = "<img src ='templates/"+template+"/images/draft.png' title='"+get_lang('Draft')+"'>"; 
    15041504                else if (headers_msgs.Answered == 'A'){ 
    15051505                        td_element21.onclick=function(){search_emails(headers_msgs.subject.replace(/^(re: ?|fw: ?|enc: ?|res: ?|fwd: ?)*/gi,''),true);}; 
    1506                         td_element21.innerHTML = "<img src ='templates/"+template+"/images/answered.gif' title='"+get_lang('Answered')+"'>"; 
     1506                        td_element21.innerHTML = "<img src ='templates/"+template+"/images/answered.png' title='"+get_lang('Answered')+"'>"; 
    15071507                    }else 
    15081508                        td_element21.innerHTML = "&nbsp;&nbsp;&nbsp;"; 
     
    35403540} 
    35413541 
    3542 function input_binds(input, ID){ 
    3543         var mySource = new Array(); 
    3544         var myArray = contacts.split(","); 
    3545         for(var i in myArray){ 
    3546                 var teste = myArray[i].split(";"); 
    3547                 if(teste.length > 1) 
    3548                         mySource.push({name : teste[0], email: teste[1], value : (teste[0] +" - "+teste[1])}); 
    3549                 else 
    3550                         mySource.push({name : "", email: teste[0], value :teste[0]}); 
    3551         } 
    3552         input.bind( "keydown", function( event ) { 
    3553                 if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { 
    3554                         event.preventDefault(); 
    3555                 } 
    3556                 if((event.keyCode) == 120){ 
     3542//DESENHO DAS CAIXA DE EMAIL 
     3543function draw_email_box(input_data, location, personal){ 
     3544        if($.trim(input_data) != ""){ 
     3545                var box_data = valid_emails(input_data); 
     3546                DataLayer.render("../prototype/modules/mail/templates/emailBox.ejs", box_data, function(html){ 
     3547                        var newBox = location.before(html).prev(); 
     3548                        box_actions(newBox); 
     3549                        if((preferences.expressoMail_ldap_identifier_recipient || personal)&& $(newBox).hasClass("invalid-email-box")){ 
     3550                                //$(newBox).find(".loading").css("background-image", "../prototype/modules/mail/img/ajax-loader.gif"); 
     3551                                show_detais(newBox, input_data, personal); 
     3552                        }else{ 
     3553                                $(newBox).find(".box-loading").remove(); 
     3554                        } 
     3555                }); 
     3556        } 
     3557} 
     3558 
     3559function valid_emails(email){ 
     3560        var ContactBox = {name:"", email:"", valid : false}; 
     3561        var reSimpleEmail = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[_a-z0-9-]+(\.[_a-z0-9-]+)+$/; 
     3562        var reComplexEmail = /<([^<]*)>[\s]*$/; 
     3563        var validation = email.split('"'); 
     3564         
     3565        //FUNÇÃO QUE VALIDA OS DADOS QUANDO O EMAIL É DIGITADO COM ("NOME SOBRENOME" <Email@dominio.com>) 
     3566        var complexValidation = function(complexMail){ 
     3567                var Objct = {}; 
     3568                if($.trim(complexMail[1]).match(reComplexEmail)){ 
     3569                        if($.trim(complexMail[1]).match(reComplexEmail).length){ 
     3570                                Objct['email'] = $.trim(complexMail[1]).match(reComplexEmail)[1]; 
     3571                        } 
     3572                }else{ 
     3573                        Objct['email'] = $.trim(complexMail[1]); 
     3574                } 
     3575                Objct['name'] = complexMail[0]; 
     3576                Objct['valid'] = reSimpleEmail.test(Objct['email'].toLowerCase()); 
     3577                return Objct; 
     3578        } 
     3579        switch (validation.length) { 
     3580                //PEGA TODO O CONTEUDO E SETA COMO SE FOSSE O EMAIL 
     3581                case 1: 
     3582                        validation.unshift(""); 
     3583                        ContactBox = complexValidation(validation); 
     3584                        break; 
     3585                //CORRIGI ERRO DE DIGITAÇÃO COMO ( huahua"<huhau@hauhau.com>) ou (hahahaha"huahua@email.com) ou ainda (hahahaha"huahua@ema  il.com) 
     3586                case 2:  
     3587                        ContactBox = complexValidation(validation); 
     3588                        break; 
     3589                //RECEBE O EMAIL CORRETAMENTE SÓ VALIDA POSSIVEIS ERROS COMO O DE CIMA E OS CORRIGI CASO ACONTEÇAM 
     3590                case 3: 
     3591                        //RETIRA O PRIMEIRO INDICE QUE FICOU "INUTIL" 
     3592                        validation.shift(); 
     3593                        ContactBox = complexValidation(validation); 
     3594                        break; 
     3595                //SE EXISTIREM MAIS DO QUE 2 (") 
     3596                default: 
     3597                        if($.trim(validation[validation.length-1]).match(reComplexEmail)){ 
     3598                                if($.trim(validation[validation.length-1]).match(reComplexEmail).length){ 
     3599                                        ContactBox.mail = $.trim(validation[validation.length-1]).match(reComplexEmail)[1]; 
     3600                                } 
     3601                        }else{ 
     3602                                ContactBox.mail = $.trim(complexMail[1]); 
     3603                        } 
     3604                        ContactBox.valid = reSimpleEmail.test(ContactBox.mail.toLowerCase());    
     3605        } 
     3606        return ContactBox; 
     3607} 
     3608 
     3609//EVENTO DOS INPUTS PARA - CC - CCO 
     3610function input_keydowns(input, ID){ 
     3611        var f9 = false; 
     3612        input.keydown(function(e){ 
     3613                f9 = false; 
     3614                var focusing = input.parent().find(".email-text"); 
     3615                //SE OS CONTATOS DINAMICOS ESTAO ATIVOS 
     3616                if(parseInt(preferences.use_dynamic_contacts) && !input.hasClass("box-input")){ 
     3617                        //SELECIONA O CONTATO E EVITA OUTROS COMANDOS 
     3618                        if ( e.keyCode === $.ui.keyCode.TAB && $( this ).data( "catcomplete" ).menu.active ) { 
     3619                                e.preventDefault(); 
     3620                                return false; 
     3621                        }                
     3622                         
     3623                        //FECHA OS CONTATOS DINÂMICOS 
     3624                        if( (e.keyCode == 27) && $( this ).data( "catcomplete" ).menu.active ){ 
     3625                                   e.stopPropagation(); 
     3626                                   e.preventDefault(); 
     3627                        } 
     3628                         
     3629                        //SELECIONA O CONTATO E EVITA OUTROS COMANDOS 
     3630                        if(e.keyCode == $.ui.keyCode.ENTER && $( this ).data( "catcomplete" ).menu.active){ 
     3631                                e.preventDefault(); 
     3632                                return false; 
     3633                        } 
     3634                         
     3635                        if(e.keyCode == $.ui.keyCode.DELETE && $( this ).data( "catcomplete" ).menu.active){ 
     3636                                if($($( this ).data( "catcomplete" ).menu.element).find(".ui-state-hover").parents("li:first").hasClass("dynamic-recent")) 
     3637                                        $($( this ).data( "catcomplete" ).menu.element).find(".ui-state-hover").next().trigger("click"); 
     3638                                return false; 
     3639                        } 
     3640                } 
     3641                //BUSCA COM A TECLA F9 
     3642                if((e.keyCode) == 120){ 
     3643                        f9 = true; 
    35573644                        emQuickSearch($(this).val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true); 
    3558                 }else if( (event.keyCode == 27) && $( this ).data( "autocomplete" ).menu.active ){ 
    3559                            event.stopPropagation(); 
    3560                event.preventDefault(); 
    3561                 } 
    3562         }).autocomplete({ 
    3563                 minLength: 0,                    
    3564                 source: function( request, response ) { 
    3565                         response( $.ui.autocomplete.filter( 
    3566                                 mySource, extractLast( request.term ) ) ); 
     3645                        e.preventDefault(); 
     3646                        return false; 
     3647                } 
     3648 
     3649                //AO DIGITAR ENTER, ";", "," "  " 
     3650                if(e.keyCode == 13 || e.keyCode == 9 || (e.keyCode == 188 && !e.shiftKey) || (e.keyCode == 191 && !e.shiftKey) ){ 
     3651                        if(e.keyCode == 13){ 
     3652                                e.preventDefault(); 
     3653                        } 
     3654                        if(input.val() != ""){ 
     3655                                if(e.keyCode != 9) 
     3656                                        e.preventDefault(); 
     3657                                draw_email_box(input.val(), input); 
     3658                                if(input.hasClass("box-input")){ 
     3659                                        input.remove(); 
     3660                                        focusing.focus(); 
     3661                                        return; 
     3662                                } 
     3663                        } 
     3664                        if(input.length) 
     3665                                input.val(""); 
     3666                } 
     3667                if((e.keyCode == 8 || e.keyCode == 37) && input.val() == "" && input.prev().hasClass("box")){ 
     3668                        e.preventDefault(); 
     3669                        input.prev().focus(); 
     3670                        return; 
     3671                } 
     3672                //AO DIGITAR " " 
     3673                if(e.keyCode == 32){ 
     3674                        if(!input.val().length){ 
     3675                                e.preventDefault(); 
     3676                                return; 
     3677                        }else{ 
     3678                                var texto = input.val(); 
     3679                                texto = texto.substring(0, getPosition(input[0])); 
     3680                                if(texto.split('"').length-1 == 0){ 
     3681                                        if(input.val().split('"').length-1 == 0){ 
     3682                                                e.preventDefault(); 
     3683                                                e.stopPropagation(); 
     3684                                                draw_email_box(input.val(), input); 
     3685                                                input.val(""); 
     3686                                                if(input.hasClass("box-input")){ 
     3687                                                        input.remove(); 
     3688                                                        focusing.focus(); 
     3689                                                        return; 
     3690                                                } 
     3691                                                return; 
     3692                                        } 
     3693                                } 
     3694                        } 
     3695                } 
     3696                //AO DIGITAR ">" 
     3697                if(e.keyCode == 190 && e.shiftKey && input.val().length == getPosition(input[0])){ 
     3698                        input.val(input.val()+">"); 
     3699                        draw_email_box(input.val(), input); 
     3700                        e.preventDefault(); 
     3701                        input.val(""); 
     3702                        if(input.hasClass("box-input")){ 
     3703                                input.remove(); 
     3704                                focusing.focus(); 
     3705                                return; 
     3706                        } 
     3707                } 
     3708                 
     3709                //INPUT AUTO RESIZE      
     3710                setTimeout(function(){ 
     3711                        input.css("width", 15+(input.val().length * 9));         
     3712                        input.parent().scrollTo(":last");        
     3713                }, 100); 
     3714        }) 
     3715        //AO SAIR DO FOCO MONTAGEM DA CAIXA DE EMAIL 
     3716        .focusout(function(){ 
     3717                if(!$(this).data('is_open')){ 
     3718                        if(!(f9 || $(this).parents("tr:first").find("button").hasClass("ui-state-active"))){ 
     3719                                if($(input).val() != "") 
     3720                                        draw_email_box(input.val(), input); 
     3721                                if(input.hasClass("box-input")) 
     3722                                        input.remove(); 
     3723                        } 
     3724                 
     3725                        input_search = $(input).val(); 
     3726                        $(input).val(""); 
     3727                } 
     3728        }) 
     3729        //AO COLAR UM TEXTO NO CAMPO 
     3730        .bind("paste", function(e){ 
     3731                $(this).trigger("keydown"); 
     3732                var pthis = $(this); 
     3733                setTimeout(function() { 
     3734                        var str = pthis.val().replace(/[,;\t\n]/gi, ","); 
     3735                        str = str.split(","); 
     3736                        $.each(str, function(index, value){ 
     3737                                draw_email_box(value, pthis); 
     3738                        }); 
     3739                        pthis.val(""); 
     3740                }, 50); 
     3741        }); 
     3742        //SE FOR EDIÇÃO DE EMAILS RECALCULA O INPUT E SETA O FOCO 
     3743        if(input.hasClass("box-input")){ 
     3744                input.trigger("keydown"); 
     3745                input.focus(); 
     3746        } 
     3747} 
     3748var input_search = ""; 
     3749//EVENTOS DA CAIXA 
     3750function box_actions(box){ 
     3751        //AO PRESSIONAR UMA TECLA COM A CAIXA SELECIONADA        
     3752        box.keydown(function(e){ 
     3753                switch (e.keyCode) { 
     3754                        case $.ui.keyCode.LEFT: 
     3755                                //VERIFICA SE EXISTE ALGUMA CAIXA A ESQUERDA 
     3756                                if($(this).prev().hasClass("box")) 
     3757                                        $(this).removeClass("box-selected").prev().focus(); 
     3758                                break; 
     3759                        case $.ui.keyCode.RIGHT: 
     3760                                //VERIFICA SE EXISTE ALGUMA CAIXA A DIREITA  
     3761                                if($(this).next().hasClass("box")) 
     3762                                        $(this).removeClass("box-selected").next().focus(); 
     3763                                //SENAO FOCO O INPUT DO EMAIL 
     3764                                else 
     3765                                        $(this).removeClass("box-selected").next().focus(); 
     3766                                break; 
     3767                        case $.ui.keyCode.HOME: 
     3768                                //SELECIONO A PRIMEIRA CAIXA 
     3769                                e.preventDefault(); 
     3770                                $(this).parents(".email-area").find("div:first").focus(); 
     3771                                break; 
     3772                        case $.ui.keyCode.END: 
     3773                                //SELECIONO A ULTIMA CAIXA 
     3774                                e.preventDefault(); 
     3775                                $(this).parents(".email-area").find("div:last").focus(); 
     3776                                break; 
     3777                        case $.ui.keyCode.DELETE: 
     3778                                //VERIFICA SE EXISTE ALGUMA CAIXA A DIREITA 
     3779                                if($(this).next().hasClass("box")) 
     3780                                        $(this).next().focus(); 
     3781                                //SENAO FOCO O INPUT DO EMAIL 
     3782                                else 
     3783                                        $(this).next().focus(); 
     3784                                //REMOVO ESTA CAIXA 
     3785                                $(this).remove(); 
     3786                                break; 
     3787                        case $.ui.keyCode.BACKSPACE: 
     3788                                //VERIFICA SE EXISTE ALGUMA CAIXA A ESQUERDA 
     3789                                if($(this).prev().hasClass("box")) 
     3790                                        $(this).removeClass("box-selected").prev().focus(); 
     3791                                //SENAO HOUVER VERIFICA SE EXISTE ALGUMA CAIXA A DIREITA 
     3792                                else if($(this).next().hasClass("box")) 
     3793                                        $(this).next().focus(); 
     3794                                //SENAO HOUVER NEM A DIREITA NEM A ESQUERDA SETO O FOCO NO INPUT DO EMAIL 
     3795                                else 
     3796                                        $(this).next().focus(); 
     3797                                //REMOVO ESTA CAIXA      
     3798                                $(this).remove(); 
     3799                                e.preventDefault(); 
     3800                                break; 
     3801                        case $.ui.keyCode.ENTER: 
     3802                                e.preventDefault(); 
     3803                                $(this).trigger("dblclick"); 
     3804                                break; 
     3805                } 
     3806        }) 
     3807        //AO FAZER UM DUPLO CLICK NA CAIXA 
     3808        .dblclick(function(e){ 
     3809                var input = $(this).find("input").clone(); 
     3810                input.css("display" , "inline-block"); 
     3811                $(this).before(input); 
     3812                input_keydowns(input, currentTab); 
     3813                $(this).remove(); 
     3814        //CLICK SIMPLES NA CAIXA 
     3815        }).click(function(){ 
     3816                $(this).focus(); 
     3817        //AO DAR O FOCO NA CAIXA 
     3818        }).focus(function(){ 
     3819                $(this).parent().find("div").removeClass("box-selected"); 
     3820                $(this).addClass("box-selected"); 
     3821        }).focusout(function(){ 
     3822                $(this).removeClass("box-selected"); 
     3823        }).draggable({ 
     3824                revert: 'invalid', 
     3825                helper : 'clone', 
     3826                stack: "body", 
     3827                containment : ".new-msg-head-data", 
     3828                start: function(e, ui){ 
     3829                        $(this).parent().droppable( "disable" ); 
    35673830                }, 
    3568                 focus: function() { 
    3569                         return false; 
    3570                 }, 
    3571                 select: function( event, ui ) { 
    3572                         var terms = mySplit( this.value ); 
    3573                         terms.pop(); 
    3574                         terms.push( (ui.item.name != "" ? "\""+ui.item.name+"\" " : "") + (ui.item.email ? "<"+ui.item.email+">" : "")); 
    3575                         terms.push( "" ); 
    3576                         this.value = terms.join( ", " ); 
    3577                         return false; 
    3578                 }, 
    3579                 autoFocus: true 
    3580         }).data( "autocomplete" )._renderItem = function( ul, item ) { 
    3581                 ul.css({"max-height" : "115px", "overflow-y" : "auto"}); 
    3582                 if( $(ul).find("li").length > 10 ){ 
    3583                         return; 
    3584                 } 
    3585                 return $( "<li></li>" ) 
    3586                         .data( "item.autocomplete", item ) 
    3587                         .append( "<a>" + item.name + " - " + item.email + "</a>" ) 
    3588                         .appendTo( ul ); 
    3589         }; 
    3590         input.parents("tr:first").find("button").button().click(function(){ 
    3591                 emQuickSearch($(this).parents("tr:first").find("textarea").val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true); 
     3831                stop : function(e, ui){ 
     3832                        $(this).parent().droppable( "enable" ); 
     3833                } 
     3834        }); 
     3835} 
     3836 
     3837//MOSTRA OS DETALHES DAS CAIXA DE EMAIL NOS CAMPOS PARA - CC - CCO 
     3838function show_detais(box, value, personal){ 
     3839        var ldap_id = preferences.expressoMail_ldap_identifier_recipient; 
     3840        var group = (personal != undefined ? (personal == "G" ? true : false) : false); 
     3841         
     3842        if(group){ 
     3843                REST.get("/group/"+value, {}, function(data){ 
     3844                        if(!data.error){ 
     3845                                if(data.collection.error) 
     3846                                        box.find(".box-loading").remove(); 
     3847                                else{ 
     3848                                        //box.find(".box-loading").css("background-image", "url(templates/default/images/information.png) no-repeat! !important"); 
     3849                                        box.find(".box-loading").removeClass("box-loading").addClass("box-info"); 
     3850                                        box.addClass("box-"+value).removeClass("invalid-email-box"); 
     3851                                        loadGroupBox(data.collection, ".box-"+value); 
     3852                                        box.unbind("dblclick").bind("dblclick", function(e){ 
     3853                                                new $.Zebra_Dialog('<strong>Impossivel editar</strong> um contato do catálogo pessoal\n' + 
     3854                                                        '<strong>Porém</strong> é possivel remove-lo', { 
     3855                                                        'buttons':  false, 
     3856                                                        'modal': false, 
     3857                                                        'position': ['right - 20', 'top + 20'], 
     3858                                                        'auto_close': 3000 
     3859                                                }); 
     3860                                        }).find(".box-input").val("\""+data.collection.data[1].value+"\" <"+data.collection.data[1].value+">"); 
     3861                                        box.find(".email-box-value").html( (data.collection.data[1].value.length > 18 ? data.collection.data[1].value.substring(0, 15)+"...": data.collection.data[1].value)) 
     3862                                } 
     3863                        }else{ 
     3864                                box.find(".box-loading").remove(); 
     3865                        } 
     3866                }); 
     3867                return; 
     3868        } 
     3869         
     3870        if(personal){ 
     3871                REST.get("/contact/"+value, {}, function(data){ 
     3872                        if(!data.error){ 
     3873                                if(data.collection.error) 
     3874                                        box.find(".box-loading").remove(); 
     3875                                else{ 
     3876                                        //box.find(".box-loading").css("background-image", "url(templates/default/images/information.png) no-repeat! !important"); 
     3877                                        box.find(".box-loading").removeClass("box-loading").addClass("box-info"); 
     3878                                        box.addClass("box-"+value).removeClass("invalid-email-box"); 
     3879                                        loadExtraLDAPBox(data.collection.data, ".box-"+value); 
     3880                                        box.unbind("dblclick").bind("dblclick", function(e){ 
     3881                                                new $.Zebra_Dialog('<strong>Impossivel editar</strong> um contato do catálogo pessoal\n' + 
     3882                                                        '<strong>Porém</strong> é possivel remove-lo', { 
     3883                                                        'buttons':  false, 
     3884                                                        'modal': false, 
     3885                                                        'position': ['right - 20', 'top + 20'], 
     3886                                                        'auto_close': 3000 
     3887                                                }); 
     3888                                        }).find(".box-input").val("\""+data.collection.data[0].value+"\" <"+data.collection.data[1].value+">"); 
     3889                                        box.find(".email-box-value").html( (data.collection.data[0].value.length > 18 ? data.collection.data[0].value.substring(0, 15)+"...": data.collection.data[0].value)) 
     3890                                } 
     3891                        }else{ 
     3892                                box.find(".box-loading").remove(); 
     3893                        } 
     3894                }); 
     3895                return; 
     3896        } 
     3897         
     3898        REST.get("/usersldap", {field : ldap_id,value: value}, function(data){ 
     3899                if(!data.error){ 
     3900                        if(data.collection.error) 
     3901                                box.find(".box-loading").remove(); 
     3902                        else{ 
     3903                                //box.find(".box-loading").css("background-image", "url(templates/default/images/information.png) no-repeat! !important"); 
     3904                                box.find(".box-loading").removeClass("box-loading").addClass("box-info"); 
     3905                                box.addClass("box-"+value).removeClass("invalid-email-box"); 
     3906                                loadExtraLDAPBox(data.collection.itens[0].data, ".box-"+value); 
     3907                                box.unbind("dblclick").bind("dblclick", function(e){ 
     3908                                        new $.Zebra_Dialog('<strong>Impossivel editar</strong> um contato do catálogo geral\n' + 
     3909                                                '<strong>Porém</strong> é possivel remove-lo', { 
     3910                                                'buttons':  false, 
     3911                                                'modal': false, 
     3912                                                'position': ['right - 20', 'top + 20'], 
     3913                                                'auto_close': 3000 
     3914                                        }); 
     3915                                }).find(".box-input").val("\""+data.collection.itens[0].data[0].value+"\" <"+data.collection.itens[0].data[1].value+">"); 
     3916                                box.find(".email-box-value").html( (data.collection.itens[0].data[0].value.length > 18 ? data.collection.itens[0].data[0].value.substring(0, 15)+"...": data.collection.itens[0].data[0].value)) 
     3917                        } 
     3918                }else{ 
     3919                        box.find(".box-loading").remove(); 
     3920                } 
     3921        }); 
     3922} 
     3923 
     3924//FUNÇÃO QUE "SETA" OS BINDS DOS CAMPOS PARA - CC - CCO 
     3925function input_binds(div, ID){ 
     3926 
     3927        //AO CLICAR NA DIV SETA O FOCO NO INPUT 
     3928        div.click(function(e){ 
     3929                if(e.target == $(this)[0]){ 
     3930                        $(this).find("input:last").focus(); 
     3931                        $(this).find("div").removeClass("box-selected"); 
     3932                } 
     3933        }) 
     3934         
     3935        //AO SAIR DO FOCO DA DIV ELE RETIRA TODAS AS CLASSES DE CAIXAS SELECIONADAS 
     3936        .focusout(function(e){ 
     3937                if(!$(e.target).parents(".email-area:first").length) 
     3938                        $(this).find("div").removeClass("box-selected"); 
     3939        }).droppable({ 
     3940                hoverClass: "box-draggable-hover", 
     3941                accept : ".box", 
     3942                drop : function(e, ui){ 
     3943                        ui.draggable.parent().droppable( "enable" ); 
     3944                        var box = ui.draggable.clone(); 
     3945                        box_actions(box); 
     3946                        if(box.find(".box-info").length){ 
     3947                                box.unbind("dblclick").bind("dblclick", function(e){ 
     3948                                        new $.Zebra_Dialog('<strong>Impossivel editar</strong> um contato do ldap\n' + 
     3949                                                '<strong>Porém</strong>é possivel remove-lo', { 
     3950                                                'buttons':  false, 
     3951                                                'modal': false, 
     3952                                                'position': ['right - 20', 'top + 20'], 
     3953                                                'auto_close': 3000 
     3954                                        }); 
     3955                                }); 
     3956                        } 
     3957                        $(this).prepend(box); 
     3958                        ui.draggable.remove(); 
     3959                } 
     3960        }); 
     3961         
     3962        //MAKE KEYDOWN 
     3963        input_keydowns(div.find("input"), ID); 
     3964         
     3965         
     3966        //VERIFICA PREFERENCIA DE CONTATOS DINÂMICOS ESTA ATIVA 
     3967        if(parseInt(preferences.use_dynamic_contacts)){ 
     3968                //PREPARAÇÃO DA ARRAY DOS CONTATOS DINÂMICOS 
     3969 
     3970                $.widget( "custom.catcomplete", $.ui.autocomplete, { 
     3971                        _renderMenu: function( ul, items ) { 
     3972                                var self = this, 
     3973                                currentType = ""; 
     3974                                $.each( items, function( index, item ) { 
     3975                                        if ( item.type != currentType) { 
     3976                                                if(item.type == "G" && $(ul).find(".dynamic-recent").length) 
     3977                                                        self._renderItem( ul, {name:"", value:"", type:"linha"} ); 
     3978                                                if(item.type == "P" && $(ul).find(".dynamic-group").length) 
     3979                                                        self._renderItem( ul, {name:"", value:"", type:"linha"} );       
     3980                                                currentType = item.type; 
     3981                                        } 
     3982                                        self._renderItem( ul, item ); 
     3983                                        $(ul).find("li:last").find(".dynamic-stars").raty({ 
     3984                                                readOnly : true, 
     3985                                                half : true, 
     3986                                                hints : ['','','','',''], 
     3987                                                score    : ((parseInt(item.qtd)*5)/topContact), 
     3988                                                starOn  : '../../prototype/plugins/jq-raty/img/star-on.png', 
     3989                                                starOff : '../../prototype/plugins/jq-raty/img/star-off.png', 
     3990                                                starHalf : '../../prototype/plugins/jq-raty/img/star-half.png' 
     3991                                        }); 
     3992                                }); 
     3993                        } 
     3994                }); 
     3995                //INSERÇÃO DO AUTO COMPLETE AO INPUT 
     3996                div.find("input").catcomplete({ 
     3997                        minLength: 1,                    
     3998                        source: function(request, response){ 
     3999                                response( $.ui.autocomplete.filter(dynamicContactList, request.term ) ); 
     4000                        }, 
     4001                        focus: function() { 
     4002                                return false; 
     4003                        }, 
     4004                         
     4005                        //EVENTO AO SELECIONAR UM CONTATO DINÂMICO 
     4006                        select: function( event, ui ) { 
     4007                                event.preventDefault(); 
     4008                                $(this).val(""); 
     4009                                if(ui.item.type == "P") 
     4010                                        draw_email_box(""+ui.item.id, $(this), true); 
     4011                                else if(ui.item.type == "G") 
     4012                                        draw_email_box(""+ui.item.id, $(this), "G"); 
     4013                                else 
     4014                                        draw_email_box(ui.item.name ? "\""+ui.item.name+"\" <"+ui.item.email+">" : ui.item.email, $(this)); 
     4015                                return false; 
     4016                        }, 
     4017                        autoFocus: true, 
     4018                        position : { my: "left top", at: "left bottom", collision: "fit" } 
     4019                }).bind('catcompleteopen', function(event, ui) { 
     4020                        $(this).data('is_open',true); 
     4021                }).bind('catcompleteclose', function(event, ui) { 
     4022                        $(this).data('is_open',false); 
     4023                }) 
     4024                 
     4025                //MONTAGEM DA LISTA DE CONTATOS DINÂMICOS DO AUTO COMPLETE 
     4026                .data( "catcomplete" )._renderItem = function( ul, item ) { 
     4027                        ul.css({"min-width":"400px", "width":"50%", "max-height" : "180px", "overflow-y" : "auto", "min-height": "30px"}); 
     4028                        var listContacts = DataLayer.render("../prototype/modules/mail/templates/listContacts.ejs", item); 
     4029                        return $(listContacts).data( "item.autocomplete", item ).appendTo( ul ).find("span:last").button({ 
     4030                                        icons : { 
     4031                                        primary : "ui-icon-close" 
     4032                                }, 
     4033                                text: false 
     4034                        }).click(function(){ 
     4035                                var removeLi = $(this).parents("li:first"); 
     4036                                $.Zebra_Dialog('Deseja remover <b>'+(item.name ? item.name+" - " : "")+ item.email+'</b>?', { 
     4037                                                'type':     'question', 
     4038                                                'custom_class': (is_ie ? 'configure-zebra-dialog' : ''), 
     4039                                                'title':    'Atenção', 
     4040                                                'buttons': ['Sim','Não'],                
     4041                                                'overlay_opacity': '0.5', 
     4042                                                'onClose':  function(caption) { 
     4043                                                        if(caption == 'Sim'){ 
     4044                                                                $(removeLi).remove(); 
     4045                                                                REST.delete("/dynamiccontact/"+item.id); 
     4046                                                                updateDynamicContact(); 
     4047                                                                updateDynamicContactList(); 
     4048                                                        } 
     4049                                                } 
     4050                                }); 
     4051                        }); 
     4052                }; 
     4053        } 
     4054         
     4055        //FUNÇÃO DOS BOTÕES PARA - CC - CCO 
     4056        div.parents("tr:first").find("button").button().click(function(){ 
     4057                if(!$(":focus").hasClass("new-message-input")) 
     4058                        emQuickSearch(($(this).parents("tr:first").find("input").val() ? $(this).parents("tr:first").find("input").val() : input_search), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true); 
    35924059        }); 
    35934060} 
     
    35964063        connector.loadScript("color_palette"); 
    35974064        connector.loadScript('wfolders'); 
     4065        connector.loadScript("ccQuickAdd");  
    35984066         
    35994067        if(typeof(RichTextEditor) == 'undefined' || typeof(ColorPalette) == 'undefined' || typeof(wfolders) == 'undefined') 
     
    36434111                button.toggleClass("expressomail-button-icon-ative"); 
    36444112                field.toggle(); 
    3645                 field.find("textarea").val("").focus(); 
    3646                 if(!field.find("textarea").hasClass("elastic")){ 
    3647                         field.find("textarea").css({"max-height" : "115px", "overflow-y" : "auto"}).addClass("elastic").elastic().unbind('blur');        
    3648                         input_binds(field.find("textarea"), ID); 
     4113                field.find("textarea").val("").parent().find("input").focus(); 
     4114                field.find(".email-area div").remove(); 
     4115                if(!field.find("textarea").hasClass("track")){ 
     4116                        field.find("textarea").css({"max-height" : "115px", "overflow-y" : "auto"}).addClass("track");   
     4117                        input_binds(field.find(".email-area"), ID); 
    36494118                } 
    36504119        }  
    36514120         
    3652         input_binds(content.find('[name="input_to"]').css({"max-height" : "115px", "overflow-y" : "auto"}).addClass("elastic").elastic().unbind('blur').focus(), ID);    
     4121        input_binds(content.find('[name="input_aux_to"]').css("max-width" , parseInt($(".email-area").css("width"))-5).focus().parent().css({"max-height" : "115px", "overflow-y" : "auto"}), ID);       
    36534122         
    36544123        //Botão TextoRico/TextoSimples 
Note: See TracChangeset for help on using the changeset viewer.