Changeset 341


Ignore:
Timestamp:
06/26/08 16:13:40 (16 years ago)
Author:
niltonneto
Message:

Ajuste do comentario.

File:
1 edited

Legend:

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

    r325 r341  
    3535        var bar = Element("toolbar"); 
    3636        var offset = 0; 
    37         if(bar.style.visibility != 'hidden') 
    38                 offset = (bar.offsetHeight ? bar.offsetHeight :  bar.clientHeight); 
     37        if(bar.style.visibility != 'hidden')  
     38                offset = (bar.offsetHeight ? bar.offsetHeight :  bar.clientHeight);      
    3939 
    4040        var screenHeight = document.body.clientHeight ? document.body.clientHeight : document.body.offsetHeight; 
     
    7777function get_lang(_key,_arg1,_arg2,_arg3,_arg4) { 
    7878 
    79         if(!array_lang[0]){ 
     79        if(!array_lang[0]){              
    8080                return _key+"*"; 
    8181        } 
    82         _value = ""; 
     82        _value = "";     
    8383        for(i = 0; i < array_lang[0].length;i++){ 
    8484                if(array_lang[0][i] == _key.toLowerCase()) { 
    85                         _value = array_lang[1][i]; 
     85                        _value = array_lang[1][i];                                       
    8686                        break; 
    8787                } 
    88         } 
    89  
     88        }        
     89         
    9090        if(!_value) 
    9191                return _key+"*"; 
    92  
     92                         
    9393        if(_arg1 || _arg2 ||_arg3 || _arg4) { 
    9494                for(j = 1; j <= 4; j++){ 
    9595                        if(eval("_arg"+j)) { 
    96                                 var regExp = new RegExp("%"+j+""); 
     96                                var regExp = new RegExp("%"+j+"");               
    9797                                _value = _value.replace(regExp,eval("_arg"+j)); 
    9898                        } 
    9999                } 
    100100        } 
    101  
     101         
    102102        return _value; 
    103103} 
     
    110110 
    111111// Change the class of message. 
    112 // In refresh, the flags UnRead and UnSeen don't exist anymore. 
     112// In refresh, the flags UnRead and UnSeen don't exist anymore.  
    113113function set_msg_as_read(msg_number, selected){ 
    114114        tr_message = Element(msg_number); 
     
    168168        //Get element tBody. 
    169169        main = document.getElementById("tbody_box"); 
    170  
     170                 
    171171        // Get all TR (messages) in tBody. 
    172172        main_list = main.childNodes; 
    173  
     173         
    174174        return main_list.length; 
    175175} 
     
    178178        div_attachment = document.getElementById("id_div_attachment"); 
    179179        var params = ''; 
    180  
     180         
    181181        if (div_attachment == null){ 
    182182                var div_attachment = document.createElement("DIV"); 
     
    193193 
    194194function download_all_attachments(msg_folder, msg_number){ 
    195         var handler_source = function(data){ 
     195        var handler_source = function(data){             
    196196                download_attachments(null, null, data, null,null,'anexos.zip'); 
    197197        } 
     
    203203        if (! divFiles) 
    204204                return false; 
    205  
     205         
    206206        if (divFiles.lastChild) 
    207207                var countDivFiles = parseInt(divFiles.lastChild.id.split('_')[2]) + 1; 
     
    209209        if (! countDivFiles) 
    210210                var countDivFiles = 1; 
    211  
     211         
    212212        divFile = document.createElement('DIV'); 
    213  
     213         
    214214        var inputFile = document.createElement("INPUT"); 
    215  
     215         
    216216        var tmp_id_border = document.createAttribute('id_border'); 
    217217        tmp_id_border.value = id_border; 
    218  
     218         
    219219        inputFile.setAttributeNode(tmp_id_border); 
    220220        inputFile.id = "inputFile_"+id_border+"_"+countDivFiles; 
     
    224224        inputFile.maxLength = 255; 
    225225        inputFile.name='file_'+countDivFiles; 
    226  
     226         
    227227        divFile.appendChild(inputFile); 
    228  
     228         
    229229        var linkFile = document.createElement("A"); 
    230230        linkFile.id = "linkFile_"+id_border+"_"+countDivFiles; 
    231231        linkFile.href='javascript:void(0)'; 
    232232        linkFile.onclick=function () {removeFile(this.id.replace("link","div")); return false;}; 
    233         linkFile.innerHTML=get_lang("Remove"); 
     233        linkFile.innerHTML=get_lang("Remove");   
    234234        //divFile.innerHTML += "&nbsp;&nbsp;"; 
    235235        divFile.appendChild(linkFile); 
    236         divFile.id = "divFile_"+id_border+"_"+countDivFiles; 
     236        divFile.id = "divFile_"+id_border+"_"+countDivFiles;     
    237237        divFiles.appendChild(divFile); 
    238238} 
     
    287287// Funcao usada para escrever mensagem 
    288288// notimeout = True : mensagem nao apaga 
    289 function write_msg(msg, notimeout){ 
    290  
     289function write_msg(msg, notimeout){      
     290         
    291291        if (setTimeout_write_msg) 
    292292                clearTimeout(setTimeout_write_msg); 
    293  
     293         
    294294        var msg_div = Element('em_div_write_msg'); 
    295295        var old_divStatusBar = Element("divStatusBar"); 
     
    302302                msg_div.style.display = 'none'; 
    303303                old_divStatusBar.parentNode.insertBefore(msg_div,old_divStatusBar); 
    304         } 
     304        }        
    305305        msg_div.innerHTML = '<table bgcolor="#f7f8fa" width=100% cellspacing="0" cellpadding="0" border="0"><tbody><tr><th width="40%"></th><th noWrap class="action_info_th">'+msg+'</th><th width="40%"></th></tr></tbody></table>'; 
    306306        old_divStatusBar.style.display = 'none'; 
    307         msg_div.style.display = ''; 
     307        msg_div.style.display = '';      
    308308        // Nao ponha var na frente!! jakjr 
    309309        handle_write_msg = function(){ 
     
    312312                                clean_msg(); 
    313313                        else 
    314                                 write_msg(old_msg, true); 
     314                                write_msg(old_msg, true);                        
    315315                } 
    316316                catch(e){} 
     
    328328        if(msg_div) 
    329329                msg_div.style.display = 'none'; 
    330         old_divStatusBar.style.display = ''; 
     330        old_divStatusBar.style.display = '';     
    331331} 
    332332 
     
    371371        var quickSearchKeyBegin; 
    372372        var quickSearchKeyEnd; 
    373  
     373         
    374374        var handler_emQuickSearch = function(data) 
    375375        { 
     
    378378                        window_DropDownContacts.style.visibility = 'hidden'; 
    379379                } 
    380  
     380                 
    381381                if ((!data.status) && (data.error == "many results")){ 
    382382                        alert(get_lang('More than %1 results. Please, try to refine your search.',200)); 
    383383                        return false; 
    384384                } 
    385  
     385                         
    386386                if (data.length > 0){ 
    387387                        if ((field != 'null') && (ID != 'null')) 
     
    400400                return true; 
    401401        } 
    402  
     402         
    403403        if ((field != 'null') && (ID != 'null')) 
    404404        { 
    405                 Element(field +'_'+ ID).focus(); //necessï¿œrio para o IE. 
     405                Element(field +'_'+ ID).focus(); //It requires for IE. 
    406406                var i = getPosition(Element(field +'_'+ ID)); //inputBox.selectionStart; 
    407407                var j = --i; 
     
    420420        else 
    421421                var search_for = emailList; 
    422  
     422         
    423423        if (search_for.length < 4){ 
    424424                alert(get_lang('Your search argument must be longer than 4 characters.')); 
    425425                return false; 
    426426        } 
    427  
     427         
    428428        cExecute ("$this.ldap_functions.quicksearch&search_for="+search_for+"&field="+field+"&ID="+ID, handler_emQuickSearch); 
    429429} 
     
    473473 
    474474function url_encode(str){ 
    475     var hex_chars = "0123456789ABCDEF"; 
    476     var noEncode = /^([a-zA-Z0-9\_\-\.])$/; 
    477     var n, strCode, hex1, hex2, strEncode = ""; 
    478  
    479     for(n = 0; n < str.length; n++) { 
    480         if (noEncode.test(str.charAt(n))) { 
    481             strEncode += str.charAt(n); 
    482         } else { 
    483             strCode = str.charCodeAt(n); 
    484             hex1 = hex_chars.charAt(Math.floor(strCode / 16)); 
    485             hex2 = hex_chars.charAt(strCode % 16); 
    486             strEncode += "%" + (hex1 + hex2); 
    487         } 
    488     } 
    489     return strEncode; 
    490 } 
    491  
    492 function url_decode(str) { 
    493  
    494         var n, strCode, strDecode = ""; 
    495         for (n = 0; n < str.length; n++) { 
    496             if (str.charAt(n) == "%") { 
    497                 strCode = str.charAt(n + 1) + str.charAt(n + 2); 
    498                 strDecode += String.fromCharCode(parseInt(strCode, 16)); 
    499                 n += 2; 
    500             } else { 
    501                 strDecode += str.charAt(n); 
    502             } 
    503         } 
    504         return strDecode; 
    505 } 
     475    var hex_chars = "0123456789ABCDEF";  
     476    var noEncode = /^([a-zA-Z0-9\_\-\.])$/;  
     477    var n, strCode, hex1, hex2, strEncode = "";  
     478 
     479    for(n = 0; n < str.length; n++) {  
     480        if (noEncode.test(str.charAt(n))) {  
     481            strEncode += str.charAt(n);  
     482        } else {  
     483            strCode = str.charCodeAt(n);  
     484            hex1 = hex_chars.charAt(Math.floor(strCode / 16));  
     485            hex2 = hex_chars.charAt(strCode % 16);  
     486            strEncode += "%" + (hex1 + hex2);  
     487        }  
     488    }  
     489    return strEncode;  
     490}   
     491 
     492function url_decode(str) {  
     493 
     494        var n, strCode, strDecode = "";  
     495        for (n = 0; n < str.length; n++) {  
     496            if (str.charAt(n) == "%") {  
     497                strCode = str.charAt(n + 1) + str.charAt(n + 2);  
     498                strDecode += String.fromCharCode(parseInt(strCode, 16));  
     499                n += 2;  
     500            } else {  
     501                strDecode += str.charAt(n);  
     502            }  
     503        }  
     504        return strDecode;  
     505}   
    506506 
    507507 
     
    528528                        var Lp=obj.createTextRange(); 
    529529                } 
    530  
     530                 
    531531                Lp.setEndPoint("EndToStart",M); 
    532532                var rb=Lp.text.length; 
    533  
     533                 
    534534                if(rb > obj.value.length) 
    535535                { 
     
    541541 
    542542function trim(inputString) { 
    543    if (typeof inputString != "string") 
     543   if (typeof inputString != "string")  
    544544        return inputString; 
    545  
     545       
    546546   var retValue = inputString; 
    547547   var ch = retValue.substring(0, 1); 
    548    while (ch == " ") { 
     548   while (ch == " ") {  
    549549          retValue = retValue.substring(1, retValue.length); 
    550550          ch = retValue.substring(0, 1); 
    551551   } 
    552552   ch = retValue.substring(retValue.length-1, retValue.length); 
    553    while (ch == " ") { 
     553   while (ch == " ") {  
    554554          retValue = retValue.substring(0, retValue.length-1); 
    555555          ch = retValue.substring(retValue.length-1, retValue.length); 
    556556   } 
    557    while (retValue.indexOf("  ") != -1) { 
    558           retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
     557   while (retValue.indexOf("  ") != -1) {  
     558          retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length);  
    559559   } 
    560    return retValue; 
     560   return retValue;  
    561561} 
    562562 
    563563function increment_folder_unseen(){ 
    564564        var folder_id = get_current_folder(); 
    565  
     565         
    566566        var folder_unseen = Element('dftree_'+folder_id+'_unseen'); 
    567567        if (folder_unseen) 
     
    579579function decrement_folder_unseen(){ 
    580580        var folder_id = get_current_folder(); 
    581  
     581         
    582582        var folder_unseen = Element('dftree_'+folder_id+'_unseen'); 
    583583        if(!folder_unseen) 
     
    603603        var strTemp = ""; 
    604604        var iTemp = 0; 
    605  
     605         
    606606        if(v_length < 1) 
    607607                return ""; 
    608608 
    609609        var v_length = value ? value.length : 0; 
    610  
     610         
    611611        while(iTemp < v_length){ 
    612612                if(value && value.charAt(iTemp) != w_space){ 
     
    615615                } 
    616616                iTemp++; 
    617         } 
     617        }        
    618618        return strTemp; 
    619619} 
     
    671671        var main_list = main.childNodes; 
    672672        var len_main_list = main_list.length; 
    673  
     673         
    674674        if (select) 
    675675        { 
Note: See TracChangeset for help on using the changeset viewer.