7 % if (! defined $type) {
8 % $type = $context-
>{client}-
>send_receive_command_msg(
9 % 'get_workflow_type_for_id',
15 % if ($type eq 'I18N_OPENXPKI_WF_TYPE_SCEP_REQUEST') {
16 <h1><%
i18nGettext ('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SHOW_CSR_BRIEF_TITLE_SCEP', '__WORKFLOWID__' => $msg
->{PARAMS
}->{WORKFLOW
}->{ID
}, '__STATE__' => $msg
->{PARAMS
}->{WORKFLOW
}->{STATE
} ) %></h1>
18 % elsif ($type eq 'I18N_OPENXPKI_WF_TYPE_SMARTCARD_PERSONALIZATION') {
19 <h1><%
i18nGettext ('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SHOW_CSR_BRIEF_TITLE_SMARTCARD', '__WORKFLOWID__' => $msg
->{PARAMS
}->{WORKFLOW
}->{ID
}, '__STATE__' => $msg
->{PARAMS
}->{WORKFLOW
}->{STATE
} ) %></h1>
22 <h1><%
i18nGettext ('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_SHOW_CSR_BRIEF_TITLE', '__WORKFLOWID__' => $msg
->{PARAMS
}->{WORKFLOW
}->{ID
}, '__STATE__' => $msg
->{PARAMS
}->{WORKFLOW
}->{STATE
} ) %></h1>
28 % foreach my $action (qw(
29 % I18N_OPENXPKI_WF_ACTION_PERSIST_CSR
30 % I18N_OPENXPKI_WF_ACTION_APPROVE_CSR
31 % I18N_OPENXPKI_WF_ACTION_CANCEL_CSR_APPROVAL
32 % I18N_OPENXPKI_WF_ACTION_REJECT_CSR
33 % I18N_OPENXPKI_WF_ACTION_CHANGE_NOTBEFORE
34 % I18N_OPENXPKI_WF_ACTION_CHANGE_NOTAFTER
36 % my $filename = lc($action);
37 % $filename =~ s/i18n_openxpki_wf_action_//;
38 % if (exists $actions{i18nGettext($action)}) {
40 <& /service/open_form.mhtml, 'action' =
> $context-
>{menu}-
>get_root().
"/service/workflow/activity/$filename.html" &
>
41 <& /lib/html/hidden.mhtml, 'name' =
> 'type', 'value' =
> $type &
>
42 <& /lib/html/hidden.mhtml, 'name' =
> 'id', 'value' =
> $id &
>
43 <& /lib/html/hidden.mhtml, 'name' =
> 'context_hash', 'value' =
> $context_hash &
>
44 <& /lib/html/input.mhtml, 'type' =
> 'submit', 'value' =
> i18nGettext($action) &
>
45 <& /service/close_form.mhtml &
>
52 % if ($creator ne '') {
54 <td><%
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_CREATOR') %>:
</td>
57 target =
> $context-
>{menu}-
>get_root().
"/service/workflow/show_pending_requests.html",
59 [ 'creator', $creator ],
60 [ 'show_approval_buttons',
1],
63 % if (defined $mail) {
64 (
<a href=
"mailto:<% $mail %>">mail
</a
>)
69 <!-- TODO
- add
type (basic
, PKCS#
10, SPKAC
, IE
) -->
71 % if (scalar
@tickets) {
73 <td
><% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_TICKETS') %>:
</td>
75 % my $tickets = join(q{, }, @tickets);
81 <td><%
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_WORKFLOW_LAST_UPDATE') %></td>
82 <td><% $last_update
%></td>
84 % if ($type ne 'I18N_OPENXPKI_WF_TYPE_SMARTCARD_PERSONALIZATION') {
86 <td><& '/lib/field_to_i18n.mhtml', 'field' =
> 'cert_role' &
>
87 % if (exists $sources-
>{'cert_role'} && $sources-
>{'cert_role'} ne 'USER') {
88 (<%
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_SOURCE') %>: <% $sources-
>{'cert_role'}
%>)
90 / <& '/lib/field_to_i18n.mhtml', field =
> 'cert_profile' &
>
91 % if (exists $sources-
>{'cert_role'} && $sources-
>{'cert_profile'} ne 'USER') {
92 (<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_SOURCE') %
>: <% $sources
->{'cert_profile'} %>)
99 % if (exists $actions{i18nGettext('I18N_OPENXPKI_WF_ACTION_CHANGE_CSR_ROLE')}) {
100 <& /service/open_form.mhtml, 'action' =
> $context-
>{menu}-
>get_root().
"/service/workflow/activity/change_csr_role.html" &
>
101 <& /lib/html/hidden.mhtml, 'name' =
> 'type', 'value' =
> $type &
>
102 <& /lib/html/hidden.mhtml, 'name' =
> 'id', 'value' =
> $id &
>
103 <& /lib/html/input.mhtml, 'type' =
> 'submit', 'value' =
> i18nGettext('I18N_OPENXPKI_HTML_MASON_CHANGE') &
>
104 <& /service/close_form.mhtml &
>
107 / <%
i18nGettext($profile
) %>
109 % if (exists $actions{i18nGettext('I18N_OPENXPKI_WF_ACTION_CHANGE_CSR_PROFILE')}) {
110 <& /service/open_form.mhtml, 'action' =
> $context-
>{menu}-
>get_root().
"/service/workflow/activity/change_csr_profile.html" &
>
111 <& /lib/html/hidden.mhtml, 'name' =
> 'type', 'value' =
> $type &
>
112 <& /lib/html/hidden.mhtml, 'name' =
> 'id', 'value' =
> $id &
>
113 <& /lib/html/input.mhtml, 'type' =
> 'submit', 'value' =
> i18nGettext('I18N_OPENXPKI_HTML_MASON_CHANGE') &
>
114 <& /service/close_form.mhtml &
>
121 <td><& '/lib/field_to_i18n.mhtml', 'field' =
> 'cert_subject' &
></td>
125 <& /lib/html/a.mhtml,
126 target =
> $context-
>{menu}-
>get_root().
"/service/api/cert_list.html",
128 [ 'subject', $subject ],
130 label =
> $breakable_subject &
>
131 % if (exists $sources-
>{'cert_subject_parts'} && $sources-
>{'cert_subject_parts'} ne 'USER') {
132 (<%
i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_SOURCE') %>: <% $sources-
>{'cert_subject_parts'}
%>)
136 % if (exists $actions{i18nGettext('I18N_OPENXPKI_WF_ACTION_CHANGE_CSR_SUBJECT')}) {
137 <& /service/open_form.mhtml, 'action' =
> $context-
>{menu}-
>get_root().
"/service/workflow/activity/change_csr_subject.html" &
>
138 <& /lib/html/hidden.mhtml, 'name' =
> 'type', 'value' =
> $type &
>
139 <& /lib/html/hidden.mhtml, 'name' =
> 'id', 'value' =
> $id &
>
140 <& /lib/html/input.mhtml, 'type' =
> 'submit', 'value' =
> i18nGettext('I18N_OPENXPKI_HTML_MASON_CHANGE') &
>
141 <& /service/close_form.mhtml &
>
146 % if (scalar @sans) {
148 <td><& '/lib/field_to_i18n.mhtml', field =
> 'cert_subject_alt_name' &
>
149 % if ($sources-
>{'cert_subject_alt_name_parts'} ne 'USER') {
150 (<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_SOURCE') %
>: <% $sources
->{'cert_subject_alt_name_parts'} %>)
152 % if (exists $actions{i18nGettext('I18N_OPENXPKI_WF_ACTION_CHANGE_CSR_SUBJECT_ALT_NAME')}) {
153 <& /service/open_form.mhtml, 'action' =
> $context-
>{menu}-
>get_root().
"/service/workflow/activity/change_csr_subject_alt_name.html" &
>
154 <& /lib/html/hidden.mhtml, 'name' =
> 'type', 'value' =
> $type &
>
155 <& /lib/html/hidden.mhtml, 'name' =
> 'id', 'value' =
> $id &
>
156 <& /lib/html/input.mhtml, 'type' =
> 'submit', 'value' =
> i18nGettext('I18N_OPENXPKI_HTML_MASON_CHANGE') &
>
157 <& /service/close_form.mhtml &
>
161 % foreach my $san (@sans) {
162 % if ($san-
>[
0] =~ m{ \A DNS \z }xms) {
163 % if (! gethostbyname($san-
>[
1])) {
164 <br><small><font color=
"#ff0000"><% $san
->[0] %>: <% $san-
>[
1]
%></font></small>
167 <br><small><font color=
"#009900"><% $san-
>[
0] %
>: <% $san
->[1] %></font></small>
171 <br><small><% $san
->[0] %>: <% $san-
>[
1]
%></small>
177 % foreach my $key (keys %cert_info) {
179 % if (defined $cert_info{$key} && $cert_info{$key} ne '') {
181 <td><& '/lib/field_to_i18n.mhtml', field =
> $key &
></td>
182 <td><% $cert_info{$key}
%></td>
188 <& /lib/html/a.mhtml,
189 target =
> $context-
>{menu}-
>get_root().
"/service/workflow/show_instance.html",
194 label =
> i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_SHOW_CSR_BRIEF_DETAILED_LINK') &
>
197 use Encode qw(encode decode);
200 if (not defined $msg or
202 not ref $msg eq
"HASH")
204 if (! defined $type
) {
205 # type was not specified
, get it from the server
206 my $type_msg
= $context
->{client
}->send_receive_command_msg(
207 'get_workflow_type_for_id',
212 $type
= $type_msg
->{PARAMS
};
214 ## ok we have to get the info from the server
215 $msg
= $context
->{client
}->send_receive_command_msg
226 ## sometimes we have only the message
227 $id
= $msg
->{PARAMS
}->{WORKFLOW
}->{ID
} if (not defined $id
);
228 $type
= $msg
->{PARAMS
}->{WORKFLOW
}->{TYPE
} if (not defined $type
);
230 if (not defined $activities
)
232 ## ok we have to get the info from the server
233 ## FIXME
: this fails
if type and id are undefined
, id can
234 ## be extracted from $msg
, but what about type?
235 my $hmsg
= $context
->{client
}->send_receive_command_msg
237 "get_workflow_activities",
243 $activities
= $hmsg
->{PARAMS
};
247 foreach my $
key (@
{$activities
})
249 ## I hope that nobody will translate two actions with the same string
250 $actions
{i18nGettext($key
)} = $key
;
253 my $creator
= $msg
->{PARAMS
}->{WORKFLOW
}->{CONTEXT
}->{creator
};
255 if ($creator
=~ m
{ \@
}xms
) {
256 # looks like an e
-mail address
, let
's make it a link
259 my $last_update = $msg->{PARAMS}->{WORKFLOW}->{LAST_UPDATE};
260 $last_update =~ s{T}{ }xms;
262 my $ser = OpenXPKI::Serialization::Simple->new();
265 my $sources_ser = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{sources};
266 if (defined $sources_ser && $sources_ser ne '') {
267 $sources = $ser->deserialize($sources_ser);
270 my $subject = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{cert_subject};
271 if ($type eq 'I18N_OPENXPKI_WF_TYPE_SMARTCARD_PERSONALIZATION
') {
272 # Smartcard personalization workflow context has different structure
273 my $cert_iss_data = OpenXPKI::Serialization::Simple->new()->deserialize($msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{cert_issuance_data});
274 my @subjects = map { $_->{'cert_subject
'} } @{ $cert_iss_data };
275 $subject = join q{<br>}, @subjects;
277 my $breakable_subject = $subject;
278 $breakable_subject =~ s{,}{, }xmsg;
281 my $san_ser = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{cert_subject_alt_name};
282 if (defined $san_ser && $san_ser ne '') {
283 my $san_ref = $ser->deserialize($san_ser);
284 if (ref $san_ref eq 'ARRAY
') {
285 @sans = @{ $san_ref };
289 my $role = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{cert_role};
290 my $profile = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{cert_profile};
293 my $ticket_ser = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{ticket};
294 if (defined $ticket_ser) {
295 my $tickets = $ser->deserialize($ticket_ser);
296 foreach my $key (keys %{ $tickets }) {
298 $ticket_entry->{ID} = $tickets->{$key};
299 my $url_msg = $context->{client}->send_receive_command_msg(
300 'get_url_for_ticket
',
303 TICKET => $tickets->{$key},
306 $ticket_entry->{URL} = $url_msg->{PARAMS};
307 push @tickets, qq{<a href="$url_msg->{PARAMS}">$tickets->{$key}</a>};
312 my $cert_info_ser = $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{cert_info};
313 if (defined $cert_info_ser) {
314 my $cert_info_deser = $ser->deserialize($cert_info_ser);
315 if (ref $cert_info_deser eq 'HASH
') {
316 %cert_info = %{ $cert_info_deser };
320 my $context_hash = $m->comp('/service
/workflow
/context_hash
.mhtml
',
321 'context
' => $msg->{PARAMS}->{WORKFLOW}->{CONTEXT},