<%args> $type => undef $id => undef $msg => undef $activities => undef

<% i18nGettext ('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SHOW_INSTANCE_TITLE') %>

<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SHOW_INSTANCE_DESCRIPTION') %>

% ## I expect the following: % ## SERVICE_MSG => "COMMAND", % ## COMMAND => $cmd, % ## PARAMS => % ## { % ## WORKFLOW => % ## { % ## ID => $id, % ## STATE => $state, % ## CONTEXT => { ... a simple hash ... } % ## } % ## } % foreach my $param (sort keys %{$msg->{PARAMS}->{WORKFLOW}->{CONTEXT}}) % { % next if ($param eq "approvals" and length $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{$param} == 0); % next if ($param eq "cert_profile_id"); % next if ($param =~ m{ \A _ }xms); # ignore "volatile" context parameters % }
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_TABLE_HEAD_NAME') %> <% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_TABLE_HEAD_VALUE') %>
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SERIAL') %> <% $msg->{PARAMS}->{WORKFLOW}->{ID} %>
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_STATE') %> <% i18nGettext($msg->{PARAMS}->{WORKFLOW}->{STATE}) %>
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_TYPE') %> <% i18nGettext($msg->{PARAMS}->{WORKFLOW}->{TYPE}) %>
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_DESCRIPTION') %> <% i18nGettext($msg->{PARAMS}->{WORKFLOW}->{DESCRIPTION}) %>
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_LAST_UPDATE') %> <% $msg->{PARAMS}->{WORKFLOW}->{LAST_UPDATE} %>
% $m->comp('/lib/field_to_i18n.mhtml', % 'field' => $param); % my $value = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{$param}; % # someone is interpreting UTF8 data here, re-encode ... % # FIXME - find out why this is actually happening so that we % # can eliminate the source % $value = encode('UTF-8', $value); % if ($value =~ /^(ARRAY|HASH|-----BEGIN)/) % { % ## serialized stuff % my $ser = OpenXPKI::Serialization::Simple->new(); % my $ref = $ser->deserialize($value);
%      if ($param eq "cert_info")
%      {
%          ## simple hash
%          foreach my $key (sort keys %{$ref})
%          {
<% $key %>::=<% $ref->{$key} %>
%          }
%      }
%      elsif ($param eq 'ticket') {
    % foreach my $key (sort keys %{$ref}) { % my $url_msg = $context->{client}->send_receive_command_msg( % "get_url_for_ticket", % { % "NOTIFIER" => $key, % "TICKET" => $ref->{$key} % }, % ); % my $url = $url_msg->{PARAMS};
  • <% i18nGettext($key) %>: <% i18nGettext($ref->{$key}) %> % }
% } % elsif ($param eq "cert_subject_alt_name") % { % ## array of arrays % foreach my $pair (@{$ref}) % { % next if (not $pair); ## empty array <% $pair->[0] %>::=<% $pair->[1] %> % } % } % elsif ($param eq "approvals") % { % if (ref $ref eq 'HASH') { # old style % ## hash: user to role % foreach my $user (sort keys %{$ref}) % { % next if (not defined $user); ## empty hash - !??? <% $user %>→<% $ref->{$user} %> % } % } % elsif (ref $ref eq 'ARRAY') { # new style for signatures % foreach my $approval (@{$ref}) { % if (defined $approval->{signature}) { <% i18nGettext('I18N_OPENXPKI_SIGNED_APPROVAL') %>: <% $approval->{signer_subject} %>→<% $approval->{signer_role} %> <% i18nGettext('I18N_OPENXPKI_SIGNER_CERTIFICATE_IDENTIFIER') %>: <% $approval->{signer_identifier} %> <% i18nGettext('I18N_OPENXPKI_SIGNED_TEXT') %>: <% $approval->{plaintext} %> <% i18nGettext('I18N_OPENXPKI_SIGNATURE') %>: <% $approval->{signature} %> % } <% $approval->{session_user} %>→<% $approval->{session_role} %> ================================================================ % } % } % } % else % { <% $value %> % }
% } elsif ($param eq "spkac") { % for (my $i = int(length ($value) / 64); $i > 0; $i--) % { % $value = substr ($value, 0, $i*64)."\n".substr($value,$i*64); % }
<% $value %>
% } else { <% i18nGettext($value) %> % }

<% i18nGettext ('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SHOW_INSTANCE_ACTIVITIES') %>

% foreach my $action (sort keys %actions) % { % my $filename = lc($actions{$action}); % $filename =~ s/i18n_openxpki_wf_[^_]*_//;
<& /service/open_form.mhtml, 'action' => $context->{menu}->get_root()."/service/workflow/activity/$filename.html" &> <& /lib/html/hidden.mhtml, 'name' => 'type', 'value' => $type &> <& /lib/html/hidden.mhtml, 'name' => 'id', 'value' => $id &> <& /lib/html/input.mhtml, 'type' => 'submit', 'value' => $action &> <& /service/close_form.mhtml &>
% }
<& /service/open_form.mhtml, 'action' => $context->{menu}->get_root()."/service/workflow/get_workflow_instance_info.html" &> <& /lib/html/hidden.mhtml, 'name' => 'id', 'value' => $id &> <& /lib/html/hidden.mhtml, 'name' => 'format', 'value' => 'png' &> <& /lib/html/input.mhtml, 'type' => 'submit', 'value' => i18nGettext ('I18N_OPENXPKI_HTML_GET_WORKFLOW_INSTANCE_INFO') &> <& /service/close_form.mhtml &>
<%once> use Encode qw(encode decode); <%init> if (not defined $msg or not ref $msg or not ref $msg eq "HASH") { if (! defined $type) { # type was not specified, get it from the server my $type_msg = $context->{client}->send_receive_command_msg( 'get_workflow_type_for_id', { 'ID' => $id, }, ); $type = $type_msg->{PARAMS}; } ## ok we have to get the info from the server $msg = $context->{client}->send_receive_command_msg ( "get_workflow_info", { "WORKFLOW" => $type, "ID" => $id } ); } else { ## sometimes we have only the message $id = $msg->{PARAMS}->{WORKFLOW}->{ID} if (not defined $id); $type = $msg->{PARAMS}->{WORKFLOW}->{TYPE} if (not defined $type); } if (not defined $activities) { ## ok we have to get the info from the server ## FIXME: this fails if type and id are undefined, id can ## be extracted from $msg, but what about type? my $hmsg = $context->{client}->send_receive_command_msg ( "get_workflow_activities", { "WORKFLOW" => $type, "ID" => $id } ); $activities = $hmsg->{PARAMS}; } my %actions = (); foreach my $key (@{$activities}) { ## I hope that nobody will translate two actions with the same string $actions{i18nGettext($key)} = $key; }