Changeset 4683 for branches/2.2.0.1/expressoMail1_2/js/main.js
- Timestamp:
- 07/08/11 11:37:32 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.0.1/expressoMail1_2/js/main.js
r4681 r4683 1784 1784 var handler_delete_msg = function(data){refresh(preferences.alert_new_msg);}; 1785 1785 1786 if (data.append != true || !data)1786 if (data == null || data.append != true ) 1787 1787 { 1788 RichTextEditor.saveFlag = 0;1788 RichTextEditor.saveFlag = -1; 1789 1789 if (! data.append) 1790 if(data == 'Post-Content-Length') 1791 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)); 1792 else 1793 write_msg(get_lang('ERROR saving your message.')); 1790 write_msg('ERROR saving your message.'); 1794 1791 else 1795 1792 { … … 1813 1810 1814 1811 var newTitle = document.getElementById('subject_'+border_id).value; 1815 if (newTitle == '') 1816 newTitle = get_lang("No subject"); 1817 set_border_caption('border_id_'+border_id, newTitle); 1812 if (newTitle.length > 18) 1813 newTitle = newTitle.substr(18) + '...'; 1814 else if (newTitle == '') 1815 newTitle = get_lang("No subject"); 1816 document.getElementById('font_border_id_'+border_id).innerHTML = newTitle; 1818 1817 1819 1818 // Replace the embedded images for new uids 1820 var mainField = document.getElementById('body_'+border_id).contentWindow; 1821 var content_body = mainField.document.getElementsByTagName('body').item(0).innerHTML; 1822 var body_images = content_body.match(/msg_num=\d*/g); 1823 var images_part = content_body.match(/msg_part=\d*/g); 1824 if (body_images) 1819 var mainField = document.getElementById('body_'+border_id).contentWindow; 1820 var content_body = mainField.document.getElementsByTagName('body').item(0).innerHTML; 1821 var body_images = content_body.match(/msg_num=\d*/g); 1822 var folder_images = content_body.match(/msg_folder=[^&]*&/g); 1823 1824 if (body_images != null) 1825 1825 { 1826 for (var i=0; i<body_images.length; i++){ 1827 content_body = content_body.replace(body_images[i],"msg_num="+openTab.imapUid[border_id]); 1828 } 1829 var allImgs = new Array (images_part.length); 1830 var j=-1; 1831 for (var i in images_part){ 1832 1833 if (is_ie) 1834 if (i == 0) 1835 var image_number = parseInt(images_part[i].substr(9)); 1836 else 1837 image_number = "null"; 1838 else 1839 var image_number = parseInt(images_part[i].substr(9)); 1840 1841 if (! isNaN(image_number)) 1842 { 1843 if (! allImgs[image_number]) 1844 { 1845 allImgs[image_number] = true; 1846 j--; 1847 } 1848 content_body = content_body.replace(images_part[i],'msg_part='+j); 1849 } 1850 } 1851 content_body = content_body.replace(/msg_part=-/g,'msg_part='); 1852 1853 mainField.document.getElementsByTagName('body').item(0).innerHTML = content_body; 1854 } 1826 for (var i=0; i<body_images.length; i++) 1827 { 1828 if( folder_images != null) 1829 content_body = content_body.replace(folder_images[i], "msg_folder=INBOX" + cyrus_delimiter + draftsfolder +"&"); 1830 1831 content_body = content_body.replace(body_images[i],"msg_num="+openTab.imapUid[border_id]); 1832 } 1833 1834 var images_part = content_body.match(/msg_part=[0-9.]*/g); 1835 1836 if(images_part != null) 1837 { 1838 for (var x = 0; x < images_part.length; x++) 1839 { 1840 var position = images_part[x].substr(9,images_part[x].length); 1841 content_body = content_body.replace(images_part[x],'msg_part(||.|||.||)='+data.imagesParts[position]); 1842 } 1843 1844 } 1845 content_body = content_body.replace(/msg_part\(\|\|\.\|\|\|\.\|\|\)=/g,'msg_part='); 1846 1847 mainField.document.getElementsByTagName('body').item(0).innerHTML = content_body; 1848 } 1855 1849 1856 1850 //Replace all files to new files 1857 1851 var divFiles = Element("divFiles_"+border_id); 1858 elFiles = divFiles.getElementsByTagName("input"); 1859 var countCheck =0; 1860 for (var i=0; i<elFiles.length; i++) { 1861 if(elFiles[i].value !=""){ 1862 if (elFiles[i].type == "checkbox") { 1863 countCheck++; 1864 } 1865 else { 1866 elFiles[i].value =""; 1867 parantNodeFile = elFiles[i].parentNode.parentNode; 1868 parantNodeFile.removeChild(elFiles[i].parentNode); 1869 i--; 1870 } 1871 1872 } 1873 }; 1852 divFiles.innerHTML = ''; 1874 1853 1875 1854 var attach_files = connector.unserialize(data.files); 1876 1855 if (attach_files != null) { 1877 openTab.countFile[border_id] = attach_files.length; 1878 att_index = countCheck; 1879 for (att_index; att_index < attach_files.length; att_index++){ 1880 1881 var link_attachment = document.createElement("A"); 1882 var fileName = attach_files[att_index].substr(0,attach_files[att_index].indexOf('_SIZE_')); 1883 var fileSize = parseInt(attach_files[att_index].substr(attach_files[att_index].indexOf('_SIZE_')+6))/1024 1884 link_attachment.innerHTML = fileName + " ("+borkb((parseInt(fileSize)*1024))+")"; 1885 1886 var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"','"+(att_index+2)+"','base64'"; 1887 1888 link_attachment.setAttribute("href", "javascript:download_attachments("+href+")"); 1889 1890 var a_tmp = href.split(','); 1891 a_tmp[2] = fileName; 1892 s_tmp = escape(connector.serialize(a_tmp)); 1893 1894 var check_attachment = document.createElement("INPUT"); 1895 check_attachment.type = 'CHECKBOX'; 1896 check_attachment.name = 'forwarding_attachments[]'; 1897 check_attachment.value = trim(s_tmp); 1898 1899 if (!divFiles.childNodes[0]) 1900 { 1901 divFiles.appendChild(document.createElement("BR")); 1902 } 1903 else 1904 { 1905 divFiles.insertBefore(document.createElement("BR"),divFiles.childNodes[0]); 1906 } 1907 1908 divFiles.insertBefore(link_attachment,divFiles.childNodes[0]); 1909 divFiles.insertBefore(check_attachment,divFiles.childNodes[0]); 1910 1911 check_attachment.checked = true; 1912 } 1913 } 1856 openTab.countFile[border_id] = attach_files.length; 1857 for (att_index = 0; att_index < attach_files.length; att_index++){ 1858 1859 var link_attachment = document.createElement("a"); 1860 var fileName = attach_files[att_index].substr(0, attach_files[att_index].lastIndexOf('_SIZE_')); 1861 var fileSize = parseInt(attach_files[att_index].substr(attach_files[att_index].lastIndexOf('_SIZE_')+6))/1024 1862 link_attachment.innerHTML = fileName + " ("+parseInt(fileSize)+" kb)"; 1863 1864 var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"','0."+(att_index+1)+"','base64'"; 1865 1866 link_attachment.setAttribute("href", "javascript:download_attachments("+href+")"); 1867 1868 var a_tmp = href.split(','); 1869 a_tmp[2] = fileName; 1870 s_tmp = escape(connector.serialize(a_tmp)); 1871 1872 var check_attachment = document.createElement("input"); 1873 check_attachment.type = 'checkbox'; 1874 check_attachment.name = 'forwarding_attachments[]'; 1875 check_attachment.value = s_tmp; 1876 1877 check_attachment.checked = true; 1878 check_attachment.setAttribute("checked", "checked"); 1879 1880 divFiles.appendChild(check_attachment); 1881 divFiles.appendChild(link_attachment); 1882 divFiles.appendChild(document.createElement("br")); 1883 } 1884 } 1885 1914 1886 if (message_id) 1915 1887 { 1916 cExecute ("$this.imap_functions.delete_msgs&folder="+openTab.imapBox[border_id]+"&msgs_number="+message_id,handler_delete_msg); 1917 if (openTab.imapBox[0] == "INBOX/"+draftsfolder) 1918 { 1919 //Update mailbox 1920 var tr_msg = document.getElementById(message_id); 1921 change_tr_properties(tr_msg, data.msg_no, data.subject); 1922 } 1923 } else { 1924 refresh(); 1888 cExecute ("$this.imap_functions.delete_msgs&folder="+openTab.imapBox[border_id]+"&msgs_number="+message_id,handler_delete_msg); 1889 if (openTab.imapBox[0] == "INBOX" + cyrus_delimiter + draftsfolder) 1890 { 1891 //Update mailbox 1892 var tr_msg = document.getElementById(message_id); 1893 change_tr_properties(tr_msg, data.msg_no, data.subject); 1894 } 1895 1925 1896 } 1926 1897
Note: See TracChangeset
for help on using the changeset viewer.