Changeset 4854
- Timestamp:
- 07/25/11 11:06:55 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/main.js
r4852 r4854 1837 1837 if (data == null || data.append != true ) 1838 1838 { 1839 RichTextEditor.saveFlag = -1;1839 RichTextEditor.saveFlag = 0; 1840 1840 if (! data.append) 1841 write_msg('ERROR saving your message.'); 1841 if(data == 'Post-Content-Length') 1842 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)); 1843 else 1844 write_msg(get_lang('ERROR saving your message.')); 1842 1845 else 1843 1846 { … … 1861 1864 1862 1865 var newTitle = document.getElementById('subject_'+border_id).value; 1863 if (newTitle.length > 18) 1864 newTitle = newTitle.substr(18) + '...'; 1865 else if (newTitle == '') 1866 if (newTitle == '') 1866 1867 newTitle = get_lang("No subject"); 1867 document.getElementById('font_border_id_'+border_id).innerHTML = newTitle;1868 set_border_caption('border_id_'+border_id, newTitle); 1868 1869 1869 1870 // Replace the embedded images for new uids 1870 var mainField = document.getElementById('body_'+border_id).contentWindow; 1871 var content_body = mainField.document.getElementsByTagName('body').item(0).innerHTML; 1872 var body_images = content_body.match(/msg_num=\d*/g); 1873 var folder_images = content_body.match(/msg_folder=[^&]*&/g); 1874 1875 if (body_images != null) 1871 var mainField = document.getElementById('body_'+border_id).contentWindow; 1872 var content_body = mainField.document.getElementsByTagName('body').item(0).innerHTML; 1873 var body_images = content_body.match(/msg_num=\d*/g); 1874 var images_part = content_body.match(/msg_part=\d*/g); 1875 if (body_images) 1876 1876 { 1877 for (var i=0; i<body_images.length; i++) 1878 { 1879 if( folder_images != null) 1880 content_body = content_body.replace(folder_images[i], "msg_folder=INBOX" + cyrus_delimiter + draftsfolder +"&"); 1881 1877 for (var i=0; i<body_images.length; i++){ 1882 1878 content_body = content_body.replace(body_images[i],"msg_num="+openTab.imapUid[border_id]); 1883 1879 } 1884 1880 1885 var images_part = content_body.match(/msg_part=[0-9.]*/g); 1886 1887 if(images_part != null) 1888 { 1889 for (var x = 0; x < images_part.length; x++) 1881 var allImgs = new Array (images_part.length); 1882 var j=-1; 1883 for (var i in images_part){ 1884 1885 if (is_ie) 1886 if (i == 0) 1887 var image_number = parseInt(images_part[i].substr(9)); 1888 else 1889 image_number = "null"; 1890 else 1891 var image_number = parseInt(images_part[i].substr(9)); 1892 1893 if (! isNaN(image_number)) 1890 1894 { 1891 var position = images_part[x].substr(9,images_part[x].length); 1892 content_body = content_body.replace(images_part[x],'msg_part(||.|||.||)='+data.imagesParts[position]); 1895 if (! allImgs[image_number]) 1896 { 1897 allImgs[image_number] = true; 1898 j--; 1899 } 1900 content_body = content_body.replace(images_part[i],'msg_part='+j); 1893 1901 } 1894 1902 content_body = content_body.replace(/msg_part=-/g,'msg_part='); 1895 1903 } 1896 content_body = content_body.replace(/msg_part\(\|\|\.\|\|\|\.\|\|\)=/g,'msg_part=');1897 1898 1904 mainField.document.getElementsByTagName('body').item(0).innerHTML = content_body; 1899 1905 } … … 1901 1907 //Replace all files to new files 1902 1908 var divFiles = Element("divFiles_"+border_id); 1903 divFiles.innerHTML = ''; 1909 elFiles = divFiles.getElementsByTagName("input"); 1910 var countCheck =0; 1911 for (var i=0; i<elFiles.length; i++) { 1912 if(elFiles[i].value !=""){ 1913 if (elFiles[i].type == "checkbox") { 1914 countCheck++; 1915 } 1916 else { 1917 elFiles[i].value =""; 1918 parantNodeFile = elFiles[i].parentNode.parentNode; 1919 parantNodeFile.removeChild(elFiles[i].parentNode); 1920 i--; 1921 } 1922 } 1923 } 1904 1924 1905 1925 var attach_files = connector.unserialize(data.files); 1906 1926 if (attach_files != null) { 1907 1927 openTab.countFile[border_id] = attach_files.length; 1908 for (att_index = 0; att_index < attach_files.length; att_index++){ 1928 att_index = countCheck; 1929 for (att_index; att_index < attach_files.length; att_index++) 1930 { 1909 1931 1910 1932 var link_attachment = document.createElement("a"); 1911 var fileName = attach_files[att_index].substr(0, attach_files[att_index].lastIndexOf('_SIZE_'));1912 var fileSize = parseInt(attach_files[att_index].substr(attach_files[att_index].lastIndexOf('_SIZE_')+6))/10241913 link_attachment.innerHTML = fileName + " ("+parseInt(fileSize)+" kb)";1914 1915 var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"',' 0."+(att_index+1)+"','base64'";1933 var fileName = attach_files[att_index].substr(0,attach_files[att_index].indexOf('_SIZE_')); 1934 var fileSize = parseInt(attach_files[att_index].substr(attach_files[att_index].indexOf('_SIZE_')+6))/1024 1935 link_attachment.innerHTML = fileName + " ("+borkb((parseInt(fileSize)*1024))+")"; 1936 1937 var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"','"+(att_index+2)+"','base64'"; 1916 1938 1917 1939 link_attachment.setAttribute("href", "javascript:download_attachments("+href+")"); … … 1921 1943 s_tmp = escape(connector.serialize(a_tmp)); 1922 1944 1923 var check_attachment = document.createElement("input"); 1924 check_attachment.type = 'checkbox'; 1925 check_attachment.name = 'forwarding_attachments[]'; 1926 check_attachment.value = s_tmp; 1945 var check_attachment = document.createElement("INPUT"); 1946 check_attachment.type = 'CHECKBOX'; 1947 check_attachment.name = 'forwarding_attachments[]'; 1948 check_attachment.value = trim(s_tmp); 1949 1950 if (!divFiles.childNodes[0]) 1951 { 1952 divFiles.appendChild(document.createElement("BR")); 1953 } 1954 else 1955 { 1956 divFiles.insertBefore(document.createElement("BR"),divFiles.childNodes[0]); 1957 } 1958 1959 divFiles.insertBefore(link_attachment,divFiles.childNodes[0]); 1960 divFiles.insertBefore(check_attachment,divFiles.childNodes[0]); 1927 1961 1928 1962 check_attachment.checked = true; … … 1944 1978 change_tr_properties(tr_msg, data.msg_no, data.subject); 1945 1979 } 1946 1980 } else { 1981 refresh(); 1947 1982 } 1948 1983
Note: See TracChangeset
for help on using the changeset viewer.