%args>
$type => undef
$context_key => undef
$context_value => undef
$notitle => undef
$certificate_link => undef
$limit => 20
$start => 1
$page => undef
%args>
<%init>
my @search_context;
if (defined $context_key && defined $context_value) {
if (! ref $context_key) {
$context_key = [ $context_key ];
}
if (! ref $context_value) {
$context_value = [ $context_value ];
}
for (my $i = 0; $i < scalar @{$context_key}; $i++) {
$context_value->[$i] =~ s/\*/%/g;
if ($context_key->[$i] ne '') {
push @search_context, {
KEY => $context_key->[$i],
VALUE => $context_value->[$i],
};
}
}
}
%init>
% my $msg;
% my $nr_of_results;
% if (scalar @search_context > 0 || exists $m->request_args()->{'__submit'}) {
% my $params = {
% 'CONTEXT' => \@search_context,
% };
% if ($type) {
% $params->{TYPE} = $type,
% }
% $nr_of_results = $context->{client}->send_receive_command_msg(
% 'search_workflow_instances_count',
% $params,
% )->{PARAMS};
% $params->{LIMIT} = $limit,
% my $page_info = $m->comp('/lib/paging.mhtml',
% totalEntries => $nr_of_results,
% entriesPerPage => $limit,
% page => $page,
% start => $start,
% url => $context->{menu}->get_root() . '/service/workflow/search_instances.html',
% additional_params => {
% 'context_key' => $context_key,
% 'context_value' => $context_value,
% }
% );
% if (defined $page_info) {
% $params->{START} = $page_info->first - 1;
% }
% if ($params->{START} == -1) {
% $params->{START} = 1;
% }
% $msg = $context->{client}->send_receive_command_msg
% (
% "search_workflow_instances",
% $params,
% );
% }
% if ($nr_of_results > 0) { # SEARCH RESULT
% if (! $notitle) {
<% i18nGettext ('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_RESULT_TITLE') %>
% }
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_TYPE') %> |
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SERIAL') %> |
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_STATE') %> |
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_LAST_UPDATE') %> |
% foreach my $instance (@{$msg->{PARAMS}}) # @{$msg->{PARAMS}})
% {
<% i18nGettext($instance->{'WORKFLOW.WORKFLOW_TYPE'}) %> |
<% $instance->{'WORKFLOW.WORKFLOW_SERIAL'} %> |
<% i18nGettext($instance->{'WORKFLOW.WORKFLOW_STATE'}) %>
% if ($certificate_link && $instance->{'WORKFLOW.WORKFLOW_TYPE'} eq 'I18N_OPENXPKI_WF_TYPE_CERTIFICATE_SIGNING_REQUEST' && ($instance->{'WORKFLOW.WORKFLOW_STATE'} eq 'SUCCESS' || $instance->{'WORKFLOW.WORKFLOW_STATE'} eq 'CHECK_CHILD_FINISHED')) {
% # we have a CSR workflow with a potential certificate
<& '/service/workflow/link_to_cert_by_csr_id.mhtml',
id => $instance->{'WORKFLOW.WORKFLOW_SERIAL'},
label => '(' . i18nGettext('I18N_OPENXPKI_HTML_MASON_DOWNLOAD_CERTIFICATE') . ')',
&>
% }
|
<% $instance->{'WORKFLOW.WORKFLOW_LAST_UPDATE'} %> |
% } # END FOREACH
% } # END IF
% elsif (! defined $nr_of_results) { # SEARCH FORM
% #### TODO: get all possible context keys (for type) from DB
<% i18nGettext ('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_FORM_TITLE') %>
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_FORM_DESCRIPTION') %>
<& /service/open_form.mhtml &>
% my $msg = $context->{client}->send_receive_command_msg ("list_workflow_titles");
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_WORKFLOW_TYPE') %>
|
|
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_FORM_KEY') %> |
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_FORM_VALUE') %> |
% if (!defined $type) {
% $type = '';
% }
% my $keys_msg = $context->{client}->send_receive_command_msg
% (
% "list_context_keys",
% {
% 'WORKFLOW_TYPE' => $type
% },
% );
|
<& /lib/html/input.mhtml, 'name' => "context_value" &> |
|
<& /lib/html/input.mhtml, 'name' => "context_value" &> |
|
<& /lib/html/input.mhtml, 'name' => "context_value" &> |
|
<& /lib/html/input.mhtml, 'name' => "context_value" &> |
|
<& /service/send_form.mhtml &>
<& /service/close_form.mhtml &>
% }