Changeset 4413 for sandbox/2.2.0.2/expressoMail1_2
- Timestamp:
- 05/13/11 18:21:58 (13 years ago)
- Location:
- sandbox/2.2.0.2/expressoMail1_2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.2.0.2/expressoMail1_2/inc/class.imap_functions.inc.php
r4291 r4413 2739 2739 $msg_uid = $params['msg_id']; 2740 2740 $body = $params['body']; 2741 $body = str_replace("%nbsp;"," ", $params['body']);2741 $body = str_replace("%nbsp;"," ", $body); 2742 2742 $body = preg_replace("/\n/"," ",$body); 2743 2743 $body = preg_replace("/\r/","",$body); -
sandbox/2.2.0.2/expressoMail1_2/js/common_functions.js
r4062 r4413 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 += " "; 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 350 364 divFile.appendChild(linkFile); 351 365 divFile.id = "divFile_"+id_border+"_"+countDivFiles; 352 366 divFiles.appendChild(divFile); 353 367 354 355 356 return document.getElementById("inputFile_"+id_border+"_"+countDivFiles); 368 return inputFile; 357 369 } 358 370 // Remove Input File Dynamically. -
sandbox/2.2.0.2/expressoMail1_2/js/draw_api.js
r4365 r4413 3189 3189 } 3190 3190 3191 /** 3192 * event to enable autosave_draft on file attachment 3193 */ 3194 function save_onchange_attachment_handler () { 3195 away = false; 3196 var save_link = Element("save_message_options_"+border_id); 3197 save_link.onclick = function onclick(event) { 3198 openTab.toPreserve[border_id] = true; 3199 save_msg(border_id); 3200 }; 3201 save_link.className = 'message_options'; 3202 }; 3203 3191 3204 var add_files = document.createElement("A"); 3192 3205 add_files.setAttribute("href", "javascript:void(0)"); 3193 add_files.onclick = function () { addFile(ID); return false;}; 3206 add_files.onclick = function () { 3207 var obj = addFile(ID); 3208 if (preferences.auto_save_draft == 1 && obj) { 3209 if ( obj.addEventListener ) 3210 obj.addEventListener('click', save_onchange_attachment_handler, false); 3211 } 3212 return false; 3213 }; 3194 3214 add_files.innerHTML = get_lang("Attachments: add+"); 3195 3215 add_files.setAttribute("tabIndex","-1"); -
sandbox/2.2.0.2/expressoMail1_2/js/main.js
r4364 r4413 3 3 // tempo do auto save (em milisegundos) 4 4 // 20000 = 20 segundos 5 var autosave_time = 20000;5 var autosave_time = 5000; 6 6 7 7 var cabecalho = '<h4>ExpressoLivre - ExpressoMail</h4>'; … … 1745 1745 } 1746 1746 else 1747 { 1747 1748 cExecuteForm("$this.imap_functions.send_mail", form, handler_send_message, ID); 1749 } 1748 1750 } 1749 1751 function change_tr_properties(tr_element, newUid, newSubject){ … … 1765 1767 } 1766 1768 1767 function return_save(data,border_id,folder_name,folder_id,message_id) 1768 { 1769 function return_save(data,border_id,folder_name,folder_id,message_id){ 1769 1770 Element("send_button_"+border_id).style.visibility="visible"; 1770 var handler_delete_msg = function(data){ refresh(preferences.alert_new_msg);};1771 1772 if (data .append != true || !data)1771 var handler_delete_msg = function(data){refresh(preferences.alert_new_msg);}; 1772 1773 if (data == null || data.append != true ) 1773 1774 { 1774 RichTextEditor.saveFlag = -1; 1775 1776 RichTextEditor.saveFlag = -1; 1775 1777 if (! data.append) 1776 if(data == 'Post-Content-Length') 1777 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)); 1778 else 1779 write_msg(get_lang('ERROR saving your message.')); 1778 write_msg('ERROR saving your message.'); 1780 1779 else 1781 1780 { … … 1798 1797 openTab.imapUid[border_id] = data.msg_no; 1799 1798 openTab.imapBox[border_id] = data.folder_id; 1800 1799 1801 1800 var newTitle = document.getElementById('subject_'+border_id).value; 1802 if (newTitle == '') 1801 if (newTitle.length > 18) 1802 newTitle = newTitle.substr(18) + '...'; 1803 else if (newTitle == '') 1803 1804 newTitle = get_lang("No subject"); 1804 set_border_caption('border_id_'+border_id, newTitle);1805 1805 document.getElementById('font_border_id_'+border_id).innerHTML = newTitle; 1806 1806 1807 // Replace the embedded images for new uids 1807 var mainField = document.getElementById('body_'+border_id).contentWindow; 1808 var content_body = mainField.document.getElementsByTagName('body').item(0).innerHTML; 1809 var body_images = content_body.match(/msg_num=\d*/g); 1810 var images_part = content_body.match(/msg_part=\d*/g); 1811 if (body_images) 1808 var mainField = document.getElementById('body_'+border_id).contentWindow; 1809 var content_body = mainField.document.getElementsByTagName('body').item(0).innerHTML; 1810 var body_images = content_body.match(/msg_num=\d*/g); 1811 var folder_images = content_body.match(/msg_folder=[^&]*&/g); 1812 1813 if (body_images != null) 1812 1814 { 1813 for (var i=0; i<body_images.length; i++){ 1814 content_body = content_body.replace(body_images[i],"msg_num="+openTab.imapUid[border_id]); 1815 } 1816 var allImgs = new Array (images_part.length); 1817 var j=-1; 1818 for (var i in images_part){ 1819 1820 if (is_ie) 1821 if (i == 0) 1822 var image_number = parseInt(images_part[i].substr(9)); 1823 else 1824 image_number = "null"; 1825 else 1826 var image_number = parseInt(images_part[i].substr(9)); 1827 1828 if (! isNaN(image_number)) 1829 { 1830 if (! allImgs[image_number]) 1831 { 1832 allImgs[image_number] = true; 1833 j--; 1834 } 1835 content_body = content_body.replace(images_part[i],'msg_part='+j); 1836 } 1837 } 1838 content_body = content_body.replace(/msg_part=-/g,'msg_part='); 1839 1840 mainField.document.getElementsByTagName('body').item(0).innerHTML = content_body; 1841 } 1842 1815 for (var i=0; i<body_images.length; i++) 1816 { 1817 if( folder_images != null) 1818 content_body = content_body.replace(folder_images[i], "msg_folder=INBOX" + cyrus_delimiter + draftsfolder +"&"); 1819 1820 content_body = content_body.replace(body_images[i],"msg_num="+openTab.imapUid[border_id]); 1821 } 1822 1823 var images_part = content_body.match(/msg_part=[0-9.]*/g); 1824 1825 if(images_part != null) 1826 { 1827 for (var x = 0; x < images_part.length; x++) 1828 { 1829 var position = images_part[x].substr(9,images_part[x].length); 1830 content_body = content_body.replace(images_part[x],'msg_part(||.|||.||)='+data.imagesParts[position]); 1831 } 1832 1833 } 1834 content_body = content_body.replace(/msg_part\(\|\|\.\|\|\|\.\|\|\)=/g,'msg_part='); 1835 1836 mainField.document.getElementsByTagName('body').item(0).innerHTML = content_body; 1837 } 1838 1839 1840 1843 1841 //Replace all files to new files 1844 1842 var divFiles = Element("divFiles_"+border_id); 1845 elFiles = divFiles.getElementsByTagName("input"); 1846 var countCheck =0; 1847 for (var i=0; i<elFiles.length; i++) { 1848 if(elFiles[i].value !=""){ 1849 if (elFiles[i].type == "checkbox") { 1850 countCheck++; 1851 } 1852 else { 1853 elFiles[i].value =""; 1854 parantNodeFile = elFiles[i].parentNode.parentNode; 1855 parantNodeFile.removeChild(elFiles[i].parentNode); 1856 i--; 1857 } 1858 1859 } 1860 }; 1861 1843 divFiles.innerHTML = ''; 1844 1862 1845 var attach_files = connector.unserialize(data.files); 1863 1846 if (attach_files != null) { 1864 1847 openTab.countFile[border_id] = attach_files.length; 1865 att_index = countCheck; 1866 for (att_index; att_index < attach_files.length; att_index++){ 1867 1868 var link_attachment = document.createElement("A"); 1869 var fileName = attach_files[att_index].substr(0,attach_files[att_index].indexOf('_SIZE_')); 1870 var fileSize = parseInt(attach_files[att_index].substr(attach_files[att_index].indexOf('_SIZE_')+6))/1024 1871 link_attachment.innerHTML = fileName + " ("+borkb((parseInt(fileSize)*1024))+")"; 1872 1873 var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"','"+(att_index+2)+"','base64'"; 1874 1875 link_attachment.setAttribute("href", "javascript:download_attachments("+href+")"); 1876 1877 var a_tmp = href.split(','); 1878 a_tmp[2] = fileName; 1879 s_tmp = escape(connector.serialize(a_tmp)); 1880 1881 var check_attachment = document.createElement("INPUT"); 1882 check_attachment.type = 'CHECKBOX'; 1883 check_attachment.name = 'forwarding_attachments[]'; 1884 check_attachment.value = trim(s_tmp); 1885 1886 if (!divFiles.childNodes[0]) 1887 { 1888 divFiles.appendChild(document.createElement("BR")); 1889 } 1890 else 1891 { 1892 divFiles.insertBefore(document.createElement("BR"),divFiles.childNodes[0]); 1893 } 1894 1895 divFiles.insertBefore(link_attachment,divFiles.childNodes[0]); 1896 divFiles.insertBefore(check_attachment,divFiles.childNodes[0]); 1897 1898 check_attachment.checked = true; 1899 } 1900 } 1848 for (att_index = 0; att_index < attach_files.length; att_index++){ 1849 1850 var link_attachment = document.createElement("a"); 1851 var fileName = attach_files[att_index].substr(0, attach_files[att_index].lastIndexOf('_SIZE_')); 1852 var fileSize = parseInt(attach_files[att_index].substr(attach_files[att_index].lastIndexOf('_SIZE_')+6))/1024 1853 link_attachment.innerHTML = fileName + " ("+parseInt(fileSize)+" kb)"; 1854 1855 var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"','0."+(att_index+1)+"','base64'"; 1856 1857 link_attachment.setAttribute("href", "javascript:download_attachments("+href+")"); 1858 1859 var a_tmp = href.split(','); 1860 a_tmp[2] = fileName; 1861 s_tmp = escape(connector.serialize(a_tmp)); 1862 1863 var check_attachment = document.createElement("input"); 1864 check_attachment.type = 'checkbox'; 1865 check_attachment.name = 'forwarding_attachments[]'; 1866 check_attachment.value = s_tmp; 1867 1868 check_attachment.checked = true; 1869 check_attachment.setAttribute("checked", "checked"); 1870 1871 divFiles.appendChild(check_attachment); 1872 divFiles.appendChild(link_attachment); 1873 divFiles.appendChild(document.createElement("br")); 1874 } 1875 } 1876 1877 1901 1878 if (message_id) 1902 1879 { 1903 1880 cExecute ("$this.imap_functions.delete_msgs&folder="+openTab.imapBox[border_id]+"&msgs_number="+message_id,handler_delete_msg); 1904 if (openTab.imapBox[0] == "INBOX /"+draftsfolder)1881 if (openTab.imapBox[0] == "INBOX" + cyrus_delimiter + draftsfolder) 1905 1882 { 1906 1883 //Update mailbox 1907 1884 var tr_msg = document.getElementById(message_id); 1908 1885 change_tr_properties(tr_msg, data.msg_no, data.subject); 1909 1886 } 1910 } else { 1911 refresh(); 1912 } 1913 1887 1888 } 1914 1889 var save_link = Element("save_message_options_"+border_id); 1915 1890 save_link.onclick = ''; … … 1917 1892 watch_changes_in_msg(border_id); 1918 1893 write_msg(get_lang('Your message was save as draft in folder %1.', lang_folder(folder_name))); 1919 } 1894 } 1920 1895 } 1921 1896
Note: See TracChangeset
for help on using the changeset viewer.