3 # $Id: svc_domain.cgi,v 1.8 1999-02-07 09:59:25 ivan Exp $
5 # Usage: svc_domain.cgi pkgnum{pkgnum}-svcpart{svcpart}
6 # http://server.name/path/svc_domain.cgi?pkgnum{pkgnum}-svcpart{svcpart}
8 # Note: Should be run setuid freeside as user nobody
10 # ivan@voicenet.com 97-jan-5 -> 97-jan-6
12 # changes for domain template 3.5
13 # ivan@voicenet.com 97-jul-24
15 # rewrite ivan@sisd.com 98-mar-14
17 # no GOV in instructions ivan@sisd.com 98-jul-17
19 # $Log: svc_domain.cgi,v $
20 # Revision 1.8 1999-02-07 09:59:25 ivan
21 # more mod_perl fixes, and bugfixes Peter Wemm sent via email
23 # Revision 1.7 1999/01/19 05:13:46 ivan
24 # for mod_perl: no more top-level my() variables; use vars instead
25 # also the last s/create/new/;
27 # Revision 1.6 1999/01/18 09:41:35 ivan
28 # all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
31 # Revision 1.5 1998/12/30 23:03:25 ivan
32 # bugfixes; fields isn't exported by derived classes
34 # Revision 1.4 1998/12/23 03:00:16 ivan
35 # $cgi->keywords instead of $cgi->query_string
37 # Revision 1.3 1998/12/17 06:17:12 ivan
38 # fix double // in relative URLs, s/CGI::Base/CGI/;
40 # Revision 1.2 1998/11/13 09:56:48 ivan
41 # change configuration file layout to support multiple distinct databases (with
42 # own set of config files, export, etc.)
46 use vars qw( $cgi $action $svcnum $svc_domain $pkgnum $svcpart $part_svc
47 $svc $otaker $domain $p1 $kludge_action $purpose );
49 use CGI::Carp qw(fatalsToBrowser);
50 use FS::UID qw(cgisuidsetup getotaker);
51 use FS::CGI qw(header popurl);
52 use FS::Record qw(qsearch qsearchs fields);
58 if ( $cgi->param('error') ) {
59 $svc_domain = new FS::svc_domain ( {
60 map { $_, scalar($cgi->param($_)) } fields('svc_domain')
62 $svcnum = $svc_domain->svcnum;
63 $pkgnum = $cgi->param('pkgnum');
64 $svcpart = $cgi->param('svcpart');
65 $kludge_action = $cgi->param('action');
66 $purpose = $cgi->param('purpose');
67 $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } );
68 die "No part_svc entry!" unless $part_svc;
72 my($query) = $cgi->keywords;
73 if ( $query =~ /^(\d+)$/ ) { #editing
75 $svc_domain=qsearchs('svc_domain',{'svcnum'=>$svcnum})
76 or die "Unknown (svc_domain) svcnum!";
78 my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum})
79 or die "Unknown (cust_svc) svcnum!";
81 $pkgnum=$cust_svc->pkgnum;
82 $svcpart=$cust_svc->svcpart;
84 $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
85 die "No part_svc entry!" unless $part_svc;
89 $svc_domain = new FS::svc_domain({});
91 foreach $_ (split(/-/,$query)) {
92 $pkgnum=$1 if /^pkgnum(\d+)$/;
93 $svcpart=$1 if /^svcpart(\d+)$/;
95 $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
96 die "No part_svc entry!" unless $part_svc;
100 #set fixed and default fields from part_svc
102 foreach $field ( fields('svc_domain') ) {
103 if ( $part_svc->getfield('svc_domain__'. $field. '_flag') ne '' ) {
104 $svc_domain->setfield($field,$part_svc->getfield('svc_domain__'. $field) );
110 $action = $svcnum ? 'Edit' : 'Add';
112 $svc = $part_svc->getfield('svc');
116 $domain = $svc_domain->domain;
119 print $cgi->header( '-expires' => 'now' ), header("$action $svc", '');
121 print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
123 if $cgi->param('error');
126 <FORM ACTION="${p1}process/svc_domain.cgi" METHOD=POST>
127 <INPUT TYPE="hidden" NAME="svcnum" VALUE="$svcnum">
128 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">
129 <INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">
132 print qq!<INPUT TYPE="radio" NAME="action" VALUE="N"!;
133 print ' CHECKED' if $kludge_action eq 'N';
135 print qq!<BR><INPUT TYPE="radio" NAME="action" VALUE="M"!;
136 print ' CHECKED' if $kludge_action eq 'M';
140 <P>Customer agrees to be bound by NSI's
141 <A HREF="http://rs.internic.net/help/agreement.txt">
142 Domain Name Registration Agreement</A>
143 <SELECT NAME="legal" SIZE=1><OPTION SELECTED>No<OPTION>Yes</SELECT>
144 <P>Domain <INPUT TYPE="text" NAME="domain" VALUE="$domain" SIZE=28 MAXLENGTH=26>
145 <BR>Purpose/Description: <INPUT TYPE="text" NAME="purpose" VALUE="$purpose" SIZE=64>
146 <P><CENTER><INPUT TYPE="submit" VALUE="Submit"></CENTER>
148 <LI>COM is for commercial, for-profit organziations
149 <LI>ORG is for miscellaneous, usually, non-profit organizations
150 <LI>NET is for network infrastructure machines and organizations
151 <LI>EDU is for 4-year, degree granting institutions
152 <!-- <LI>GOV is for United States federal government agencies
155 US state and local government agencies, schools, libraries, museums, and individuals should register under the US domain. See RFC 1480 for a complete description of the US domain
156 and registration procedures.
157 <!-- <P>GOV registrations are limited to top-level US Federal Government agencies (see RFC 1816).