<%args>
    $type => undef
</%args>
<h1><% i18nGettext ('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_LIST_INSTANCES_TITLE') %></h1>
<p>
  <% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_LIST_INSTANCES_DESCRIPTION') %>
</p>
%   my $msg = $context->{client}->send_receive_command_msg
%             (
%                 "list_workflow_instances",
%#                 {"type" => $type}
%# type is not a valid parameter for list_workflow_instances
%             );
%   ## I expect the following:
%   ## SERVICE_MSG => "COMMAND",
%   ## COMMAND     => $cmd,
%   ## PARAMS      => [ {
%   ##                   'WORKFLOW_STATE'       => $state,
%   ##                   'WORKFLOW_TYPE'        => $type,
%   ##                   'WORKFLOW_SERIAL'      => $serial,
%   ##                   'WORKFLOW_LAST_UPDATE' => $date,
%   ##                   'PKI_REALM'            => $pki_realm
%   ##                  } ]*
<table>
  <tr>
    <th><% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_TYPE') %></th>
    <th><% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SERIAL') %></th>
    <th><% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_STATE') %></th>
    <th><% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_LAST_UPDATE') %></th>
<!-- The PKI_REALM is always the one we are logged in to (should probably
     be displayed somewhere globally)!
    <th><% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_PKI_REALM') %></th>
-->
  </tr>
% foreach my $instance (@{$msg->{PARAMS}})
% {
  <tr>
    <td><% i18nGettext($instance->{'WORKFLOW_TYPE'}) %></td>
    <td><a href="show_instance.html?type=<% $instance->{'WORKFLOW_TYPE'} %>;id=<% $instance->{'WORKFLOW_SERIAL'} %>;<% $context->{menu}->get_link_params() %>"><% $instance->{'WORKFLOW_SERIAL'} %></a></td>
    <td><% i18nGettext($instance->{'WORKFLOW_STATE'}) %></td>
    <td><% $instance->{'WORKFLOW_LAST_UPDATE'} %></td>
<!--    <td><% i18nGettext ($instance->{'PKI_REALM'}) %></td> -->
  </tr>
% }
</table>
