activityStatusTranslation = new Array(); activityStatusTranslation['running'] = 'Em execução'; activityStatusTranslation['completed'] = 'Completada'; instanceStatusTranslation = new Array(); instanceStatusTranslation['completed'] = 'Completada'; instanceStatusTranslation['active'] = 'Ativa'; instanceStatusTranslation['aborted'] = 'Abortada'; instanceStatusTranslation['exception'] = 'Em exceção'; workflowInboxPriority = new Array(); workflowInboxPriority[0] = ' '; workflowInboxPriority[1] = ' '; workflowInboxPriority[2] = ' '; workflowInboxPriority[3] = ' '; workflowInboxPriority[4] = ' '; var workflowCommonExpressoIndexPath = null; /* abre uma nova aba para mostrar os dados da instancia */ function drawViewInstance(data) { var borderID = create_border("Visualizar Instância"); var content = '
'; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += '
Instância de ' + data['wf_procname'] + '(v' + data['wf_version'] + ')
Criado emFinalizado emPrioridadeSituaçãoProprietário
' + data['wf_started'] + '' + data['wf_ended'] + '' + data['wf_priority'] + '' + instanceStatusTranslation[data['wf_status']] + '' + data['wf_owner'] + '
'; content += '
'; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; var current; var workitemCount = data['wf_workitems'].length; for (var i = 0; i < workitemCount; i++) { current = data['wf_workitems'][i]; content += ''; content += ''; content += ''; content += ''; content += ''; } content += '
Histórico
AtividadeIniciado emDuraçãoUsuário
' + activity_icon(current['wf_type'], current['wf_is_interactive']) + " " + current['wf_name']; content += '' + current['wf_started'] + '' + current['wf_duration'] + '' + current['wf_user'] + '
'; if ((data['wf_status'] == 'active') || (data['wf_status'] == 'exception')) { content += '
'; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; var current; var activityCount = data['wf_activities'].length; for (var i = 0; i < activityCount; i++) { current = data['wf_activities'][i]; content += ''; content += ''; content += ''; content += ''; content += ''; } content += '
Atividades em Andamento
NomeIniciado emSituaçãoUsuário
' + activity_icon(current['wf_type'], current['wf_is_interactive']) + " " + current['wf_name']; content += '' + current['wf_started'] + '' + activityStatusTranslation[current['wf_status']] + '' + ((current['wf_user']) ? current['wf_user'] : '*') + '
'; } if(data['wf_properties'] != null) { content += '
'; content += ''; content += ''; content += ''; content += ''; content += ''; content += ''; var propertiesCount = data['wf_properties']['keys'].length; for (var i = 0; i < propertiesCount; i++) { content += ''; content += ''; content += ''; content += ''; } content += '
Propriedades
NomeValor
' + data['wf_properties']['keys'][i] + '' + data['wf_properties']['values'][i] + '
'; } if (data['viewRunAction']) { var viewActivity = data['viewRunAction']; content += '
'; content += ''; content += ''; content += ''; content += ''; content += ''; content += '
Atividade View do Processo
'; } $('content_id_' + borderID).innerHTML = content; } /** * Constrói um iframe oculto para os processos que possuem sua própria atividade do tipo view * @param string preffix O prefixo usado para nomear o iframe oculto * @param int numberOfColumns A quantidade de colunas da tabela * @param int instanceID O ID da instância * @param int activityID O ID da atividade * @param int height A altura do iframe * @return string O código XHTML do iframe */ function constructHiddenView(preffix, numberOfColumns, instanceID, activityID, height) { var output = ''; output += ''; output += ''; output += ''; return output; } /** * Exibe ou oculta o iframe da atividade View * @param string preffix O prefixo usado para nomear o iframe oculto * @param int instanceID O ID da instância * @param int activityID O ID da atividade * @param int viewActivityID O ID da atividade View * @return void */ function toggleHiddenView(preffix, instanceID, activityID, viewActivityID, useHTTPS) { var tr = $(preffix + '_hiddenView_' + instanceID + '_' + activityID); var iframe = tr.childNodes[0].childNodes[0]; function openView(obj) { workflowInboxOpenedViewActivities++; if (obj.element.src == '') obj.element.src = getInstanceURL(instanceID, viewActivityID, useHTTPS); } function closeView(obj) { workflowInboxOpenedViewActivities--; if (workflowInboxOpenedViewActivities < 0) workflowInboxOpenedViewActivities = 0; tr.hide(); } if (tr.visible()) { new Effect.BlindUp(iframe, {duration: 0.2, afterFinish: closeView}); } else { tr.show(); new Effect.BlindDown(iframe, {duration: 0.2, afterFinish: openView}); } } function getInstanceURL(instanceID, activityID, useHTTPS) { if (workflowCommonExpressoIndexPath == null) { workflowCommonExpressoIndexPath = $A(document.getElementsByTagName("script")).findAll( function(s) { return (s.src && s.src.match(/\/workflow\/js\/userinterface\/common_functions\.js(\?.*)?$/)); }).first().src; /* pega só até o /workflow/ */ workflowCommonExpressoIndexPath = workflowCommonExpressoIndexPath.replace(/\/workflow\/js\/userinterface\/common_functions\.js(\?.*)?$/, ''); /* se não possuir o endereço completo, tenta montá-lo utilizando a informação da página atual (IE MAGIC) */ if (workflowCommonExpressoIndexPath.match(/^https?:\/\//) == null) workflowCommonExpressoIndexPath = location.href.substr(0, location.href.indexOf('/', location.href.indexOf('//') + 2)) + workflowCommonExpressoIndexPath; } var output = instanceURL = workflowCommonExpressoIndexPath + '/index.php?menuaction=workflow.run_activity.go&iid=' + instanceID + '&activity_id=' + activityID; if (useHTTPS == 1) output = output.replace(/http:/, 'https:'); return output; }