summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-xhttemplate/edit/part_svc.cgi1
-rw-r--r--httemplate/edit/process/svc_cert.cgi71
-rw-r--r--httemplate/edit/svc_cert.cgi30
-rw-r--r--httemplate/edit/svc_cert/generate_privatekey.html34
-rw-r--r--httemplate/edit/svc_cert/import_privatekey.html28
5 files changed, 164 insertions, 0 deletions
diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi
index 940ea8d25..e14acb5a9 100755
--- a/httemplate/edit/part_svc.cgi
+++ b/httemplate/edit/part_svc.cgi
@@ -15,6 +15,7 @@ Disable new orders <INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $hashref->
Service definitions are the templates for items you offer to your customers.
<UL><LI>svc_acct - Accounts - anything with a username (Mailboxes, PPP accounts, shell accounts, RADIUS entries for broadband, etc.)
<LI>svc_domain - Domains
+ <LI>svc_cert - Certificates
<LI>svc_forward - Mail forwarding
<LI>svc_mailinglist - Mailing list
<LI>svc_www - Virtual domain website
diff --git a/httemplate/edit/process/svc_cert.cgi b/httemplate/edit/process/svc_cert.cgi
new file mode 100644
index 000000000..1bf749f96
--- /dev/null
+++ b/httemplate/edit/process/svc_cert.cgi
@@ -0,0 +1,71 @@
+%if ( $popup ) {
+% if ( $error ) { #should redirect back to the posting page?
+<% include("/elements/header-popup.html", "Error") %>
+<P><FONT SIZE="+1" COLOR="#ff0000"><% $error |h %></FONT>
+<BR><BR>
+<P ALIGN="center">
+<BUTTON TYPE="button" onClick="parent.cClick();">Close</BUTTON>
+</BODY></HTML>
+% } else {
+<% include('/elements/header-popup.html', $title ) %>
+ <SCRIPT TYPE="text/javascript">
+ window.top.location = '<% popurl(3). "edit/svc_cert.cgi?$svcnum" %>';
+ </SCRIPT>
+ </BODY></HTML>
+% }
+%} elsif ( $error ) {
+% $cgi->param('error', $error);
+<% $cgi->redirect(popurl(2). "svc_cert.cgi?". $cgi->query_string ) %>
+%} else {
+%#change link when we make a non-generic view
+%#<% $cgi->redirect(popurl(3). "view/svc_cert.cgi?$svcnum") %>
+<% $cgi->redirect(popurl(3). "view/svc_Common.html?svcdb=svc_cert;svcnum=$svcnum") %>
+% }
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
+
+$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
+my $svcnum = $1;
+
+my $new = new FS::svc_cert ( {
+ map {
+ $_, scalar($cgi->param($_));
+ } ( fields('svc_cert'), qw( pkgnum svcpart ) )
+} );
+
+my $old = '';
+if ( $svcnum ) {
+ $old = qsearchs('svc_cert', { 'svcnum' => $svcnum } ) #agent virt;
+ or die 'unknown svcnum';
+ $new->$_( $old->$_ ) for grep $old->$_, qw( privatekey );
+}
+
+my $popup = 0;
+my $title = '';
+if ( $cgi->param('privatekey') eq '_generate' ) { #generate
+ $popup = 1;
+ $title = 'Key generated';
+
+ $cgi->param('keysize') =~ /^(\d+)$/ or die 'illegal keysize';
+ my $keysize = $1;
+ $new->generate_privatekey($keysize);
+
+} elsif ( $cgi->param('privatekey') =~ /\S/ ) { #import
+ $popup = 1;
+ $title = 'Key imported';
+
+ $new->privatekey( $cgi->param('privatekey') );
+
+} #elsif ( $cgi->param('privatekey') eq '_clear' ) { #import
+
+my $error = '';
+if ($cgi->param('svcnum')) {
+ $error = $new->replace();
+} else {
+ $error = $new->insert;
+ $svcnum = $new->svcnum;
+}
+
+</%init>
diff --git a/httemplate/edit/svc_cert.cgi b/httemplate/edit/svc_cert.cgi
new file mode 100644
index 000000000..fa14f0ba3
--- /dev/null
+++ b/httemplate/edit/svc_cert.cgi
@@ -0,0 +1,30 @@
+<% include('/elements/header.html', "$action $svc", '') %>
+
+<% include('/elements/error.html') %>
+
+<FORM ACTION="<% $p1 %>process/svc_cert.cgi" METHOD=POST>
+<INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>">
+<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
+<INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>">
+
+<% ntable("#cccccc",2) %>
+
+</TABLE>
+<BR>
+
+<INPUT TYPE="submit" VALUE="Submit">
+
+</FORM>
+
+<% include('/elements/footer.html') %>
+
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
+
+#my $conf = new FS::Conf;
+
+
+
+</%init>
diff --git a/httemplate/edit/svc_cert/generate_privatekey.html b/httemplate/edit/svc_cert/generate_privatekey.html
new file mode 100644
index 000000000..45414e773
--- /dev/null
+++ b/httemplate/edit/svc_cert/generate_privatekey.html
@@ -0,0 +1,34 @@
+<% include('/elements/header-popup.html', 'Generate private key' ) %>
+
+<FORM NAME="GenerateKeyForm" ACTION="<% $p %>process/svc_cert.cgi" METHOD="POST">
+
+<INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>">
+<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
+<INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>">
+
+<INPUT TYPE="hidden" NAME="privatekey" VALUE="_generate">
+
+Key size: <SELECT NAME="keysize">
+ <OPTION VALUE="512">512</OPTION>
+ <OPTION VALUE="1024">1024</OPTION>
+ <OPTION VALUE="2048" SELECTED>2048</OPTION>
+ <OPTION VALUE="4096">4096</OPTION>
+</SELECT>
+
+<BR><BR>
+<INPUT TYPE="submit" VALUE="Generate">
+
+</FORM>
+</BODY>
+</HTML>
+<%init>
+
+$cgi->param('svcnum') =~ /^(\d*)$/ or die 'illegal svcnum';
+my $svcnum = $1;
+$cgi->param('pkgnum') =~ /^(\d*)$/ or die 'illegal pkgnum';
+my $pkgnum = $1;
+$cgi->param('svcpart') =~ /^(\d*)$/ or die 'illegal svcpart';
+my $svcpart = $1;
+
+</%init>
+
diff --git a/httemplate/edit/svc_cert/import_privatekey.html b/httemplate/edit/svc_cert/import_privatekey.html
new file mode 100644
index 000000000..52e6002f8
--- /dev/null
+++ b/httemplate/edit/svc_cert/import_privatekey.html
@@ -0,0 +1,28 @@
+<% include('/elements/header-popup.html', 'Import private key' ) %>
+
+<% include('/elements/error.html') %>
+
+<FORM NAME="ImportKeyForm" ACTION="<% $p %>process/svc_cert.cgi" METHOD="POST">
+
+<INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>">
+<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
+<INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>">
+
+<TEXTAREA NAME="privatekey" COLS=64 ROWS=15 STYLE="font-family:monospace"></TEXTAREA>
+
+<BR><BR>
+<INPUT TYPE="submit" VALUE="Import">
+
+</FORM>
+</BODY>
+</HTML>
+<%init>
+
+$cgi->param('svcnum') =~ /^(\d*)$/ or die 'illegal svcnum';
+my $svcnum = $1;
+$cgi->param('pkgnum') =~ /^(\d*)$/ or die 'illegal pkgnum';
+my $pkgnum = $1;
+$cgi->param('svcpart') =~ /^(\d*)$/ or die 'illegal svcpart';
+my $svcpart = $1;
+
+</%init>