X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fsvc_cert.cgi;h=964b808ab4b23c0314e9b36502227700b51b2287;hb=d2b55d07a9e6e64a38877136d7974ab93e14f1ed;hp=28a269bcce2baee057eac16dc0c1132c93b10715;hpb=874ad675da1321638b374d0b574231d7fa577196;p=freeside.git
diff --git a/httemplate/view/svc_cert.cgi b/httemplate/view/svc_cert.cgi
index 28a269bcc..964b808ab 100644
--- a/httemplate/view/svc_cert.cgi
+++ b/httemplate/view/svc_cert.cgi
@@ -17,7 +17,7 @@ my %labels = map { $_ => ( ref($fields->{$_})
my @fields = (
{ field=>'privatekey',
- value=> sub {
+ value_callback=> sub {
my $svc_cert = shift;
if ( $svc_cert->privatekey && $svc_cert->check_privatekey ) {
'Verification OK';
@@ -31,11 +31,33 @@ my @fields = (
qw( common_name organization organization_unit city state country cert_contact
),
{ 'field'=>'csr',
- 'value'=> sub {
+ 'value_callback'=> sub {
my $svc_cert = shift;
- if ( $svc_cert->csr ) { #display the subject etc?
- '
'. "\n". $svc_cert->csr.
- '
';
+ if ( $svc_cert->csr ) {
+
+ my $out = '';
+
+ my %hash = $svc_cert->check_csr;
+
+ $out .= include('/elements/table-grid.html'). #''.
+ ''.
+ 'Requested by |
';
+
+ my $col = $svc_cert->subj_col;
+
+ foreach my $key (keys %hash) {
+ $out .= "". $labels{$col->{$key}}. " | ".
+ "". $hash{$key}. " |
";
+ }
+
+ $out .= '
';
+
+ $out .=
+ ''. $svc_cert->csr.
+ '
';
+
+ $out;
+
} elsif ( $svc_cert->common_name ) {
my $svcnum = $svc_cert->svcnum;
qq(Generate);
@@ -45,7 +67,7 @@ my @fields = (
},
},
{ 'field'=>'certificate',
- 'value'=> sub {
+ 'value_callback'=> sub {
my $svc_cert = shift;
if ( $svc_cert->certificate ) {
@@ -83,8 +105,9 @@ my @fields = (
"$hash{notBefore} - $hash{notAfter} | ".
'';
+ my $svcnum = $svc_cert->svcnum;
+
if ( $hash{'selfsigned'} ) {
- my $svcnum = $svc_cert->svcnum;
$out .= qq(
Re-generate self-signed).
' '.
include('/elements/popup_link.html', {
@@ -113,6 +136,70 @@ my @fields = (
}
},
},
+ { 'field'=>'cacert',
+ 'value_callback'=> sub {
+ my $svc_cert = shift;
+ if ( $svc_cert->cacert ) {
+
+ my %hash = $svc_cert->check_cacert;
+
+ tie my %w, 'Tie::IxHash',
+ 'subject' => 'Issued to',
+ 'issuer' => 'Issued by',
+ ;
+
+ my $out = '';
+
+ foreach my $w ( keys %w ) {
+
+ $out .= include('/elements/table-grid.html'). #''.
+ ''.
+ $w{$w}. ' | ';
+
+ my $col = $svc_cert->subj_col;
+
+ my $subj = $hash{$w};
+ foreach my $key (keys %$col) { #( keys %$subj ) {
+ $out .= "". $labels{$col->{$key}}. " | ".
+ "". $subj->{$key}. " | ";
+ }
+
+ $out .= ' | ';
+ }
+ $out .= ' |
';
+
+ $out .= ''.
+ 'Serial number | '.
+ "$hash{serial} |
".
+ 'Valid | '.
+ "$hash{notBefore} - $hash{notAfter} |
".
+ '
';
+
+ $out .= ''.
+ $svc_cert->certificate.
+ '';
+
+ $out;
+
+ } else {
+
+ my $svcnum = $svc_cert->svcnum;
+
+ include('/elements/popup_link.html', {
+ 'action' => $p."edit/svc_cert/import_cacert.html".
+ "?svcnum=$svcnum",
+ 'label' => 'Import certificate authority chain',#link
+ 'actionlabel' => 'Import certificate authority chain',#title
+ #opt
+ 'width' => '544',
+ 'height' => '368',
+ #'color' => '#ff0000',
+ }). ' (optional)'.
+ '
';
+
+ }
+ },
+ },
);
%init>