/* armazena os parâmetro passados para a construção da interface */ var workflowInstancesParams; /* armazena os nomes dos usuários que possuem as instâncias */ var workflowInstancesUserNames; /* armazena informações dos processos */ var workflowInstancesProcessesInfo; /* armazena os nomes das atividades */ var workflowInstancesActivityNames; /* armazena a lista de processos cujas instâncias o usuário pode acessar */ var workflowInstancesProcesses; /* array que relaciona um status a uma imagem */ var workflowInstancesStatusImages = Array(); workflowInstancesStatusImages['active'] = 'i_active.png'; workflowInstancesStatusImages['exception'] = 'i_waiting.png'; workflowInstancesStatusImages['completed'] = 'i_completed.png'; workflowInstancesStatusImages['aborted'] = 'i_aborted.png'; /* array que relaciona um status a um texto */ var workflowInstancesStatusText = Array(); workflowInstancesStatusText['active'] = 'Ativa'; workflowInstancesStatusText['exception'] = 'Exceção'; workflowInstancesStatusText['completed'] = 'Completa'; workflowInstancesStatusText['aborted'] = 'Abortada'; /** * Recebe os dados do Ajax e chama os métodos para construção da interface * @param array data Os dados retornados por Ajax * @return void */ function instances(data) { if (_checkError(data)) return; workflowInboxLightVersion = data['light']; workflowInstancesProcessesInfo = data['processesInfo']; workflowInstancesParams = data['params']; workflowInstancesActivityNames = data['activityNames']; workflowInstancesUserNames = data['userNames']; workflowInstancesProcesses = data['processes']; var information = $('workflowInstancesInformation'); if (information) information.remove(); var currentInstancesMenu = $('table_tools_instances'); var currentInstancesElements = $('table_elements_instances'); if (currentInstancesElements) currentInstancesElements.remove(); if (currentInstancesMenu) currentInstancesMenu.remove(); createInstancesMenu(data['instances'].length); if (data['instances'].length > 0) { createInstances(data['instances'], data['paging_links']); } else { var pagingContainer = $('td_tools_instances_3'); if (pagingContainer) pagingContainer.innerHTML = ''; if (workflowInstancesParams['active'] == '1') $('content_id_2').innerHTML += '
Nenhum registro ativo foi encontrado.
'; else $('content_id_2').innerHTML += 'Nenhum registro encerrado foi encontrado.
'; } } /** * Busca os dados, por Ajax, para a construção da interface * @param int p_page O número da página (quando houver paginação) que está sendo exibida * @param string sort A ordenação selecionada * @param int pid O ID do processo que se quer filtrar (ao utilizar 0 (zero), todos os processos serão exibidos * @param char active Indica se estão sendo exibidas as instâncias ativas ('1') ou inativas ('0') * @return void */ function draw_instances_folder(p_page, sort, pid, active) { var p_page = (p_page == null) ? 0 : p_page; var sort = (sort == null) ? 0 : sort; var pid = (pid == null) ? 0 : pid; var active = (active == null) ? '1' : active; var params = 'sort=' + sort + '&pid=' + pid +'&active=' + active + '&p_page=' + p_page; cExecute('$this.bo_userinterface.instances', instances, params); } /** * Cria o menu da interface * @param int count O número de instâncias listadas * @return void */ function createInstancesMenu(count) { var content = ''; content += '';
content += '
| ';
content += ''; content += ' | '; content += ''; content += ''; content += ' |
' + createInstancesSortingHeaders('Início Processo', 'wf_started') + ' | '; content += '' + createInstancesSortingHeaders('Fim do Processo', 'wf_ended') + ' | '; content += '' + createInstancesSortingHeaders('Processo', 'wf_procname') + ' | '; content += '' + createInstancesSortingHeaders('Identificador', 'insname') + ' | '; content += 'Situação | '; content += 'Ações | '; } if (workflowInstancesParams['active'] == '1') { content += '' + createInstancesSortingHeaders('Início da Atividade', 'wf_act_started') + ' | '; content += '' + createInstancesSortingHeaders('Processo', 'wf_procname') + ' | '; content += '' + createInstancesSortingHeaders('Identificador', 'insname') + ' | '; content += '' + createInstancesSortingHeaders('Atividade', 'wf_name') + ' | '; content += 'Situação | '; content += 'Atribuído a | '; content += 'Ações | '; } content += '||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
' + current['wf_started'] + ' | '; content += '' + current['wf_ended'] + ' | '; if (current['viewRunAction']) content += ''; else content += ' | '; content += ((workflowInboxLightVersion) ? workflowInboxPriority[current['wf_priority']] : (' ')); content += workflowInstancesProcessesInfo[current['wf_p_id']]['name'] + ' | '; content += '' + current['insname'] + ' | '; content += '' + ((workflowInboxLightVersion) ? workflowInstancesStatusText[current['wf_status']] : '') + ' | '; content += '' + ((workflowInboxLightVersion) ? 'Visualizar' : '') + ''; } if (workflowInstancesParams['active'] == '1') { content += ' | ' + current['wf_act_started'] + ' | '; if (current['viewRunAction']) content += '' + workflowInstancesProcessesInfo[current['wf_p_id']]['name'] + ' | '; else content += '' + workflowInstancesProcessesInfo[current['wf_p_id']]['name'] + ' | '; content += '' + current['insname'] + ' | '; content += '' + ((workflowInboxLightVersion) ? workflowInboxPriority[current['wf_priority']] : (' ')); content += workflowInstancesActivityNames[current['wf_activity_id']] + ' | '; content += '' + ((workflowInboxLightVersion) ? workflowInstancesStatusText[current['wf_status']] : '') + ' | '; content += '' + workflowInstancesUserNames[current['wf_user']] + ' | '; content += '' + ((workflowInboxLightVersion) ? 'Visualizar' : '') + ''; } content += ' |