Changeset 4848 for branches


Ignore:
Timestamp:
07/21/11 16:56:05 (13 years ago)
Author:
rafaelraymundo
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/expressoMail1_2/js/main.js

    r4831 r4848  
    18351835        if (data == null || data.append != true ) 
    18361836        { 
    1837                 RichTextEditor.saveFlag = -1; 
     1837                RichTextEditor.saveFlag = 0; 
    18381838                if (! data.append) 
    1839                         write_msg('ERROR saving your message.'); 
     1839                    if(data == 'Post-Content-Length') 
     1840                        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)); 
     1841                else 
     1842                    write_msg(get_lang('ERROR saving your message.')); 
    18401843                else 
    18411844                { 
     
    18591862 
    18601863                var newTitle = document.getElementById('subject_'+border_id).value; 
    1861                 if (newTitle.length > 18) 
    1862                     newTitle = newTitle.substr(18) + '...'; 
    1863                 else if (newTitle == '') 
     1864                if (newTitle == '') 
    18641865                    newTitle = get_lang("No subject"); 
    1865                 document.getElementById('font_border_id_'+border_id).innerHTML = newTitle;  
     1866                set_border_caption('border_id_'+border_id, newTitle); 
    18661867 
    18671868                // Replace the embedded images for new uids 
    1868                 var mainField     = document.getElementById('body_'+border_id).contentWindow; 
    1869                 var content_body  = mainField.document.getElementsByTagName('body').item(0).innerHTML; 
    1870                 var body_images   = content_body.match(/msg_num=\d*/g); 
    1871                 var folder_images = content_body.match(/msg_folder=[^&]*&/g); 
    1872  
    1873                 if (body_images != null) 
     1869                var mainField = document.getElementById('body_'+border_id).contentWindow; 
     1870                var content_body =  mainField.document.getElementsByTagName('body').item(0).innerHTML; 
     1871                var body_images = content_body.match(/msg_num=\d*/g); 
     1872                var images_part = content_body.match(/msg_part=\d*/g); 
     1873                if (body_images) 
    18741874                { 
    1875                     for (var i=0; i<body_images.length; i++) 
    1876                     { 
    1877                         if( folder_images != null) 
    1878                             content_body = content_body.replace(folder_images[i], "msg_folder=INBOX" + cyrus_delimiter + draftsfolder +"&"); 
    1879  
     1875                    for (var i=0; i<body_images.length; i++){ 
    18801876                        content_body = content_body.replace(body_images[i],"msg_num="+openTab.imapUid[border_id]); 
    18811877                    } 
    18821878 
    1883                     var images_part   = content_body.match(/msg_part=[0-9.]*/g); 
    1884  
    1885                     if(images_part != null) 
    1886                     { 
    1887                         for (var x = 0; x < images_part.length; x++) 
     1879                    var allImgs = new Array (images_part.length); 
     1880                    var j=-1; 
     1881                    for (var i in images_part){ 
     1882 
     1883                        if (is_ie) 
     1884                            if (i == 0) 
     1885                                var image_number = parseInt(images_part[i].substr(9)); 
     1886                            else 
     1887                                image_number = "null"; 
     1888                        else 
     1889                            var image_number = parseInt(images_part[i].substr(9)); 
     1890 
     1891                        if (! isNaN(image_number)) 
    18881892                        { 
    1889                             var position = images_part[x].substr(9,images_part[x].length); 
    1890                             content_body = content_body.replace(images_part[x],'msg_part(||.|||.||)='+data.imagesParts[position]); 
     1893                            if (! allImgs[image_number]) 
     1894                            { 
     1895                                allImgs[image_number] = true; 
     1896                                j--; 
     1897                            } 
     1898                            content_body = content_body.replace(images_part[i],'msg_part='+j); 
    18911899                        } 
    1892  
     1900                        content_body = content_body.replace(/msg_part=-/g,'msg_part='); 
    18931901                    } 
    1894                     content_body = content_body.replace(/msg_part\(\|\|\.\|\|\|\.\|\|\)=/g,'msg_part='); 
    1895  
    18961902                    mainField.document.getElementsByTagName('body').item(0).innerHTML = content_body; 
    18971903                } 
     
    18991905                //Replace all files to new files 
    19001906                var divFiles = Element("divFiles_"+border_id); 
    1901                 divFiles.innerHTML = ''; 
     1907                elFiles = divFiles.getElementsByTagName("input"); 
     1908                var countCheck =0; 
     1909                for (var i=0; i<elFiles.length; i++) { 
     1910                    if(elFiles[i].value !=""){ 
     1911                        if (elFiles[i].type == "checkbox") { 
     1912                            countCheck++; 
     1913                        } 
     1914                        else { 
     1915                            elFiles[i].value =""; 
     1916                            parantNodeFile = elFiles[i].parentNode.parentNode; 
     1917                            parantNodeFile.removeChild(elFiles[i].parentNode); 
     1918                            i--; 
     1919                        } 
     1920                    } 
     1921                } 
    19021922 
    19031923                var attach_files = connector.unserialize(data.files); 
    19041924                if (attach_files != null) { 
    19051925                    openTab.countFile[border_id] = attach_files.length; 
    1906                     for (att_index = 0; att_index < attach_files.length; att_index++){ 
     1926                    att_index = countCheck; 
     1927                    for (att_index; att_index < attach_files.length; att_index++) 
     1928                    { 
    19071929 
    19081930                        var link_attachment = document.createElement("a"); 
    1909                         var fileName = attach_files[att_index].substr(0, attach_files[att_index].lastIndexOf('_SIZE_')); 
    1910                         var fileSize = parseInt(attach_files[att_index].substr(attach_files[att_index].lastIndexOf('_SIZE_')+6))/1024 
    1911                         link_attachment.innerHTML = fileName + " ("+parseInt(fileSize)+" kb)"; 
    1912  
    1913                         var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"','0."+(att_index+1)+"','base64'"; 
     1931                        var fileName = attach_files[att_index].substr(0,attach_files[att_index].indexOf('_SIZE_')); 
     1932                        var fileSize = parseInt(attach_files[att_index].substr(attach_files[att_index].indexOf('_SIZE_')+6))/1024 
     1933                        link_attachment.innerHTML = fileName + " ("+borkb((parseInt(fileSize)*1024))+")"; 
     1934 
     1935                        var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"','"+(att_index+2)+"','base64'"; 
    19141936 
    19151937                        link_attachment.setAttribute("href", "javascript:download_attachments("+href+")"); 
     
    19191941                        s_tmp = escape(connector.serialize(a_tmp)); 
    19201942 
    1921                         var check_attachment = document.createElement("input"); 
    1922                         check_attachment.type = 'checkbox'; 
    1923                         check_attachment.name = 'forwarding_attachments[]'; 
    1924                         check_attachment.value = s_tmp; 
     1943                        var check_attachment = document.createElement("INPUT"); 
     1944                        check_attachment.type = 'CHECKBOX'; 
     1945                        check_attachment.name = 'forwarding_attachments[]'; 
     1946                        check_attachment.value = trim(s_tmp); 
     1947 
     1948                        if (!divFiles.childNodes[0]) 
     1949                        { 
     1950                            divFiles.appendChild(document.createElement("BR")); 
     1951                        } 
     1952                        else 
     1953                            { 
     1954                                divFiles.insertBefore(document.createElement("BR"),divFiles.childNodes[0]); 
     1955                            } 
     1956 
     1957                        divFiles.insertBefore(link_attachment,divFiles.childNodes[0]); 
     1958                        divFiles.insertBefore(check_attachment,divFiles.childNodes[0]); 
    19251959 
    19261960                        check_attachment.checked = true; 
     
    19421976                        change_tr_properties(tr_msg, data.msg_no, data.subject); 
    19431977                    } 
    1944                  
     1978                } else { 
     1979                    refresh(); 
    19451980                } 
    19461981 
Note: See TracChangeset for help on using the changeset viewer.