Reverted menu-left-example.png back to original and cleaned up menu-top-example to...
[freeside.git] / httemplate / edit / svc_domain.cgi
1 <% include('/elements/header.html', "$action $svc", '') %>
2
3 <% include('/elements/error.html') %>
4
5 <FORM ACTION="<% $p1 %>process/svc_domain.cgi" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>">
7 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
8 <INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>">
9
10 <% ntable("#cccccc",2) %>
11
12 <TR>
13   <TD ALIGN="right">Domain</TD>
14   <TD>
15 %   if ( !$svcnum || $conf->exists('svc_domain-edit_domain') ) {
16       <INPUT TYPE="text" NAME="domain" VALUE="<% $domain %>" SIZE=28 MAXLENGTH=63>
17 %   } else {
18       <B><% $domain %></B>
19       <INPUT TYPE="hidden" NAME="domain" VALUE="<% $domain %>">
20 %   }
21
22 % if ($export) {
23 <BR>
24 Available top-level domains: <% $export->option('tlds') %>
25 </TR>
26
27 <TR>
28 <INPUT TYPE="radio" NAME="action" VALUE="N"<% $kludge_action eq 'N' ? ' CHECKED' : '' %>>Register at <% $registrar->{'name'} %>
29 <BR>
30
31 <INPUT TYPE="radio" NAME="action" VALUE="M"<% $kludge_action eq 'M' ? ' CHECKED' : '' %>>Transfer to <% $registrar->{'name'} %>
32 <BR>
33
34 <INPUT TYPE="radio" NAME="action" VALUE="I"<% $kludge_action eq 'I' ? ' CHECKED' : '' %>>Registered elsewhere
35
36 </TR>
37
38 %    if($export->option('auoptions')) {
39 %       # XXX: this whole thing should be done like svc_Common with label_fixup, etc. eventually
40             <% include('/elements/tr-select.html',
41                         'field' => 'au_eligibiilty_type',
42                         'label' => 'AU Eligibility Type',
43                         'value' => $svc_domain->au_eligibility_type,
44                         'options' => $svc_domain->au_eligibility_type_values,
45                       )
46             %>
47             <% include('/elements/tr-input-text.html',
48                         'field' => 'au_registrant_name',
49                         'label' => 'AU Registrant Name',
50                         'value' => $svc_domain->au_registrant_name,
51                       )
52             %>
53 %    }
54
55 % }
56   </TD>
57 </TR>
58
59 % if ( $part_svc->part_svc_column('quota')->columnflag =~ /^[FA]$/ ) {
60     <INPUT TYPE="hidden" NAME="quota" VALUE="<% $svc_domain->quota %>">
61 % } else {
62     <TR>
63       <TD ALIGN="right">Quota</TD>
64       <TD>
65         <INPUT TYPE="text" NAME="quota" SIZE=8 VALUE="<% $svc_domain->quota %>">
66       </TD>
67     </TR>
68 % }
69
70 <% include('svc_domain/communigate-basics.html',
71              'svc_domain'  => $svc_domain,
72              'part_svc'    => $part_svc,
73              'communigate' => $communigate,
74           )
75 %>
76
77 </TABLE>
78 <BR>
79
80 <% include('svc_domain/communigate-acct_defaults.html',
81              'svc_domain'  => $svc_domain,
82              'part_svc'    => $part_svc,
83              'communigate' => $communigate,
84           )
85 %>
86
87 <INPUT TYPE="submit" VALUE="Submit">
88
89 </FORM>
90
91 <% include('/elements/footer.html') %>
92
93 <%init>
94
95 die "access denied"
96   unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
97
98 my $conf = new FS::Conf;
99
100 my($svcnum, $pkgnum, $svcpart, $kludge_action, $part_svc,
101    $svc_domain);
102 if ( $cgi->param('error') ) {
103
104   $svc_domain = new FS::svc_domain ( {
105     map { $_, scalar($cgi->param($_)) } fields('svc_domain')
106   } );
107   $svcnum = $svc_domain->svcnum;
108   $pkgnum = $cgi->param('pkgnum');
109   $svcpart = $cgi->param('svcpart');
110   $kludge_action = $cgi->param('action');
111   $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } );
112   die "No part_svc entry!" unless $part_svc;
113
114 } elsif ( $cgi->param('pkgnum') && $cgi->param('svcpart') ) { #adding
115
116   $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum';
117   $pkgnum = $1;
118   $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart';
119   $svcpart = $1;
120
121   $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
122   die "No part_svc entry!" unless $part_svc;
123
124   $svc_domain = new FS::svc_domain({});
125
126   $svcnum='';
127
128   $svc_domain->set_default_and_fixed;
129
130 } else { #editing
131
132   $kludge_action = '';
133   my($query) = $cgi->keywords;
134   $query =~ /^(\d+)$/ or die "unparsable svcnum";
135   $svcnum=$1;
136   $svc_domain=qsearchs('svc_domain',{'svcnum'=>$svcnum})
137     or die "Unknown (svc_domain) svcnum!";
138
139   my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum})
140     or die "Unknown (cust_svc) svcnum!";
141
142   $pkgnum=$cust_svc->pkgnum;
143   $svcpart=$cust_svc->svcpart;
144
145   $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
146   die "No part_svc entry!" unless $part_svc;
147
148 }
149 my $action = $svcnum ? 'Edit' : 'Add';
150
151 my $svc = $part_svc->getfield('svc');
152
153 my $communigate = scalar($part_svc->part_export('communigate_pro'));
154                 # || scalar($part_svc->part_export('communigate_pro_singledomain'));
155
156 # Find the first export that does domain registration
157 my @exports = grep $_->can('registrar'), $part_svc->part_export;
158 my $export = $exports[0];
159 # If we have a domain registration export, get the registrar object
160 my $registrar = $export ? $export->registrar : '';
161
162 my $domain = $svc_domain->domain;
163
164 my $p1 = popurl(1);
165
166 </%init>