X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fview%2Fsvc_cert.cgi;h=48494d2d20ecf6d3e637de3843b91b4ae838e389;hp=92902d6d273f6faf0a085c4944c94ed3ef027630;hb=e50b6ec8d63afe4c04ae33384758d8786fcc7cfe;hpb=2d73473ce78c22160b618e93802a9551c9c77d69 diff --git a/httemplate/view/svc_cert.cgi b/httemplate/view/svc_cert.cgi index 92902d6d2..48494d2d2 100644 --- a/httemplate/view/svc_cert.cgi +++ b/httemplate/view/svc_cert.cgi @@ -28,7 +28,156 @@ my @fields = ( } }, }, - qw( organization organization_unit city state country cert_contact ) + qw( common_name organization organization_unit city state country cert_contact + ), + { 'field'=>'csr', + 'value'=> sub { + my $svc_cert = shift; + if ( $svc_cert->csr ) { #display the subject etc? + '
'. "\n". $svc_cert->csr.
+        '
'; + } elsif ( $svc_cert->common_name ) { + my $svcnum = $svc_cert->svcnum; + qq(Generate); + } else { + ''; + } + }, + }, + { 'field'=>'certificate', + 'value'=> sub { + my $svc_cert = shift; + if ( $svc_cert->certificate ) { + + my %hash = $svc_cert->check_certificate; + + tie my %w, 'Tie::IxHash', + 'subject' => 'Issued to', + 'issuer' => 'Issued by', + ; + + my $out = '
'; + + foreach my $w ( keys %w ) { + + $out .= include('/elements/table-grid.html'). #''. + ''; + + my $col = $svc_cert->subj_col; + + my $subj = $hash{$w}; + foreach my $key (keys %$col) { #( keys %$subj ) { + $out .= "". + ""; + } + + $out .= '
'. + $w{$w}. '
". $labels{$col->{$key}}. "". $subj->{$key}. "
'; + } + $out .= '
'; + + $out .= ''. + ''. + "". + ''. + "". + '
Serial number$hash{serial}
Valid$hash{notBefore} - $hash{notAfter}
'; + + my $svcnum = $svc_cert->svcnum; + + if ( $hash{'selfsigned'} ) { + $out .= qq(
Re-generate self-signed). + '   '. + 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', + }). + '
'; + } + + $out .= '
'.
+                $svc_cert->certificate.
+                '
';
+
+        $out;
+      } elsif ( $svc_cert->csr ) {
+        my $svcnum = $svc_cert->svcnum;
+        qq(Generate self-signed);
+      } else {
+        '';
+      }
+    },
+  },
+  { 'field'=>'cacert',
+    'value'=> 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'). #''. + ''; + + my $col = $svc_cert->subj_col; + + my $subj = $hash{$w}; + foreach my $key (keys %$col) { #( keys %$subj ) { + $out .= "". + ""; + } + + $out .= '
'. + $w{$w}. '
". $labels{$col->{$key}}. "". $subj->{$key}. "
'; + } + $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)'.
+        '
'; + + } + }, + }, );