Changeset 4757


Ignore:
Timestamp:
07/15/11 09:36:50 (13 years ago)
Author:
roberto.santosjunior
Message:

Ticket #1820 - Impressão de mensagens de uma pasta. r4602

Location:
trunk/expressoMail1_2
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/js/main.js

    r4733 r4757  
    33// tempo do auto save (em milisegundos) 
    44// 20000 = 20 segundos 
    5 var autosave_time = 5000; 
    6  
    7 var cabecalho = '<h4>ExpressoLivre - ExpressoMail</h4>';  
     5var autosave_time = 20000; 
    86 
    97function init(){ 
     
    2220 
    2321                preferences = data; 
    24                  
    25                 if(preferences.show_name_print_messages == "1") {  
    26                         var getUserName = document.getElementById("user_info");  
    27                         var userName = getUserName.innerHTML;  
    28                         var position = userName.indexOf("-");  
    29                         var userName = userName.substring(3, position);  
    30                         cabecalho = '<h4>' + userName;  
    31                 }   
    32                  
    3322                current_folder="INBOX"; 
    3423                 
     
    9079 
    9180        cExecute ("$this.functions.get_preferences", save_preferences); 
    92         cExecute ("phpgwapi.browser.isMobile", function( data )  
    93         {  
    94             mobile_device = ( ( data.constructor == Boolean ) ? data : ( data === 'true' ) );  
    95         } ); 
    96          
     81        cExecute ("phpgwapi.browser.isMobile", function( data ) 
     82        { 
     83                mobile_device = ( ( data.constructor == Boolean ) ? data : ( data === 'true' ) ); 
     84        } ); 
    9785        setTimeout('auto_refresh()', time_refresh); 
    9886 
     
    902890                } 
    903891        var new_border_ID = draw_new_message(parseInt(border_ID)); 
    904  
    905892        if(typeof(openTab.type[new_border_ID]) != "undefined") { 
    906893                if(tabTypes[type] == openTab.type[new_border_ID]) { 
    907                         if (type != 'edit')  
    908                         {  
    909                         return new_border_ID;  
    910                     } 
     894                    if (type != 'edit') 
     895                    { 
     896                        return new_border_ID; 
     897                    }                    
    911898                } else { 
    912899                        var a_types = { 6 : get_lang("Forward"),7 : get_lang("Reply"),  
     
    926913                } 
    927914        } 
    928  
    929915        if (new_border_ID == false) 
    930916        { 
     
    13861372        } 
    13871373 
     1374        if ( ! expresso_offline ) 
     1375        { 
     1376                if ( mobile_device ) 
     1377                { 
     1378                        var text_plain = document.getElementById( 'textplain_rt_checkbox_' + new_border_ID ); 
     1379                        text_plain.click( ); 
     1380                        text_plain.parentNode.style.display = 'none'; 
     1381                } 
     1382        } 
     1383 
    13881384        if (preferences.auto_save_draft == 1) 
    13891385        { 
     
    16701666        }; 
    16711667 
    1672         var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + ID );  
    1673         mail_as_plain = ( mail_as_plain ) ? mail_as_plain.checked : false;  
    1674          
     1668        var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + ID ); 
     1669        mail_as_plain = ( mail_as_plain ) ? mail_as_plain.checked : false; 
     1670 
    16751671        var textArea = document.createElement("TEXTAREA"); 
    16761672        textArea.style.display='none'; 
    16771673        textArea.name = "body"; 
    16781674        body = document.getElementById("body_"+ID); 
    1679  
    16801675        textArea.value = ( ( mail_as_plain ) ? body.previousSibling.value : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); 
    1681          
    16821676        var input_folder = document.createElement("INPUT"); 
    16831677        input_folder.style.display='none'; 
     
    17141708        form.appendChild(msg_id); 
    17151709 
    1716         var mail_type = document.createElement('input'); 
    1717     mail_type.setAttribute('type', 'hidden'); 
    1718         mail_type.name = 'type';  
    1719         mail_type.value = ( mail_as_plain ) ? 'plain' : 'html'; 
    1720         form.parentNode.appendChild(mail_type); 
    1721          
    1722          
     1710    var mail_type = document.createElement('input'); 
     1711        mail_type.setAttribute('type', 'hidden'); 
     1712        mail_type.name = 'type'; 
     1713        mail_type.value = ( mail_as_plain ) ? 'plain' : 'html'; 
     1714    form.parentNode.appendChild(mail_type); 
     1715 
    17231716        var _subject = trim(Element("subject_"+ID).value); 
    17241717        if((_subject.length == 0) && !confirm(get_lang("Send this message without a subject?"))) { 
     
    17471740        } 
    17481741        else 
    1749         { 
    17501742                cExecuteForm("$this.imap_functions.send_mail", form, handler_send_message, ID); 
    1751         } 
    17521743} 
    17531744function change_tr_properties(tr_element, newUid, newSubject){ 
     
    17691760} 
    17701761 
    1771 function return_save(data,border_id,folder_name,folder_id,message_id){ 
     1762function return_save(data,border_id,folder_name,folder_id,message_id) 
     1763{ 
    17721764        Element("send_button_"+border_id).style.visibility="visible"; 
    1773         var handler_delete_msg = function(data){refresh(preferences.alert_new_msg);}; 
    1774  
    1775         if (data == null || data.append != true ) 
     1765        var handler_delete_msg = function(data){ refresh(preferences.alert_new_msg); }; 
     1766 
     1767        if (data.append != true || !data) 
    17761768        { 
    1777  
    1778                 RichTextEditor.saveFlag = 0; 
     1769                RichTextEditor.saveFlag = 0; 
    17791770                if (! data.append) 
    1780                         write_msg('ERROR saving your message.'); 
     1771                        if(data == 'Post-Content-Length') 
     1772                                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)); 
     1773                        else 
     1774                                write_msg(get_lang('ERROR saving your message.')); 
    17811775                else 
    17821776                { 
     
    17981792                openTab.imapUid[border_id] = data.msg_no; 
    17991793                openTab.imapBox[border_id] = data.folder_id; 
    1800                  
     1794 
    18011795                var newTitle = document.getElementById('subject_'+border_id).value; 
    1802                 if (newTitle.length > 18) 
    1803                         newTitle = newTitle.substr(18) + '...'; 
    1804                 else if (newTitle == '') 
     1796                if (newTitle == '') 
    18051797                        newTitle = get_lang("No subject"); 
    1806                 document.getElementById('font_border_id_'+border_id).innerHTML = newTitle; 
    1807                  
     1798                set_border_caption('border_id_'+border_id, newTitle); 
     1799 
    18081800                // Replace the embedded images for new uids 
    1809                 var mainField     = document.getElementById('body_'+border_id).contentWindow; 
    1810                 var content_body  = mainField.document.getElementsByTagName('body').item(0).innerHTML; 
    1811                 var body_images   = content_body.match(/msg_num=\d*/g); 
    1812                 var folder_images = content_body.match(/msg_folder=[^&]*&/g);            
    1813                  
    1814                 if (body_images != null) 
     1801                var mainField = document.getElementById('body_'+border_id).contentWindow; 
     1802                var content_body =  mainField.document.getElementsByTagName('body').item(0).innerHTML; 
     1803                var body_images = content_body.match(/msg_num=\d*/g); 
     1804                var images_part = content_body.match(/msg_part=\d*/g); 
     1805                if (body_images) 
    18151806                { 
    1816                     for (var i=0; i<body_images.length; i++) 
    1817                     { 
    1818                         if( folder_images != null) 
    1819                            content_body = content_body.replace(folder_images[i], "msg_folder=INBOX" + cyrus_delimiter + draftsfolder +"&"); 
    1820  
    1821                         content_body = content_body.replace(body_images[i],"msg_num="+openTab.imapUid[border_id]); 
    1822                     } 
    1823  
    1824                     var images_part   = content_body.match(/msg_part=[0-9.]*/g); 
    1825  
    1826                     if(images_part != null) 
    1827                     { 
    1828                         for (var x = 0; x < images_part.length; x++) 
    1829                         { 
    1830                             var position = images_part[x].substr(9,images_part[x].length); 
    1831                             content_body = content_body.replace(images_part[x],'msg_part(||.|||.||)='+data.imagesParts[position]); 
    1832                         } 
    1833  
    1834                     } 
    1835                     content_body = content_body.replace(/msg_part\(\|\|\.\|\|\|\.\|\|\)=/g,'msg_part='); 
    1836  
    1837                     mainField.document.getElementsByTagName('body').item(0).innerHTML = content_body; 
    1838                  }        
    1839                  
    1840  
    1841          
     1807                        for (var i=0; i<body_images.length; i++){ 
     1808                                content_body =  content_body.replace(body_images[i],"msg_num="+openTab.imapUid[border_id]); 
     1809                        } 
     1810                        var allImgs = new Array (images_part.length); 
     1811                                var j=-1; 
     1812                                for (var i in images_part){ 
     1813 
     1814                                        if (is_ie) 
     1815                                                if (i == 0) 
     1816                                                        var image_number = parseInt(images_part[i].substr(9)); 
     1817                                                else 
     1818                                                        image_number = "null"; 
     1819                                        else 
     1820                                                var image_number = parseInt(images_part[i].substr(9)); 
     1821 
     1822                                if (! isNaN(image_number)) 
     1823                                        { 
     1824                                                if (! allImgs[image_number]) 
     1825                                                { 
     1826                                                        allImgs[image_number] = true; 
     1827                                                        j--; 
     1828                                                } 
     1829                                        content_body = content_body.replace(images_part[i],'msg_part='+j); 
     1830                                        } 
     1831                                } 
     1832                        content_body = content_body.replace(/msg_part=-/g,'msg_part='); 
     1833 
     1834                        mainField.document.getElementsByTagName('body').item(0).innerHTML = content_body; 
     1835                } 
     1836 
    18421837                //Replace all files to new files 
    18431838                var divFiles = Element("divFiles_"+border_id); 
    1844                  
    1845                 divFiles.innerHTML = ''; 
    1846                  
     1839                elFiles = divFiles.getElementsByTagName("input"); 
     1840                var countCheck =0; 
     1841                for (var i=0; i<elFiles.length; i++) { 
     1842                        if(elFiles[i].value !=""){ 
     1843                                if (elFiles[i].type == "checkbox") { 
     1844                                        countCheck++; 
     1845                                } 
     1846                                else { 
     1847                                        elFiles[i].value =""; 
     1848                                        parantNodeFile = elFiles[i].parentNode.parentNode; 
     1849                                        parantNodeFile.removeChild(elFiles[i].parentNode); 
     1850                                        i--; 
     1851                                } 
     1852 
     1853                        } 
     1854                }; 
     1855 
    18471856                var attach_files = connector.unserialize(data.files); 
    18481857                if (attach_files != null) { 
    18491858                        openTab.countFile[border_id] = attach_files.length; 
    1850                         for (att_index = 0; att_index < attach_files.length; att_index++){ 
    1851                  
    1852                                 var link_attachment = document.createElement("a"); 
    1853                                 var fileName = attach_files[att_index].substr(0, attach_files[att_index].lastIndexOf('_SIZE_')); 
    1854                                 var fileSize = parseInt(attach_files[att_index].substr(attach_files[att_index].lastIndexOf('_SIZE_')+6))/1024 
    1855                                 link_attachment.innerHTML = fileName + " ("+parseInt(fileSize)+" kb)"; 
    1856  
    1857                                 var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"','0."+(att_index+1)+"','base64'"; 
    1858  
    1859                                 link_attachment.setAttribute("href", "javascript:download_attachments("+href+")"); 
    1860  
    1861                                 var a_tmp = href.split(','); 
    1862                                 a_tmp[2] = fileName; 
    1863                                 s_tmp = escape(connector.serialize(a_tmp)); 
    1864                                                  
    1865                                 var check_attachment = document.createElement("input"); 
    1866                                 check_attachment.type = 'checkbox'; 
    1867                                 check_attachment.name = 'forwarding_attachments[]'; 
    1868                                 check_attachment.value = s_tmp; 
    1869                                  
    1870                                 check_attachment.checked = true; 
    1871                                 check_attachment.setAttribute("checked", "checked"); 
    1872                                  
    1873                                 divFiles.appendChild(check_attachment); 
    1874                                 divFiles.appendChild(link_attachment); 
    1875                                 divFiles.appendChild(document.createElement("br")); 
    1876                         }                        
    1877                 } 
    1878                  
    1879                  
     1859                        att_index = countCheck; 
     1860                for (att_index; att_index < attach_files.length; att_index++){ 
     1861 
     1862                        var link_attachment = document.createElement("A"); 
     1863                        var fileName = attach_files[att_index].substr(0,attach_files[att_index].indexOf('_SIZE_')); 
     1864                        var fileSize = parseInt(attach_files[att_index].substr(attach_files[att_index].indexOf('_SIZE_')+6))/1024 
     1865                        link_attachment.innerHTML = fileName + " ("+borkb((parseInt(fileSize)*1024))+")"; 
     1866 
     1867                        var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"','"+(att_index+2)+"','base64'"; 
     1868 
     1869                        link_attachment.setAttribute("href", "javascript:download_attachments("+href+")"); 
     1870 
     1871                        var a_tmp = href.split(','); 
     1872                        a_tmp[2] = fileName; 
     1873                        s_tmp = escape(connector.serialize(a_tmp)); 
     1874 
     1875                        var check_attachment = document.createElement("INPUT"); 
     1876                        check_attachment.type = 'CHECKBOX'; 
     1877                        check_attachment.name = 'forwarding_attachments[]'; 
     1878                        check_attachment.value = trim(s_tmp); 
     1879 
     1880                        if (!divFiles.childNodes[0]) 
     1881                        { 
     1882                            divFiles.appendChild(document.createElement("BR")); 
     1883                        } 
     1884                        else 
     1885                            { 
     1886                                divFiles.insertBefore(document.createElement("BR"),divFiles.childNodes[0]); 
     1887                            } 
     1888 
     1889                        divFiles.insertBefore(link_attachment,divFiles.childNodes[0]); 
     1890                        divFiles.insertBefore(check_attachment,divFiles.childNodes[0]); 
     1891 
     1892                        check_attachment.checked = true; 
     1893                } 
     1894        } 
    18801895                if (message_id) 
    18811896                { 
    18821897                        cExecute ("$this.imap_functions.delete_msgs&folder="+openTab.imapBox[border_id]+"&msgs_number="+message_id,handler_delete_msg); 
    1883                         if (openTab.imapBox[0] == "INBOX" + cyrus_delimiter + draftsfolder) 
     1898                        if (openTab.imapBox[0] == "INBOX/"+draftsfolder) 
    18841899                        { 
    18851900                                //Update mailbox 
    1886                                 var tr_msg = document.getElementById(message_id); 
     1901                                                var tr_msg = document.getElementById(message_id); 
    18871902                                change_tr_properties(tr_msg, data.msg_no, data.subject); 
    18881903                        } 
    1889                  
    1890                 } 
     1904                } else { 
     1905                        refresh(); 
     1906                } 
     1907 
    18911908                var save_link = Element("save_message_options_"+border_id); 
    18921909                save_link.onclick = ''; 
     
    18941911                watch_changes_in_msg(border_id); 
    18951912                write_msg(get_lang('Your message was save as draft in folder %1.', lang_folder(folder_name))); 
    1896                 setTimeout( function(){ RichTextEditor.saveFlag = 1; }, 1000 ); 
    1897         }                
     1913                setTimeout( function(){ RichTextEditor.saveFlag = 1; }, 1000 ); 
     1914        } 
    18981915} 
    18991916 
     
    19291946        var handler_save_msg = function(data){ return_save(data,this.tmp_border_id,this.tmp_folder_name,this.tmp_folder_id,this.message_id); } 
    19301947 
    1931         var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + border_id );  
    1932         mail_as_plain = ( mail_as_plain ) ? mail_as_plain.checked : false; 
    1933          
     1948        var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + border_id ); 
     1949        mail_as_plain = ( mail_as_plain ) ? mail_as_plain.checked : false; 
     1950 
    19341951        var textArea = document.createElement("TEXTAREA"); 
    19351952        textArea.style.display='none'; 
     
    19381955        if (! body) 
    19391956                return; 
    1940          
    19411957        textArea.value = ( ( mail_as_plain ) ? body.previousSibling.value : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); 
    1942          
    19431958        var input_folder = document.createElement("INPUT"); 
    19441959        input_folder.style.display='none'; 
     
    19551970 
    19561971 
    1957         if (is_ie){ 
     1972        if (is_ie) 
     1973        { 
    19581974                var i = 0; 
    19591975                while (document.forms(i).name != "form_message_"+border_id){i++} 
     
    19611977        } 
    19621978        else 
     1979        { 
    19631980                form = document.forms["form_message_"+border_id]; 
     1981        } 
     1982         
    19641983        form.appendChild(textArea); 
    19651984        form.appendChild(input_folder); 
     
    19671986        form.appendChild(input_insertImg); 
    19681987 
    1969          
    1970         var mail_type;        
    1971   
    1972         if (is_ie)  
    1973         {  
    1974                 mail_type = document.createElement('<input type="hidden" />');  
    1975         }  
    1976         else  
    1977         {  
    1978                 mail_type = document.createElement('input');  
    1979                 mail_type.setAttribute('type', 'hidden');  
    1980         }  
    1981         mail_type.setAttribute('name', 'type');  
    1982         var mail_type_value = ( mail_as_plain ) ? 'plain' : 'html';  
    1983         mail_type.setAttribute("value", mail_type_value); 
    1984  
    1985         form.parentNode.appendChild( mail_type ); 
    1986          
     1988        var mail_type; 
     1989         
     1990        if (is_ie) 
     1991        { 
     1992            mail_type = document.createElement('<input type="hidden" />'); 
     1993        } 
     1994        else 
     1995            { 
     1996                mail_type = document.createElement('input'); 
     1997                mail_type.setAttribute('type', 'hidden'); 
     1998            } 
     1999        mail_type.setAttribute('name', 'type'); 
     2000        var mail_type_value = ( mail_as_plain ) ? 'plain' : 'html'; 
     2001        mail_type.setAttribute("value", mail_type_value); 
     2002 
     2003        form.parentNode.appendChild(mail_type); 
     2004 
    19872005        cExecuteForm ("$this.imap_functions.save_msg", form, handler_save_msg,border_id); 
    19882006} 
     
    21652183 
    21662184        var folder= Element('border_id_0').innerHTML; 
    2167         var body = Element('divScrollMain_'+numBox).innerHTML; 
     2185        var thead = Element('divScrollHead_'+numBox).firstChild.firstChild.innerHTML; 
     2186        var tbody = Element('divScrollMain_'+numBox).firstChild.firstChild.innerHTML; 
    21682187        var print_width = screen.width - 200; 
    21692188        var x = ((screen.width - print_width) / 2); 
    21702189        var y = ((screen.height - 400) / 2) - 35; 
    21712190        var window_print = window.open('','ExpressoMail','width='+print_width+',height=400,resizable=yes,scrollbars=yes,left='+x+',top='+y); 
    2172         var seekDot = /\<img /gi; 
    2173         body = body.replace(seekDot, "<img style='display:none' "); 
    2174         seekDot = /\<input /gi; 
    2175         body = body.replace(seekDot, "<input style='display:none' "); 
     2191        seekDot = /width="24"/gi; 
     2192        thead = thead.replace(seekDot, "style='display:none'"); 
     2193        tbody = tbody.replace(seekDot, "style='display:none'"); 
     2194        seekDot = /width="16"/gi; 
     2195        thead = thead.replace(seekDot, "style='display:none'"); 
     2196        tbody = tbody.replace(seekDot, "style='display:none'"); 
     2197        seekDot = /width="12"/gi; 
     2198        thead = thead.replace(seekDot, "style='display:none'"); 
     2199        tbody = tbody.replace(seekDot, "style='display:none'"); 
    21762200 
    21772201        while (1){ 
    21782202                try{ 
    2179                         var html = '<br>'; 
    2180                         html += cabecalho + "</h4><hr>"; 
    2181                         html += folder+"<hr>"; 
    2182  
    2183                         window_print.document.body.innerHTML = html + '<blockquote><font size="2">' + 
    2184                         '<table style="font-size:12" width="'+(is_ie ? "94%" : "100%" )+'">' +  
    2185                         '<TD width="25%" align="center">'+get_lang("Who")+'</TD>' +  
    2186                         '<TD align="center" width="'+(is_ie ? "50%" : "55%" )+'">'+get_lang("Subject")+'</TD>' +  
    2187                         '<TD align="center" width="11%">'+get_lang("Date")+'</TD>' +  
    2188                         '<TD align="center" width="'+(is_ie ? "10%" : "9%" )+'">'+get_lang("Size")+'</TD></TR></table>' 
    2189                         + body + '</font></blockquote>'; 
     2203                        window_print.document.open(); 
     2204                        var html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>' 
     2205                        + '<head><link rel="stylesheet" type="text/css" href="templates/'+template+'/print.css"></head>' 
     2206                        + '<body class="print-all-messages"><h1>ExpressoLivre - ExpressoMail</h1>' 
     2207                        + '<h2>'+folder+'</h2><hr/><blockquote><font size="2">' 
     2208                        + '<table width="100%" cellpadding="0" cellspacing="0">' 
     2209                        + '<thead>' + thead + '</thead><tbody>' + tbody + '</tbody>' 
     2210                        + '</table></font></blockquote></body></html>'; 
     2211                        window_print.document.write(html); 
     2212                        window_print.document.close(); 
    21902213                        break; 
    21912214                } 
     
    22462269                var attachs = ""; 
    22472270                var show_attachs = ""; 
    2248                 var ii = a.length >2?2:1;  
    2249             for(i=ii;i<a.length;i++) 
     2271                var ii = a.length >2?2:1; 
     2272                for(i=ii;i<a.length;i++) 
    22502273                { 
    22512274                        if(a[i].tagName && a[i].tagName == "A") 
     
    22572280        } else{ 
    22582281                show_attachs = ""; 
    2259         } 
    2260          
     2282        }        
    22612283        var current_path = window.location.href.substr(0,window.location.href.lastIndexOf("/")); 
    2262  
    2263         var head = '<head><title></title><link href="'+current_path+'/templates/default/main.css" type="text/css" rel="stylesheet"></head>';  
    2264         window_print.document.write(head);  
    2265          
     2284        var head = '<head><title></title><link href="'+current_path+'/templates/default/main.css" type="text/css" rel="stylesheet"></head>'; 
     2285        window_print.document.write(head); 
     2286 
    22662287        while (1){ 
    22672288                try{ 
    22682289                        var html ='<body>'; 
    2269                         html += cabecalho + "</h4><hr>"; 
     2290                        html += "<h4>ExpressoLivre - ExpressoMail</h4><hr>"; 
    22702291                        html += '<table><tbody>'; 
    22712292                        if(sender) 
     
    22932314                        html += show_attachs; //to show the names of the attachments 
    22942315                        html += "</tbody></table><hr>"; 
    2295                         window_print.document.write(html + body.innerHTML);  
     2316                        window_print.document.write(html + body.innerHTML); 
    22962317                        if(!is_ie){ 
    22972318                                var tab_tags = window_print.document.getElementsByTagName("IMG"); 
     
    23612382 
    23622383function export_all_selected_msgs(){ 
    2363         var msgs_to_export = this.get_selected_messages();  
    2364  
    23652384        if (openTab.type[currentTab] > 1){ 
    2366                 msgs_to_export = currentTab.substr(0,(currentTab.length - 2)); 
    2367         } 
     2385                source_msg(currentTab,current_folder); 
     2386                return; 
     2387        } 
     2388        var msgs_to_export = this.get_selected_messages(); 
    23682389 
    23692390        var handler_export_all_selected_msgs = function(data){ 
     
    23722393                        write_msg(get_lang('Error compressing messages (ZIP). Contact the administrator.')); 
    23732394                } 
    2374                 else  
    2375                 {  
    2376                         if (data.substr(data.length-3, 3) == "zip") {  
    2377                                 download_attachments(null, null, data, null, null,'mensagens.zip');  
    2378                         } else if (data.substr(data.length-3, 3) == "eml") {  
    2379                                 //extracts the file name from file path  
    2380                                 var string_start  = data.lastIndexOf("/") + 1;  
    2381                                 var string_length = data.length - string_start;  
    2382                                 var fname = data.substr(string_start, string_length);  
    2383                                 //extracts the session_id from file name  
    2384                                 var string_end  = data.lastIndexOf("_") - 5;  
    2385                                 fname = fname.substr(0, string_end).concat(".eml");  
    2386                                 download_attachments(null, null, data, null, null, fname);  
    2387                         } else {  
    2388                                 download_attachments(null, null, data, null, null, 'mensagens');  
    2389                         }  
    2390                 }  
     2395                else 
     2396                        download_attachments(null, null, data, null,null,'mensagens.zip'); 
    23912397        } 
    23922398 
     
    25362542        } 
    25372543        form_upload.innerHTML = '<form method="POST" name="form_import" enctype="multipart/form-data">'+get_lang('zip mails to import')+':<br>'+ 
    2538         '<input name="file_1" maxlength="255" size="40" id="file_1" type="file"><br>' + 
     2544        '<input name="file_1" maxlength="255" size="50" id="file_1" type="file"><br>' + 
    25392545        '<input title="'+get_lang('Select a folder')+'"  value="' + get_lang('Select a folder') + '"' + 'type="button" onclick="javascript:select_import_folder()">&nbsp;' + 
    25402546        '<input title="' + get_lang('Close') + '"  value="' + get_lang('Close') + '"' + 
     
    25462552        function handler(data){ 
    25472553                // Its necessary to encapsulate the data returned (IE bugfix) 
    2548                 clear_msg(); 
    25492554                return_import_msgs(data,wfolders_tree); 
    25502555        } 
     
    25622567        folder.value = wfolders_tree._selected.id; 
    25632568        document.form_import.appendChild(folder); 
    2564         write_msg(get_lang('You must wait while the messages will be imported...'), undefined, true); 
     2569        write_msg(get_lang('You must wait while the messages will be imported...')); 
    25652570 
    25662571        cExecuteForm('$this.imap_functions.import_msgs', document.form_import, handler); 
Note: See TracChangeset for help on using the changeset viewer.