/* retorno do Ajax para listagem de processos */
function processList(data)
{
if (handleError(data))
{
var divProcess = document.getElementById("divProcess");
divProcess.innerHTML = '';
if (data['data'].length == 0)
{
var parag = document.createElement("P");
parag.className = "text_dsp";
parag.innerHTML = "Não existem processos";
divProcess.appendChild(parag);
}
else
{
permissions = data['permissions'];
drawProcessesList(data);
}
}
}
/* chama o método Ajax que lista os processos */
function listProcesses()
{
cExecute("$this.bo_monitors.listProcesses", processList);
}
/* desenha os processos na interface */
function drawProcessesList(data)
{
var processes = data['data'];
var divProcess = document.getElementById("divProcess");
var tableHeader = new Array();
var tableAtributes = new Array();
var content = '
';
content += '
ID
Nome
';
var processCount = processes.length;
for (var i = 0; i < processCount; i++)
{
content += '
';
divProcess.innerHTML = content;
}
/* desenha as opções do processo */
function drawProcessOptions(pid)
{
$("divInstance").innerHTML = '';
/* marca o processo selecionado */
var tr = document.getElementById('p_' + pid);
var table = tr.parentNode;
var newClass;
$A(table.childNodes).each(function(row)
{
Element.extend(row).removeClassName('selected')
});
Element.extend(tr).addClassName('selected');
/* constrói a tabela de ações */
var content = '
';
$('divOptions').innerHTML = content;
}
function clickReplaceUser(link, pid)
{
function resultClickReplaceUser(data)
{
$('MonitorLoading').remove();
var divInstance = $('divInstance');
if (handleError(data))
{
var users = data['users'];
if (users.length > 0)
{
var content = '
';
var params = 'pid=' + pid;
cExecute("$this.bo_monitors.getUsersInInstances", resultClickReplaceUser, params);
}
function clickLoadActivities(pid)
{
function resultClickLoadActivities(data)
{
$('MonitorLoading').remove();
var tdActivities = $('tdActivities');
if (handleError(data))
{
var activities = data['activities'];
if (activities.length > 0)
{
var content = '
';
cExecute("$this.bo_monitors.replaceUser", resultClickReplaceUserAction, params);
}
function clickShowStatistics(link, pid)
{
function resultShowStatistics(data)
{
killElement('loading_image_statistics');
var divInstance = $('divInstance');
if (handleError(data))
{
if (data.length > 0)
{
var content = '
Estatísticas
';
content += '
';
for (var i = 0; i < data.length; i++)
content += '