Ignore:
Timestamp:
10/18/10 13:48:42 (14 years ago)
Author:
rafaelraymundo
Message:

Ticket #1293 - Acerta encaminhamento de msgs com nome de anexo com caracteres especiais.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/expressoMail1_2/js/common_functions.js

    r3336 r3369  
    3535function resizeWindow(){ 
    3636 
    37         var divScrollMain = Element("divScrollMain_"+numBox);  
    38         var table_message = Element("table_message");  
    39         var content_folders = Element("content_folders");  
    40         var clientHeight = ((window.innerHeight ? window.innerHeight : document.body.offsetHeight) - 8);  
     37        var divScrollMain = Element("divScrollMain_"+numBox); 
     38        var table_message = Element("table_message"); 
     39        var content_folders = Element("content_folders"); 
     40        var clientHeight = ((window.innerHeight ? window.innerHeight : document.body.offsetHeight) - 8); 
    4141        var clientWidth = window.innerWidth ? window.innerWidth : document.body.offsetWidth; 
    4242 
    43         if(divScrollMain){  
    44                 divScrollMain.style.height = (clientHeight - (findPosY(divScrollMain) + (table_message.clientHeight ? table_message.clientHeight : table_message.offsetHeight))) + "px";  
    45         }  
     43        if(divScrollMain){ 
     44                divScrollMain.style.height = (clientHeight - (findPosY(divScrollMain) + (table_message.clientHeight ? table_message.clientHeight : table_message.offsetHeight))) + "px"; 
     45        } 
    4646 
    4747        if(typeof(BordersArray) != 'undefined') { 
     
    5050                        var div = Element("content_id_"+BordersArray[i].sequence); 
    5151 
    52                         if(div){  
    53                                 div.style.height = (clientHeight - (findPosY(div) + (table_message.clientHeight ? table_message.clientHeight : table_message.offsetHeight)+2)) + "px";  
    54                                  div.style.width = (clientWidth - (findPosX(div)+10)) + "px";  
    55                         }  
    56                         if(div_scroll){  
    57                                 div_scroll.style.height = (clientHeight - (findPosY(div_scroll) + (table_message.clientHeight ? table_message.clientHeight : table_message.offsetHeight)+5)) + "px";  
    58                                 div_scroll.style.width = (clientWidth - (findPosX(div_scroll)+15)) + "px";  
    59                         }  
    60                 }  
    61         }  
    62  
    63         if(content_folders){  
    64                 var search_div = Element("search_div");  
    65                 var contentFoldersY = findPosY(content_folders);  
    66                 content_folders.style.height = (clientHeight - (contentFoldersY + (contentFoldersY > findPosY(search_div) ? 0 : (search_div.clientHeight ? search_div.clientHeight : search_div.offsetHeight) + 5))) + "px";  
    67         }  
     52                        if(div){ 
     53                                div.style.height = (clientHeight - (findPosY(div) + (table_message.clientHeight ? table_message.clientHeight : table_message.offsetHeight)+2)) + "px"; 
     54                                 div.style.width = (clientWidth - (findPosX(div)+10)) + "px"; 
     55                        } 
     56                        if(div_scroll){ 
     57                                div_scroll.style.height = (clientHeight - (findPosY(div_scroll) + (table_message.clientHeight ? table_message.clientHeight : table_message.offsetHeight)+5)) + "px"; 
     58                                div_scroll.style.width = (clientWidth - (findPosX(div_scroll)+15)) + "px"; 
     59                        } 
     60                } 
     61        } 
     62 
     63        if(content_folders){ 
     64                var search_div = Element("search_div"); 
     65                var contentFoldersY = findPosY(content_folders); 
     66                content_folders.style.height = (clientHeight - (contentFoldersY + (contentFoldersY > findPosY(search_div) ? 0 : (search_div.clientHeight ? search_div.clientHeight : search_div.offsetHeight) + 5))) + "px"; 
     67        } 
    6868        redim_borders(count_borders()); 
    6969} 
     
    9595// Translate words and phrases using user language from eGroupware. 
    9696function get_lang(_key) { 
    97         if (typeof(_key) == 'undefined')  
    98                 return false;  
     97        if (typeof(_key) == 'undefined') 
     98                return false; 
    9999        var key = _key.toLowerCase(); 
    100100        if(array_lang[key]) 
     
    116116 
    117117// Change the class of message. 
    118 // In refresh, the flags UnRead and UnSeen don't exist anymore.  
     118// In refresh, the flags UnRead and UnSeen don't exist anymore. 
    119119function set_msg_as_read(msg_number, selected){ 
    120120        tr_message = Element(msg_number); 
     
    123123        remove_className(tr_message, 'tr_msg_unread'); 
    124124        remove_className(tr_message, 'selected_msg'); 
    125         Element("td_message_unseen_"+msg_number).innerHTML = "<img src ='templates/"+template+"/images/seen.gif' title='"+get_lang('Seen')+"'>";  
     125        Element("td_message_unseen_"+msg_number).innerHTML = "<img src ='templates/"+template+"/images/seen.gif' title='"+get_lang('Seen')+"'>"; 
    126126        connector.purgeCache(); 
    127127        return true; 
     
    136136        tr_message = Element(msg_number); 
    137137        if ((exist_className(tr_message, 'tr_msg_read') || exist_className(tr_message, 'tr_msg_read2')) && (!exist_className(tr_message, 'tr_msg_unread'))) 
    138                 increment_folder_unseen();       
     138                increment_folder_unseen(); 
    139139        remove_className(tr_message, 'selected_msg'); 
    140140        add_className(tr_message, 'tr_msg_unread'); 
    141         Element("td_message_unseen_"+msg_number).innerHTML = "<img src ='templates/"+template+"/images/unseen.gif' title='"+get_lang('Unseen')+"'>";  
     141        Element("td_message_unseen_"+msg_number).innerHTML = "<img src ='templates/"+template+"/images/unseen.gif' title='"+get_lang('Unseen')+"'>"; 
    142142} 
    143143 
     
    197197        //Get element tBody. 
    198198        main = document.getElementById("tbody_box"); 
    199                  
     199 
    200200        // Get all TR (messages) in tBody. 
    201201        main_list = main.childNodes; 
    202          
     202 
    203203        return main_list.length; 
    204204} 
     
    218218        div_attachment = document.getElementById("id_div_attachment"); 
    219219        var params = ''; 
    220          
     220 
    221221        if (div_attachment == null){ 
    222222                var div_attachment = document.createElement("DIV"); 
     
    233233 
    234234function download_all_attachments(msg_folder, msg_number){ 
    235         var handler_source = function(data){             
     235        var handler_source = function(data){ 
    236236                download_attachments(null, null, data, null,null,'anexos.zip'); 
    237237        } 
     
    244244        if (! divFiles) 
    245245                return false; 
    246          
     246 
    247247        if (divFiles.lastChild) 
    248248                var countDivFiles = parseInt(divFiles.lastChild.id.split('_')[2]) + 1; 
     
    250250        if (! countDivFiles) 
    251251                var countDivFiles = 1; 
    252          
     252 
    253253        divFile = document.createElement('DIV'); 
    254          
     254 
    255255 
    256256        if (!expresso_offline) { 
    257257                if (!is_ie) { 
    258258                        var inputFile = document.createElement("INPUT"); 
    259                          
     259 
    260260                        var tmp_id_border = document.createAttribute('id_border'); 
    261261                        tmp_id_border.value = id_border; 
    262                          
     262 
    263263                        inputFile.setAttributeNode(tmp_id_border); 
    264264                        inputFile.id = "inputFile_" + id_border + "_" + countDivFiles; 
     
    271271                else { 
    272272                        var inputFile = document.createElement("link"); 
    273                          
     273 
    274274                        var tmp_id_border = document.createAttribute('id_border'); 
    275275                        tmp_id_border.value = id_border; 
    276                          
     276 
    277277                        inputFile.setAttributeNode(tmp_id_border); 
    278278                        inputFile.id = "inputFile_" + id_border + "_" + countDivFiles; 
    279279                        inputFile.name = 'file_' + countDivFiles; 
    280                          
    281                          
    282                 } 
    283                  
     280 
     281 
     282                } 
     283 
    284284        } 
    285285        else { 
     
    287287                inputFile.type = 'hidden'; 
    288288                inputFile.name = 'offline_forward_' + countDivFiles; 
    289         }        
     289        } 
    290290        divFile.appendChild(inputFile); 
    291291 
     
    299299        checkbox.id = "checkbox_"+id_border+"_"+countDivFiles; 
    300300        checkbox.name = "local_attachments[]"; 
    301          
     301 
    302302        checkbox.value = s_tmp; 
    303303        divFile.appendChild(checkbox); 
    304          
     304 
    305305        var link_attachment = document.createElement("A"); 
    306306        link_attachment.setAttribute("href", link); 
    307          
     307 
    308308        link_attachment.innerHTML = file_name; 
    309309        divFile.appendChild(link_attachment); 
    310          
     310 
    311311        countDivFiles++; 
    312         divFile.id = "divFile_"+id_border+"_"+countDivFiles;     
     312        divFile.id = "divFile_"+id_border+"_"+countDivFiles; 
    313313        divFiles.appendChild(divFile); 
    314314 
     
    322322        if (! divFiles) 
    323323                return false; 
    324          
     324 
    325325        if (divFiles.lastChild) 
    326326                var countDivFiles = parseInt(divFiles.lastChild.id.split('_')[2]) + 1; 
     
    328328        if (! countDivFiles) 
    329329                var countDivFiles = 1; 
    330          
     330 
    331331        divFile = document.createElement('DIV'); 
    332          
    333          
     332 
     333 
    334334        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+"'>"; 
    335335 
    336          
     336 
    337337        var linkFile = document.createElement("A"); 
    338338        linkFile.id = "linkFile_"+id_border+"_"+countDivFiles; 
    339339        linkFile.href='javascript:void(0)'; 
    340340        linkFile.onclick=function () {removeFile(this.id.replace("link","div")); return false;}; 
    341         linkFile.innerHTML=get_lang("Remove");   
     341        linkFile.innerHTML=get_lang("Remove"); 
    342342        //divFile.innerHTML += "&nbsp;&nbsp;"; 
    343343        divFile.appendChild(linkFile); 
    344         divFile.id = "divFile_"+id_border+"_"+countDivFiles;     
     344        divFile.id = "divFile_"+id_border+"_"+countDivFiles; 
    345345        divFiles.appendChild(divFile); 
    346346 
    347          
     347 
    348348 
    349349        return document.getElementById("inputFile_"+id_border+"_"+countDivFiles); 
     
    357357 
    358358function validateFileExtension(fileName, id, id_border){ 
    359          
     359 
    360360        var error_flag  = false; 
    361361 
     
    365365                        var file = fileName.substr(fileName.lastIndexOf('\\') + 1, fileName.length); 
    366366                        if ((fileName.indexOf(':\\') != 1) && (fileName.indexOf('\\\\') != 0)) // Is stored in partition or a network file? 
    367                                 error_flag = true;       
     367                                error_flag = true; 
    368368                } 
    369369                else // is Unix 
    370                         var file = fileName.substr(fileName.lastIndexOf('/') + 1, fileName.length);                                              
     370                        var file = fileName.substr(fileName.lastIndexOf('/') + 1, fileName.length); 
    371371        } 
    372372        else  // is Firefox 3 
     
    382382                        break; 
    383383                } 
    384                          
     384 
    385385        } 
    386386 
     
    399399// Funcao usada para escrever mensagem 
    400400// notimeout = True : mensagem nao apaga 
    401 function write_msg(msg, notimeout){      
    402          
     401function write_msg(msg, notimeout){ 
     402 
    403403        if (setTimeout_write_msg) 
    404404                clearTimeout(setTimeout_write_msg); 
    405          
     405 
    406406        var msg_div = Element('em_div_write_msg'); 
    407407        var old_divStatusBar = Element("divStatusBar"); 
     
    413413                old_divStatusBar.parentNode.insertBefore(msg_div,old_divStatusBar); 
    414414        } 
    415          
     415 
    416416        if( document.getElementById('JabberMessenger')) 
    417417                loadscript.adIcon(); 
     
    420420 
    421421        old_divStatusBar.style.display = 'none'; 
    422         msg_div.style.display = '';      
     422        msg_div.style.display = ''; 
    423423        // Nao ponha var na frente!! jakjr 
    424424        handle_write_msg = function(){ 
     
    427427                                clean_msg(); 
    428428                        else 
    429                                 write_msg(old_msg, true);                        
     429                                write_msg(old_msg, true); 
    430430                } 
    431431                catch(e){} 
     
    443443        if(msg_div) 
    444444                msg_div.style.display = 'none'; 
    445         old_divStatusBar.style.display = '';     
     445        old_divStatusBar.style.display = ''; 
    446446} 
    447447 
     
    507507                return; 
    508508        } 
    509                  
     509 
    510510        var handler_emQuickSearch = function(data) 
    511511        { 
     
    514514                        window_DropDownContacts.style.visibility = 'hidden'; 
    515515                } 
    516                  
     516 
    517517                if ((!data.status) && (data.error == "many results")){ 
    518518                        alert(get_lang('More than %1 results. Please, try to refine your search.',200)); 
    519519                        return false; 
    520520                } 
    521                          
     521 
    522522                if (data.length > 0){ 
    523523                        if ((field != 'null') && (ID != 'null')) 
     
    544544                return true; 
    545545        } 
    546          
     546 
    547547        if ((field != 'null') && (ID != 'null')) 
    548548        { 
     
    564564        else 
    565565                var search_for = emailList; 
    566          
     566 
    567567        if (search_for.length < preferences.search_characters_number){ 
    568568            alert(get_lang('Your search argument must be longer than %1 characters.', preferences.search_characters_number)); 
    569569            return false; 
    570570        } 
    571          
     571 
    572572        cExecute ("$this.ldap_functions.quicksearch&search_for="+search_for+"&field="+field+"&ID="+ID, handler_emQuickSearch); 
    573573} 
     
    680680        var n, strCode, strDecode = ""; 
    681681        for (n = 0; n < str.length; n++) { 
    682             if (str.charAt(n) == "%") { 
    683                 strCode = str.charAt(n + 1) + str.charAt(n + 2); 
    684                 strDecode += String.fromCharCode(parseInt(strCode, 16)); 
    685                 n += 2; 
    686             } else { 
    687                 strDecode += str.charAt(n); 
    688             } 
     682            strDecode += str.charAt(n); 
     683            //if (str.charAt(n) == "%") { 
     684            //    strCode = str.charAt(n + 1) + str.charAt(n + 2); 
     685            //    strDecode += String.fromCharCode(parseInt(strCode, 16)); 
     686            //    n += 2; 
     687            //} else { 
     688            //    strDecode += str.charAt(n); 
     689            //} 
    689690        } 
    690691        return strDecode; 
     
    713714                        var Lp=obj.createTextRange(); 
    714715                } 
    715                  
     716 
    716717                Lp.setEndPoint("EndToStart",M); 
    717718                var rb=Lp.text.length; 
    718                  
     719 
    719720                if(rb > obj.value.length) 
    720721                { 
     
    726727 
    727728function trim(inputString) { 
    728    if (typeof inputString != "string")  
     729   if (typeof inputString != "string") 
    729730        return inputString; 
    730        
     731 
    731732   var retValue = inputString; 
    732733   var ch = retValue.substring(0, 1); 
    733    while (ch == " ") {  
     734   while (ch == " ") { 
    734735          retValue = retValue.substring(1, retValue.length); 
    735736          ch = retValue.substring(0, 1); 
    736737   } 
    737738   ch = retValue.substring(retValue.length-1, retValue.length); 
    738    while (ch == " ") {  
     739   while (ch == " ") { 
    739740          retValue = retValue.substring(0, retValue.length-1); 
    740741          ch = retValue.substring(retValue.length-1, retValue.length); 
    741742   } 
    742    while (retValue.indexOf("  ") != -1) {  
    743           retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length);  
     743   while (retValue.indexOf("  ") != -1) { 
     744          retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
    744745   } 
    745    return retValue;  
     746   return retValue; 
    746747} 
    747748 
     
    922923        var main_list = main.childNodes; 
    923924        var len_main_list = main_list.length; 
    924          
     925 
    925926        if (select) 
    926927        { 
Note: See TracChangeset for help on using the changeset viewer.