Changeset 4821
- Timestamp:
- 07/19/11 15:58:30 (13 years ago)
- Location:
- trunk/expressoMail1_2/js
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/draw_api.js
r4820 r4821 6 6 'imapBox' : [], // Stores the folder name 7 7 'toPreserve' : [], // Check if the message should be removed from draft after send 8 'autosave_timer' : [] // The timeout timer for autosave function 8 'autosave_timer' : [], // The timeout timer for autosave function 9 'condition' : [] // Will store the search condition if the tab is the result of a search 9 10 }; 10 11 var tabTypes = { -
trunk/expressoMail1_2/js/main.js
r4820 r4821 616 616 } 617 617 connector.purgeCache(); 618 refresh(); 618 619 EsearchE.refresh(); 619 620 } 620 621 -
trunk/expressoMail1_2/js/search.js
r4817 r4821 374 374 } 375 375 376 searchE.prototype.make_tr_message = function(aux,border_id,i) { 377 var tr = document.createElement("TR"); 378 if(typeof(preferences.line_height) != 'undefined') 379 tr.style.height = preferences.line_height; 380 381 var mailbox = aux.boxname; 382 var uid_msg = aux.uid; 383 var subject = aux.subject; 384 385 tr.id = uid_msg+"_s"+numBox; 386 387 // Keep the two lines together please 388 tr.setAttribute('name',mailbox); 389 tr.name = mailbox; 390 391 if ( aux.flag.match("U") ) 392 add_className(tr,'tr_msg_unread'); 393 394 add_className(tr, i%2 != 0 ? 'tr_msg_read2' : 'tr_msg_read'); 395 396 var _onclick = function() 397 { 398 proxy_mensagens.get_msg(this.parentNode.id,url_encode(this.parentNode.getAttribute('name')),false,show_msg); 399 }; 400 401 for(var j=0 ; j <= 10 ; j++) 402 { 403 var td = document.createElement("TD"); 404 if (j == 0) 405 { 406 td.setAttribute("width", colSizes[1][0]); 407 var chk_onclick; 408 if (is_ie) 409 chk_onclick = "changeBgColor(window.event,"+uid_msg+");"; 410 else 411 chk_onclick = "changeBgColor(event,"+uid_msg+");"; 412 var td1 = '<input type="checkbox" onclick="' + chk_onclick + '" id="' + border_id + '_check_box_message_'+uid_msg+'"></input>'; 413 414 } 415 if (j == 1) 416 { 417 td.setAttribute("width", colSizes[1][1]); 418 if (aux.flag.match('T')) 419 { 420 attachNum = parseInt(aux.flag.substr(aux.flag.indexOf('T')+1)); 421 td1 = "<img src='templates/"+template+"/images/clip.gif' title='"+attachNum +' '+ get_lang('attachment(s)')+"'>"; 422 } 423 else 424 td1 = ''; 425 } 426 if (j == 2) 427 { 428 td.setAttribute("width", colSizes[1][2]); 429 td.id = "td_message_answered_"+uid_msg; 430 if (aux.flag.match('X')) 431 td1 = '<img src=templates/'+template+'/images/forwarded.gif title="'+get_lang('Forwarded')+'">'; 432 else 433 if (aux.flag.match('A')) 434 td1 = '<img src=templates/'+template+'/images/answered.gif title="'+get_lang('Answered')+'">'; 435 else 436 td1 = ''; 437 } 438 if (j == 3) 439 { 440 td.setAttribute("width", colSizes[1][3]); 441 td.id = "td_message_important_"+uid_msg; 442 if (aux.flag.match("F")) 443 { 444 add_className(tr, 'flagged_msg'); 445 td1 = "<img src='templates/"+template+"/images/important.gif' title='"+get_lang('Flagged')+"'>"; 446 } 447 else 448 td1 = ''; 449 } 450 if (j == 4) 451 { 452 td.setAttribute("width", colSizes[1][4]); 453 td.id = "td_message_sent_"+uid_msg; 454 td1 = ''; 455 } 456 457 if ( j == 5 ) 458 { 459 td.setAttribute("width", colSizes[1][5]); 460 td.className = "td_resizable"; 461 td.onclick = _onclick; 462 var nm_box = aux.boxname.split(cyrus_delimiter); 463 var td1 = nm_box.pop(); 464 td.setAttribute("NoWrap","true"); 465 td.style.overflow = "hidden"; 466 td.style.color = "#42795b"; 467 td.style.fontWeight = "bold"; 468 469 var td1 = get_lang(td1).substr(get_lang(td1).length-1) == "*"?td1:get_lang(td1); 470 471 td1 = translateFolder(td1); 472 473 474 if( proxy_mensagens.is_local_folder(td1)) 475 { 476 var td1 = this.aux_local_folder_display(td1); 477 } 478 } 479 480 if( j == 6 ) 481 { 482 if (aux.from.length > 29) 483 aux.from = aux.from.substr(0,29) + "..."; 484 485 td.setAttribute("width", colSizes[1][6]); 486 td.className = "td_resizable"; 487 td.onclick = _onclick; 488 td.setAttribute("NoWrap","true"); 489 td.style.overflow = "hidden"; 490 var td1 = '<div style="width:100%;overflow:hidden">'+aux.from+"</div>"; 491 } 492 493 if( j == 7 ) 494 { 495 var subject_encode = url_encode(subject); 496 497 if (! subject_encode) 498 aux.subject = get_lang("no subject") + "..."; 499 if (aux.subject.length > 70) 500 aux.subject = aux.subject.substr(0,70) + "..."; 501 502 td.setAttribute("width", colSizes[1][7]); 503 td.className = "td_resizable"; 504 td.onclick = _onclick; 505 td.setAttribute("NoWrap","true"); 506 td.style.overflow = "hidden"; 507 508 var td1 = aux.subject; 509 } 510 511 if( j == 8 ) 512 { 513 td.setAttribute("width", colSizes[1][8]); 514 td.className = "td_resizable"; 515 td.align = "center"; 516 td.onclick = _onclick; 517 518 if( validate_date( aux.udate ) ) 519 { 520 var td1 = aux.udate; 521 } 522 else 523 { 524 var dt = new Date( aux.udate * 1000 ); 525 var td1 = dt.getDate() + "/"; 526 527 if( !( dt.getMonth() + 1 ).toString().match(/\d{2}/) ) 528 td1 += "0"+( dt.getMonth() + 1 ) + "/"; 529 else 530 td1 += ( dt.getMonth() + 1 ) + "/"; 531 532 td1 += dt.getFullYear(); 533 } 534 } 535 536 if( j == 9 ) 537 { 538 td.setAttribute("width", colSizes[1][9]); 539 td.className = "td_resizable"; 540 td.align = "center"; 541 td.onclick = _onclick; 542 var td1 = borkb(aux.size); 543 } 544 545 if( j == 10 ) 546 { 547 if (aux.flag.match("U")) 548 add_className(tr, 'tr_msg_unread'); 549 if (aux.flag.match("F")) 550 add_className(tr, 'flagged_msg'); 551 var td1 = ''; 552 } 553 if (j<10) { 554 td.innerHTML = td1; 555 tr.appendChild(td); 556 } 557 } 558 559 _dragArea.makeDragged(tr, uid_msg, subject, true, mailbox); 560 561 return tr; 562 } 563 376 564 // Form resultado 377 searchE.prototype.mount_result = function( Data, sort_type )565 searchE.prototype.mount_result = function( Data, sort_type, keep_border ) 378 566 { 379 567 var data = ( Data['data'] ) ? Data['data'] : Data['data_gears']; … … 389 577 sort_type = this.sort_type; 390 578 391 numBox++; 392 393 if( Data['data'] ) 394 var border_id = create_border(get_lang("Server Results"), "search_" + numBox); 395 396 if( Data['data_gears']) 397 var border_id = create_border(get_lang("Local Results"), "search_local_msg" + numBox); 398 579 if ( keep_border ) { 580 var border_id = currentTab; 581 } 582 else { 583 numBox++; 584 585 if( Data['data'] ) 586 var border_id = create_border(get_lang("Server Results"), "search_" + numBox); 587 588 if( Data['data_gears']) 589 var border_id = create_border(get_lang("Local Results"), "search_local_msg" + numBox); 590 } 591 399 592 if (!border_id) 400 593 return; … … 403 596 openTab.content_id[currentTab] = Element('content_id_search_' + numBox); 404 597 openTab.type[currentTab] = 1; 405 598 openTab.condition[currentTab] = this.condition; 599 600 if ( keep_border ) { 601 var content_search = Element('content_id_' + border_id); 602 var div_scroll_result = Element("divScrollMain_"+numBox); 603 content_search.removeChild(div_scroll_result); 604 } 605 406 606 var table = document.createElement("TABLE"); 407 607 table.id = "table_resultsearch_" + numBox; … … 417 617 for( var i=0; i < data.length; i++) 418 618 { 419 var tr = document.createElement("TR"); 420 if(typeof(preferences.line_height) != 'undefined') 421 tr.style.height = preferences.line_height; 422 423 var aux = data[i]; 424 var mailbox = aux.boxname; 425 var uid_msg = aux.uid; 426 var subject = aux.subject; 427 428 tr.id = uid_msg+"_s"+numBox; 429 430 // Keep the two lines together please 431 tr.setAttribute('name',mailbox); 432 tr.name = mailbox; 433 434 if ( aux.flag.match("U") ) 435 add_className(tr,'tr_msg_unread'); 436 437 add_className(tr, i%2 != 0 ? 'tr_msg_read2' : 'tr_msg_read'); 438 439 var _onclick = function() 440 { 441 proxy_mensagens.get_msg(this.parentNode.id,url_encode(this.parentNode.getAttribute('name')),false,show_msg); 442 }; 443 444 for(var j=0 ; j <= 10 ; j++) 445 { 446 var td = document.createElement("TD"); 447 if (j == 0) 448 { 449 td.setAttribute("width", colSizes[1][0]); 450 var chk_onclick; 451 if (is_ie) 452 chk_onclick = "changeBgColor(window.event,"+uid_msg+");"; 453 else 454 chk_onclick = "changeBgColor(event,"+uid_msg+");"; 455 var td1 = '<input type="checkbox" onclick="' + chk_onclick + '" id="' + border_id + '_check_box_message_'+uid_msg+'"></input>'; 456 457 } 458 if (j == 1) 459 { 460 td.setAttribute("width", colSizes[1][1]); 461 if (aux.flag.match('T')) 462 { 463 attachNum = parseInt(aux.flag.substr(aux.flag.indexOf('T')+1)); 464 td1 = "<img src='templates/"+template+"/images/clip.gif' title='"+attachNum +' '+ get_lang('attachment(s)')+"'>"; 465 } 466 else 467 td1 = ''; 468 } 469 if (j == 2) 470 { 471 td.setAttribute("width", colSizes[1][2]); 472 td.id = "td_message_answered_"+uid_msg; 473 if (aux.flag.match('X')) 474 td1 = '<img src=templates/'+template+'/images/forwarded.gif title="'+get_lang('Forwarded')+'">'; 475 else 476 if (aux.flag.match('A')) 477 td1 = '<img src=templates/'+template+'/images/answered.gif title="'+get_lang('Answered')+'">'; 478 else 479 td1 = ''; 480 } 481 if (j == 3) 482 { 483 td.setAttribute("width", colSizes[1][3]); 484 td.id = "td_message_important_"+uid_msg; 485 if (aux.flag.match("F")) 486 { 487 add_className(tr, 'flagged_msg'); 488 td1 = "<img src='templates/"+template+"/images/important.gif' title='"+get_lang('Flagged')+"'>"; 489 } 490 else 491 td1 = ''; 492 } 493 if (j == 4) 494 { 495 td.setAttribute("width", colSizes[1][4]); 496 td.id = "td_message_sent_"+uid_msg; 497 td1 = ''; 498 } 499 500 if ( j == 5 ) 501 { 502 td.setAttribute("width", colSizes[1][5]); 503 td.className = "td_resizable"; 504 td.onclick = _onclick; 505 var nm_box = aux.boxname.split(cyrus_delimiter); 506 var td1 = nm_box.pop(); 507 td.setAttribute("NoWrap","true"); 508 td.style.overflow = "hidden"; 509 td.style.color = "#42795b"; 510 td.style.fontWeight = "bold"; 511 512 var td1 = get_lang(td1).substr(get_lang(td1).length-1) == "*"?td1:get_lang(td1); 513 514 td1 = translateFolder(td1); 515 516 517 if( proxy_mensagens.is_local_folder(td1)) 518 { 519 var td1 = this.aux_local_folder_display(td1); 520 } 521 } 522 523 if( j == 6 ) 524 { 525 if (aux.from.length > 29) 526 aux.from = aux.from.substr(0,29) + "..."; 527 528 td.setAttribute("width", colSizes[1][6]); 529 td.className = "td_resizable"; 530 td.onclick = _onclick; 531 td.setAttribute("NoWrap","true"); 532 td.style.overflow = "hidden"; 533 var td1 = '<div style="width:100%;overflow:hidden">'+aux.from+"</div>"; 534 } 535 536 if( j == 7 ) 537 { 538 var subject_encode = url_encode(subject); 539 540 if (! subject_encode) 541 aux.subject = get_lang("no subject") + "..."; 542 if (aux.subject.length > 70) 543 aux.subject = aux.subject.substr(0,70) + "..."; 544 545 td.setAttribute("width", colSizes[1][7]); 546 td.className = "td_resizable"; 547 td.onclick = _onclick; 548 td.setAttribute("NoWrap","true"); 549 td.style.overflow = "hidden"; 550 551 var td1 = aux.subject; 552 } 553 554 if( j == 8 ) 555 { 556 td.setAttribute("width", colSizes[1][8]); 557 td.className = "td_resizable"; 558 td.align = "center"; 559 td.onclick = _onclick; 560 561 if( validate_date( aux.udate ) ) 562 { 563 var td1 = aux.udate; 564 } 565 else 566 { 567 var dt = new Date( aux.udate * 1000 ); 568 var td1 = dt.getDate() + "/"; 569 570 if( !( dt.getMonth() + 1 ).toString().match(/\d{2}/) ) 571 td1 += "0"+( dt.getMonth() + 1 ) + "/"; 572 else 573 td1 += ( dt.getMonth() + 1 ) + "/"; 574 575 td1 += dt.getFullYear(); 576 } 577 } 578 579 if( j == 9 ) 580 { 581 td.setAttribute("width", colSizes[1][9]); 582 td.className = "td_resizable"; 583 td.align = "center"; 584 td.onclick = _onclick; 585 var td1 = borkb(aux.size); 586 } 587 588 if( j == 10 ) 589 { 590 if (aux.flag.match("U")) 591 add_className(tr, 'tr_msg_unread'); 592 if (aux.flag.match("F")) 593 add_className(tr, 'flagged_msg'); 594 var td1 = ''; 595 } 596 if (j<10) { 597 td.innerHTML = td1; 598 tr.appendChild(td); 599 } 600 } 601 602 _dragArea.makeDragged(tr, uid_msg, subject, true, mailbox); 619 var tr = EsearchE.make_tr_message(data[i],border_id,i); 620 603 621 tbody.appendChild(tr); 604 622 } … … 1270 1288 } 1271 1289 1290 searchE.prototype.refresh = function(alert_new_msg){ 1291 var handler_refresh = function(data){ 1292 var allMsg = [3]; 1293 var count = ( data['num_msgs'] ) ? data['num_msgs'] : "0"; 1294 1295 if( data['num_msgs'] ) 1296 { 1297 allMsg['data'] = data['data']; 1298 allMsg['num_msgs'] = data['num_msgs']; 1299 } 1300 1301 if( ( data['num_msgs'] ) == 0 ) 1302 { 1303 alert( get_lang("None result was found.") ); 1304 } 1305 else 1306 { 1307 if( data['num_msgs'] ) 1308 { 1309 write_msg( count + " " + get_lang("results found") ); 1310 EsearchE.mount_result( allMsg, 'SORTDATE', true ); 1311 } 1312 } 1313 } 1314 1315 this.condition = openTab.condition[currentTab]; 1316 1317 var sort_type = (this.sort_type ? this.sort_type : 'SORTDATE'); 1318 1319 if( expresso_offline ) 1320 handler('none'); 1321 else 1322 cExecute( "$this.imap_functions.search_msg", handler_refresh, "condition="+openTab.condition[currentTab]+"&page="+EsearchE.page+"&sort_type="+sort_type); 1323 } 1324 1325 1272 1326 // Cria o objeto 1273 1327 var EsearchE;
Note: See TracChangeset
for help on using the changeset viewer.