String.prototype.repeat = function(l)
{
return new Array(l+1).join(this);
};
var workflowOrgchartAdminEmployeeInfoTimer = null;
var workflowOrgchartAdminAreaInfoTimer = null;
var CadastroAjax = Class.create();
CadastroAjax.prototype =
{
initialize: function()
{
this.name = '';
this.required = new Array();
this.tableHeader = new Array();
this.combo = new Array();
},
add: function()
{
for (var i = 0; i < this.required.length; i++)
{
if ($F(this.required[i]) == '')
{
alert("Campo necessário ausente: " + $(this.required[i]).parentNode.parentNode.childNodes[0].childNodes[0].innerHTML);
$(this.required[i]).focus();
return;
}
}
var cb = function(data)
{
if (!handleError(data))
return;
/* update the screen info */
if (this.name.toLowerCase() == "organization")
listOrganizations();
else
{
if ($('organizacao_id'))
{
var index = $F('organizacao_id');
if (refreshAreas[index])
refreshAreas[index]();
}
}
valid.deactivate();
};
return this.ajaxAction('add', cb, Form.serialize($('orgchartForm')));
},
update: function()
{
for (var i = 0; i < this.required.length; i++)
{
if ($F(this.required[i]) == '')
{
alert("Campo necessário ausente: " + $(this.required[i]).parentNode.parentNode.childNodes[0].childNodes[0].innerHTML);
$(this.required[i]).focus();
return;
}
}
var cb = function(data)
{
if (!handleError(data))
return;
/* update the screen info */
if (this.name.toLowerCase() == "organization")
listOrganizations();
else
{
if ($('organizacao_id'))
{
var index = $F('organizacao_id');
if (refreshAreas[index])
refreshAreas[index]();
}
}
valid.deactivate();
};
return this.ajaxAction('update', cb, Form.serialize($('orgchartForm')));
},
remove: function(params, linkRemove)
{
if (linkRemove.addClassName)
linkRemove.addClassName('alerta');
if (confirm("Tem certeza que deseja excluir o registro selecionado?"))
{
var cb = function(data)
{
if (!handleError(data))
return;
/* update the screen info */
if (this.name.toLowerCase() == "organization")
listOrganizations();
else
{
var index = $('organizacao_id') ? $F('organizacao_id') : params['organizacao_id'];
if (refreshAreas[index])
refreshAreas[index]();
}
if ($('lbContent'))
valid.deactivate();
};
return this.ajaxAction('remove', cb, $H(params).toQueryString());
}
else
if (linkRemove.removeClassName)
linkRemove.removeClassName('alerta');
},
list: function(callback, params)
{
return this.ajaxAction('list', callback, $H(params).toQueryString());
},
generateTable: function(params, displayArea)
{
tableHeader = this.tableHeader;
var tableResult = function(data)
{
if (!handleError(data))
return;
if (data.length == 0)
{
displayArea.innerHTML += '
Nenhum registro encontrado ';
return true;
}
for (var i = 0; i < data.length; i++)
{
data[i]['tr_attributes'] = new Array();
data[i]['tr_attributes']['class'] = "linha" + i%2;;
data[i]['tr_attributes']['className'] = "linha" + i%2;;
}
var tableAtributes = new Array();
tableAtributes['id'] = this.name + 'List';
tableAtributes['class'] = 'organizationList';
tableAtributes['className'] = 'organizationList';
displayArea.appendChild(constructTable(tableHeader, data, tableAtributes));
};
this.list(tableResult, params);
},
generateUpdateTable: function(params, displayArea)
{
tableHeader = this.tableHeader;
if (!tableHeader['actions'])
tableHeader['actions'] = "Ações";
name = this.name.charAt(0).capitalize() + this.name.substr(1);
var tableResult = function(data)
{
if (!handleError(data))
return;
if (data.length == 0)
{
//displayArea.innerHTML += 'Nenhum registro encontrado ';
elem = document.createElement('div');
elem.id = this.name.capitalize() + 'List';
elem.innerHTML = 'Nenhum registro encontrado ';
displayArea.appendChild(elem);
return true;
}
for (var i = 0; i < data.length; i++)
{
var dataHash = new Hash();
for (j in data[i])
if (typeof data[i][j] != "function")
{
dataHash[j] = data[i][j];
if ( dataHash[j] == null )
dataHash[j] = '';
}
for (j in tableHeader)
if (typeof tableHeader[j] != "function")
if (j != 'actions')
data[i][j] = '' + data[i][j] + ' ';
data[i]['tr_attributes'] = new Array();
data[i]['tr_attributes']['class'] = "linha" + i%2;
data[i]['tr_attributes']['className'] = "linha" + i%2;
data[i]['actions'] = ' ';
}
var tableAtributes = new Array();
tableAtributes['id'] = this.name + 'List';
tableAtributes['class'] = 'orgchartUpdateTable';
tableAtributes['className'] = 'orgchartUpdateTable';
displayArea.appendChild(constructTable(tableHeader, data, tableAtributes));
};
this.list(tableResult, params);
},
fillForm: function(dataHash)
{
dataHash = $H(dataHash);
dataHash.each(function(pair)
{
var campo = $(pair.key);
if (campo)
{
if ((campo.nodeName == "SELECT") && (pair.value == null))
campo.value = campo.firstChild.value;
else
if (pair.value != null)
campo.value = pair.value;
}
else
new Insertion.Bottom($('orgchartForm'), ' ');
});
if (!$('updateOrgchart'))
new Insertion.Bottom($('orgchartForm'), ' ');
var saveButton = $('inserir');
saveButton.innerHTML = "Salvar";
var name = this.name;
saveButton.onclick = function(){ eval('obj' + name.charAt(0).capitalize() + name.substr(1) + '.update();')};
var titleObject = $('modalTitle');
var title = titleObject.innerHTML.split(' ');
title[0] = "Atualizar";
titleObject.innerHTML = title.join(' ');
$('lightbox').scrollTop = 0;
},
generateComboBox: function(params, displayArea, includeNull, name, callback)
{
if (!name)
name = this.combo['id'];
combo = this.combo;
var comboResult = function(data)
{
if (!handleError(data))
return;
var newFormat = new Array();
if (includeNull)
newFormat['NULL'] = "Nenhum";
for (var i = 0; i < data.length; i++)
newFormat[data[i][combo['id']]] = data[i][combo['name']];
if ((newFormat.length > 0) || includeNull)
displayArea.innerHTML = constructSelectBox(name, newFormat);
else
displayArea.innerHTML = 'nenhum registro encontado ';
if (callback)
callback();
};
this.list(comboResult, params);
},
ajaxAction: function(action, callback, params)
{
if (params == "")
cExecute('$this.bo_orgchart.' + action + this.name.charAt(0).capitalize() + this.name.substr(1), callback);
else
cExecute('$this.bo_orgchart.' + action + this.name.charAt(0).capitalize() + this.name.substr(1), callback, params);
}
};
var CadastroOrganization =
{
name: 'organization',
required: new Array('nome', 'descricao', 'ativa'),
tableHeader: {'nome': 'Organização'},
combo: {'id': 'organizacao_id', 'name': 'nome'}
};
var objOrganization = new CadastroAjax();
Object.extend(objOrganization, CadastroOrganization);
var CadastroEmployeeStatus =
{
name: 'employeeStatus',
required: new Array('descricao', 'exibir'),
tableHeader: {'descricao': 'Status de Funcionário'},
combo: {'id': 'funcionario_status_id', 'name': 'descricao'}
};
var objEmployeeStatus = new CadastroAjax();
Object.extend(objEmployeeStatus, CadastroEmployeeStatus);
var CadastroEmployeeCategory =
{
name: 'employeeCategory',
required: new Array('organizacao_id', 'descricao'),
tableHeader: {'descricao': 'Nome'},
combo: {'id': 'funcionario_categoria_id', 'name': 'descricao'}
};
var objEmployeeCategory = new CadastroAjax();
Object.extend(objEmployeeCategory, CadastroEmployeeCategory);
var CadastroJobTitle =
{
name: 'jobTitle',
required: new Array('organizacao_id', 'descricao'),
tableHeader: {'descricao': 'Nome'},
combo: {'id': 'cargo_id', 'name': 'descricao'}
};
var objJobTitle = new CadastroAjax();
Object.extend(objJobTitle, CadastroJobTitle);
var CadastroAreaStatus =
{
name: 'areaStatus',
required: new Array('organizacao_id', 'descricao', 'nivel'),
tableHeader: {'descricao': 'Nome', 'nivel': 'Nível'},
combo: {'id': 'area_status_id', 'name': 'descricao'}
};
var objAreaStatus = new CadastroAjax();
Object.extend(objAreaStatus, CadastroAreaStatus);
var CadastroCostCenter =
{
name: 'costCenter',
required: new Array('organizacao_id', 'nm_centro_custo', 'descricao', 'grupo'),
tableHeader: {'nm_centro_custo': 'Número', 'descricao': 'Nome', 'grupo': 'Grupo'},
combo: {'id': 'centro_custo_id', 'name': 'descricao'}
};
var objCostCenter = new CadastroAjax();
Object.extend(objCostCenter, CadastroCostCenter);
var CadastroLocal =
{
name: 'local',
required: new Array('organizacao_id', 'descricao'),
tableHeader: {'descricao': 'Localidade'},
combo: {'id': 'localidade_id', 'name': 'descricao'}
};
var objLocal = new CadastroAjax();
Object.extend(objLocal, CadastroLocal);
var CadastroEmployee =
{
name: 'employee',
required: new Array('funcionario_id', 'organizacao_id', 'funcionario_status_id', 'centro_custo_id', 'localidade_id', 'area_id'),
tableHeader: {'funcionario_id': 'Funcionário'},
combo: {'id': 'funcionario_id', 'name': 'funcionario_id'}
};
var objEmployee = new CadastroAjax();
Object.extend(objEmployee, CadastroEmployee);
var CadastroArea =
{
name: 'area',
required: new Array('organizacao_id', 'area_status_id', 'centro_custo_id', 'superior_area_id', 'sigla', 'descricao', 'ativa'),
tableHeader: {'sigla': 'Área'},
combo: {'id': 'area_id', 'name': 'sigla'}
};
var objArea = new CadastroAjax();
Object.extend(objArea, CadastroArea);
var CadastroTelefone =
{
name: 'telephones',
required: new Array('organizacao_id', 'descricao', 'numero'),
tableHeader: {'descricao': 'Descrição', 'numero': 'Telefones'},
combo: {'id': 'telefone_id', 'name': 'descricao'}
};
var objTelephones = new CadastroAjax();
Object.extend(objTelephones, CadastroTelefone);
var CadastroSubstituto =
{
name: 'substitution',
required: new Array('organizacao_id', 'area_id', 'descricao', 'titular_funcionario_id', 'substituto_funcionario_id', 'data_inicio', 'data_fim'),
tableHeader: {'substituto_funcionario_id_desc': 'Nome', 'data_inicio': 'Data de início', 'data_fim': 'Data de término'},
combo: {}
};
var objSubstitution = new CadastroAjax();
Object.extend(objSubstitution, CadastroSubstituto);
function createOrganizationLayout(organizationID, organizationDiv)
{
organizationDiv.innerHTML = '';
organizationDiv.innerHTML += '
';
organizationDiv.innerHTML += '
';
organizationDiv.innerHTML += '';
organizationDiv.innerHTML += '
';
organizationDiv.innerHTML += '
';
createOrganizationMenu(organizationID, $('orgchartMenu_' + organizationID));
loadOrganizationAreas(organizationID, $('orgchartAreas_' + organizationID));
lb_initialize();
}
function createOrganizationMenu(organizationID, div)
{
var content = '';
content += ' ';
content += ' ';
div.innerHTML = content;
}
function loadOrganizationAreas(organizationID, div)
{
var loadOrganizationAreasResult = function(data)
{
function recursivePrint(subdata)
{
for (var i = 0; i < subdata.length; i++)
{
div.innerHTML += ' ' + ' '.repeat(subdata[i]['depth']) + '' + subdata[i]['sigla'] + ' ';
if (subdata[i]['children'].length > 0)
recursivePrint(subdata[i]['children']);
}
}
if (!handleError(data))
return;
if (data.length == 0)
{
div.innerHTML = "Nenhuma área cadastrada. ";
return;
}
div.innerHTML = "ÁREAS ";
recursivePrint(data);
if (refreshEmployees[organizationID])
refreshEmployees[organizationID]();
};
objArea.ajaxAction('listHierarchical', loadOrganizationAreasResult, $H({'organizacao_id': organizationID}).toQueryString());
refreshAreas[organizationID] = function(){objArea.ajaxAction('listHierarchical', loadOrganizationAreasResult, $H({'organizacao_id': organizationID}).toQueryString());};
}
function searchEmployee(organizationID, div)
{
var searchEmployeeResult = function(data)
{
if (!handleError(data))
return;
div.innerHTML = "";
if (data.length == 0)
{
div.innerHTML = "Nenhum funcionário encontrado. ";
return;
}
var tableHeader = new Array();
tableHeader['funcionario_id_desc'] = 'Funcionário';
tableHeader['area_sigla'] = 'Área';
tableHeader['uid'] = 'UID';
tableHeader['actions'] = 'Ações';
for (var i = 0; i < data.length; i++)
{
var dataHash = new Hash();
for (j in data[i])
if (typeof data[i][j] != "function")
dataHash[j] = data[i][j];
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'] = '' + data[i]['funcionario_id_desc'] + ' ' + (data[i]['removed'] ? ' (excluído) ' : '');
data[i]['actions'] = ' ';
}
var tableAtributes = new Array();
tableAtributes['class'] = 'employeeList';
tableAtributes['className'] = 'employeeList';
div.appendChild(constructTable(tableHeader, data, tableAtributes));
lb_initialize();
};
objEmployee.ajaxAction('search', searchEmployeeResult, $H({'organizacao_id': organizationID, 'search_term': $F('search_term')}).toQueryString());
refreshEmployees[organizationID] = function(){objEmployee.ajaxAction('search', searchEmployeeResult, $H({'organizacao_id': organizationID, 'search_term': $F('search_term')}).toQueryString());};
}
function loadAreaEmployees(organizationID, areaID, div)
{
var loadAreaEmployeesResult = function(data)
{
if (!handleError(data))
return;
var areaLink = $('area_' + areaID);
if (!areaLink.hasClassName('destaque'))
areaLink.addClassName('destaque');
div.innerHTML = "";
if (data.length == 0)
{
div.innerHTML = "Nenhum funcionário alocado nesta área. ";
return;
}
var tableHeader = new Array();
tableHeader['funcionario_id_desc'] = 'Funcionário';
tableHeader['uid'] = 'UID';
tableHeader['actions'] = 'Ações';
var complement;
for (var i = 0; i < data.length; i++)
{
var dataHash = new Hash();
for (j in data[i])
if (typeof data[i][j] != "function")
dataHash[j] = data[i][j];
// are you a chief ('titular' or 'substituto')?
complement = '';
if (data[i]['chief'])
complement = ' (' + ((data[i]['chief'] == 1) ? 'Titular' : 'Substituto') + ') ';
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'] = '' + data[i]['funcionario_id_desc'] + ' ' + complement + ' ' + (data[i]['removed'] ? ' (excluído) ' : '');
data[i]['actions'] = ' ';
window.scrollTo(0,0);
}
var tableAtributes = new Array();
tableAtributes['class'] = 'employeeList';
tableAtributes['className'] = 'employeeList';
div.appendChild(constructTable(tableHeader, data, tableAtributes));
lb_initialize();
};
objEmployee.ajaxAction('listArea', loadAreaEmployeesResult, $H({'area_id': areaID, 'organizacao_id': organizationID}).toQueryString());
refreshEmployees[organizationID] = function(){objEmployee.ajaxAction('listArea', loadAreaEmployeesResult, $H({'area_id': areaID, 'organizacao_id': organizationID}).toQueryString());};
}
function loadAddEmployeeStatusUI(organizationID)
{
var valoresSimNao = new Array();
valoresSimNao['S'] = 'Sim';
valoresSimNao['N'] = 'Não';
var content;
content = 'Adicionar Status de Funcionário ';
content += '';
content += 'Inserir ';
content += 'Cancelar ';
var divLB = $('lbContent');
divLB.innerHTML = content;
$('descricao').focus();
objEmployeeStatus.generateUpdateTable({'organizacao_id': organizationID}, divLB);
}
function loadAddEmployeeCategoryUI(organizationID)
{
var content;
content = 'Adicionar Categoria ';
content += '';
content += 'Inserir ';
content += 'Cancelar ';
var divLB = $('lbContent');
divLB.innerHTML = content;
$('descricao').focus();
objEmployeeCategory.generateUpdateTable({'organizacao_id': organizationID}, divLB);
}
function loadAddJobTitleUI(organizationID)
{
var content;
content = 'Adicionar Cargos ';
content += '';
content += 'Inserir ';
content += 'Cancelar ';
var divLB = $('lbContent');
divLB.innerHTML = content;
$('descricao').focus();
objJobTitle.generateUpdateTable({'organizacao_id': organizationID}, divLB);
}
function loadAddAreaStatusUI(organizationID)
{
var content;
content = 'Adicionar Status de Área ';
content += '';
content += 'Inserir ';
content += 'Cancelar ';
var divLB = $('lbContent');
divLB.innerHTML = content;
$('descricao').focus();
objAreaStatus.generateUpdateTable({'organizacao_id': organizationID}, divLB);
}
function loadAddCostCenterUI(organizationID)
{
var content;
content = 'Adicionar Centro de Custo ';
content += '';
content += 'Inserir ';
content += 'Cancelar ';
var divLB = $('lbContent');
divLB.innerHTML = content;
$('nm_centro_custo').focus();
objCostCenter.generateUpdateTable({'organizacao_id': organizationID}, divLB);
}
function loadAddLocalUI(organizationID)
{
var content;
content = 'Adicionar Localidade ';
content += '';
content += 'Inserir ';
content += 'Cancelar ';
var divLB = $('lbContent');
divLB.innerHTML = content;
$('descricao').focus();
objCostCenter.generateComboBox({'organizacao_id': organizationID}, $('comboCentroCusto'), true, null,
function()
{
objLocal.generateUpdateTable({'organizacao_id': organizationID}, divLB);
}
);
}
function loadAddEmployeeUI(organizationID, callback)
{
var content;
content = 'Adicionar Funcionário ';
content += '';
content += 'Inserir ';
content += 'Cancelar ';
var divLB = $('lbContent');
divLB.innerHTML = content;
objEmployeeStatus.generateComboBox({'organizacao_id': organizationID}, $('comboStatus'), false, null,
function()
{
objEmployeeCategory.generateComboBox({'organizacao_id': organizationID}, $('comboFuncionarioCategoria'), true, null,
function()
{
objJobTitle.generateComboBox({'organizacao_id': organizationID}, $('comboCargo'), true, null,
function()
{
objArea.generateComboBox({'organizacao_id': organizationID}, $('comboArea'), false, null,
function()
{
objCostCenter.generateComboBox({'organizacao_id': organizationID}, $('comboCentroCusto'), true, null,
function()
{
objLocal.generateComboBox({'organizacao_id': organizationID}, $('comboLocalidade'), false, null, callback);
}
)
}
)
}
)
}
)
}
);
}
function loadAddAreaUI(organizationID)
{
var valoresSimNao = new Array();
valoresSimNao['S'] = 'Sim';
valoresSimNao['N'] = 'Não';
var content;
content = 'Adicionar Área ';
content += '';
content += 'Inserir ';
content += 'Cancelar ';
var divLB = $('lbContent');
divLB.innerHTML = content;
$('sigla').focus();
objAreaStatus.generateComboBox({'organizacao_id': organizationID}, $('comboStatus'), false, null,
function()
{
objArea.generateComboBox({'organizacao_id': organizationID}, $('comboArea'), true, 'superior_area_id',
function()
{
objCostCenter.generateComboBox({'organizacao_id': organizationID}, $('comboCentroCusto'), false, null,
function()
{
objArea.generateUpdateTable({'organizacao_id': organizationID}, divLB);
}
)
}
)
}
);
}
function loadAddTelephoneUI(organizationID)
{
var content;
content = 'Adicionar Telefones da Organização ';
content += '';
content += 'Inserir ';
content += 'Cancelar ';
var divLB = $( 'lbContent' );
divLB.innerHTML = content;
$( 'descricao' ).focus( );
objTelephones.generateUpdateTable( { 'organizacao_id' : organizationID }, divLB );
}
function loadAddSubstitutionUI(organizationID)
{
var area_id = 'combo_area';
var content;
content = 'Adicionar Substituição ';
content += '';
content += 'Inserir ';
content += 'Cancelar ';
var divLB = $('lbContent');
divLB.innerHTML = content;
// function that must be called after loading areas on the combobox
var areas_callback = function () {
// every change on the combo box must query for area information
$(area_id).onchange = function () {
if ($('SubstitutionList'))
$('SubstitutionList').remove();
var info_callback = function (data) {
// just to be sure
if (!data[0]) {
alert("Não foi possível encontrar os dados.");
}
// we received an empty response. Let's reset the form.
if ((data[0]['area_id'] == '') || (data[0]['area_id'] == null)) {
alert('RESET');
$('area_id').value = '';
$('descricao').value = '';
$('titular_funcionario_id').value = '';
$('titular_funcionario_id_desc').value = '';
}
// fill the form
else {
$('area_id').value = data[0]['area_id'];
$('descricao').value = data[0]['descricao'];
$('titular_funcionario_id').value = data[0]['titular_funcionario_id'];
$('titular_funcionario_id_desc').value = data[0]['titular_funcionario_id_desc'];
}
// get the list of substitutions
objSubstitution.generateUpdateTable({'organizacao_id': organizationID, 'area_id': $(area_id).value}, divLB);
}
objArea.list(info_callback, {'organizacao_id': organizationID, 'area_id': $(area_id).value});
}
}
objArea.generateComboBox({'organizacao_id': organizationID}, $('comboArea'), true, area_id, areas_callback);
}
function getEmployeeInfoTimer(e, employeeID, organizationID)
{
var div = $('employeeInfo');
div.style.left = (Event.pointerX(e) + 20) + 'px';
div.style.top = (Event.pointerY(e) + 14) + 'px';
if (workflowOrgchartAdminEmployeeInfoTimer != null)
{
workflowOrgchartAdminEmployeeInfoTimer = clearTimeout(workflowOrgchartAdminEmployeeInfoTimer);
workflowOrgchartAdminEmployeeInfoTimer = null;
}
workflowOrgchartAdminEmployeeInfoTimer = setTimeout('getEmployeeInfo(' + employeeID + ', ' + organizationID + ' )', 500);
}
function getEmployeeInfo(employeeID, organizationID)
{
function resultGetEmployeeInfo(data)
{
if (workflowOrgchartAdminEmployeeInfoTimer == null)
return;
workflowOrgchartAdminEmployeeInfoTimer = clearTimeout(workflowOrgchartAdminEmployeeInfoTimer);
workflowOrgchartAdminEmployeeInfoTimer = null;
var content = '';
content += '';
content += ' ';
content += ' ';
for (var i = 0; i < data['info'].length; i++)
content += '' + data['info'][i]['name'] + ' : ' + data['info'][i]['value'] + ' ';
content += '
';
var pageYLimit = document.body.scrollTop + document.body.clientHeight;
var div = $('employeeInfo');
div.innerHTML = content;
if ((parseInt(div.style.top.replace(/px/g, '')) + div.getHeight()) > pageYLimit)
div.style.top = (parseInt(div.style.top.replace(/px/g, '')) - (div.getHeight())) + 'px';
div.show();
}
cExecute('$this.bo_orgchart.getEmployeeInfo', resultGetEmployeeInfo, 'funcionario_id=' + employeeID + '&organizacao_id=' + organizationID);
}
function hideEmployeeInfo()
{
if (workflowOrgchartAdminEmployeeInfoTimer != null)
{
workflowOrgchartAdminEmployeeInfoTimer = clearTimeout(workflowOrgchartAdminEmployeeInfoTimer);
workflowOrgchartAdminEmployeeInfoTimer = null;
}
$('employeeInfo').hide();
}
function getAreaInfoTimer(e, areaID, organizationID)
{
var div = $('areaInfo');
div.style.left = (Event.pointerX(e) + 20) + 'px';
div.style.top = (Event.pointerY(e) + 14) + 'px';
if (workflowOrgchartAdminAreaInfoTimer != null)
{
workflowOrgchartAdminAreaInfoTimer = clearTimeout(workflowOrgchartAdminAreaInfoTimer);
workflowOrgchartAdminAreaInfoTimer = null;
}
workflowOrgchartAdminAreaInfoTimer = setTimeout('getAreaInfo(' + areaID + ', ' + organizationID + ' )', 500);
}
function getAreaInfo(areaID, organizationID)
{
function resultGetAreaInfo(data)
{
if (workflowOrgchartAdminAreaInfoTimer == null)
return;
workflowOrgchartAdminAreaInfoTimer = clearTimeout(workflowOrgchartAdminAreaInfoTimer);
workflowOrgchartAdminAreaInfoTimer = null;
var content = '';
content += '';
content += '';
for (var i = 0; i < data['info'].length; i++)
content += '' + data['info'][i]['name'] + ' : ' + data['info'][i]['value'] + ' ';
content += '
';
var pageYLimit = document.body.scrollTop + document.body.clientHeight;
var div = $('areaInfo');
div.innerHTML = content;
if ((parseInt(div.style.top.replace(/px/g, '')) + div.getHeight()) > pageYLimit)
div.style.top = (parseInt(div.style.top.replace(/px/g, '')) - (div.getHeight())) + 'px';
div.show();
}
cExecute('$this.bo_orgchart.getAreaInfo', resultGetAreaInfo, 'area_id=' + areaID + '&organizacao_id=' + organizationID);
}
function hideAreaInfo()
{
if (workflowOrgchartAdminAreaInfoTimer != null)
{
workflowOrgchartAdminAreaInfoTimer = clearTimeout(workflowOrgchartAdminAreaInfoTimer);
workflowOrgchartAdminAreaInfoTimer = null;
}
$('areaInfo').hide();
}