<%args> $id => undef $format => "png" $language => "png" $filled => undef <%init> my $msg = $context->{client}->send_receive_command_msg ( "get_workflow_instance_info", { ID => $id, FORMAT => $format, LANGUAGE => $language }); if (exists $msg->{SERVICE_MSG} and $msg->{SERVICE_MSG} eq "ERROR") { $m->comp ('/service/create_csr/print_errors.mhtml', 'errors' => [ $m->comp ('/lib/get_deep_error.mhtml', 'msg' => $msg) ]); } else { my $data = $msg->{PARAMS}; switch ($format) { case "cmpax" { $r->content_type ("text/html") } case "fig" { $r->content_type ("application/x-xfig") } case "gif" { $r->content_type ("image/gif") } case "hpgl" { $r->content_type ("application/vnd.hp-HPGL") } case "imap" { $r->content_type ("text/html") } case "jpg" { $r->content_type ("image/jpeg") } # FIXME: I have no FrameMaker so which content type is correct # case "mif" { $r->content_type ("application/vnd.mif") } case "mif" { $r->content_type ("application/x-maker") } case "pcl" { $r->content_type ("application/vnd.hp-PCL") } case "png" { $r->content_type ("image/png") } case "ps" { $r->content_type ("application/postscript") } case "svg" { $r->content_type ("image/svg+xml") } case "svgz" { $r->content_type ("image/svg+xml") } else { $r->content_type ("application/octet-stream") } } print $data; } <%once> use Switch;