From 729ceea3edac7b5364aa572c894991a979a53f2b Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Nov 2010 05:30:29 +0000 Subject: certificates ala communigate, RT#7515 --- httemplate/edit/svc_cert.cgi | 168 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 166 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/svc_cert.cgi') diff --git a/httemplate/edit/svc_cert.cgi b/httemplate/edit/svc_cert.cgi index fa14f0ba3..93194228e 100644 --- a/httemplate/edit/svc_cert.cgi +++ b/httemplate/edit/svc_cert.cgi @@ -2,13 +2,123 @@ <% include('/elements/error.html') %> -
+ <% ntable("#cccccc",2) %> + + Private key + + +% if ( $svc_cert->privatekey && $svc_cert->check_privatekey ) { + + Verification OK +% # remove key & cert link? just unprovision? + + + +% if (0) { #( $svc_cert->csr_submitted ) { #XXX add field? date? } + +% # just show the fields once the csr has been submitted + +% } else { + +% my $cust_main = $svc_cert->cust_svc->cust_pkg->cust_main; + + + Common name + + + + + Organization + + + + + Organization Unit + + + + + City + <% include('/elements/city.html', + 'city' => $svc_cert->city || $cust_main->city, + 'state' => $svc_cert->state || $cust_main->state, + 'country' => $svc_cert->country || $cust_main->country, + ) + %> + + + + + State + <% include('/elements/select-state.html', + 'city' => $svc_cert->city || $cust_main->city, + 'state' => $svc_cert->state || $cust_main->state, + 'country' => $svc_cert->country || $cust_main->country, + ) + %> + + + + + Country + <% include('/elements/select-country.html', + 'city' => $svc_cert->city || $cust_main->city, + 'state' => $svc_cert->state || $cust_main->state, + 'country' => $svc_cert->country || $cust_main->country, + ) + %> + + + + + Contact email + + + +% } + +% } else { +% my $re = ''; +% if ( $svc_cert->privatekey ) { + Verification error +% $re = 'Clear and Re-'; +% } + <% include('/elements/popup_link.html', { + 'action' => "svc_cert/generate_privatekey.html$link_query", + 'label' => $re.'Generate', + 'actionlabel' => 'Generate private key', + #opt + 'width' => '350', + 'height' => '150' + #'color' => '#ff0000', + #'closetext' => 'Go Away', # the value '' removes the link + })%> + + or + + <% include('/elements/popup_link.html', { + 'action' => "svc_cert/import_privatekey.html$link_query", + 'label' => $re.'Import', + 'actionlabel' => 'Import private key', + #opt + 'width' => '544', + 'height' => '368', + #'color' => '#ff0000', + #'closetext' => 'Go Away', # the value '' removes the link + })%> +% if ( $svc_cert->privatekey ) { +
<% $svc_cert->privatekey |h %>
+% } + + +% } +
@@ -23,8 +133,62 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? -#my $conf = new FS::Conf; +my $conf = new FS::Conf; + +my($svcnum, $pkgnum, $svcpart, $part_svc, $svc_cert ); +if ( $cgi->param('error') ) { + + $svc_cert = new FS::svc_cert ( { + map { $_, scalar($cgi->param($_)) } fields('svc_cert') + } ); + $svcnum = $svc_cert->svcnum; + $pkgnum = $cgi->param('pkgnum'); + $svcpart = $cgi->param('svcpart'); + $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } ); + die "No part_svc entry!" unless $part_svc; + +} elsif ( $cgi->param('pkgnum') && $cgi->param('svcpart') ) { #adding + + $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum'; + $pkgnum = $1; + $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart'; + $svcpart = $1; + + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; + + $svc_cert = new FS::svc_cert({}); + + $svcnum=''; + + $svc_cert->set_default_and_fixed; + +} else { #editing + + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/ or die "unparsable svcnum"; + $svcnum=$1; + $svc_cert=qsearchs('svc_cert',{'svcnum'=>$svcnum}) + or die "Unknown (svc_cert) svcnum!"; + + my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) + or die "Unknown (cust_svc) svcnum!"; + + $pkgnum=$cust_svc->pkgnum; + $svcpart=$cust_svc->svcpart; + + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; + +} +my $action = $svcnum ? 'Edit' : 'Add'; + +my $svc = $part_svc->getfield('svc'); + +#my $otaker = getotaker; +my $p1 = popurl(1); +my $link_query = "?svcnum=$svcnum;pkgnum=$pkgnum;svcpart=$svcpart"; -- cgit v1.2.1