Changeset 5459


Ignore:
Timestamp:
02/01/12 13:20:05 (12 years ago)
Author:
cristiano
Message:

Ticket #2475 - Problema no registro da função autosave

Location:
trunk/expressoMail1_2/js
Files:
5 edited

Legend:

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

    r5439 r5459  
    285285        div.style.overflow = "hidden"; 
    286286 
    287         Element("exmail_main_body").insertBefore(div,Element("footer_menu")); 
     287        Element("exmail_main_body").insertBefore(div,Element("footer_menu"));        
    288288        alternate_border(ID); 
    289289        return ID; 
     
    436436        openTab.imapUid[ID] = 0; 
    437437 
    438         if (preferences.auto_save_draft == 1) 
    439         { 
    440                 if (openTab.autosave_timer[ID]) 
    441                         clearTimeout(openTab.autosave_timer[ID]); 
    442                 openTab.autosave_timer[ID] = false; 
    443         } 
    444  
     438        // Limpa o autosave 
     439            if (preferences.auto_save_draft == 1 && autoSaveControl.timer[ID] !== null ) 
     440            { 
     441                autoSaveControl.status[ID] = null; 
     442                clearInterval(autoSaveControl.timer[ID]); 
     443            } 
     444        //////////////////////////////// 
     445         
    445446        hold_session = false; 
    446447        if (exist_className(Element('border_id_'+ID),'menu-sel')) 
  • trunk/expressoMail1_2/js/common_functions.js

    r5458 r5459  
    367367        inputFile.onchange  = function () { 
    368368            validateFileExtension(this.value, this.id.replace('input','div'), this.getAttribute('id_border')); 
    369             openTab.autosave_timer[id_border] = setTimeout("save_msg("+id_border+")", autosave_time); 
    370369        }; 
    371  
    372         inputFile.onfocus = function () { 
    373             if (openTab.autosave_timer[id_border]) 
    374                 clearTimeout(openTab.autosave_timer[id_border]); 
    375             }; 
    376370 
    377371        divFile.appendChild(inputFile); 
  • trunk/expressoMail1_2/js/draw_api.js

    r5456 r5459  
    66        'imapBox' : [], // Stores the folder name 
    77        'toPreserve' : [], // Check if the message should be removed from draft after send 
    8         'autosave_timer' : [], // The timeout timer for autosave function 
    98        'condition' : [] // Will store the search condition if the tab is the result of a search 
    109}; 
     10 
     11var autoSaveControl = { 
     12    'timer' : [], // The timeout timer for autosave function 
     13    'status' : [] // The status autosave  
     14}; 
     15 
    1116var tabTypes = { 
    1217        'new':4, 
     
    1722        'reply_to_all_without_history':10, 
    1823        'edit':5 
    19         } 
     24        }; 
    2025 
    2126var currentTab,numBox = 0; // Open Tab and num of mailboxes opened at context 
  • trunk/expressoMail1_2/js/main.js

    r5453 r5459  
    33// tempo do auto save (em milisegundos) 
    44// 20000 = 20 segundos 
    5 var autosave_time = 20000; 
     5var autosave_time = 40000; 
    66 
    77var results_search_messages = "";  
     
    20392039function send_message(ID, folder, folder_name){ 
    20402040 
    2041         //limpa autosave_timer[ID]; havia conflito quando uma mensagem ia ser enviada e nesse exato momento o autosave 
    2042                 //entrava em execucao (a aba de edicao da mensagem continuava aberta e a mensagem exibida era a de que a mensagem foi 
    2043                 //salva na pasta Rascunhos e nao que tinha sido enviada, como deveria); 
    20442041        if (preferences.auto_save_draft == 1) 
    2045         { 
    2046                 if (openTab.autosave_timer[ID]) 
    2047                 { 
    2048                         clearTimeout(openTab.autosave_timer[ID]); 
    2049                 } 
    2050         } 
    2051  
     2042            autoSaveControl.status[ID] = true; 
    20522043 
    20532044        var save_link = Element("save_message_options_"+ID); 
     
    23932384} 
    23942385 
     2386function autoSave( ID ) 
     2387{ 
     2388    if(autoSaveControl.status[ID] === false) 
     2389        save_msg(ID);          
     2390} 
     2391 
    23952392function save_msg(border_id,withImage, out){ 
     2393        
     2394       //seta o status do auto_save = true 
     2395        if (preferences.auto_save_draft == 1) 
     2396            autoSaveControl.status[border_id] = true; 
     2397       /////////////////////////////////////////// 
     2398       
    23962399        if (typeof(withImage) == 'undefined') 
    23972400                withImage = false; 
     
    24512454        mail_as_plain = ( mail_as_plain ) ? mail_as_plain.checked : false; 
    24522455 
    2453         var content_body  = RichTextEditor.getData("body_"+border_id); 
     2456       var content_body  = RichTextEditor.getData("body_"+border_id); 
    24542457       //Remove imagens do corpo que estao com o checkbox desmarcados 
    24552458       var files_checkbox =  $("#divFiles_"+border_id+" input:checkbox"); 
  • trunk/expressoMail1_2/js/rich_text_editor.js

    r5417 r5459  
    146146 
    147147cRichTextEditor.prototype.createImage = function(){ 
    148         if (preferences.auto_save_draft == 1) 
    149         { 
    150                         autosave_time = 200000; 
    151                         clearTimeout(openTab.autosave_timer[currentTab]); 
    152         } 
    153148                 
    154149        var form = document.getElementById("attachment_window"); 
     
    264259 
    265260cRichTextEditor.prototype.execPosInstance = function(inst) { 
     261     if(RichTextEditor.editorReady === false) 
     262     { 
    266263        var editor =  CKEDITOR.instances[inst];  
    267264        var id = inst.replace('body_',''); 
     
    274271        }); 
    275272         
    276 //Adicionando atalhos de preferencias   
    277 //TODO: Não esta pegando o numero (keycode) 
    278 //        if (preferences.use_shortcuts == '1') 
    279 //        { 
    280 //            CKEDITOR.instances[inst].document.on('keyup', function(event){ 
    281 //                    if(event.keyCode == 27){                          
    282 //                            delete_border(id,'false');}  //Tecla delete fechar aba           
    283 //            }); 
    284 //        }   
    285273        
    286274        // IM Module Enabled 
     
    291279                });              
    292280        } 
    293          
     281 
    294282        if (preferences.auto_save_draft == 1) 
    295283        { 
    296                 openTab.autosave_timer[id] = false; 
    297                 var save_link = document.getElementById("save_message_options"+id); 
    298                 CKEDITOR.instances[inst].document.on('keydown', function(event){ 
    299                    if (openTab.autosave_timer[id]) 
    300                                 clearTimeout(openTab.autosave_timer[id]); 
    301                    openTab.autosave_timer[id] = setTimeout("save_msg("+id+")", autosave_time); 
    302                                          
    303                 });   
    304         } 
    305          
    306         /*var rich_button = document.createElement("a"); 
    307         //rich_button.className = "button small"; 
    308         rich_button.name = "textplain_rt_checkbox_"+id; 
    309         rich_button.innerHTML = get_lang('Simple text mode')+" >>"; 
    310         rich_button.href = "#"; 
    311         rich_button.onclick = function (){ 
    312                 var check = $("#"+$(this).attr("name")).attr("checked"); 
    313                 $("#"+$(this).attr("name")).attr("checked", (!check ? true : false)); 
    314                 $("#"+$(this).attr("name")).trigger('click'); 
    315                 //RichTextEditor.setPlain($("#"+$(this).attr("name")).attr("checked"), id); 
    316         }; 
    317         if($("#cke_top_body_"+id).find(".cke_toolbar:last")) 
    318         $("#cke_top_body_"+id).find(".cke_toolbar:last").append("<span class='button small'></span>"); 
    319         $("#cke_top_body_"+id).find("span:last").append(rich_button); 
    320         $("#cke_top_body_"+id).attr("colSpan", "2"); 
    321         $("#cke_contents_body_"+id).attr("colSpan", "2"); 
    322         $("#cke_bottom_body_"+id).attr("colSpan", "2");*/ 
     284            autoSaveControl.status[id] = true; 
     285            autoSaveControl.timer[id] = window.setInterval( "autoSave("+id+")" ,autosave_time);   
     286 
     287            CKEDITOR.instances[inst].document.on('keydown', function(event){    
     288                autoSaveControl.status[id] = false; 
     289            }) 
     290        } 
     291         
    323292        $(".cke_editor").css("white-space", "normal"); 
    324          
    325         RichTextEditor.editorReady = true; 
    326 } 
     293        RichTextEditor.editorReady = true; 
     294     }   
     295} 
     296 
    327297cRichTextEditor.prototype.setPlain = function (active,id){ 
    328298      RichTextEditor.plain[id] = active; 
Note: See TracChangeset for help on using the changeset viewer.