Index: /sandbox/2.4.1-3/prototype/modules/mail/templates/emailBox.ejs
===================================================================
--- /sandbox/2.4.1-3/prototype/modules/mail/templates/emailBox.ejs	(revision 6334)
+++ /sandbox/2.4.1-3/prototype/modules/mail/templates/emailBox.ejs	(revision 6374)
@@ -10,3 +10,4 @@
 	</span>
 	<input class="box-input" value="<%= input_value %>"></input>
+	<span class="box-loading">&nbsp;&nbsp;&nbsp;</span>
 </div>
Index: /sandbox/2.4.1-3/expressoMail1_2/index.php
===================================================================
--- /sandbox/2.4.1-3/expressoMail1_2/index.php	(revision 6246)
+++ /sandbox/2.4.1-3/expressoMail1_2/index.php	(revision 6374)
@@ -195,4 +195,5 @@
 	$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['telephone_number'] = $GLOBALS['phpgw_info']['user']['telephonenumber'];
 	$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_cache'] = $current_config['expressoMail_enable_cache'];
+	$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['expressoMail_ldap_identifier_recipient'] = $current_config['expressoMail_ldap_identifier_recipient'];
 	$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_x_origin'] = $current_config['expressoMail_use_x_origin'];
 	$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['number_of_contacts'] = $current_config['expressoMail_Number_of_dynamic_contacts'] ? $current_config['expressoMail_Number_of_dynamic_contacts'] : "0";
@@ -216,5 +217,5 @@
 	$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['auto_create_local'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['auto_create_local'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['auto_create_local'] : "0";
 	$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['return_recipient_deafault'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['return_recipient_deafault'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['return_recipient_deafault'] : "0";
-
+	$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['ldap_identifier_recipient'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['quick_search_default'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['quick_search_default'] : 1;
 	$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['quick_search_default'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['quick_search_default'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['quick_search_default'] : 1;
 	// 	ACL for block edit Personal Data.
@@ -276,5 +277,5 @@
     echo '<script> var use_spam_filter = \''.$current_config['expressoMail_use_spam_filter'].'\'
            var sieve_forward_domains = \''.$current_config['expressoMail_sieve_forward_domains'].'\' 
-		   var ldap_identifier_recipient = \''.$current_config['expressoMail_ldap_identifier_recipient'].'\' </script>';
+		  </script>';
 	// End Set Anti-Spam options.
 
Index: /sandbox/2.4.1-3/expressoMail1_2/templates/default/main.css
===================================================================
--- /sandbox/2.4.1-3/expressoMail1_2/templates/default/main.css	(revision 6358)
+++ /sandbox/2.4.1-3/expressoMail1_2/templates/default/main.css	(revision 6374)
@@ -1336,2 +1336,11 @@
 	border : 1px solid #474747;
 }
+
+.box-loading{
+	background : url("../../../prototype/modules/mail/img/loading.gif") no-repeat !important;
+	background-size: 17px auto !important;
+}
+
+.box-info{
+	background : url("images/information.png") no-repeat !important;
+}
Index: /sandbox/2.4.1-3/expressoMail1_2/js/draw_api.js
===================================================================
--- /sandbox/2.4.1-3/expressoMail1_2/js/draw_api.js	(revision 6361)
+++ /sandbox/2.4.1-3/expressoMail1_2/js/draw_api.js	(revision 6374)
@@ -3502,9 +3502,15 @@
 //DESENHO DAS CAIXA DE EMAIL
 function draw_email_box(input_data, location){
-	if(input_data != ""){
+	if($.trim(input_data) != ""){
 		var box_data = valid_emails(input_data);
 		DataLayer.render("../prototype/modules/mail/templates/emailBox.ejs", box_data, function(html){
 			var newBox = location.before(html).prev();
 			box_actions(newBox);
+			if(preferences.expressoMail_ldap_identifier_recipient && $(newBox).hasClass("invalid-email-box")){
+				//$(newBox).find(".loading").css("background-image", "../prototype/modules/mail/img/ajax-loader.gif");
+				show_detais(newBox, input_data);
+			}else{
+				$(newBox).find(".box-loading").remove();
+			}
 		});
 	}
@@ -3534,6 +3540,6 @@
 		//PEGA TODO O CONTEUDO E SETA COMO SE FOSSE O EMAIL
 		case 1:
-			ContactBox.email = $.trim(email);
-			ContactBox.valid = reSimpleEmail.test($.trim(email.toLowerCase()));
+			validation.unshift("");
+			ContactBox = complexValidation(validation);
 			break;
 		//CORRIGI ERRO DE DIGITAÇÃO COMO ( huahua"<huhau@hauhau.com>) ou (hahahaha"huahua@email.com) ou ainda (hahahaha"huahua@ema  il.com)
@@ -3631,4 +3637,5 @@
 					if(input.val().split('"').length-1 == 0){
 						e.preventDefault();
+						e.stopPropagation();
 						draw_email_box(input.val(), input);
 						input.val("");
@@ -3782,6 +3789,30 @@
 
 //MOSTRA OS DETALHES DAS CAIXA DE EMAIL NOS CAMPOS PARA - CC - CCO
-function show_detais(img){
-	
+function show_detais(box, value){
+	var ldap_id = preferences.expressoMail_ldap_identifier_recipient;
+	DataLayer.read("/usersldap", {field : ldap_id,value: value}, function(data){
+		if(!data.error){
+			if(data.collection.error)
+				box.find(".box-loading").remove();
+			else{
+				//box.find(".box-loading").css("background-image", "url(templates/default/images/information.png) no-repeat! !important");
+				box.find(".box-loading").removeClass("box-loading").addClass("box-info");
+				box.addClass("box-"+value).removeClass("invalid-email-box");
+				loadExtraLDAPBox(data.collection.itens[0].data, ".box-"+value);
+				box.unbind("dblclick").bind("dblclick", function(e){
+					new $.Zebra_Dialog('<strong>Impossivel editar</strong> um contato do ldap\n' +
+						'<strong>Porém</strong>é possivel remove-lo', {
+						'buttons':  false,
+						'modal': false,
+						'position': ['right - 20', 'top + 20'],
+						'auto_close': 3000
+					});
+				}).find(".box-input").val("\""+data.collection.itens[0].data[0].value+"\" <"+data.collection.itens[0].data[1].value+">");
+				box.find(".email-box-value").html( (data.collection.itens[0].data[0].value.length > 18 ? data.collection.itens[0].data[0].value.substring(0, 15)+"...": data.collection.itens[0].data[0].value))
+			}
+		}else{
+			box.find(".box-loading").remove();
+		}
+	});
 }
 
@@ -3876,6 +3907,6 @@
 			autoFocus: true,
 			open : function(){
-				if($(this).val() == "")
-					$(this).autocomplete( "close" )
+				if($.trim($(this).val()) == "")
+					$(this).autocomplete( "close" );
 			}
 		})
Index: /sandbox/2.4.1-3/expressoMail1_2/js/doiMenuData.js
===================================================================
--- /sandbox/2.4.1-3/expressoMail1_2/js/doiMenuData.js	(revision 6334)
+++ /sandbox/2.4.1-3/expressoMail1_2/js/doiMenuData.js	(revision 6374)
@@ -305,8 +305,24 @@
 }
 
-
-
-
-
-
-
+function loadExtraLDAPBox(data, element){
+	//menuItensLabel[index] = {type: "label", customName: menuItems[index].name};		
+	$.contextMenu({
+		selector: "#content_id_"+currentTab+" "+element+" .box-info",
+		trigger: 'hover',
+		delay:100,
+		autoHide:true,
+		items: {
+			"Name" : {name: "<b>"+data[0].value+"</b>", disabled: true} ,
+			"Email" : {name: data[1].value, disabled: true},
+			"TelefoneLabel" : {name: "<b>Telefone</b>", disabled: true},
+			"TelefoneValue" : {name: data[2].value, disabled: true}
+		}
+	});	
+}
+
+
+
+
+
+
+
Index: /sandbox/2.4.1-3/expressoMail1_2/js/QuickCatalogSearch.js
===================================================================
--- /sandbox/2.4.1-3/expressoMail1_2/js/QuickCatalogSearch.js	(revision 6358)
+++ /sandbox/2.4.1-3/expressoMail1_2/js/QuickCatalogSearch.js	(revision 6374)
@@ -598,5 +598,8 @@
 
 		final_contact = final_contact.replace(/\/n/, "");  
-		draw_email_box(final_contact, $(field_).filter("input"));
+		draw_email_box(
+			(data_[parseInt(divs.split("_")[1])-1].uid ? data_[parseInt(divs.split("_")[1])-1].uid[0] : final_contact)
+			, $(field_).filter("input")
+		);
 		button.onclick = function(){
 			remove_contact_field(document.getElementById(divs).innerHTML, button, divs);
