Index: /sandbox/2.2.0.2/admin/inc/class.uiconfig.inc.php
===================================================================
--- /sandbox/2.2.0.2/admin/inc/class.uiconfig.inc.php	(revision 3018)
+++ /sandbox/2.2.0.2/admin/inc/class.uiconfig.inc.php	(revision 4500)
@@ -79,13 +79,26 @@
 				/* Load hook file with functions to validate each config (one/none/all) */
 				$GLOBALS['phpgw']->hooks->single('config_validate',$appname);
+				
+				if (!isset($_POST['newsettings']['cc_allow_details'])) {
+					$_POST['newsettings']['cc_allow_details'] = "false";
+				}
 
 				foreach($_POST['newsettings'] as $key => $config)
 				{
-					if ($config)
-					{
-						if($GLOBALS['phpgw_info']['server']['found_validation_hook'] && function_exists($key))
-						{
-							call_user_func($key,$config);
-							if($GLOBALS['config_error'])
+					
+					if ($config)  
+					{																						  // Código adicionado	
+						if($GLOBALS['phpgw_info']['server']['found_validation_hook'] && (function_exists($key) || function_exists(substr($key,0,strrpos($key,'_')))) )
+						{
+							if(function_exists(substr($key,0,strrpos($key,'_'))))
+                        	{
+                                call_user_func(substr($key,0,strrpos($key,'_')),&$config);
+                        	} 
+                        	else 
+                        	{
+                                call_user_func($key,&$config);
+                        	}
+
+                        	if($GLOBALS['config_error'])
 							{
 								$errors .= lang($GLOBALS['config_error']) . '&nbsp;';
@@ -152,4 +165,74 @@
 			echo parse_navbar();
 
+			
+			$campos = '';
+			
+			if($appname=="contactcenter") 
+			{
+				
+				foreach ($c->config_data as $key => $config) 
+				{        	
+					$parts = explode('_', $key);
+                	if (is_numeric($parts[3]) && $parts[1]=='attribute')
+                	{
+                        $fields[$parts[3]][$key] = $config;
+                	}
+                	
+                	
+                	if($key == 'cc_allow_details') {
+                		$checkedCoisa = 'value="details"';
+              			if ($config=='true') {
+              				$checkedCoisa = 'value="details" checked="checked"'; 
+              			}
+                	}
+                }
+        		
+                
+        		foreach ($fields as $i => $line) 
+        		{
+                	if ($line["cc_attribute_name_$i"] != '' && $line["cc_attribute_ldapname_$i"] != '') {
+                        $selectedText  = $line["cc_attribute_type_$i"] == 'text' ? 'selected="selected"' : '';
+                        $selectedTMult = $line["cc_attribute_type_$i"] == 'multivalues' ? 'selected="selected"' : '';
+                		
+                		$campos = $campos . "<div class=\"cc_attribute\">
+                                <label>" . lang('Name') .":</label>
+                                <input type=\"text\" name=\"newsettings[cc_attribute_name_" . $i . "]\" value=\"".$line["cc_attribute_name_$i"]."\" /> 
+                                <label>" . lang('Corresponding LDAP') . ":</label>
+                                <input type=\"text\" name=\"newsettings[cc_attribute_ldapname_" . $i . "]\" value=\"".$line["cc_attribute_ldapname_$i"]."\" /> 
+                                <label>" . lang('Type') . ":</label>
+                                <select name=\"newsettings[cc_attribute_type_" . $i . "]\">
+                                        <option value=\"text\" $selectedText>" . lang('Text') . "</option>
+                                        <option value=\"multivalues\" $selectedTMult>" . lang('Multivalued') ."</option>
+                                </select>
+                                <img src=\"contactcenter/templates/default/images/cc_x.png\" alt=\"". lang('Delete') . "\" style=\"width: 15px; height: 14px; cursor: pointer; position: relative; top: 3px;\" onclick=\"javascript:cc_attribute_delete(this)\"/>  
+                        </div>";
+                	}
+        		} 
+        	
+			    if ($campos == '')
+        		{
+        			$campos = "<div class=\"cc_attribute\">
+                                <label>" . lang('Name') .":</label>
+                                <input type=\"text\" name=\"newsettings[cc_attribute_name_0]\" value=\"\" /> 
+                                <label>" . lang('Corresponding LDAP') . ":</label>
+                                <input type=\"text\" name=\"newsettings[cc_attribute_ldapname_0]\" value=\"\" /> 
+                                <label>" . lang('Type') . ":</label>
+                                <select name=\"newsettings[cc_attribute_type_0]\">
+                                        <option value=\"text\">" . lang('Text') . "</option>
+                                        <option value=\"multivalues\">" . lang('Multivalued') . "</option>
+                                </select>
+                                <img src=\"contactcenter/templates/default/images/cc_x.png\" alt=\"". lang('Delete') ."\" style=\"width: 15px; height: 14px; cursor: pointer; position: relative; top: 3px;\" onclick=\"javascript:cc_attribute_delete(this)\"/> 
+                        </div>";
+        		}
+        		
+        		$t->set_var('lang_add_button', lang('Add'));
+				$t->set_var('lang_cc_Set_details_attributes',   lang('Details on the Global Catalog Address'));
+        		$t->set_var('lang_cc_Allow_view_details_label', lang('Enable display of contact details for the Global Catalog'));				
+        		$t->set_var('attribute_fields', $campos);      		
+        		$t->set_var('cc_config_js', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/contactcenter/js/cc_config.js');
+        		$t->set_var('cc_allow_view_details_value', $checkedCoisa);
+			} 
+        	
+			
 			if($appname=="expressoAdmin1_2") {
 				/* Varre a pasta inc do admin do expresso procurando scripts de geração de login automático
Index: /sandbox/2.2.0.2/contactcenter/setup/phpgw_es-es.lang
===================================================================
--- /sandbox/2.2.0.2/contactcenter/setup/phpgw_es-es.lang	(revision 4498)
+++ /sandbox/2.2.0.2/contactcenter/setup/phpgw_es-es.lang	(revision 4500)
@@ -205,2 +205,11 @@
 Not Allowed	contactcenter	es-es	Acceso negado
 Unavailable function	contactcenter	es-es	Función no disponible
+Details on the Global Catalog Address	common	es-es	Detalles en el Catálogo Global de Direcciones
+Enable display of contact details for the Global Catalog	common	es-es	Permitir visualización de detalles para contactos del Catálogo Global
+Nome	common	es-es	Nombre	
+Type	common	es-es	Tipo
+Delete	common	es-es	Borrar
+Add	common	es-es	Añadir
+The reported field was not found in LDAP	common	es-es	El campo reportado como correspondencia en LDAP no se encontró
+Text	common	es-es	Texto
+Multivalued	common	es-es	multivalor
Index: /sandbox/2.2.0.2/contactcenter/inc/class.bo_ldap_manager.inc.php
===================================================================
--- /sandbox/2.2.0.2/contactcenter/inc/class.bo_ldap_manager.inc.php	(revision 4352)
+++ /sandbox/2.2.0.2/contactcenter/inc/class.bo_ldap_manager.inc.php	(revision 4500)
@@ -193,5 +193,5 @@
 		/*
 		 * @function get_external_ldap_fields_association
-		 * @author Mï¿œrio Cï¿œsar Kolling <mario.kolling@serpro.gov.br>
+		 * @author Mário César Kolling <mario.kolling@serpro.gov.br>
 		 * @abstract get the fields association for an external ldap_source
 		 * @return an array with attribute mappings
@@ -206,5 +206,5 @@
 		/*
 		 * @function test_connection
-		 * @author Mï¿œrio Cï¿œsar Kolling <mario.kolling@serpro.gov.br>
+		 * @author Mário César Kolling <mario.kolling@serpro.gov.br>
 		 * @abstract Test if we can bind to a ldap server in a reasonable time
 		 * @param (string) $host ldap server's hostname
@@ -291,5 +291,5 @@
 			@function get_external_ldap_tree
 			@abstract Returns the LDAP external tree corresponding to the specified level
-			@author Mï¿œrio Cï¿œsar Kolling <mario.kolling@serpro.gov.br>
+			@author Mário César Kolling <mario.kolling@serpro.gov.br>
 			@param (integer) $id_source The ID of the external LDAP source
 			@param (string)  $context The context to be used as root branch
@@ -458,6 +458,6 @@
 		{
 			/*
-			 * Esta operaï¿œï¿œo resolve o problema causado pela conversï¿œo de caracteres acentuados realizada
-			 * pela funï¿œï¿œo ldap_explode_dn().
+			 * Esta operação resolve o problema causado pela conversão de caracteres acentuados realizada
+			 * pela função ldap_explode_dn().
 			 */
 
@@ -539,5 +539,5 @@
 				list($group) = explode('=',$dn_parts_full[0]);
 
-				//Faz a comparaï¿œï¿œo do branch como case insensitive
+				//Faz a comparação do branch como case insensitive
 				if (strtolower($group) == strtolower($branch_dn) or $branch_dn === 'all')
 				{
Index: /sandbox/2.2.0.2/contactcenter/inc/hook_config_validate.inc.php
===================================================================
--- /sandbox/2.2.0.2/contactcenter/inc/hook_config_validate.inc.php	(revision 2)
+++ /sandbox/2.2.0.2/contactcenter/inc/hook_config_validate.inc.php	(revision 4500)
@@ -47,3 +47,18 @@
 		}
 	}
+
+	
+	/*
+	 * @function cc_allow_details
+	 * @abstract Recebe o valor do checkbox e forï¿œa a saï¿œda para TRUE ou FALSE
+	 * @author Prognus software livre - http://www.prognus.com.br | prognus@prognus.com.br
+	 * @param $value
+	 */
+	function cc_allow_details(&$value) {
+		if ($value == 'details') {
+			$value = "true";
+		} else {
+			$value = "false";
+		}
+	}
 ?>
Index: /sandbox/2.2.0.2/contactcenter/inc/class.ui_api.inc.php
===================================================================
--- /sandbox/2.2.0.2/contactcenter/inc/class.ui_api.inc.php	(revision 4498)
+++ /sandbox/2.2.0.2/contactcenter/inc/class.ui_api.inc.php	(revision 4500)
@@ -183,4 +183,29 @@
 			$template->parse('out','search');
 
+			return $template->get_var('out');
+		}
+		
+		function get_contact_details()
+		{
+			$template = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
+			$template->set_file(array('details' => 'contact_details.tpl'));
+			
+			if (!$this->commons_loaded)
+			{
+				$template->set_var('cc_api', $this->commons);
+				$this->commons_loaded = true;
+			}
+			else
+			{
+				$template->set_var('cc_api', '');
+			}
+			
+			//$template->set_var('ccContactDetails.js', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/contactcenter/js/ccContactDetails.js');
+			$template->set_var('cc_contact_details_title',lang("Contact's details"));
+			$template->set_var('cc_contact_details_close',lang("Close"));
+			$template->set_var('cc_contact_details_no_fields',lang("The extra details are not configured."));
+			$template->set_var('cc_contact_details_attr_name',lang("Attribute name"));
+			$template->set_var('cc_contact_details_attr_value',lang("Value"));
+			$template->parse('out','details');
 			return $template->get_var('out');
 		}
Index: /sandbox/2.2.0.2/contactcenter/inc/class.ui_data.inc.php
===================================================================
--- /sandbox/2.2.0.2/contactcenter/inc/class.ui_data.inc.php	(revision 4498)
+++ /sandbox/2.2.0.2/contactcenter/inc/class.ui_data.inc.php	(revision 4500)
@@ -259,4 +259,5 @@
 			$GLOBALS['phpgw']->template->set_var('cc_msg_expresso_default_csv', lang('Export as Expresso (Default) CSV.'));
 			$GLOBALS['phpgw']->template->set_var('cc_msg_copy_to_catalog', lang('Copy to personal catalog.'));
+			$GLOBALS['phpgw']->template->set_var('cc_msg_show_extra_detail', lang("Show extra contact's details."));
 			$GLOBALS['phpgw']->template->set_var('cc_msg_add_contact_to_group', lang('You did not add any contact for this group.'));
 			$GLOBALS['phpgw']->template->set_var('cc_msg_fill_field_name', lang('Fill the field Full Name'));
@@ -289,4 +290,5 @@
 			$main .= $api->get_quick_add_plugin();
 			$main .= $api->get_add_group();
+			$main .= $api->get_contact_details();
 			$main .= $GLOBALS['phpgw']->template->get_var('out');
 
@@ -445,6 +447,10 @@
 					return $this->export_contacts($_POST['typeExport']);
 				
+				case 'get_contact_details':
+					return $this->get_contact_details($_GET['id']);
+
 				case 'get_qtds_compartilhado':
 					return $this->get_qtds_compartilhado();
+
 				case 'get_list_owners_perms_add':
 					echo $this->get_list_owners_perms_add();
@@ -1323,5 +1329,8 @@
 					)
 				);
-
+				//verifica se esta habilitado a opcao de exibir os detalhes extras
+				$objconfig = CreateObject('phpgwapi.config', 'contactcenter');
+				$config = $objconfig->read_repository();
+				$final[12] = isset($config['cc_allow_details'])? $config['cc_allow_details'] : false;
 				//echo 'Page: '.$page.'<br>';
 				$n_entries = count($this->page_info['actual_entries']);
@@ -4434,4 +4443,68 @@
 			echo serialize($return);
 		}
+	
+		/*!
+		 * @function get_contact_details
+		 * @abstract Retorna os detalhes extras de um contato
+		 * @author Luiz Carlos Viana Melo - Prognus
+		 * @param (string) O ID do usuário do LDAP
+		 */
+		function get_contact_details($id)
+		{
+			$data = array();
+			
+			if(!$this->bo->catalog->src_info) {
+				$ldap = CreateObject('contactcenter.bo_ldap_manager');
+				$this->bo->catalog->src_info = $ldap->srcs[1];
+			}
+			
+			$ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true);				
+			$dn=$this->bo->catalog->src_info['dn'];
+			
+			//buscar os atributos do ldap
+			$configobj = CreateObject('phpgwapi.config', 'contactcenter');
+			$prefs = $configobj->read_repository();
+			$attr_names = array();
+			$attr_types = array();
+			$justThese = array();
+			foreach ($prefs as $pref_key => $pref_value)
+			{
+				if (stripos($pref_key, "cc_attribute_name_") !== false)
+				{
+					$num = substr($pref_key, strlen("cc_attribute_name_"));
+					$attr_names[] = $prefs["cc_attribute_name_$num"];
+					$attr_types[] = $prefs["cc_attribute_type_$num"];
+					$justThese[] = strtolower($prefs["cc_attribute_ldapname_$num"]);
+				}
+			}
+			$sr = ldap_read($ds,$id, "objectClass=*",$justThese);							
+			$info = ldap_get_entries($ds, $sr);
+			if ($info)
+			{
+				for ($i = 0; $i < count($justThese); $i++)
+				{
+					$attr = array();
+					$attr['name'] = $attr_names[$i];
+					if ($attr_types[$i] == 'multivalues')
+					{
+						$attr['type'] = 'multivalues';
+						$attr['value'] = array();
+						for ($j = 0; $j < $info[0][$justThese[$i]]['count']; $j++)
+							$attr['value'][] = utf8_decode($info[0][$justThese[$i]][$j]);
+					}
+					else
+					{
+						$attr['type'] = 'text';
+						$attr['value'] = utf8_decode($info[0][$justThese[$i]][0]);
+					}
+					$data[] = $attr;
+				}
+			}
+			else
+				$data = 'error';
+			ldap_close($ds);
+			
+			echo serialize($data);
+		}
 	}
 
Index: /sandbox/2.2.0.2/contactcenter/js/cc.js
===================================================================
--- /sandbox/2.2.0.2/contactcenter/js/cc.js	(revision 4498)
+++ /sandbox/2.2.0.2/contactcenter/js/cc.js	(revision 4500)
@@ -227,4 +227,74 @@
 function closeFullAdd(){
 	fullAddWin.close();
+}
+/******** Contact details ***********/
+function openContactDetails(id){
+	// Build the ContactDetails Window.
+	if(!contactdetailsWin && !is_ie) 
+		__cdWin();
+
+	contactdetailsWin.open();
+	
+	populateContactDetails(id);
+}
+
+function populateContactDetails(id)
+{
+	var handler = function(responseText)
+	{
+		var fieldsDiv = Element('id_cc_contact_details_fields');
+		var data = unserialize(responseText);
+		//alert(responseText);
+		fieldsDiv.innerHTML = "";
+		if (data && data.length > 0)
+		{
+			//fieldsDiv.innerHTML = "";
+			var table = document.createElement("table");
+			table.border=0;
+			//table.style.borderBottom = '1px solid #999';
+			//table.cellSpacing = '0';
+			table.width = '480px';
+			var attr_name_size = '50%';
+			var attr_value_size = '50%';
+			for(i = 0; i < data.length; i++)
+			{
+				var row = table.insertRow(i);
+				if ((i % 2) == 0)
+					row.setAttribute('class', 'row_off');
+				else
+					row.setAttribute('class', 'row_on');
+				//row.style.borderBottom = '1px solid #999';
+				attr_name = row.insertCell(0);
+				attr_value = row.insertCell(1);
+				attr_name.style.width = attr_name_size;
+				attr_value.style.width = attr_value_size;
+				attr_name.innerHTML = data[i]['name'];
+				if (data[i]['type'] == 'text')
+					attr_value.innerHTML = data[i]['value'];
+				else
+				{
+					var multivalue_div = document.createElement("div");
+					multivalue_div.style.overflow = 'auto';
+					multivalue_div.style.height = '100px';
+					multivalue_div.style.border = '1px solid #999';
+					//multivalue_div.style.backgroundColor = 'transparent';
+					for (j = 0; j < data[i]['value'].length; j++)
+					{
+						multivalue_div.appendChild(document.createTextNode(data[i]['value'][j]));
+						multivalue_div.appendChild(document.createElement("br"));
+					}
+					attr_value.appendChild(multivalue_div);
+				}	
+			}
+			fieldsDiv.appendChild(table);
+		}
+		else
+			fieldsDiv.innerHTML = Element('cc_contact_details_no_fields').value; 
+	};
+	Connector.newRequest('populateContactDetails', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_contact_details&id=' + id, 'GET', handler);
+}
+
+function closeContactDetails(){
+	contactdetailsWin.close();
 }
 /********** New Contact *************/
@@ -2302,5 +2372,9 @@
 								Element(id+':cc_photo').src = '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_photo' + (data[4][pos] != 0 ? '&id='+data[3][pos][k] : '');
 								if(ccTree.catalog_perms == 1)
+								{
 									Element(id+':cc_icon_data').innerHTML =  '<span title="'+Element('cc_msg_copy_to_catalog').value+'" id="' + id + ':ccQuickAdd" onmouseout="window.status=\'\';" onclick="ccQuickAddContact.showList(\''+ Element(id+':cc_id').value + '\');return true;" style="cursor: pointer; cursor: hand; z-index: 1"><img src="templates/default/images/address-conduit-16.png" align="center"></span>';
+									if (data[12] == true || data[12] == 'true')
+										Element(id+':cc_icon_data').innerHTML += "  |  " + '<span title="'+ Element('cc_msg_show_extra_detail').value+'" id="' + id + ':ccContactDetails" onclick="javascript:openContactDetails(\'' + Element(id+':cc_id').value + '\');" style="cursor: pointer; cursor: hand; z-index: 1"><img src="templates/default/images/addressbook-mini.png" align="center"></span>';
+								}
 								break;
 
Index: /sandbox/2.2.0.2/contactcenter/templates/default/config.tpl
===================================================================
--- /sandbox/2.2.0.2/contactcenter/templates/default/config.tpl	(revision 3262)
+++ /sandbox/2.2.0.2/contactcenter/templates/default/config.tpl	(revision 4500)
@@ -1,4 +1,6 @@
 <!-- BEGIN header -->
-<form method="POST" action="{action_url}">
+<script type="text/javascript" src="{cc_config_js}"></script>
+<!-- Foi incluído essa parte no evento do form (onsubmit....) e foi incluído a linha de cima para usar o arquivo .js -->
+<form  onsubmit="javascript:cc_attribute_clear(this);" method="POST" action="{action_url}">
 <table border="0" align="center">
 	<tr class="th">
@@ -79,13 +81,23 @@
 		</td>
 	</tr>
-	<tr class="th">
-		<td colspan="2">&nbsp;</td>
-	</tr>
-	<tr>
-   		<td></td>
-	</tr>
-	<tr>
-   		<td></td>
-	</tr>
+<tr class="th">
+        <td colspan="2">&nbsp;<b>{lang_cc_Set_details_attributes}</b></td>
+    </tr>
+    <tr>
+                <td colspan="2" id="cc_attribute_fields">
+                        <div>
+                                <input id="config_cc_allow_details" type="checkbox" name="newsettings[cc_allow_details]" {cc_allow_view_details_value} value="details"/> 
+                                <label for="config_cc_allow_details" >{lang_cc_Allow_view_details_label}</label>
+                       
+                        </div>
+ 						
+ 						<div align="right" id="cc_attribute_box_adder">
+                                <input type="button" onclick="javascript:cc_attribute_add();" name="addattribute" value="{lang_add_button}" /> 
+                        </div>
+ 						
+ 						<br />
+							{attribute_fields}                        
+				</td>
+    </tr>
   <!-- <tr class="row_on">
   	<td>{lang_objectClass_to_be_used_as_a_Contact}:</td>
Index: /sandbox/2.2.0.2/contactcenter/templates/default/index.tpl
===================================================================
--- /sandbox/2.2.0.2/contactcenter/templates/default/index.tpl	(revision 3311)
+++ /sandbox/2.2.0.2/contactcenter/templates/default/index.tpl	(revision 4500)
@@ -86,4 +86,5 @@
 <input id="cc_msg_expresso_default_csv" type="hidden" value="{cc_msg_expresso_default_csv}">
 <input id="cc_msg_copy_to_catalog" type="hidden" value="{cc_msg_copy_to_catalog}">
+<input id="cc_msg_show_extra_detail" type="hidden" value="{cc_msg_show_extra_detail}">
 <input id="cc_msg_fill_field_name" type="hidden" value="{cc_msg_fill_field_name}">
 <input id="cc_msg_add_contact_to_group" type="hidden" value="{cc_msg_add_contact_to_group}">
