Changeset 4820


Ignore:
Timestamp:
07/19/11 15:55:40 (13 years ago)
Author:
roberto.santosjunior
Message:

Ticket #1820 - Salvar rascunho não grava imagem inserida.4683

Location:
trunk/expressoMail1_2/js
Files:
3 edited

Legend:

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

    r4749 r4820  
    224224        div_attachment = document.getElementById("id_div_attachment"); 
    225225        var params = ''; 
    226          
     226 
    227227        if (div_attachment == null){ 
    228228                var div_attachment = document.createElement("DIV"); 
     
    343343 
    344344        divFile = document.createElement('div'); 
    345         var inputFile = document.createElement("input"); 
    346         inputFile.id        = "inputFile_"+id_border+"_"+countDivFiles;  
    347          
    348         inputFile.name      = "file_"+countDivFiles;  
    349         inputFile.type      = "file";  
    350         inputFile.size      = 50; 
    351         inputFile.maxlength = 255; 
    352          
    353         inputFile.onchange  = function () { 
    354                 validateFileExtension(this.value, this.id.replace('input','div'), this.getAttribute('id_border')); 
    355                  
    356                 openTab.autosave_timer[id_border] = setTimeout("save_msg("+id_border+")", autosave_time); 
    357         };  
    358                  
    359                  
    360         inputFile.onfocus = function () {        
    361                 if (openTab.autosave_timer[id_border]) 
    362                         clearTimeout(openTab.autosave_timer[id_border]); 
    363         };       
    364                  
    365         divFile.appendChild(inputFile);          
    366         var linkFile = document.createElement("a");      
    367         linkFile.id        = "linkFile_"+id_border+"_"+countDivFiles; 
    368         linkFile.href      = 'javascript:void(0)'; 
    369         linkFile.onclick   = function () { 
    370                 removeFile("divFile_"+id_border+"_"+countDivFiles); return false; 
    371         }; 
    372                  
    373         linkFile.innerHTML = get_lang("Remove");         
    374                  
    375         divFile.appendChild(linkFile); 
    376         divFile.id = "divFile_"+id_border+"_"+countDivFiles; 
    377         divFiles.appendChild(divFile); 
     345 
     346        var inputFile = document.createElement("input"); 
     347        inputFile.id        = "inputFile_"+id_border+"_"+countDivFiles; 
     348        inputFile.name      = "file_"+countDivFiles; 
     349        inputFile.type      = "file"; 
     350        inputFile.size      = 50; 
     351        inputFile.maxlength = 255; 
     352        inputFile.onchange  = function () { 
     353            validateFileExtension(this.value, this.id.replace('input','div'), this.getAttribute('id_border')); 
     354            openTab.autosave_timer[id_border] = setTimeout("save_msg("+id_border+")", autosave_time); 
     355        }; 
     356 
     357        inputFile.onfocus = function () { 
     358            if (openTab.autosave_timer[id_border]) 
     359                clearTimeout(openTab.autosave_timer[id_border]); 
     360            }; 
     361 
     362        divFile.appendChild(inputFile); 
     363 
     364        var linkFile = document.createElement("a"); 
     365        linkFile.id        = "linkFile_"+id_border+"_"+countDivFiles; 
     366        linkFile.href      = 'javascript:void(0)'; 
     367        linkFile.onclick   = function () {removeFile("divFile_"+id_border+"_"+countDivFiles); return false;}; 
     368        linkFile.innerHTML = get_lang("Remove"); 
     369 
     370        divFile.appendChild(linkFile); 
     371        divFile.id = "divFile_"+id_border+"_"+countDivFiles; 
     372        divFiles.appendChild(divFile); 
    378373 
    379374        return inputFile; 
  • trunk/expressoMail1_2/js/draw_api.js

    r4814 r4820  
    923923// Draw the inbox and another folders 
    924924function draw_box(headers_msgs, msg_folder, alternate){ 
    925         /* 
     925        /* 
    926926         * When the paging response is not in the correct folder you need to change folder 
    927927         * This occurs when the Ajax response is not fast enough and the user click in outher 
     
    12211221// Passar o parâmetro offset para esta função 
    12221222function make_tr_message(headers_msgs, msg_folder, offsetToGMT){ 
    1223                 if (typeof offsetToGMT == 'undefined') 
    1224                 { 
    1225                         // In older local messages headers_msgs.offsetToGMT is undefined. 
    1226                         offsetToGMT = typeof headers_msgs.offsetToGMT != 'undefined'?headers_msgs.offsetToGMT:0; 
    1227                 } 
     1223                if (typeof offsetToGMT == 'undefined') 
     1224                { 
     1225                    // In older local messages headers_msgs.offsetToGMT is undefined. 
     1226                    offsetToGMT = typeof headers_msgs.offsetToGMT != 'undefined'?headers_msgs.offsetToGMT:0; 
     1227                } 
    12281228                var tr_element = document.createElement('tr'); 
    12291229                if(typeof(preferences.line_height) != 'undefined') 
     
    12351235                if(headers_msgs.msg_sample && preferences.preview_msg_subject == "1") 
    12361236                { 
    1237                         if (cssForResizing) //Colunas redimensionaveis - nao trunca  
    1238                                 tr_element.msg_sample = headers_msgs.msg_sample.body.substr(0,180) + "..."; //trecho do body que sera exibido com o assunto;  
    1239                 else  
    1240                     tr_element.msg_sample = headers_msgs.msg_sample.body.substr(0,120) + "..."; //trecho do body que sera exibido com o assunto;  
     1237                        if (cssForResizing) //Colunas redimensionaveis - nao trunca 
     1238                                tr_element.msg_sample = headers_msgs.msg_sample.body.substr(0,180) + "..."; //trecho do body que sera exibido com o assunto; 
     1239                        else 
     1240                                tr_element.msg_sample = headers_msgs.msg_sample.body.substr(0,120) + "..."; //trecho do body que sera exibido com o assunto; 
    12411241                } 
    12421242 
     
    14061406                if ((headers_msgs.subject)&&(headers_msgs.subject.length > 50)) 
    14071407                { 
    1408                         if (cssForResizing)  
    1409                                 //Colunas redimensionaveis - nao trunca  
    1410                         td_element4.innerHTML += headers_msgs.subject + "<span style=\"color:#b3b3b3;\">  " + tr_element.msg_sample +"</span>";  
    1411                     else {  
    1412                                         //Modificacao para evitar que o truncamento do assunto quebre uma NCR - #1189  
    1413                             pos = headers_msgs.subject.indexOf("&",45);  
    1414                             if ((pos > 0) && (pos <= 50) && ((headers_msgs.subject.charAt(pos+5) == ";") || (headers_msgs.subject.charAt(pos+6) == ";")))  
    1415                                 td_element4.innerHTML += headers_msgs.subject.substring(0,pos+6) + "..." + "<span style=\"color:#b3b3b3;\">  " + tr_element.msg_sample +"</span>";  
    1416                             else  
    1417                                td_element4.innerHTML += headers_msgs.subject.substring(0,50) + "..." + "<span style=\"color:#b3b3b3;\">  " + tr_element.msg_sample +"</span>";//modificacao feita para exibir o trecho do body ao lado do assunto da mensagem;  
    1418                                 }  
     1408                        if (cssForResizing) 
     1409                                //Colunas redimensionaveis - nao trunca 
     1410                                td_element4.innerHTML += headers_msgs.subject + "<span style=\"color:#b3b3b3;\">  " + tr_element.msg_sample +"</span>"; 
     1411                        else { 
     1412                                //Modificacao para evitar que o truncamento do assunto quebre uma NCR - #1189 
     1413                                pos = headers_msgs.subject.indexOf("&",45); 
     1414                                if ((pos > 0) && (pos <= 50) && ((headers_msgs.subject.charAt(pos+5) == ";") || (headers_msgs.subject.charAt(pos+6) == ";"))) 
     1415                                        td_element4.innerHTML += headers_msgs.subject.substring(0,pos+6) + "..." + "<span style=\"color:#b3b3b3;\">  " + tr_element.msg_sample +"</span>"; 
     1416                                else 
     1417                                        td_element4.innerHTML += headers_msgs.subject.substring(0,50) + "..." + "<span style=\"color:#b3b3b3;\">  " + tr_element.msg_sample +"</span>";//modificacao feita para exibir o trecho do body ao lado do assunto da mensagem; 
     1418                        } 
    14191419                } 
    14201420                else 
     
    15671567        img_next_msg.style.cursor = 'pointer'; 
    15681568 
    1569         var folder_id = ID.match(/\d+/)[0]; 
    1570         var folder; 
    1571  
    1572         //Correção para fazer funcionar e-mails assinados no formato encapsulado. 
    1573    // folder_id = info_msg.original_ID ? info_msg.original_ID: info_msg.msg_number; 
    1574         //if ((folder = document.getElementById(info_msg.msg_number)) == null) 
     1569        var folder_id = ID.match(/\d+/)[0]; 
     1570        var folder; 
     1571 
     1572        //Correção para fazer funcionar e-mails assinados no formato encapsulado. 
     1573       // folder_id = info_msg.original_ID ? info_msg.original_ID: info_msg.msg_number; 
     1574        //if ((folder = document.getElementById(info_msg.msg_number)) == null) 
    15751575        if ((folder = Element(info_msg.original_ID)) == null) 
    15761576                folder = Element(info_msg.msg_number); 
     
    15791579                delete_border(ID); 
    15801580                return; 
    1581         } 
     1581                } 
    15821582        if (folder){ // mensagem local criptografada nao tem ID da pasta local 
    15831583                if (folder.nextSibling){ 
     
    18011801        option_forward.onclick = function(){new_message('forward', ID);}; 
    18021802        option_forward.onmouseover=function () { this.className='message_options_active'; }; 
    1803         option_forward.onmouseout=function () { this.className='message_options' }; 
     1803        option_forward.onmouseout=function () { this.className='message_options' }; 
    18041804        option_forward.innerHTML = get_lang('Forward'); 
    18051805        options.appendChild(space1); 
     
    22712271                div_attach.setAttribute("class", "expressomail-attachments"); 
    22722272                div_attach.setAttribute("className", "expressomail-attachments"); //for IE 
    2273                  
     2273 
    22742274                var div_attach_lbl = document.createElement("span"); 
    22752275                div_attach_lbl.setAttribute("class", "expressomail-attachments-label"); 
     
    22822282                div_attach_list.setAttribute("className", "expressomail-attachments-list"); //for IE 
    22832283                 
    2284                 if(info_msg.attachments.length > 1) { 
     2284                        if(info_msg.attachments.length > 1) { 
    22852285                        var li_link_attachment = document.createElement("LI"); 
    2286                         var link_attachment     = document.createElement("A"); 
     2286                                var link_attachment      = document.createElement("A"); 
    22872287                        link_attachment.setAttribute("class", "expressomail-attachments-link"); 
    22882288                        link_attachment.setAttribute("className", "expressomail-attachments-link"); //for IE 
    22892289         
    2290                         if(proxy_mensagens.is_local_folder(current_folder)) 
    2291                                 link_attachment.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); 
    2292                         else 
    2293                                 link_attachment.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); 
    2294                         link_attachment.innerHTML = " "+info_msg.attachments.length+' '+get_lang('files')+' :: '+get_lang('Download all atachments'); 
     2290                                 if(proxy_mensagens.is_local_folder(current_folder)) 
     2291                                        link_attachment.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); 
     2292                                else 
     2293                                        link_attachment.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); 
     2294                                link_attachment.innerHTML = " "+info_msg.attachments.length+' '+get_lang('files')+' :: '+get_lang('Download all atachments'); 
    22952295                        li_link_attachment.appendChild(link_attachment); 
    22962296                        div_attach_list.appendChild(li_link_attachment); 
    2297                 } 
     2297                        } 
    22982298                 
    2299                 if(parseInt(preferences.remove_attachments_function)) 
    2300                 { 
     2299                        if(parseInt(preferences.remove_attachments_function)) 
     2300                        { 
    23012301                        var li_link_attachment = document.createElement("LI"); 
    23022302                        var link_attachment     = document.createElement("A"); 
     
    23082308                        li_link_attachment.appendChild(link_attachment); 
    23092309                        div_attach_list.appendChild(li_link_attachment); 
    2310                 } 
    2311                  
     2310                        } 
     2311 
    23122312                for (var i=0; i<info_msg.attachments.length; i++) 
    23132313                { 
     
    23312331                                link_attachment.appendChild(link_import_attachment); 
    23322332                        } 
    2333                  
     2333 
    23342334                        li_link_attachment.appendChild(link_attachment); 
    23352335                        div_attach_list.appendChild(li_link_attachment); 
     
    23462346                tr6.appendChild(td6); 
    23472347                tbody_message_others_options.appendChild(tr6); 
    2348         }        
     2348        } 
    23492349        //k!! 
    23502350        var div = document.createElement("DIV"); 
     
    24572457        //k 
    24582458         
    2459         if ( (info_msg.thumbs) && (info_msg.thumbs.length > 0) ){ 
     2459        if ((info_msg.thumbs)&&(info_msg.thumbs.length > 0)){ 
    24602460                var div_thumbs = document.createElement("DIV"); 
    24612461                div_thumbs.setAttribute("class", "expressomail-thumbs"); 
     
    24732473                var div_thumbs_lbl_a  = document.createElement("A"); 
    24742474 
    2475                 if(info_msg.thumbs.length > 1){                          
    2476                         if(proxy_mensagens.is_local_folder(current_folder)) 
     2475                if(info_msg.thumbs.length > 1){ 
     2476                         if(proxy_mensagens.is_local_folder(current_folder)) 
    24772477                                div_thumbs_lbl_a.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); 
    24782478                        else 
     
    24872487                div_thumbs_lbl_sp.appendChild(div_thumbs_lbl_a); 
    24882488                div_thumbs_lbl.appendChild(div_thumbs_lbl_sp); 
    2489                  
     2489 
    24902490                var div_thumbs_lbl_sp2   = document.createElement("SPAN"); 
    24912491                div_thumbs_lbl_sp2.setAttribute("class", "message_tips"); 
    24922492                div_thumbs_lbl_sp2.setAttribute("className", "message_tips"); //for IE 
    24932493                div_thumbs_lbl_sp2.innerHTML = get_lang("<strong>Tip:</strong> <span>For faster save, click over the image with <em>right button</em>.</span>"); 
    2494                  
     2494 
    24952495                var ul_thumbs_list = document.createElement("UL"); 
    24962496                ul_thumbs_list.setAttribute("class", "expressomail-thumbs-list"); 
     
    25302530                        show_div_address_full(ID,'cc'); 
    25312531        } 
    2532          
     2532 
    25332533        //k! 
    25342534        /* 
     
    25552555                        }); 
    25562556                }); 
    2557         } 
     2557} 
    25582558        //k!! 
    25592559} 
     
    26502650                if(!expresso_offline) 
    26512651                        var option_send_and_file= '<span class="message_options" onclick=wfolders.makeWindow("'+ID+'","send_and_file");>'+get_lang("Send and file")+'</span> | '; 
    2652                 else                     
     2652                else 
    26532653                        var option_send_and_file=''; 
    26542654        } 
     
    26712671 
    26722672        tr_menu_new_message.appendChild(td_menu_new_message); 
    2673          
     2673 
    26742674         
    26752675        tbody_menu_new_message.appendChild(tr_menu_new_message); 
     
    27052705        var td1_2 = document.createElement("TD"); 
    27062706        tr1_2.style.display = 'none'; 
    2707         td1_2.innerHTML = get_lang("Reply to")+":"; 
     2707        td1_2.innerHTML = get_lang("Reply to")+":"; 
    27082708        td1_2.setAttribute("noWrap","true"); 
    27092709        td1_2.style.width = "1%"; 
    27102710 
    27112711        var td_replyto = document.createElement("TD"); 
    2712         td_replyto.setAttribute("noWrap","true"); 
     2712        td_replyto.setAttribute("noWrap","true"); 
    27132713        td_replyto.style.width = "100%"; 
    27142714 
    2715         var input_replyto = document.createElement('INPUT'); 
     2715        var input_replyto = document.createElement('INPUT'); 
    27162716        input_replyto.id = "replyto_"+ID; 
    2717         input_replyto.name = "input_replyto"; 
     2717        input_replyto.name = "input_replyto"; 
    27182718        input_replyto.setAttribute("tabIndex","1"); 
    2719         input_replyto.style.width = "100%"; 
     2719        input_replyto.style.width = "100%"; 
    27202720        input_replyto.setAttribute("wrap","soft"); 
    2721         input_replyto.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus', this.id);}; 
     2721        input_replyto.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus', this.id);}; 
    27222722        input_replyto.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; 
    27232723 
     
    32003200        tr5.appendChild(td5); 
    32013201        tr5.appendChild(td_return_receipt); 
    3202          
    3203         if ( ! expresso_offline ) 
    3204         { 
    3205                 var text_plain = td_return_receipt.appendChild( 
    3206                         document.createElement( 'span' ) 
    3207                 ).appendChild( 
    3208                         document.createTextNode( ' | ' ) 
    3209                 ).parentNode.appendChild( 
    3210                         document.createTextNode( get_lang('Send this mail as text plain') + '.') 
     3202 
     3203        if ( ! expresso_offline ) 
     3204        { 
     3205                var text_plain = td_return_receipt.appendChild( 
     3206                        document.createElement( 'span' ) 
     3207                ).appendChild( 
     3208                        document.createTextNode( ' | ' ) 
     3209                ).parentNode.appendChild( 
     3210                        document.createTextNode( get_lang('Send this mail as text plain') + '.')                 
    32113211                ).parentNode.appendChild( 
    32123212                        document.createElement( 'input' ) 
    3213                 ); 
     3213                ); 
    32143214                text_plain.setAttribute( 'tabIndex', '-1' ); 
    32153215                text_plain.id = 'textplain_rt_checkbox_' + ID ; 
    32163216                text_plain.type = "checkbox"; 
    32173217                text_plain.onclick = function () 
    3218                 { 
    3219                         RichTextEditor.plain( this.checked ); 
    3220                         document.getElementById( 'viewsource_rt_checkbox_' + ID ).parentNode.style.display = ( this.checked ) ? 'none' : ''; 
    3221                 }; 
     3218                { 
     3219                        RichTextEditor.plain( this.checked ); 
     3220                        document.getElementById( 'viewsource_rt_checkbox_' + ID ).parentNode.style.display = ( this.checked ) ? 'none' : ''; 
     3221                }; 
    32223222                                //text_plain = text_plain.parentNode.appendChild(input_checkbox); 
    3223         } 
    3224          
     3223        } 
     3224 
    32253225         
    32263226        tbody_message.appendChild(tr5); 
     
    32453245        } 
    32463246 
    3247          
     3247        /** 
     3248        * event to enable autosave_draft on file attachment 
     3249        */ 
     3250        function save_onchange_attachment_handler () { 
     3251            away = false; 
     3252            var save_link = Element("save_message_options_"+ID); 
     3253            save_link.onclick = function onclick(event) { 
     3254                openTab.toPreserve[ID] = true; 
     3255                save_msg(ID); 
     3256            }; 
     3257            save_link.className = 'message_options'; 
     3258        }; 
     3259 
    32483260        var add_files = document.createElement("A"); 
    32493261        add_files.setAttribute("href", "javascript:void(0)"); 
    3250          
    3251         add_files.onclick = function () {  
    3252                                         var obj = addFile(ID);  
    3253                                         if (preferences.auto_save_draft == 1 && obj) {  
    3254                                                 if ( obj.addEventListener )  
    3255                                                         obj.addEventListener('click', save_onchange_attachment_handler, false);  
    3256                                         }  
    3257                                         return false;  
    3258                                 };  
    3259          
     3262        add_files.onclick = function () { 
     3263            var obj = addFile(ID); 
     3264            if (preferences.auto_save_draft == 1 && obj) { 
     3265                if ( obj.addEventListener ) 
     3266                    obj.addEventListener('click', save_onchange_attachment_handler, false); 
     3267            } 
     3268            return false; 
     3269        }; 
    32603270        add_files.innerHTML =  get_lang("Attachments: add+"); 
    32613271        add_files.setAttribute("tabIndex","-1"); 
     
    33133323                draw_from_field(sel_from,tr1_1); 
    33143324        resizeWindow(); 
    3315          
     3325        
    33163326        if ( ! expresso_offline ) 
    33173327        { 
     
    35143524                td221.className = 'dsused'; 
    35153525 
    3516         td221.setAttribute("style","width: 100%");       
    3517                  
     3526        td221.setAttribute("style","width: 100%"); 
     3527         
    35183528        tr221.appendChild(td221); 
    35193529        tbody221.appendChild(tr221); 
     
    37003710        content_id_0.appendChild(table); 
    37013711} 
    3702 var idx_cc = 0; 
     3712        var idx_cc = 0; 
    37033713 
    37043714function draw_plugin_cc(ID, addrs){ 
  • trunk/expressoMail1_2/js/main.js

    r4818 r4820  
    17861786        var handler_delete_msg = function(data){refresh(preferences.alert_new_msg);}; 
    17871787 
    1788         if (data.append != true || !data) 
     1788        if (data == null || data.append != true ) 
    17891789        { 
    1790                 RichTextEditor.saveFlag = 0; 
     1790                RichTextEditor.saveFlag = -1; 
    17911791                if (! data.append) 
    1792                         if(data == 'Post-Content-Length') 
    1793                                 write_msg(get_lang('The size of this message has exceeded  the limit (%1B).', preferences.max_attachment_size ? preferences.max_attachment_size : Element('upload_max_filesize').value)); 
    1794                         else 
    1795                                 write_msg(get_lang('ERROR saving your message.')); 
     1792                        write_msg('ERROR saving your message.'); 
    17961793                else 
    17971794                { 
     
    18151812 
    18161813                var newTitle = document.getElementById('subject_'+border_id).value; 
    1817                 if (newTitle == '') 
    1818                         newTitle = get_lang("No subject"); 
    1819                 set_border_caption('border_id_'+border_id, newTitle); 
     1814                if (newTitle.length > 18) 
     1815                    newTitle = newTitle.substr(18) + '...'; 
     1816                else if (newTitle == '') 
     1817                    newTitle = get_lang("No subject"); 
     1818                document.getElementById('font_border_id_'+border_id).innerHTML = newTitle;  
    18201819 
    18211820                // Replace the embedded images for new uids 
    1822                 var mainField = document.getElementById('body_'+border_id).contentWindow; 
    1823                 var content_body =  mainField.document.getElementsByTagName('body').item(0).innerHTML; 
    1824                 var body_images = content_body.match(/msg_num=\d*/g); 
    1825                 var images_part = content_body.match(/msg_part=\d*/g); 
    1826                 if (body_images) 
     1821                var mainField     = document.getElementById('body_'+border_id).contentWindow; 
     1822                var content_body  = mainField.document.getElementsByTagName('body').item(0).innerHTML; 
     1823                var body_images   = content_body.match(/msg_num=\d*/g); 
     1824                var folder_images = content_body.match(/msg_folder=[^&]*&/g); 
     1825 
     1826                if (body_images != null) 
    18271827                { 
    1828                         for (var i=0; i<body_images.length; i++){ 
    1829                                 content_body =  content_body.replace(body_images[i],"msg_num="+openTab.imapUid[border_id]); 
    1830                         } 
    1831                         var allImgs = new Array (images_part.length); 
    1832                                 var j=-1; 
    1833                                 for (var i in images_part){ 
    1834  
    1835                                         if (is_ie) 
    1836                                                 if (i == 0) 
    1837                                                         var image_number = parseInt(images_part[i].substr(9)); 
    1838                                                 else 
    1839                                                         image_number = "null"; 
    1840                                         else 
    1841                                                 var image_number = parseInt(images_part[i].substr(9)); 
    1842  
    1843                                 if (! isNaN(image_number)) 
    1844                                         { 
    1845                                                 if (! allImgs[image_number]) 
    1846                                                 { 
    1847                                                         allImgs[image_number] = true; 
    1848                                                         j--; 
    1849                                                 } 
    1850                                         content_body = content_body.replace(images_part[i],'msg_part='+j); 
    1851                                         } 
    1852                                 } 
    1853                         content_body = content_body.replace(/msg_part=-/g,'msg_part='); 
    1854  
    1855                         mainField.document.getElementsByTagName('body').item(0).innerHTML = content_body; 
    1856                 } 
     1828                    for (var i=0; i<body_images.length; i++) 
     1829                    { 
     1830                        if( folder_images != null) 
     1831                            content_body = content_body.replace(folder_images[i], "msg_folder=INBOX" + cyrus_delimiter + draftsfolder +"&"); 
     1832 
     1833                        content_body = content_body.replace(body_images[i],"msg_num="+openTab.imapUid[border_id]); 
     1834                    } 
     1835 
     1836                    var images_part   = content_body.match(/msg_part=[0-9.]*/g); 
     1837 
     1838                    if(images_part != null) 
     1839                    { 
     1840                        for (var x = 0; x < images_part.length; x++) 
     1841                        { 
     1842                            var position = images_part[x].substr(9,images_part[x].length); 
     1843                            content_body = content_body.replace(images_part[x],'msg_part(||.|||.||)='+data.imagesParts[position]); 
     1844                        } 
     1845 
     1846                    } 
     1847                    content_body = content_body.replace(/msg_part\(\|\|\.\|\|\|\.\|\|\)=/g,'msg_part='); 
     1848 
     1849                    mainField.document.getElementsByTagName('body').item(0).innerHTML = content_body; 
     1850                } 
    18571851 
    18581852                //Replace all files to new files 
    18591853                var divFiles = Element("divFiles_"+border_id); 
    1860                 elFiles = divFiles.getElementsByTagName("input"); 
    1861                 var countCheck =0; 
    1862                 for (var i=0; i<elFiles.length; i++) { 
    1863                         if(elFiles[i].value !=""){ 
    1864                                 if (elFiles[i].type == "checkbox") { 
    1865                                         countCheck++; 
    1866                                 } 
    1867                                 else { 
    1868                                         elFiles[i].value =""; 
    1869                                         parantNodeFile = elFiles[i].parentNode.parentNode; 
    1870                                         parantNodeFile.removeChild(elFiles[i].parentNode); 
    1871                                         i--; 
    1872                                 } 
    1873  
    1874                         } 
    1875                 }; 
     1854                divFiles.innerHTML = ''; 
    18761855 
    18771856                var attach_files = connector.unserialize(data.files); 
    18781857                if (attach_files != null) { 
    1879                         openTab.countFile[border_id] = attach_files.length; 
    1880                         att_index = countCheck; 
    1881                 for (att_index; att_index < attach_files.length; att_index++){ 
    1882  
    1883                         var link_attachment = document.createElement("A"); 
    1884                         var fileName = attach_files[att_index].substr(0,attach_files[att_index].indexOf('_SIZE_')); 
    1885                         var fileSize = parseInt(attach_files[att_index].substr(attach_files[att_index].indexOf('_SIZE_')+6))/1024 
    1886                         link_attachment.innerHTML = fileName + " ("+borkb((parseInt(fileSize)*1024))+")"; 
    1887  
    1888                         var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"','"+(att_index+2)+"','base64'"; 
    1889  
    1890                         link_attachment.setAttribute("href", "javascript:download_attachments("+href+")"); 
    1891  
    1892                         var a_tmp = href.split(','); 
    1893                         a_tmp[2] = fileName; 
    1894                         s_tmp = escape(connector.serialize(a_tmp)); 
    1895  
    1896                         var check_attachment = document.createElement("INPUT"); 
    1897                         check_attachment.type = 'CHECKBOX'; 
    1898                         check_attachment.name = 'forwarding_attachments[]'; 
    1899                         check_attachment.value = trim(s_tmp); 
    1900  
    1901                         if (!divFiles.childNodes[0]) 
    1902                         { 
    1903                             divFiles.appendChild(document.createElement("BR")); 
    1904                         } 
    1905                         else 
    1906                             { 
    1907                                 divFiles.insertBefore(document.createElement("BR"),divFiles.childNodes[0]); 
    1908                             } 
    1909  
    1910                         divFiles.insertBefore(link_attachment,divFiles.childNodes[0]); 
    1911                         divFiles.insertBefore(check_attachment,divFiles.childNodes[0]); 
    1912  
    1913                         check_attachment.checked = true; 
    1914                 } 
    1915         } 
     1858                    openTab.countFile[border_id] = attach_files.length; 
     1859                    for (att_index = 0; att_index < attach_files.length; att_index++){ 
     1860 
     1861                        var link_attachment = document.createElement("a"); 
     1862                        var fileName = attach_files[att_index].substr(0, attach_files[att_index].lastIndexOf('_SIZE_')); 
     1863                        var fileSize = parseInt(attach_files[att_index].substr(attach_files[att_index].lastIndexOf('_SIZE_')+6))/1024 
     1864                        link_attachment.innerHTML = fileName + " ("+parseInt(fileSize)+" kb)"; 
     1865 
     1866                        var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"','0."+(att_index+1)+"','base64'"; 
     1867 
     1868                        link_attachment.setAttribute("href", "javascript:download_attachments("+href+")"); 
     1869 
     1870                        var a_tmp = href.split(','); 
     1871                        a_tmp[2] = fileName; 
     1872                        s_tmp = escape(connector.serialize(a_tmp)); 
     1873 
     1874                        var check_attachment = document.createElement("input"); 
     1875                        check_attachment.type = 'checkbox'; 
     1876                        check_attachment.name = 'forwarding_attachments[]'; 
     1877                        check_attachment.value = s_tmp; 
     1878 
     1879                        check_attachment.checked = true; 
     1880                        check_attachment.setAttribute("checked", "checked"); 
     1881 
     1882                        divFiles.appendChild(check_attachment); 
     1883                        divFiles.appendChild(link_attachment); 
     1884                        divFiles.appendChild(document.createElement("br")); 
     1885                    } 
     1886                } 
     1887 
    19161888                if (message_id) 
    19171889                { 
    1918                         cExecute ("$this.imap_functions.delete_msgs&folder="+openTab.imapBox[border_id]+"&msgs_number="+message_id,handler_delete_msg); 
    1919                         if (openTab.imapBox[0] == "INBOX/"+draftsfolder) 
    1920                         { 
    1921                                 //Update mailbox 
    1922                                                 var tr_msg = document.getElementById(message_id); 
    1923                                 change_tr_properties(tr_msg, data.msg_no, data.subject); 
    1924                         } 
    1925                 } else { 
    1926                         refresh(); 
     1890                    cExecute ("$this.imap_functions.delete_msgs&folder="+openTab.imapBox[border_id]+"&msgs_number="+message_id,handler_delete_msg); 
     1891                    if (openTab.imapBox[0] == "INBOX" + cyrus_delimiter + draftsfolder) 
     1892                    { 
     1893                        //Update mailbox 
     1894                        var tr_msg = document.getElementById(message_id); 
     1895                        change_tr_properties(tr_msg, data.msg_no, data.subject); 
     1896                    } 
     1897                 
    19271898                } 
    19281899 
Note: See TracChangeset for help on using the changeset viewer.