Changeset 325 for trunk/expressoMail1_2/js/common_functions.js
- Timestamp:
- 06/24/08 16:45:40 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/common_functions.js
r320 r325 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; … … 57 57 // END: FUNCTION RESIZE WINDOW 58 58 59 // onUnload edit message60 61 59 var _beforeunload_ = window.onbeforeunload; 62 60 … … 79 77 function get_lang(_key,_arg1,_arg2,_arg3,_arg4) { 80 78 81 if(!array_lang[0]){ 79 if(!array_lang[0]){ 82 80 return _key+"*"; 83 81 } 84 _value = ""; 82 _value = ""; 85 83 for(i = 0; i < array_lang[0].length;i++){ 86 84 if(array_lang[0][i] == _key.toLowerCase()) { 87 _value = array_lang[1][i]; 85 _value = array_lang[1][i]; 88 86 break; 89 87 } 90 } 91 88 } 89 92 90 if(!_value) 93 91 return _key+"*"; 94 92 95 93 if(_arg1 || _arg2 ||_arg3 || _arg4) { 96 94 for(j = 1; j <= 4; j++){ 97 95 if(eval("_arg"+j)) { 98 var regExp = new RegExp("%"+j+""); 96 var regExp = new RegExp("%"+j+""); 99 97 _value = _value.replace(regExp,eval("_arg"+j)); 100 98 } 101 99 } 102 100 } 103 101 104 102 return _value; 105 103 } … … 112 110 113 111 // Change the class of message. 114 // In refresh, the flags UnRead and UnSeen don't exist anymore. 112 // In refresh, the flags UnRead and UnSeen don't exist anymore. 115 113 function set_msg_as_read(msg_number, selected){ 116 114 tr_message = Element(msg_number); … … 170 168 //Get element tBody. 171 169 main = document.getElementById("tbody_box"); 172 170 173 171 // Get all TR (messages) in tBody. 174 172 main_list = main.childNodes; 175 173 176 174 return main_list.length; 177 175 } … … 180 178 div_attachment = document.getElementById("id_div_attachment"); 181 179 var params = ''; 182 180 183 181 if (div_attachment == null){ 184 182 var div_attachment = document.createElement("DIV"); … … 195 193 196 194 function download_all_attachments(msg_folder, msg_number){ 197 var handler_source = function(data){ 195 var handler_source = function(data){ 198 196 download_attachments(null, null, data, null,null,'anexos.zip'); 199 197 } … … 205 203 if (! divFiles) 206 204 return false; 207 205 208 206 if (divFiles.lastChild) 209 207 var countDivFiles = parseInt(divFiles.lastChild.id.split('_')[2]) + 1; … … 211 209 if (! countDivFiles) 212 210 var countDivFiles = 1; 213 211 214 212 divFile = document.createElement('DIV'); 215 213 216 214 var inputFile = document.createElement("INPUT"); 217 215 218 216 var tmp_id_border = document.createAttribute('id_border'); 219 217 tmp_id_border.value = id_border; 220 218 221 219 inputFile.setAttributeNode(tmp_id_border); 222 220 inputFile.id = "inputFile_"+id_border+"_"+countDivFiles; … … 226 224 inputFile.maxLength = 255; 227 225 inputFile.name='file_'+countDivFiles; 228 226 229 227 divFile.appendChild(inputFile); 230 228 231 229 var linkFile = document.createElement("A"); 232 230 linkFile.id = "linkFile_"+id_border+"_"+countDivFiles; 233 231 linkFile.href='javascript:void(0)'; 234 232 linkFile.onclick=function () {removeFile(this.id.replace("link","div")); return false;}; 235 linkFile.innerHTML=get_lang("Remove"); 233 linkFile.innerHTML=get_lang("Remove"); 236 234 //divFile.innerHTML += " "; 237 235 divFile.appendChild(linkFile); 238 divFile.id = "divFile_"+id_border+"_"+countDivFiles; 236 divFile.id = "divFile_"+id_border+"_"+countDivFiles; 239 237 divFiles.appendChild(divFile); 240 238 } … … 289 287 // Funcao usada para escrever mensagem 290 288 // notimeout = True : mensagem nao apaga 291 function write_msg(msg, notimeout){ 292 289 function write_msg(msg, notimeout){ 290 293 291 if (setTimeout_write_msg) 294 292 clearTimeout(setTimeout_write_msg); 295 293 296 294 var msg_div = Element('em_div_write_msg'); 297 295 var old_divStatusBar = Element("divStatusBar"); … … 304 302 msg_div.style.display = 'none'; 305 303 old_divStatusBar.parentNode.insertBefore(msg_div,old_divStatusBar); 306 } 304 } 307 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>'; 308 306 old_divStatusBar.style.display = 'none'; 309 msg_div.style.display = ''; 307 msg_div.style.display = ''; 310 308 // Nao ponha var na frente!! jakjr 311 309 handle_write_msg = function(){ … … 314 312 clean_msg(); 315 313 else 316 write_msg(old_msg, true); 314 write_msg(old_msg, true); 317 315 } 318 316 catch(e){} … … 330 328 if(msg_div) 331 329 msg_div.style.display = 'none'; 332 old_divStatusBar.style.display = ''; 330 old_divStatusBar.style.display = ''; 333 331 } 334 332 … … 373 371 var quickSearchKeyBegin; 374 372 var quickSearchKeyEnd; 375 373 376 374 var handler_emQuickSearch = function(data) 377 375 { … … 380 378 window_DropDownContacts.style.visibility = 'hidden'; 381 379 } 382 380 383 381 if ((!data.status) && (data.error == "many results")){ 384 382 alert(get_lang('More than %1 results. Please, try to refine your search.',200)); 385 383 return false; 386 384 } 387 385 388 386 if (data.length > 0){ 389 387 if ((field != 'null') && (ID != 'null')) … … 402 400 return true; 403 401 } 404 402 405 403 if ((field != 'null') && (ID != 'null')) 406 404 { 407 Element(field +'_'+ ID).focus(); //necess ário para o IE.405 Element(field +'_'+ ID).focus(); //necessï¿œrio para o IE. 408 406 var i = getPosition(Element(field +'_'+ ID)); //inputBox.selectionStart; 409 407 var j = --i; … … 422 420 else 423 421 var search_for = emailList; 424 422 425 423 if (search_for.length < 4){ 426 424 alert(get_lang('Your search argument must be longer than 4 characters.')); 427 425 return false; 428 426 } 429 427 430 428 cExecute ("$this.ldap_functions.quicksearch&search_for="+search_for+"&field="+field+"&ID="+ID, handler_emQuickSearch); 431 429 } … … 475 473 476 474 function url_encode(str){ 477 var hex_chars = "0123456789ABCDEF"; 478 var noEncode = /^([a-zA-Z0-9\_\-\.])$/; 479 var n, strCode, hex1, hex2, strEncode = ""; 480 481 for(n = 0; n < str.length; n++) { 482 if (noEncode.test(str.charAt(n))) { 483 strEncode += str.charAt(n); 484 } else { 485 strCode = str.charCodeAt(n); 486 hex1 = hex_chars.charAt(Math.floor(strCode / 16)); 487 hex2 = hex_chars.charAt(strCode % 16); 488 strEncode += "%" + (hex1 + hex2); 489 } 490 } 491 return strEncode; 492 } 493 494 function url_decode(str) { 495 496 var n, strCode, strDecode = ""; 497 for (n = 0; n < str.length; n++) { 498 if (str.charAt(n) == "%") { 499 strCode = str.charAt(n + 1) + str.charAt(n + 2); 500 strDecode += String.fromCharCode(parseInt(strCode, 16)); 501 n += 2; 502 } else { 503 strDecode += str.charAt(n); 504 } 505 } 506 return strDecode; 507 } 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 } 508 506 509 507 … … 530 528 var Lp=obj.createTextRange(); 531 529 } 532 530 533 531 Lp.setEndPoint("EndToStart",M); 534 532 var rb=Lp.text.length; 535 533 536 534 if(rb > obj.value.length) 537 535 { … … 543 541 544 542 function trim(inputString) { 545 if (typeof inputString != "string") 543 if (typeof inputString != "string") 546 544 return inputString; 547 545 548 546 var retValue = inputString; 549 547 var ch = retValue.substring(0, 1); 550 while (ch == " ") { 548 while (ch == " ") { 551 549 retValue = retValue.substring(1, retValue.length); 552 550 ch = retValue.substring(0, 1); 553 551 } 554 552 ch = retValue.substring(retValue.length-1, retValue.length); 555 while (ch == " ") { 553 while (ch == " ") { 556 554 retValue = retValue.substring(0, retValue.length-1); 557 555 ch = retValue.substring(retValue.length-1, retValue.length); 558 556 } 559 while (retValue.indexOf(" ") != -1) { 560 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); 561 559 } 562 return retValue; 560 return retValue; 563 561 } 564 562 565 563 function increment_folder_unseen(){ 566 564 var folder_id = get_current_folder(); 567 565 568 566 var folder_unseen = Element('dftree_'+folder_id+'_unseen'); 569 567 if (folder_unseen) … … 581 579 function decrement_folder_unseen(){ 582 580 var folder_id = get_current_folder(); 583 581 584 582 var folder_unseen = Element('dftree_'+folder_id+'_unseen'); 585 583 if(!folder_unseen) … … 605 603 var strTemp = ""; 606 604 var iTemp = 0; 607 605 608 606 if(v_length < 1) 609 607 return ""; 610 608 611 609 var v_length = value ? value.length : 0; 612 610 613 611 while(iTemp < v_length){ 614 612 if(value && value.charAt(iTemp) != w_space){ … … 617 615 } 618 616 iTemp++; 619 } 617 } 620 618 return strTemp; 621 619 } … … 673 671 var main_list = main.childNodes; 674 672 var len_main_list = main_list.length; 675 673 676 674 if (select) 677 675 {
Note: See TracChangeset
for help on using the changeset viewer.