%args> $type => undef $id => undef $filled => undef $signature => undef $text => undef $context_hash => undef %args> <& /service/open_form.mhtml, action => 'approve_csr.html' &> <& /lib/html/hidden.mhtml, 'name' => 'type', 'value' => $type &> <& /lib/html/hidden.mhtml, 'name' => 'id', 'value' => $id &> <& /lib/html/hidden.mhtml, 'name' => 'filled', 'value' => '1' &> <& /lib/html/hidden.mhtml, 'name' => 'signature', 'value' => '' &> <& /lib/html/hidden.mhtml, 'name' => 'text', value => $to_be_signed &> <& /lib/html/hidden.mhtml, 'name' => 'context_hash', value => $context_hash &> <& /lib/javascript.mhtml &>
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_ACTIVITY_APPROVE_CSR_DESCRIPTION') %>
<& /service/close_form.mhtml &> <& /service/create_csr/print_errors.mhtml, 'errors' => \@errors &> <%init> my @errors = (); my $to_be_signed; if ($filled) { ## approve the CSR my $params = {}; if (defined $signature && $signature ne '') { $params->{'_signature'} = $signature; $params->{'_signature_text'} = $text; } if ($context_hash) { $params->{'_check_hash'} = $context_hash; } my $msg = $context->{client}->send_receive_command_msg ( "execute_workflow_activity", { WORKFLOW => $type, ID => $id, ACTIVITY => "I18N_OPENXPKI_WF_ACTION_APPROVE_CSR", PARAMS => $params, } ); if (exists $msg->{SERVICE_MSG} and $msg->{SERVICE_MSG} eq "ERROR") { @errors = $m->comp ('/lib/get_deep_error.mhtml', 'msg' => $msg); } else { # if available, try to persist the CSR now $msg = $context->{client}->send_receive_command_msg( 'get_workflow_activities', { WORKFLOW => $type, ID => $id, }, ); if (grep { $_ eq 'I18N_OPENXPKI_WF_ACTION_PERSIST_CSR' } @{ $msg->{PARAMS} }) { $msg = $context->{client}->send_receive_command_msg( 'execute_workflow_activity', { WORKFLOW => $type, ID => $id, ACTIVITY => "I18N_OPENXPKI_WF_ACTION_PERSIST_CSR", } ); } if (exists $msg->{SERVICE_MSG} and $msg->{SERVICE_MSG} eq "ERROR") { @errors = $m->comp ('/lib/get_deep_error.mhtml', 'msg' => $msg); } return $m->comp ('/service/workflow/show_instance.html', 'msg' => $msg, 'type' => $type, 'id' => $id); } } # get translated approval message from server my $lang = 'en_GB'; if (defined $session_cache{$context->{'session_id'}}->{language}) { $lang = $session_cache{$context->{'session_id'}}->{language}; } my $sig_msg = $context->{client}->send_receive_command_msg( 'get_approval_message', { TYPE => 'CSR', WORKFLOW => $type, ID => $id, LANG => $lang, } ); if (exists $sig_msg->{SERVICE_MSG} && $sig_msg->{SERVICE_MSG} eq "ERROR") { @errors = $m->comp ('/lib/get_deep_error.mhtml', 'sig_msg' => $sig_msg); } $to_be_signed = $sig_msg->{PARAMS}; ## ok, we have to ask the user %init>