% foreach my $param (sort keys %{$msg->{PARAMS}->{WORKFLOW}->{CONTEXT}})
% {
% next if ($param eq "approvals" and length $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{$param} == 0);
% next if ($param eq "cert_profile_id");
% next if ($param =~ m{ \A _ }xms); # ignore "volatile" context parameters
% my $value = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{$param};
% # someone is interpreting UTF8 data here, re-encode ...
% # FIXME - find out why this is actually happening so that we
% # can eliminate the source
% $value = encode('UTF-8', $value);
% if ($value =~ /^(ARRAY|HASH|-----BEGIN)/)
% {
% ## serialized stuff
% my $ser = OpenXPKI::Serialization::Simple->new();
% my $ref = $ser->deserialize($value);
<%once>
use Encode qw(encode decode);
%once>
<%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;
}
%init>