Index: trunk/workflow/inc/class.so_orgchart.inc.php
===================================================================
--- trunk/workflow/inc/class.so_orgchart.inc.php	(revision 2056)
+++ trunk/workflow/inc/class.so_orgchart.inc.php	(revision 2063)
@@ -699,5 +699,11 @@
 		$this->_checkAccess($organizationID);
 
-		$supervisors = '{' . implode(', ', $this->db->GetRow('SELECT COALESCE(a.titular_funcionario_id, -1) AS titular_funcionario_id, COALESCE(s.funcionario_id, -1) AS substituto_funcionario_id FROM area a LEFT OUTER JOIN substituicao s ON ((a.area_id = s.area_id) AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) WHERE (area_id = ?) AND (organizacao_id = ?)', array($areaID, $organizationID))) . '}';
+		/* gather some info from the area */
+		$areaInfo = $this->db->query('SELECT COALESCE(a.titular_funcionario_id, -1) AS titular_funcionario_id, COALESCE(s.funcionario_id, -1) AS substituto_funcionario_id FROM area a LEFT OUTER JOIN substituicao s ON ((a.area_id = s.area_id) AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) WHERE (a.organizacao_id = ?) AND (a.area_id = ?)', array($organizationID, $areaID))->GetArray(-1);
+		if (empty($areaInfo))
+			return false;
+		$areaInfo = $areaInfo[0];
+		$supervisors = '{' . implode(', ', $areaInfo) . '}';
+
 		$query = "SELECT funcionario_id, funcionario_status_id, centro_custo_id, localidade_id, organizacao_id, area_id, cargo_id, nivel, funcionario_categoria_id, titulo FROM funcionario WHERE ((area_id = ?) AND (organizacao_id = ?)) OR (funcionario_id = ANY (?))";
 		$result = $this->db->query($query, array($areaID, $organizationID, $supervisors));
@@ -711,4 +717,8 @@
 			$output[$i]['funcionario_id_desc'] = '';
 			$output[$i]['uid'] = '';
+
+			if (in_array($output[$i]['funcionario_id'], $areaInfo))
+				$output[$i]['chief'] = ($output[$i]['funcionario_id'] == $areaInfo['titular_funcionario_id']) ? 1 : 2;
+
 			if (($entry = $cachedLDAP->getEntryByID($output[$i]['funcionario_id'])))
 			{
Index: trunk/workflow/js/orgchart/organization.js
===================================================================
--- trunk/workflow/js/orgchart/organization.js	(revision 2056)
+++ trunk/workflow/js/orgchart/organization.js	(revision 2063)
@@ -520,4 +520,6 @@
 		tableHeader['uid'] = 'UID';
 		tableHeader['actions'] = 'Ações';
+
+		var complement;
 		for (var i = 0; i < data.length; i++)
 		{
@@ -527,8 +529,13 @@
 					dataHash[j] = data[i][j];
 
+			// are you a chief ('titular' or 'substituto')?
+			complement = '';
+			if (data[i]['chief'])
+				complement = ' <strong>(' + ((data[i]['chief'] == 1) ? 'Titular' : 'Substituto') + ')</strong>';
+
 			data[i]['tr_attributes'] = new Array();
 			data[i]['tr_attributes']['class'] = "linha" + i%2;
 			data[i]['tr_attributes']['className'] = "linha" + i%2;
-			data[i]['funcionario_id_desc'] = '<a href="javascript:void(0)" class="lbOn" onmouseover="getEmployeeInfoTimer(event, ' + data[i]['funcionario_id'] + ', ' + organizationID + '); return false;" onmouseout="hideEmployeeInfo(); return false;" onclick="loadAddEmployeeUI(' + organizationID + ', function(){objEmployee.fillForm(' + dataHash.customInspect() + ')}); $(\'addEmployeeLink\').parentNode.removeChild($(\'addEmployeeLink\')); return false;">' + data[i]['funcionario_id_desc'] + '</a>' + (data[i]['removed'] ? ' <font color="red">(excluído)</font>' : '');
+			data[i]['funcionario_id_desc'] = '<a href="javascript:void(0)" class="lbOn" onmouseover="getEmployeeInfoTimer(event, ' + data[i]['funcionario_id'] + ', ' + organizationID + '); return false;" onmouseout="hideEmployeeInfo(); return false;" onclick="loadAddEmployeeUI(' + organizationID + ', function(){objEmployee.fillForm(' + dataHash.customInspect() + ')}); $(\'addEmployeeLink\').parentNode.removeChild($(\'addEmployeeLink\')); return false;">' + data[i]['funcionario_id_desc'] + ' ' + complement + '</a>' + (data[i]['removed'] ? ' <font color="red">(excluído)</font>' : '');
 			data[i]['actions'] = '<a href="#" onclick="objEmployee.remove({\'funcionario_id\': ' + data[i]['funcionario_id'] + ', \'organizacao_id\': ' + organizationID + '} , this.parentNode.parentNode); return false;"><img border="0" width="16" height="16" src="workflow/templateFile.php?file=images/button_cancel.png" /></a>';
 			window.scrollTo(0,0);
