Changeset 5357


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

Ticket #2433 - Adicionar a configuração da nova agenda no expressoMail

File:
1 edited

Legend:

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

    r5339 r5357  
    20752075                return; 
    20762076        } 
    2077  
     2077        stringEmail = Element("to_"+ID).value; 
     2078        stringEmail += Element("cco_"+ID).value =='' ? "":", "+Element("cco_"+ID).value; 
     2079        stringEmail += Element("cc_"+ID).value =='' ? "":", "+Element("cc_"+ID).value; 
    20782080        if (expresso_offline) { 
    2079                 stringEmail = Element("to_"+ID).value; 
    2080                 stringEmail += Element("cco_"+ID).value =='' ? "":", "+Element("cco_"+ID).value; 
    2081                 stringEmail += Element("cc_"+ID).value =='' ? "":", "+Element("cc_"+ID).value; 
     2081                 
    20822082                var invalidEmail = searchEmail(stringEmail); 
    20832083                if(Element("to_"+ID).value=="" && Element("cco_"+ID).value=="" && Element("cc_"+ID).value=="") { 
    2084                         write_msg(get_lang("message without receiver.")); 
     2084                        write_msg(get_lang("message without receiver")); 
    20852085                        return; 
    20862086                }else if(invalidEmail[0] == true){ 
     
    20952095        } 
    20962096        else{ 
    2097                 cExecuteForm("$this.imap_functions.send_mail", form, handler_send_message, ID); 
     2097                if(stringEmail != "") 
     2098                        cExecuteForm("$this.imap_functions.send_mail", form, handler_send_message, ID); 
     2099                else{ 
     2100                        write_msg(get_lang("message without receiver")); 
     2101                        return; 
     2102                } 
    20982103        } 
    20992104} 
     
    33323337function import_calendar(data){ 
    33333338    var import_url = '$this.db_functions.import_vcard&msg_folder='+data; 
    3334  
    3335         function handler_import_calendar(data){ 
    3336                 if(data === true){ 
    3337                         write_msg(get_lang("The event was imported successfully.")); 
    3338                 } 
     3339        var logUser; 
     3340        var up; 
     3341    function handler_import_calendar(data){ 
     3342            if(data === true){ 
     3343                    write_msg(get_lang("The event was imported successfully.")); 
     3344            } 
    33393345            else if( data['url'] ) 
    33403346            { 
     
    33503356            else 
    33513357                write_msg(get_lang(data)); 
    3352         } 
    3353         if(confirm(get_lang("Do you confirm this import to your Calendar?"))){ 
    3354                     cExecute( import_url +'&from_ajax=true',handler_import_calendar); 
    3355     } 
     3358    }    
     3359        if(new_agenda == 'false'){ 
     3360                if(confirm(get_lang("Do you confirm this import to your Calendar?"))){ 
     3361                        cExecute( import_url +'&from_ajax=true',handler_import_calendar); 
     3362                } 
     3363        }else{                   
     3364                $( "#import-dialog" ).dialog({ 
     3365                        autoOpen: false, 
     3366                        height: 220, 
     3367                        modal: true, 
     3368                        resizable : false, 
     3369                        buttons: { 
     3370                                Cancel: function() { 
     3371                                        $( this ).dialog( "close" ); 
     3372                                }, 
     3373                                "Importar": function() { 
     3374                                        $.ajax({ 
     3375                                                 url: "controller.php?action="+import_url+'&from_ajax=true&selected='+$("#select-agenda option:selected").val()+'&status='+$("#select-status option:selected").val(), 
     3376                                                 success: function(data){ 
     3377                                                        data = connector.unserialize(data); 
     3378                                                        if(data == "ok"){ 
     3379                                                                if(!up) 
     3380                                                                        alert("Importado com sucesso para "+$("#select-agenda option:selected").text()); 
     3381                                                                else 
     3382                                                                        alert("Evento atualizado com sucesso ... "); 
     3383                                                        } 
     3384                                                        else{ 
     3385                                                                if(!up) 
     3386                                                                        alert("Ocorreu um erro ao importar o evento para a agenda "+$("#select-agenda option:selected").text()); 
     3387                                                                else 
     3388                                                                        alert("Ocorreu um erro ao atualizar o evento  ... "); 
     3389                                                        } 
     3390                                                } 
     3391                                        }); 
     3392                                         
     3393                                        $( this ).dialog( "close" ); 
     3394                                } 
     3395                        }, 
     3396                        close: function(event) { 
     3397                                event.stopPropagation(); 
     3398                        }, 
     3399                        closeOnEscape: true 
     3400                }); 
     3401                $.ajax({ 
     3402                                url: '../prototype/modules/calendar/index.php', 
     3403                                async: false, 
     3404                                success: function(){ 
     3405                                        $.ajax({ 
     3406                                        url: "controller.php?action="+import_url+'&from_ajax=true&selected='+$("#select-agenda option:selected").val()+'&readable=true', 
     3407                                        async: false, 
     3408                                        success: function(data){ 
     3409                                                data = connector.unserialize(data); 
     3410                                                if(data){ 
     3411                                                        up = true; 
     3412                                                        $("#select-agenda").css("display", "none"); 
     3413                                                        $("#import-dialog" ).children("p:first-child").css("display", "none"); 
     3414                                                        $("#import-dialog" ).dialog({ 
     3415                                                                height: 160, 
     3416                                                                title: 'Atualizar Evento' 
     3417                                                        }); 
     3418                                                        $(".ui-dialog-buttonpane").find(".ui-button:last").children().html("Atualizar"); 
     3419                                                } 
     3420                                                else{ 
     3421                                                        $.getJSON("../prototype/me.php", function(user){ 
     3422                                                                logUser = user; 
     3423                                                                up = false; 
     3424                                                                $("#select-agenda").css("display", ""); 
     3425                                                                $("#import-dialog" ).children("p:first-child").css("display", ""); 
     3426                                                                $.getJSON("../prototype/request.php", 
     3427                                                                { 
     3428                                                                        concept : "calendarSignature", 
     3429                                                                        criteria : {'deepness' : 2}, 
     3430                                                                        filter : ["=", "user", logUser.id] 
     3431                                                                }, function(calendarSignatures){ 
     3432                                                                        $("#select-agenda").html(''); 
     3433                                                                        for(var calendario in calendarSignatures){ 
     3434                                                                                var doc = document .createElement("OPTION"); 
     3435                                                                                doc.value = calendarSignatures[parseInt(calendario)].calendar.id; 
     3436                                                                                doc.innerHTML = calendarSignatures[parseInt(calendario)].calendar.name; 
     3437                                                                                $("#select-agenda").append(doc); 
     3438                                                                        } 
     3439                                                                }); 
     3440                                                        }); 
     3441                                                } 
     3442                                        }}); 
     3443                                }}); 
     3444                } 
     3445                $( "#import-dialog" ).dialog( "open" ); 
    33563446} 
    33573447function open_msg_part(data){ 
Note: See TracChangeset for help on using the changeset viewer.