Changeset 341
- Timestamp:
- 06/26/08 16:13:40 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/common_functions.js
r325 r341 35 35 var bar = Element("toolbar"); 36 36 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); 39 39 40 40 var screenHeight = document.body.clientHeight ? document.body.clientHeight : document.body.offsetHeight; … … 77 77 function get_lang(_key,_arg1,_arg2,_arg3,_arg4) { 78 78 79 if(!array_lang[0]){ 79 if(!array_lang[0]){ 80 80 return _key+"*"; 81 81 } 82 _value = ""; 82 _value = ""; 83 83 for(i = 0; i < array_lang[0].length;i++){ 84 84 if(array_lang[0][i] == _key.toLowerCase()) { 85 _value = array_lang[1][i]; 85 _value = array_lang[1][i]; 86 86 break; 87 87 } 88 } 89 88 } 89 90 90 if(!_value) 91 91 return _key+"*"; 92 92 93 93 if(_arg1 || _arg2 ||_arg3 || _arg4) { 94 94 for(j = 1; j <= 4; j++){ 95 95 if(eval("_arg"+j)) { 96 var regExp = new RegExp("%"+j+""); 96 var regExp = new RegExp("%"+j+""); 97 97 _value = _value.replace(regExp,eval("_arg"+j)); 98 98 } 99 99 } 100 100 } 101 101 102 102 return _value; 103 103 } … … 110 110 111 111 // 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. 113 113 function set_msg_as_read(msg_number, selected){ 114 114 tr_message = Element(msg_number); … … 168 168 //Get element tBody. 169 169 main = document.getElementById("tbody_box"); 170 170 171 171 // Get all TR (messages) in tBody. 172 172 main_list = main.childNodes; 173 173 174 174 return main_list.length; 175 175 } … … 178 178 div_attachment = document.getElementById("id_div_attachment"); 179 179 var params = ''; 180 180 181 181 if (div_attachment == null){ 182 182 var div_attachment = document.createElement("DIV"); … … 193 193 194 194 function download_all_attachments(msg_folder, msg_number){ 195 var handler_source = function(data){ 195 var handler_source = function(data){ 196 196 download_attachments(null, null, data, null,null,'anexos.zip'); 197 197 } … … 203 203 if (! divFiles) 204 204 return false; 205 205 206 206 if (divFiles.lastChild) 207 207 var countDivFiles = parseInt(divFiles.lastChild.id.split('_')[2]) + 1; … … 209 209 if (! countDivFiles) 210 210 var countDivFiles = 1; 211 211 212 212 divFile = document.createElement('DIV'); 213 213 214 214 var inputFile = document.createElement("INPUT"); 215 215 216 216 var tmp_id_border = document.createAttribute('id_border'); 217 217 tmp_id_border.value = id_border; 218 218 219 219 inputFile.setAttributeNode(tmp_id_border); 220 220 inputFile.id = "inputFile_"+id_border+"_"+countDivFiles; … … 224 224 inputFile.maxLength = 255; 225 225 inputFile.name='file_'+countDivFiles; 226 226 227 227 divFile.appendChild(inputFile); 228 228 229 229 var linkFile = document.createElement("A"); 230 230 linkFile.id = "linkFile_"+id_border+"_"+countDivFiles; 231 231 linkFile.href='javascript:void(0)'; 232 232 linkFile.onclick=function () {removeFile(this.id.replace("link","div")); return false;}; 233 linkFile.innerHTML=get_lang("Remove"); 233 linkFile.innerHTML=get_lang("Remove"); 234 234 //divFile.innerHTML += " "; 235 235 divFile.appendChild(linkFile); 236 divFile.id = "divFile_"+id_border+"_"+countDivFiles; 236 divFile.id = "divFile_"+id_border+"_"+countDivFiles; 237 237 divFiles.appendChild(divFile); 238 238 } … … 287 287 // Funcao usada para escrever mensagem 288 288 // notimeout = True : mensagem nao apaga 289 function write_msg(msg, notimeout){ 290 289 function write_msg(msg, notimeout){ 290 291 291 if (setTimeout_write_msg) 292 292 clearTimeout(setTimeout_write_msg); 293 293 294 294 var msg_div = Element('em_div_write_msg'); 295 295 var old_divStatusBar = Element("divStatusBar"); … … 302 302 msg_div.style.display = 'none'; 303 303 old_divStatusBar.parentNode.insertBefore(msg_div,old_divStatusBar); 304 } 304 } 305 305 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>'; 306 306 old_divStatusBar.style.display = 'none'; 307 msg_div.style.display = ''; 307 msg_div.style.display = ''; 308 308 // Nao ponha var na frente!! jakjr 309 309 handle_write_msg = function(){ … … 312 312 clean_msg(); 313 313 else 314 write_msg(old_msg, true); 314 write_msg(old_msg, true); 315 315 } 316 316 catch(e){} … … 328 328 if(msg_div) 329 329 msg_div.style.display = 'none'; 330 old_divStatusBar.style.display = ''; 330 old_divStatusBar.style.display = ''; 331 331 } 332 332 … … 371 371 var quickSearchKeyBegin; 372 372 var quickSearchKeyEnd; 373 373 374 374 var handler_emQuickSearch = function(data) 375 375 { … … 378 378 window_DropDownContacts.style.visibility = 'hidden'; 379 379 } 380 380 381 381 if ((!data.status) && (data.error == "many results")){ 382 382 alert(get_lang('More than %1 results. Please, try to refine your search.',200)); 383 383 return false; 384 384 } 385 385 386 386 if (data.length > 0){ 387 387 if ((field != 'null') && (ID != 'null')) … … 400 400 return true; 401 401 } 402 402 403 403 if ((field != 'null') && (ID != 'null')) 404 404 { 405 Element(field +'_'+ ID).focus(); // necessï¿œrio para oIE.405 Element(field +'_'+ ID).focus(); //It requires for IE. 406 406 var i = getPosition(Element(field +'_'+ ID)); //inputBox.selectionStart; 407 407 var j = --i; … … 420 420 else 421 421 var search_for = emailList; 422 422 423 423 if (search_for.length < 4){ 424 424 alert(get_lang('Your search argument must be longer than 4 characters.')); 425 425 return false; 426 426 } 427 427 428 428 cExecute ("$this.ldap_functions.quicksearch&search_for="+search_for+"&field="+field+"&ID="+ID, handler_emQuickSearch); 429 429 } … … 473 473 474 474 function 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 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 } 506 506 507 507 … … 528 528 var Lp=obj.createTextRange(); 529 529 } 530 530 531 531 Lp.setEndPoint("EndToStart",M); 532 532 var rb=Lp.text.length; 533 533 534 534 if(rb > obj.value.length) 535 535 { … … 541 541 542 542 function trim(inputString) { 543 if (typeof inputString != "string") 543 if (typeof inputString != "string") 544 544 return inputString; 545 545 546 546 var retValue = inputString; 547 547 var ch = retValue.substring(0, 1); 548 while (ch == " ") { 548 while (ch == " ") { 549 549 retValue = retValue.substring(1, retValue.length); 550 550 ch = retValue.substring(0, 1); 551 551 } 552 552 ch = retValue.substring(retValue.length-1, retValue.length); 553 while (ch == " ") { 553 while (ch == " ") { 554 554 retValue = retValue.substring(0, retValue.length-1); 555 555 ch = retValue.substring(retValue.length-1, retValue.length); 556 556 } 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); 559 559 } 560 return retValue; 560 return retValue; 561 561 } 562 562 563 563 function increment_folder_unseen(){ 564 564 var folder_id = get_current_folder(); 565 565 566 566 var folder_unseen = Element('dftree_'+folder_id+'_unseen'); 567 567 if (folder_unseen) … … 579 579 function decrement_folder_unseen(){ 580 580 var folder_id = get_current_folder(); 581 581 582 582 var folder_unseen = Element('dftree_'+folder_id+'_unseen'); 583 583 if(!folder_unseen) … … 603 603 var strTemp = ""; 604 604 var iTemp = 0; 605 605 606 606 if(v_length < 1) 607 607 return ""; 608 608 609 609 var v_length = value ? value.length : 0; 610 610 611 611 while(iTemp < v_length){ 612 612 if(value && value.charAt(iTemp) != w_space){ … … 615 615 } 616 616 iTemp++; 617 } 617 } 618 618 return strTemp; 619 619 } … … 671 671 var main_list = main.childNodes; 672 672 var len_main_list = main_list.length; 673 673 674 674 if (select) 675 675 {
Note: See TracChangeset
for help on using the changeset viewer.