4 $context_value =
> undef
6 $certificate_link =
> undef
10 $show_custom_columns =
> undef
15 if (defined $context_key
&& defined $context_value
) {
16 if (! ref $context_key
) {
17 $context_key
= [ $context_key
];
19 if (! ref $context_value
) {
20 $context_value
= [ $context_value
];
22 for (my $i
= 0; $i
< scalar @
{$context_key
}; $i
++) {
23 $context_value
->[$i
] =~ s
/\*/
%/g
;
25 if ($context_key
->[$i
] ne
'') {
26 push
@search_context, {
27 KEY
=> $context_key
->[$i
],
28 VALUE
=> $context_value
->[$i
],
36 % if (scalar
@search_context > 0 || exists $m
->request_args()->{'__submit'}) {
38 % 'CONTEXT' => \
@search_context,
41 % $params
->{TYPE
} = $type
,
43 % $nr_of_results
= $context
->{client
}->send_receive_command_msg(
44 % 'search_workflow_instances_count',
47 % $params
->{LIMIT
} = $limit
,
48 % my $page_info
= $m
->comp('/lib/paging.mhtml',
49 % totalEntries
=> $nr_of_results
,
50 % entriesPerPage
=> $limit
,
53 % url
=> $context
->{menu
}->get_root() . '/service/workflow/search_instances.html',
54 % additional_params
=> {
55 % 'context_key' => $context_key
,
56 % 'context_value' => $context_value
,
59 % if (defined $page_info
) {
60 % $params
->{START
} = $page_info
->first
- 1;
62 % if ($params
->{START
} == -1) {
63 % $params
->{START
} = 1;
65 % $msg
= $context
->{client
}->send_receive_command_msg
67 % "search_workflow_instances",
71 % if (defined $nr_of_results
) { # SEARCH RESULT
73 <h1
><% i18nGettext ('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_RESULT_TITLE') %></h1>
75 % if ($nr_of_results <=
0) { # NO INSTANCES
76 <p><%
i18nGettext ('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_NO_RESULTS') %></p>
77 % } else { # INSTANCES FOUND
80 <th><%
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_TYPE') %></th>
81 <th><%
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SERIAL') %></th>
82 <th><%
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_STATE') %></th>
83 <th><%
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_LAST_UPDATE') %></th>
85 % # add custom columns
86 % foreach my $custom_column ( @custom_columns ) {
88 % # map field to i18n identifier
89 <th><% $m
->comp('/lib/field_to_i18n.mhtml', 'field' => $custom_column
) %></th>
94 % foreach my $instance (@{$msg-
>{PARAMS}}) # @{$msg-
>{PARAMS}})
97 <td><%
i18nGettext($instance
->{'WORKFLOW.WORKFLOW_TYPE'}) %></td>
98 <td><a href=
"<% $context->{menu}->get_root() %>/service/workflow/show_instance.html?type=<% $instance->{'WORKFLOW.WORKFLOW_TYPE'} %>;id=<% $instance->{'WORKFLOW.WORKFLOW_SERIAL'} %>;<% $context->{menu}->get_link_params() %>"><% $instance
->{'WORKFLOW.WORKFLOW_SERIAL'} %></a></td>
99 <td><%
i18nGettext($instance
->{'WORKFLOW.WORKFLOW_STATE'}) %>
100 % 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')) {
101 % # we have a CSR workflow with a potential certificate
102 <& '/service/workflow/link_to_cert_by_csr_id.mhtml',
103 id =
> $instance-
>{'WORKFLOW.WORKFLOW_SERIAL'},
104 label =
> '(' . i18nGettext('I18N_OPENXPKI_HTML_MASON_DOWNLOAD_CERTIFICATE') . ')',
108 <td><% $instance
->{'WORKFLOW.WORKFLOW_LAST_UPDATE'} %></td>
110 % # fill custom columns
111 % foreach my $custom_column ( @custom_columns ) {
112 % my $workflow_info = $context-
>{client}-
>send_receive_command_msg('get_workflow_info', { ID =
> $instance-
>{'WORKFLOW.WORKFLOW_SERIAL'} } );
114 % # fetch the data to be displayed in the custom column
115 % my $custom_column_data = $workflow_info-
>{PARAMS}-
>{WORKFLOW}-
>{CONTEXT}-
>{$custom_column};
117 <td><% $m
->comp('/lib/display_field.mhtml', 'field' => $custom_column_data
) %></td>
124 % } # END IF INSTANCES FOUND
125 % } # END IF SEARCH RESULTS
126 % else { # SEARCH FORM
127 % #### TODO: get all possible context keys (for type) from DB
128 <h1><%
i18nGettext ('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_FORM_TITLE') %></h1>
130 <%
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_FORM_DESCRIPTION') %>
132 <& /service/open_form.mhtml &
>
133 % my $msg = $context-
>{client}-
>send_receive_command_msg (
"list_workflow_titles");
135 <!-- TODO: input field for types -->
138 <%
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_WORKFLOW_TYPE') %>
141 <script type=
"text/javascript">
143 function reloadType(type
) {
144 search
= window
.location
.search
;
145 s_no_type
= search
.replace(/;type=.*$/, "");
146 window
.location
.search
=s_no_type
+ ";type=" + type
;
150 <select name=
"type" onchange=
"reloadType(this.value)">
151 <option value=
""><%
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_WORKFLOW_TYPE_ANY') %></option>
152 % foreach my $a_type (keys %{$msg-
>{PARAMS}}) {
153 % if ($a_type eq $type) {
154 <option value=
"<% $a_type %>" selected
><% i18nGettext($a_type
) %></option>
157 <option value=
"<% $a_type %>"><% i18nGettext($a_type
) %></option>
166 <th><%
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_FORM_KEY') %></th>
167 <th><%
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_FORM_VALUE') %></th>
170 % if (!defined $type) {
173 % my $keys_msg = $context-
>{client}-
>send_receive_command_msg
175 %
"list_context_keys",
177 % 'WORKFLOW_TYPE' =
> $type
181 <select name=
"context_key">
182 <option value=
""></option>
183 % my @i18n_keys = ();
184 % # create array of [ translated context key, I18N_KEY ]
185 % if (exists $keys_msg-
>{PARAMS}) {
186 % foreach my $key (@{$keys_msg-
>{PARAMS}}) {
187 % push @i18n_keys, [ $m-
>scomp('/lib/field_to_i18n.mhtml',
192 % # output sorted by translated keys
193 % foreach my $key (sort {lc($a-
>[
0]) cmp lc($b-
>[
0])} @i18n_keys) {
194 <option value=
"<% $key->[1] %>"><% $key
->[0] %></option>
198 <td><& /lib/html/input.mhtml, 'name' =
> "context_value" &
></td>
202 <select name=
"context_key">
203 <option value=
""></option>
204 % foreach my $key (sort {lc($a-
>[
0]) cmp lc($b-
>[
0])} @i18n_keys) {
205 <option value=
"<% $key->[1] %>"><% $key
->[0] %></option>
209 <td><& /lib/html/input.mhtml, 'name' =
> "context_value" &
></td>
213 <select name=
"context_key">
214 <option value=
""></option>
215 % foreach my $key (sort {lc($a-
>[
0]) cmp lc($b-
>[
0])} @i18n_keys) {
216 <option value=
"<% $key->[1] %>"><% $key
->[0] %></option>
220 <td><& /lib/html/input.mhtml, 'name' =
> "context_value" &
></td>
224 <select name=
"context_key">
225 <option value=
""></option>
226 % foreach my $key (sort {lc($a-
>[
0]) cmp lc($b-
>[
0])} @i18n_keys) {
227 <option value=
"<% $key->[1] %>"><% $key
->[0] %></option>
231 <td><& /lib/html/input.mhtml, 'name' =
> "context_value" &
></td>
236 % if (not $show_custom_columns) {
237 <p><a href=
"<% $context->{menu}->get_root() %>/service/workflow/search_instances.html?<% $context->{menu}->get_link_params() %>;type=<% $type %>;id=<% $msg->{PARAMS}->{WORKFLOW}->{ID} %>;show_custom_columns=1"><% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_SHOW_CUSTOM_RESULT_COLUMNS') %></a></p>
239 % else { # SHOW CUSTOM COLUMNS
244 <%
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SEARCH_INSTANCES_CUSTOM_RESULT_COLUMNS') %>
249 <select name=
"custom_columns" multiple=
"multiple">
251 % my @result_column_choices;
252 % foreach my $key (@{$keys_msg-
>{PARAMS}}) {
253 % push @result_column_choices, [ $m-
>scomp('/lib/field_to_i18n.mhtml', 'field' =
> $key), $key ];
256 % foreach my $key (sort {lc($a-
>[
0]) cmp lc($b-
>[
0])} @result_column_choices) {
257 <option value=
"<% $key->[1] %>"><% $key
->[0] %></option>
265 % } # END IF SHOW CUSTOM COLUMNS
267 <& /service/send_form.mhtml &
>
268 <& /service/close_form.mhtml &
>
269 % } # END IF SEARCH FORM