summaryrefslogtreecommitdiff
path: root/httemplate/view
diff options
context:
space:
mode:
authorivan <ivan>2010-11-07 23:47:04 +0000
committerivan <ivan>2010-11-07 23:47:04 +0000
commit874ad675da1321638b374d0b574231d7fa577196 (patch)
tree3ca9ad29f55550256e676ac4a752dedbbafa0f17 /httemplate/view
parent5ac9e46a92f4eefd795f97643f3e8f62ec1a2b26 (diff)
certificates ala communigate, RT#7515
Diffstat (limited to 'httemplate/view')
-rw-r--r--httemplate/view/svc_cert.cgi61
1 files changed, 53 insertions, 8 deletions
diff --git a/httemplate/view/svc_cert.cgi b/httemplate/view/svc_cert.cgi
index 36f598b9a..28a269bcc 100644
--- a/httemplate/view/svc_cert.cgi
+++ b/httemplate/view/svc_cert.cgi
@@ -34,8 +34,8 @@ my @fields = (
'value'=> sub {
my $svc_cert = shift;
if ( $svc_cert->csr ) { #display the subject etc?
- '<FONT STYLE="font-family:monospace"><PRE>'. $svc_cert->csr.
- '</PRE></FONT>';
+ '<PRE><FONT STYLE="font-family:monospace">'. "\n". $svc_cert->csr.
+ '</FONT></PRE>';
} elsif ( $svc_cert->common_name ) {
my $svcnum = $svc_cert->svcnum;
qq(<A HREF="${p}misc/svc_cert-generate.html?action=generate_csr;svcnum=$svcnum">Generate</A>);
@@ -50,15 +50,60 @@ my @fields = (
if ( $svc_cert->certificate ) {
my %hash = $svc_cert->check_certificate;
- my $out = '<TABLE>'; #XXX better formatting
- foreach my $key ( keys %hash ) {
- $out .= "<TR><TD>$key</TD><TD>$hash{$key}</TD></TR>";
+
+ tie my %w, 'Tie::IxHash',
+ 'subject' => 'Issued to',
+ 'issuer' => 'Issued by',
+ ;
+
+ my $out = '<TABLE><TR><TD>';
+
+ foreach my $w ( keys %w ) {
+
+ $out .= include('/elements/table-grid.html'). #'<TABLE>'.
+ '<TR><TH COLSPAN=2 BGCOLOR="#cccccc" ALIGN="center">'.
+ $w{$w}. '</TH></TR>';
+
+ my $col = $svc_cert->subj_col;
+
+ my $subj = $hash{$w};
+ foreach my $key (keys %$col) { #( keys %$subj ) {
+ $out .= "<TR><TD>". $labels{$col->{$key}}. "</TD>".
+ "<TD>". $subj->{$key}. "</TD></TR>";
+ }
+
+ $out .= '</TABLE></TD><TD>';
}
- $out .= '</TABLE>';
+ $out .= '</TD></TR></TABLE>';
+
+ $out .= '<TABLE>'.
+ '<TR><TH ALIGN="right">Serial number</TH>'.
+ "<TD>$hash{serial}</TD></TR>".
+ '<TR><TH ALIGN="right">Valid</TH>'.
+ "<TD>$hash{notBefore} - $hash{notAfter}</TD></TR>".
+ '</TABLE>';
- $out .= '<FONT STYLE="font-family:monospace"><PRE>'.
+ if ( $hash{'selfsigned'} ) {
+ my $svcnum = $svc_cert->svcnum;
+ $out .= qq(<BR> <A HREF="${p}misc/svc_cert-generate.html?action=generate_selfsigned;svcnum=$svcnum">Re-generate self-signed</A>).
+ ' &nbsp; '.
+ include('/elements/popup_link.html', {
+ 'action' => $p."edit/svc_cert/import_certificate.html".
+ "?svcnum=$svcnum",
+ 'label' => 'Import issued certificate', #link
+ 'actionlabel' => 'Import issued certificate', #title
+ #opt
+ 'width' => '544',
+ 'height' => '368',
+ #'color' => '#ff0000',
+ }).
+ '<BR>';
+ }
+
+ $out .= '<PRE><FONT STYLE="font-family:monospace">'.
$svc_cert->certificate.
- '</PRE></FONT>';
+ '</FONT><PRE>';
+
$out;
} elsif ( $svc_cert->csr ) {
my $svcnum = $svc_cert->svcnum;