Changeset 6528 for trunk/expressoMail1_2/js/QuickCatalogSearch.js
- Timestamp:
- 06/15/12 17:00:17 (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:mergeinfo
set to
/sandbox/2.4.1-3 merged eligible
-
Property
svn:mergeinfo
set to
-
trunk/expressoMail1_2/js/QuickCatalogSearch.js
r6480 r6528 290 290 var signal = "+"; 291 291 var btnClass = "add"; 292 var emailList = content.find(field_).val(); 293 var emails_adicionados = emailList.split(","); 292 emails_adicionados = ""; 293 var emailList = content.find(field_).filter("input").parent().find("div input"); 294 // var array = content.find(".to-tr").find(".box"); 295 $.each(emailList, function(index, value){ 296 emails_adicionados += $(value).val() + ","; 297 }); 298 emails_adicionados = emails_adicionados.split(","); 294 299 for(aux=0; aux<emails_adicionados.length -1; aux++) { 295 300 if(emails_adicionados[aux].match(/<([^<]*)>[\s]*$/)){ … … 697 702 var nome = $(contact).clone().find('.name').text(); 698 703 var email = $(contact).clone().find('.email').text(); 699 700 704 if(email == get_lang("No mail")){ 701 705 alert(get_lang("It is not possible to add this contact as a recipient because it does not have email")); … … 704 708 return; 705 709 } 706 707 710 verifyEmails(email, divs); 708 709 final_contact = "\""+nome +"\" <"+email+">, "; 710 711 var emailList = content.find(field_).val(); 712 //remove os caracteres da busca 713 emailList = emailList.substr(0,emailList.lastIndexOf(',')+1); 714 715 if (emailList[0] != '"' && emailList.indexOf(",") < 0) 716 emailList = emailList.substr(end_); 717 if(emailList.lastIndexOf(",") > 0){ 718 if(emailList.substr(emailList.length-1, emailList.length) == "," || emailList.substr(emailList.length-2, 1) == ","){ 719 emailList = emailList.substr(0, emailList.lastIndexOf(",") + 1); 720 } else { 721 emailList = emailList.substr(0, emailList.lastIndexOf("") + 1); 722 final_contact = ","+final_contact; 711 final_contact = "\""+nome +"\" <"+email+">"; 712 713 final_contact = final_contact.replace(/\/n/, ""); 714 var index = parseInt(divs.split("_")[1])-1; 715 if(data_[index].type_contact == "G"){ 716 var ldap_id = preferences.expressoMail_ldap_identifier_recipient; 717 if(ldap_id){ 718 draw_email_box( 719 (data_[index][ldap_id.toLowerCase()] ? data_[index][ldap_id.toLowerCase()][0] : final_contact) 720 , content.find(field_).filter("input") 721 ); 722 }else{ 723 draw_email_box(final_contact, content.find(field_).filter("input")); 724 } 725 }else{ 726 draw_email_box((data_[index].id_contact ? data_[index].id_contact : data_[index].id), content.find(field_).filter("input"), (data_[index].id_contact ? true : "G")); 723 727 } 724 }725 726 final_contact = final_contact.replace(/\/n/, "");727 new_emailList = emailList + final_contact;728 content.find(field_).val(new_emailList);729 730 content.find(field_).trigger("update");731 732 728 button.onclick = function(){ 733 729 remove_contact_field(document.getElementById(divs).innerHTML, button, divs); 734 730 }; 735 731 var div = document.getElementById(divs); 736 737 732 div.ondblclick = function(){ 738 733 remove_contact_field(div.innerHTML, button, divs); 739 734 }; 740 741 735 button.innerHTML = '<span class="ui-button-text" style="">x</span>'; 742 736 } … … 748 742 function remove_contact_field(contact, button, divs) { 749 743 var email = $(contact).clone().find('.email').text(); 750 var exist = false; 751 752 var emailList = content.find(field_).val(); 753 var emails_adicionados = emailList.split(","); 754 755 verifyEmails(email, divs); 756 757 for(i=0; i<emails_adicionados.length -1; i++) { 758 759 if(emails_adicionados[i].match(/<([^<]*)>[\s]*$/)){ 760 if(emails_adicionados[i].match(/<([^<]*)>[\s]*$/)[1].toLowerCase() == email.toLowerCase()) { 761 emails_adicionados[i] = "%"; 762 exist = true; 763 } 764 }else{ 765 if(emails_adicionados[i].toLowerCase() == email.toLowerCase()) { 766 emails_adicionados[i] = "%"; 767 exist = true; 768 } 769 } 770 } 771 772 if (exist == false) 773 return false; 774 var novos_contatos = emails_adicionados.join(","); 775 novos_contatos = novos_contatos.replace(/%,/g, ""); 776 content.find(field_).val(novos_contatos); 777 744 var array = content.find(field_).parent().find("div input"); 745 $.each(array, function(index, value){ 746 var validated_email = $(value).val(); 747 if(validated_email.match(/<([^<]*)>[\s]*$/)){ 748 if(validated_email.match(/<([^<]*)>[\s]*$/)[1].toLowerCase() == email.toLowerCase()) { 749 $(value).parent().remove(); 750 } 751 } 752 }); 753 778 754 button.onclick = function(){ 779 755 add_contact_field(document.getElementById(divs).innerHTML, button, divs); 780 756 }; 781 782 757 var div = document.getElementById(divs); 783 784 758 div.ondblclick = function(){ 785 759 add_contact_field(div.innerHTML, button, divs); 786 760 }; 787 788 content.find(field_).trigger("update");789 761 button.innerHTML = '<span class="ui-button-text" style="">+</span>'; 790 762 }
Note: See TracChangeset
for help on using the changeset viewer.