<%args> $type => undef $id => undef $msg => undef $activities => undef % if (! defined $type) { % $type = $context->{client}->send_receive_command_msg( % 'get_workflow_type_for_id', % { % ID => $id, % }, % )->{PARAMS}; % } % if ($type eq 'I18N_OPENXPKI_WF_TYPE_SCEP_REQUEST') {

<% i18nGettext ('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SHOW_CSR_BRIEF_TITLE_SCEP', '__WORKFLOWID__' => $msg->{PARAMS}->{WORKFLOW}->{ID}, '__STATE__' => $msg->{PARAMS}->{WORKFLOW}->{STATE} ) %>

% } % elsif ($type eq 'I18N_OPENXPKI_WF_TYPE_SMARTCARD_PERSONALIZATION') {

<% i18nGettext ('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SHOW_CSR_BRIEF_TITLE_SMARTCARD', '__WORKFLOWID__' => $msg->{PARAMS}->{WORKFLOW}->{ID}, '__STATE__' => $msg->{PARAMS}->{WORKFLOW}->{STATE} ) %>

% } % else {

<% i18nGettext ('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SHOW_CSR_BRIEF_TITLE', '__WORKFLOWID__' => $msg->{PARAMS}->{WORKFLOW}->{ID}, '__STATE__' => $msg->{PARAMS}->{WORKFLOW}->{STATE} ) %>

% }

% foreach my $action (qw( % I18N_OPENXPKI_WF_ACTION_PERSIST_CSR % I18N_OPENXPKI_WF_ACTION_APPROVE_CSR % I18N_OPENXPKI_WF_ACTION_CANCEL_CSR_APPROVAL % I18N_OPENXPKI_WF_ACTION_REJECT_CSR % I18N_OPENXPKI_WF_ACTION_CHANGE_NOTBEFORE % I18N_OPENXPKI_WF_ACTION_CHANGE_NOTAFTER % )) { % my $filename = lc($action); % $filename =~ s/i18n_openxpki_wf_action_//; % if (exists $actions{i18nGettext($action)}) { % } % }
<& /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/hidden.mhtml, 'name' => 'context_hash', 'value' => $context_hash &> <& /lib/html/input.mhtml, 'type' => 'submit', 'value' => i18nGettext($action) &> <& /service/close_form.mhtml &>
% if ($creator ne '') { % } % if (scalar @tickets) { % } % if ($type ne 'I18N_OPENXPKI_WF_TYPE_SMARTCARD_PERSONALIZATION') { % } % if (scalar @sans) { % } % foreach my $key (keys %cert_info) { % # comments, etc. % if (defined $cert_info{$key} && $cert_info{$key} ne '') { % } % }
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_CREATOR') %>: <& /lib/html/a.mhtml, target => $context->{menu}->get_root()."/service/workflow/show_pending_requests.html", params => [ [ 'creator', $creator ], [ 'show_approval_buttons', 1], ], label => $creator &> % if (defined $mail) { (mail) % }
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_TICKETS') %>: % my $tickets = join(q{, }, @tickets); <% $tickets | n %>
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_LAST_UPDATE') %> <% $last_update %>
<& '/lib/field_to_i18n.mhtml', 'field' => 'cert_role' &> % if (exists $sources->{'cert_role'} && $sources->{'cert_role'} ne 'USER') { (<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_SOURCE') %>: <% $sources->{'cert_role'} %>) % } / <& '/lib/field_to_i18n.mhtml', field => 'cert_profile' &> % if (exists $sources->{'cert_role'} && $sources->{'cert_profile'} ne 'USER') { (<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_SOURCE') %>: <% $sources->{'cert_profile'} %>) % }
<% $role %> % if (exists $actions{i18nGettext('I18N_OPENXPKI_WF_ACTION_CHANGE_CSR_ROLE')}) { <& /service/open_form.mhtml, 'action' => $context->{menu}->get_root()."/service/workflow/activity/change_csr_role.html" &> <& /lib/html/hidden.mhtml, 'name' => 'type', 'value' => $type &> <& /lib/html/hidden.mhtml, 'name' => 'id', 'value' => $id &> <& /lib/html/input.mhtml, 'type' => 'submit', 'value' => i18nGettext('I18N_OPENXPKI_HTML_MASON_CHANGE') &> <& /service/close_form.mhtml &> % } / <% i18nGettext($profile) %> % if (exists $actions{i18nGettext('I18N_OPENXPKI_WF_ACTION_CHANGE_CSR_PROFILE')}) { <& /service/open_form.mhtml, 'action' => $context->{menu}->get_root()."/service/workflow/activity/change_csr_profile.html" &> <& /lib/html/hidden.mhtml, 'name' => 'type', 'value' => $type &> <& /lib/html/hidden.mhtml, 'name' => 'id', 'value' => $id &> <& /lib/html/input.mhtml, 'type' => 'submit', 'value' => i18nGettext('I18N_OPENXPKI_HTML_MASON_CHANGE') &> <& /service/close_form.mhtml &> % }
<& '/lib/field_to_i18n.mhtml', 'field' => 'cert_subject' &>
<& /lib/html/a.mhtml, target => $context->{menu}->get_root()."/service/api/cert_list.html", params => [ [ 'subject', $subject ], ], label => $breakable_subject &> % if (exists $sources->{'cert_subject_parts'} && $sources->{'cert_subject_parts'} ne 'USER') { (<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_SOURCE') %>: <% $sources->{'cert_subject_parts'} %>) % } % if (exists $actions{i18nGettext('I18N_OPENXPKI_WF_ACTION_CHANGE_CSR_SUBJECT')}) { <& /service/open_form.mhtml, 'action' => $context->{menu}->get_root()."/service/workflow/activity/change_csr_subject.html" &> <& /lib/html/hidden.mhtml, 'name' => 'type', 'value' => $type &> <& /lib/html/hidden.mhtml, 'name' => 'id', 'value' => $id &> <& /lib/html/input.mhtml, 'type' => 'submit', 'value' => i18nGettext('I18N_OPENXPKI_HTML_MASON_CHANGE') &> <& /service/close_form.mhtml &> % }
<& '/lib/field_to_i18n.mhtml', field => 'cert_subject_alt_name' &> % if ($sources->{'cert_subject_alt_name_parts'} ne 'USER') { (<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_SOURCE') %>: <% $sources->{'cert_subject_alt_name_parts'} %>) % } % if (exists $actions{i18nGettext('I18N_OPENXPKI_WF_ACTION_CHANGE_CSR_SUBJECT_ALT_NAME')}) { <& /service/open_form.mhtml, 'action' => $context->{menu}->get_root()."/service/workflow/activity/change_csr_subject_alt_name.html" &> <& /lib/html/hidden.mhtml, 'name' => 'type', 'value' => $type &> <& /lib/html/hidden.mhtml, 'name' => 'id', 'value' => $id &> <& /lib/html/input.mhtml, 'type' => 'submit', 'value' => i18nGettext('I18N_OPENXPKI_HTML_MASON_CHANGE') &> <& /service/close_form.mhtml &> % } % foreach my $san (@sans) { % if ($san->[0] =~ m{ \A DNS \z }xms) { % if (! gethostbyname($san->[1])) {
<% $san->[0] %>: <% $san->[1] %> % } % else {
<% $san->[0] %>: <% $san->[1] %> % } % } % else {
<% $san->[0] %>: <% $san->[1] %> % } % }
<& '/lib/field_to_i18n.mhtml', field => $key &> <% $cert_info{$key} %>

<& /lib/html/a.mhtml, target => $context->{menu}->get_root()."/service/workflow/show_instance.html", params => [ [ 'id', $id ], [ 'type', $type ], ], label => i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_SHOW_CSR_BRIEF_DETAILED_LINK') &>

<%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; } my $creator = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{creator}; my $mail; if ($creator =~ m{ \@ }xms) { # looks like an e-mail address, let's make it a link $mail = $creator; } my $last_update = $msg->{PARAMS}->{WORKFLOW}->{LAST_UPDATE}; $last_update =~ s{T}{ }xms; my $ser = OpenXPKI::Serialization::Simple->new(); my $sources = {}; my $sources_ser = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{sources}; if (defined $sources_ser && $sources_ser ne '') { $sources = $ser->deserialize($sources_ser); } my $subject = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{cert_subject}; if ($type eq 'I18N_OPENXPKI_WF_TYPE_SMARTCARD_PERSONALIZATION') { # Smartcard personalization workflow context has different structure my $cert_iss_data = OpenXPKI::Serialization::Simple->new()->deserialize($msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{cert_issuance_data}); my @subjects = map { $_->{'cert_subject'} } @{ $cert_iss_data }; $subject = join q{
}, @subjects; } my $breakable_subject = $subject; $breakable_subject =~ s{,}{, }xmsg; my @sans; my $san_ser = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{cert_subject_alt_name}; if (defined $san_ser && $san_ser ne '') { my $san_ref = $ser->deserialize($san_ser); if (ref $san_ref eq 'ARRAY') { @sans = @{ $san_ref }; } } my $role = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{cert_role}; my $profile = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{cert_profile}; my @tickets = (); my $ticket_ser = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{ticket}; if (defined $ticket_ser) { my $tickets = $ser->deserialize($ticket_ser); foreach my $key (keys %{ $tickets }) { my $ticket_entry; $ticket_entry->{ID} = $tickets->{$key}; my $url_msg = $context->{client}->send_receive_command_msg( 'get_url_for_ticket', { NOTIFIER => $key, TICKET => $tickets->{$key}, }, ); $ticket_entry->{URL} = $url_msg->{PARAMS}; push @tickets, qq{$tickets->{$key}}; } } my %cert_info; my $cert_info_ser = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{cert_info}; if (defined $cert_info_ser) { my $cert_info_deser = $ser->deserialize($cert_info_ser); if (ref $cert_info_deser eq 'HASH') { %cert_info = %{ $cert_info_deser }; } } my $context_hash = $m->comp('/service/workflow/context_hash.mhtml', 'context' => $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}, );