Changeset 6358 for sandbox/2.4.1-3/expressoMail1_2/js/QuickCatalogSearch.js
- Timestamp:
- 05/31/12 09:30:20 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.4.1-3/expressoMail1_2/js/QuickCatalogSearch.js
r5911 r6358 254 254 var signal = "+"; 255 255 var btnClass = "add"; 256 var emailList = content.find(field_).val(); 257 var emails_adicionados = emailList.split(","); 256 emails_adicionados = ""; 257 var emailList = content.find(field_).filter("input").parent().find("div input"); 258 // var array = content.find(".to-tr").find(".box"); 259 $.each(emailList, function(index, value){ 260 emails_adicionados += $(value).val() + ","; 261 }); 262 emails_adicionados = emails_adicionados.split(","); 258 263 for(aux=0; aux<emails_adicionados.length -1; aux++) { 259 264 if(emails_adicionados[aux].match(/<([^<]*)>[\s]*$/)){ … … 583 588 var nome = $(contact).clone().find('.name').text(); 584 589 var email = $(contact).clone().find('.email').text(); 585 586 590 if(email == get_lang("No mail")){ 587 591 alert(get_lang("It is not possible to add this contact as a recipient because it does not have email")); … … 590 594 return; 591 595 } 592 593 596 verifyEmails(email, divs); 594 595 final_contact = "\""+nome +"\" <"+email+">, "; 596 597 var emailList = content.find(field_).val(); 598 //remove os caracteres da busca 599 emailList = emailList.substr(0,emailList.lastIndexOf(',')+1); 600 601 if (emailList[0] != '"' && emailList.indexOf(",") < 0) 602 emailList = emailList.substr(end_); 603 if(emailList.lastIndexOf(",") > 0){ 604 if(emailList.substr(emailList.length-1, emailList.length) == "," || emailList.substr(emailList.length-2, 1) == ","){ 605 emailList = emailList.substr(0, emailList.lastIndexOf(",") + 1); 606 } else { 607 emailList = emailList.substr(0, emailList.lastIndexOf("") + 1); 608 final_contact = ","+final_contact; 609 } 610 } 597 final_contact = "\""+nome +"\" <"+email+">"; 611 598 612 final_contact = final_contact.replace(/\/n/, ""); 613 new_emailList = emailList + final_contact; 614 content.find(field_).val(new_emailList); 615 616 content.find(field_).trigger("update"); 617 599 final_contact = final_contact.replace(/\/n/, ""); 600 draw_email_box(final_contact, $(field_).filter("input")); 618 601 button.onclick = function(){ 619 602 remove_contact_field(document.getElementById(divs).innerHTML, button, divs); 620 603 }; 621 604 var div = document.getElementById(divs); 622 623 605 div.ondblclick = function(){ 624 606 remove_contact_field(div.innerHTML, button, divs); 625 607 }; 626 627 608 button.innerHTML = '<span class="ui-button-text" style="">x</span>'; 628 609 } … … 634 615 function remove_contact_field(contact, button, divs) { 635 616 var email = $(contact).clone().find('.email').text(); 636 var exist = false; 637 638 var emailList = content.find(field_).val(); 639 var emails_adicionados = emailList.split(","); 640 641 verifyEmails(email, divs); 642 643 for(i=0; i<emails_adicionados.length -1; i++) { 644 645 if(emails_adicionados[i].match(/<([^<]*)>[\s]*$/)){ 646 if(emails_adicionados[i].match(/<([^<]*)>[\s]*$/)[1].toLowerCase() == email.toLowerCase()) { 647 emails_adicionados[i] = "%"; 648 exist = true; 649 } 650 }else{ 651 if(emails_adicionados[i].toLowerCase() == email.toLowerCase()) { 652 emails_adicionados[i] = "%"; 653 exist = true; 654 } 655 } 656 } 657 658 if (exist == false) 659 return false; 660 var novos_contatos = emails_adicionados.join(","); 661 novos_contatos = novos_contatos.replace(/%,/g, ""); 662 content.find(field_).val(novos_contatos); 663 617 var array = content.find(field_).parent().find("div input"); 618 $.each(array, function(index, value){ 619 var validated_email = $(value).val(); 620 if(validated_email.match(/<([^<]*)>[\s]*$/)){ 621 if(validated_email.match(/<([^<]*)>[\s]*$/)[1].toLowerCase() == email.toLowerCase()) { 622 $(value).parent().remove(); 623 } 624 } 625 }); 626 664 627 button.onclick = function(){ 665 628 add_contact_field(document.getElementById(divs).innerHTML, button, divs); 666 629 }; 667 668 630 var div = document.getElementById(divs); 669 670 631 div.ondblclick = function(){ 671 632 add_contact_field(div.innerHTML, button, divs); 672 633 }; 673 674 content.find(field_).trigger("update");675 634 button.innerHTML = '<span class="ui-button-text" style="">+</span>'; 676 635 }
Note: See TracChangeset
for help on using the changeset viewer.