Changeset 4683
- Timestamp:
- 07/08/11 11:37:32 (13 years ago)
- Location:
- branches/2.2.0.1/expressoMail1_2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.0.1/expressoMail1_2/inc/class.imap_functions.inc.php
r4682 r4683 2758 2758 $msg_uid = $params['msg_id']; 2759 2759 $body = $params['body']; 2760 $body = str_replace("%nbsp;"," ",$ params['body']);2760 $body = str_replace("%nbsp;"," ",$body); 2761 2761 $body = preg_replace("/\n/"," ",$body); 2762 2762 $body = preg_replace("/\r/","",$body); -
branches/2.2.0.1/expressoMail1_2/js/common_functions.js
r4582 r4683 336 336 var countDivFiles = 1; 337 337 338 divFile = document.createElement('DIV'); 339 340 341 divFile.innerHTML = "<input type='file' id_border='"+id_border+"' size='50' maxLength='255' onchange=\"function () {validateFileExtension(this.value, this.id.replace('input','div'), this.getAttribute('id_border'));};\" id='"+"inputFile_"+id_border+"_"+countDivFiles+"' name='file_"+countDivFiles+"'>"; 342 343 344 var linkFile = document.createElement("A"); 345 linkFile.id = "linkFile_"+id_border+"_"+countDivFiles; 346 linkFile.href='javascript:void(0)'; 347 linkFile.onclick=function () {removeFile(this.id.replace("link","div")); return false;}; 348 linkFile.innerHTML=get_lang("Remove"); 349 //divFile.innerHTML += " "; 350 divFile.appendChild(linkFile); 351 divFile.id = "divFile_"+id_border+"_"+countDivFiles; 352 divFiles.appendChild(divFile); 353 354 355 356 return document.getElementById("inputFile_"+id_border+"_"+countDivFiles); 338 divFile = document.createElement('div'); 339 340 var inputFile = document.createElement("input"); 341 inputFile.id = "inputFile_"+id_border+"_"+countDivFiles; 342 inputFile.name = "file_"+countDivFiles; 343 inputFile.type = "file"; 344 inputFile.size = 50; 345 inputFile.maxlength = 255; 346 inputFile.onchange = function () { 347 validateFileExtension(this.value, this.id.replace('input','div'), this.getAttribute('id_border')); 348 openTab.autosave_timer[id_border] = setTimeout("save_msg("+id_border+")", autosave_time); 349 }; 350 351 inputFile.onfocus = function () { 352 if (openTab.autosave_timer[id_border]) 353 clearTimeout(openTab.autosave_timer[id_border]); 354 }; 355 356 divFile.appendChild(inputFile); 357 358 var linkFile = document.createElement("a"); 359 linkFile.id = "linkFile_"+id_border+"_"+countDivFiles; 360 linkFile.href = 'javascript:void(0)'; 361 linkFile.onclick = function () {removeFile("divFile_"+id_border+"_"+countDivFiles); return false;}; 362 linkFile.innerHTML = get_lang("Remove"); 363 364 divFile.appendChild(linkFile); 365 divFile.id = "divFile_"+id_border+"_"+countDivFiles; 366 divFiles.appendChild(divFile); 367 368 return inputFile; 357 369 } 358 370 // Remove Input File Dynamically. -
branches/2.2.0.1/expressoMail1_2/js/draw_api.js
r4678 r4683 3176 3176 } 3177 3177 3178 /** 3179 * event to enable autosave_draft on file attachment 3180 */ 3181 function save_onchange_attachment_handler () { 3182 away = false; 3183 var save_link = Element("save_message_options_"+ID); 3184 save_link.onclick = function onclick(event) { 3185 openTab.toPreserve[ID] = true; 3186 save_msg(ID); 3187 }; 3188 save_link.className = 'message_options'; 3189 }; 3190 3178 3191 var add_files = document.createElement("A"); 3179 3192 add_files.setAttribute("href", "javascript:void(0)"); 3180 add_files.onclick = function () { addFile(ID); return false;}; 3193 add_files.onclick = function () { 3194 var obj = addFile(ID); 3195 if (preferences.auto_save_draft == 1 && obj) { 3196 if ( obj.addEventListener ) 3197 obj.addEventListener('click', save_onchange_attachment_handler, false); 3198 } 3199 return false; 3200 }; 3181 3201 add_files.innerHTML = get_lang("Attachments: add+"); 3182 3202 add_files.setAttribute("tabIndex","-1"); -
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.