summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2010-02-22 09:18:10 +0000
committerivan <ivan>2010-02-22 09:18:10 +0000
commit5fa9ce1b7c8b934e96a6a2f850a4e788eb76f495 (patch)
tree44ee491d16cf72bfa72fbe573d83901c6729d5c5 /httemplate
parenta1807414d26dd7d4c3ce67310047944178b07363 (diff)
communigate: domain account defaults, RT#7083
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/edit/part_svc.cgi8
-rwxr-xr-xhttemplate/edit/process/svc_domain.cgi12
-rwxr-xr-xhttemplate/edit/svc_acct.cgi2
-rwxr-xr-xhttemplate/edit/svc_domain.cgi90
-rw-r--r--httemplate/view/elements/tr.html9
-rw-r--r--httemplate/view/svc_acct/basics.html52
-rwxr-xr-xhttemplate/view/svc_domain.cgi220
-rw-r--r--httemplate/view/svc_domain/acct_defaults.html71
-rw-r--r--httemplate/view/svc_domain/basics.html134
-rw-r--r--httemplate/view/svc_domain/dns.html94
10 files changed, 457 insertions, 235 deletions
diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi
index 6428960dd..80f61a100 100755
--- a/httemplate/edit/part_svc.cgi
+++ b/httemplate/edit/part_svc.cgi
@@ -266,6 +266,14 @@ that field.
% 'empty_label' => 'Select inventory class',
% );
%
+% } elsif ( $def->{type} eq 'checkbox' ) {
+%
+% $html .= include('/elements/checkbox.html',
+% 'field' => $layer.'__'.$field,
+% 'curr_value' => $value,
+% 'value' => 'Y',
+% );
+%
% } elsif ( $def->{type} eq 'select' ) {
%
% $html .= qq!<SELECT NAME="${layer}__${field}" $disabled!;
diff --git a/httemplate/edit/process/svc_domain.cgi b/httemplate/edit/process/svc_domain.cgi
index ea97918e8..381339bc8 100755
--- a/httemplate/edit/process/svc_domain.cgi
+++ b/httemplate/edit/process/svc_domain.cgi
@@ -27,6 +27,18 @@ unless ( $cgi->param('cgp_accessmodes') ) {
);
}
+#unmunge acct_def_cgp_accessmodes (falze laziness-ahoy)
+unless ( $cgi->param('acct_def_cgp_accessmodes') ) {
+ $cgi->param('acct_def_cgp_accessmodes',
+ join(' ',
+ sort map { /^acct_def_cgp_accessmodes_([\w\/]+)$/ or die "no way"; $1; }
+ grep $cgi->param($_),
+ grep /^acct_def_cgp_accessmodes_([\w\/]+)$/,
+ $cgi->param()
+ )
+ );
+}
+
my $new = new FS::svc_domain ( {
map {
$_, scalar($cgi->param($_));
diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi
index c842b1b57..99e4b74a4 100755
--- a/httemplate/edit/svc_acct.cgi
+++ b/httemplate/edit/svc_acct.cgi
@@ -279,6 +279,7 @@ Service # <% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR>
% }
+% #false laziness w/svc_domain
% if ( $communigate
% && $part_svc->part_svc_column('cgp_accessmodes')->columnflag ne 'F' )
% {
@@ -330,6 +331,7 @@ Service # <% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR>
% if ( $communigate ) {
+%# false laziness w/svc_domain acct_def
<TR>
<TD ALIGN="right">Message delete method</TD>
<TD>
diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi
index a3589c4a7..78faf12b2 100755
--- a/httemplate/edit/svc_domain.cgi
+++ b/httemplate/edit/svc_domain.cgi
@@ -96,8 +96,98 @@ Available top-level domains: <% $export->option('tlds') %>
% }
</TABLE>
+<BR>
+
+% if ( $communigate ) {
+Account defaults
+<% ntable("#cccccc",2) %>
+
+ <% include('/elements/tr-checkbox.html',
+ 'label' =>'Password modification',
+ 'field' => 'acct_def_password_selfchange',
+ 'curr_value' => $svc_domain->acct_def_password_selfchange,
+ 'value' => 'Y',
+ )
+ %>
+ <% include('/elements/tr-checkbox.html',
+ 'label' =>'Password recovery',
+ 'field' => 'acct_def_password_recover',
+ 'curr_value' => $svc_domain->acct_def_password_recover,
+ 'value' => 'Y',
+ )
+ %>
+
+ <TR>
+ <TD ALIGN="right">Enabled services
+ </TD>
+ <TD><% include('/elements/communigate_pro-accessmodes.html',
+ 'element_name_prefix' => 'acct_def_cgp_accessmodes_',
+ 'curr_value' => $svc_domain->acct_def_cgp_accessmodes,
+ )
+ %>
+ </TD>
+ </TR>
+
+ <% include('/elements/tr-input-text.html',
+ 'label' => 'Mail storage limit',
+ 'field' => 'acct_def_quota',
+ 'curr_value' => $svc_domain->acct_def_quota,
+ )
+ %>
+ <% include('/elements/tr-input-text.html',
+ 'label' => 'File storage limit',
+ 'field' => 'acct_def_file_quota',
+ 'curr_value' => $svc_domain->acct_def_file_quota,
+ )
+ %>
+ <% include('/elements/tr-input-text.html',
+ 'label' => 'Files limit',
+ 'field' => 'acct_def_file_maxnum',
+ 'curr_value' => $svc_domain->acct_def_file_maxnum,
+ )
+ %>
+ <% include('/elements/tr-input-text.html',
+ 'label' => 'File size limit',
+ 'field' => 'acct_def_file_maxsize',
+ 'curr_value' => $svc_domain->acct_def_file_maxsize,
+ )
+ %>
+
+%# false laziness w/svc_acct acct_def
+ <TR>
+ <TD ALIGN="right">Message delete method</TD>
+ <TD>
+ <SELECT NAME="acct_def_cgp_deletemode">
+% for ( 'Move To Trash', 'Immediately', 'Mark' ) {
+ <OPTION VALUE="<% $_ %>"
+ <% $_ eq $svc_domain->acct_def_cgp_deletemode ? 'SELECTED' : '' %>
+ ><% $_ %>
+% }
+ </SELECT>
+ </TD>
+ </TR>
+
+ <% include('/elements/tr-input-text.html',
+ 'label' => 'On logout remove trash',
+ 'curr_value' => $svc_domain->acct_def_cgp_emptytrash,
+ )
+ %>
+
+</TABLE>
<BR>
+
+% } else {
+
+% foreach my $f (qw( password_selfchange password_recover cgp_accessmodes
+% quota file_quota file_maxnum file_maxsize
+% cgp_deletemode cgp_emptytrash
+% )) {
+ <INPUT TYPE="hidden" NAME="acct_def_<%$f%>" VALUE="<% $svc_domain->get("acct_def_$f") %>">
+% }
+
+% }
+
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
diff --git a/httemplate/view/elements/tr.html b/httemplate/view/elements/tr.html
new file mode 100644
index 000000000..e2ec7d42f
--- /dev/null
+++ b/httemplate/view/elements/tr.html
@@ -0,0 +1,9 @@
+<TR>
+ <TD ALIGN="right"><% $opt{'label'} %></TD>
+ <TD BGCOLOR="#ffffff"><% $opt{'value'} %></TD>
+</TR>
+<%init>
+
+my %opt = @_;
+
+</%init>
diff --git a/httemplate/view/svc_acct/basics.html b/httemplate/view/svc_acct/basics.html
index 0159a7ed0..92b9ad7fe 100644
--- a/httemplate/view/svc_acct/basics.html
+++ b/httemplate/view/svc_acct/basics.html
@@ -1,15 +1,15 @@
<% &ntable("#cccccc") %><TR><TD><% &ntable("#cccccc",2) %>
-<% include('tr.html', label=>'Service', value=>$part_svc->svc) %>
-<% include('tr.html', label=>'Username', value=>$svc_acct->username) %>
-<% include('tr.html', label=>'Domain', value=>$domain) %>
+<% include('/view/elements/tr.html', label=>'Service', value=>$part_svc->svc) %>
+<% include('/view/elements/tr.html', label=>'Username', value=>$svc_acct->username) %>
+<% include('/view/elements/tr.html', label=>'Domain', value=>$domain) %>
% if ( $opt{'communigate'} ) {
- <% include('tr.html', label=>'Aliases', value=>$svc_acct->cgp_aliases) %>
+ <% include('/view/elements/tr.html', label=>'Aliases', value=>$svc_acct->cgp_aliases) %>
%}
% if ( $svc_acct->pbxsvc ) {
- <% include('tr.html', label=>'PBX', value=>$svc_acct->pbx_title) %>
+ <% include('/view/elements/tr.html', label=>'PBX', value=>$svc_acct->pbx_title) %>
%}
% my $show_pw = '';
@@ -30,72 +30,72 @@
% $show_pw .= '<I>(hidden)</I>';
% }
% $password = '';
-<% include('tr.html', label=>'Password', value=>$show_pw) %>
+<% include('/view/elements/tr.html', label=>'Password', value=>$show_pw) %>
% if ( $conf->exists('security_phrase') ) {
- <%include('tr.html', label=>'Security phrase', value=>$svc_acct->sec_phrase)%>
+ <%include('/view/elements/tr.html', label=>'Security phrase', value=>$svc_acct->sec_phrase)%>
% }
% if ( $svc_acct->popnum ) {
% my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum});
- <% include('tr.html', label=>'Access number', value=>$svc_acct_pop->text) %>
+ <% include('/view/elements/tr.html', label=>'Access number', value=>$svc_acct_pop->text) %>
% }
% if ($svc_acct->uid ne '') {
- <% include('tr.html', label=>'UID', value=>$svc_acct->uid) %>
+ <% include('/view/elements/tr.html', label=>'UID', value=>$svc_acct->uid) %>
% }
% if ($svc_acct->gid ne '') {
- <% include('tr.html', label=>'GID', value=>$svc_acct->gid) %>
+ <% include('/view/elements/tr.html', label=>'GID', value=>$svc_acct->gid) %>
% }
% if ($svc_acct->finger ne '') {
- <% include('tr.html', label=>'Real Name', value=>$svc_acct->finger) %>
+ <% include('/view/elements/tr.html', label=>'Real Name', value=>$svc_acct->finger) %>
% }
% if ($svc_acct->dir ne '') {
- <% include('tr.html', label=>'Home directory', value=>$svc_acct->dir) %>
+ <% include('/view/elements/tr.html', label=>'Home directory', value=>$svc_acct->dir) %>
% }
% if ($svc_acct->shell ne '') {
- <% include('tr.html', label=>'Shell', value=>$svc_acct->shell) %>
+ <% include('/view/elements/tr.html', label=>'Shell', value=>$svc_acct->shell) %>
% }
% if ($svc_acct->quota ne '' && ! $opt{'communigate'} ) {
- <% include('tr.html', label=>'Quota', value=>$svc_acct->quota) %>
+ <% include('/view/elements/tr.html', label=>'Quota', value=>$svc_acct->quota) %>
% } elsif ( $opt{'communigate'} ) {
- <% include('tr.html', label=>'Mailbox type', value=>$svc_acct->cgp_type) %>
+ <% include('/view/elements/tr.html', label=>'Mailbox type', value=>$svc_acct->cgp_type) %>
- <% include('tr.html', label=>'Enabled services',
+ <% include('/view/elements/tr.html', label=>'Enabled services',
value=>$svc_acct->cgp_accessmodes ) %>
- <% include('tr.html', label=>'Mail storage limit',
+ <% include('/view/elements/tr.html', label=>'Mail storage limit',
value=>$svc_acct->quota ) %>
- <% include('tr.html', label=>'File storage limit',
+ <% include('/view/elements/tr.html', label=>'File storage limit',
value=>$svc_acct->file_quota ) %>
- <% include('tr.html', label=>'Number of files limit',
+ <% include('/view/elements/tr.html', label=>'Number of files limit',
value=>$svc_acct->file_maxnum ) %>
- <% include('tr.html', label=>'File size limit',
+ <% include('/view/elements/tr.html', label=>'File size limit',
value=>$svc_acct->file_maxsize ) %>
- <% include('tr.html', label=>'Message delete method',
+ <% include('/view/elements/tr.html', label=>'Message delete method',
value=>$svc_acct->cgp_deletemode ) %>
- <% include('tr.html', label=>'On logout remove trash',
+ <% include('/view/elements/tr.html', label=>'On logout remove trash',
value=>$svc_acct->cgp_emptytrash ) %>
% }
% if ($svc_acct->slipip) {
- <% include('tr.html',
+ <% include('/view/elements/tr.html',
label=>'IP address',
value=> ( $svc_acct->slipip eq "0.0.0.0" || $svc_acct->slipip eq '0e0' )
? "<I>(Dynamic)</I>"
@@ -112,7 +112,7 @@
% foreach my $attribute ( grep /^radius_/, $svc_acct->fields ) {
% $attribute =~ /^radius_(.*)$/;
% my $pattribute = $FS::raddb::attrib{$1};
- <% include('tr.html', label=>"Radius (reply) $pattribute",
+ <% include('/view/elements/tr.html', label=>"Radius (reply) $pattribute",
value=>$svc_acct->getfield($attribute)
)
%>
@@ -121,13 +121,13 @@
% foreach my $attribute ( grep /^rc_/, $svc_acct->fields ) {
% $attribute =~ /^rc_(.*)$/;
% my $pattribute = $FS::raddb::attrib{$1};
- <% include('tr.html', label=>"Radius (check) $pattribute",
+ <% include('/view/elements/tr.html', label=>"Radius (check) $pattribute",
value=>$svc_acct->getfield($attribute)
)
%>
% }
-<% include('tr.html', label=>'RADIUS groups',
+<% include('/view/elements/tr.html', label=>'RADIUS groups',
value=>join('<BR>', $svc_acct->radius_groups) ) %>
%# Can this be abstracted further? Maybe a library function like
diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi
index 3fd898ba5..3938a3406 100755
--- a/httemplate/view/svc_domain.cgi
+++ b/httemplate/view/svc_domain.cgi
@@ -18,181 +18,20 @@
<% include('/elements/error.html') %>
-Service #<B><% $svcnum %></B>
-% #if ( $conf->exists('svc_domain-edit_domain') ) {
- | <A HREF="<%$p%>edit/svc_domain.cgi?<%$svcnum%>">Edit this domain</A>
-% #}
-
-<% &ntable("#cccccc") %><TR><TD><% &ntable("#cccccc",2) %>
-
-<TR>
- <TD ALIGN="right">Service</TD>
- <TD BGCOLOR="#ffffff"><% $part_svc->svc %></TD>
-</TR>
-
-<TR>
- <TD ALIGN="right">Domain</TD>
- <TD BGCOLOR="#ffffff">
- <B><% $domain %></B>
- <A HREF="<% ${p} %>misc/whois.cgi?custnum=<%$custnum%>;svcnum=<%$svcnum%>;domain=<%$domain%>">(view whois information)</A>
- </TD>
-</TR>
-
-% if ($export) {
- <TR>
- <TD ALIGN="right">Registration status</TD>
- <TD BGCOLOR="#ffffff"><B><% $status %></B>
-
-% if ( $FS::CurrentUser::CurrentUser->access_right('Manage domain registration') ) {
-% if ( defined($ops{'register'}) ) {
- <A HREF="<% ${p} %>edit/process/domreg.cgi?op=register&svcnum=<% $svcnum %>">Register at <% $registrar->{'name'} %></A>&nbsp;
-% }
-% if ( defined($ops{'transfer'}) ) {
- <A HREF="<% ${p} %>edit/process/domreg.cgi?op=transfer&svcnum=<% $svcnum %>">Transfer to <% $registrar->{'name'} %></A>&nbsp;
-% }
-% if ( defined($ops{'renew'}) ) {
- <A HREF="<% ${p} %>edit/process/domreg.cgi?op=renew&svcnum=<% $svcnum %>&period=1">Renew at <% $registrar->{'name'} %></A>&nbsp;
-% }
-% if ( defined($ops{'revoke'}) ) {
- <A HREF="<% ${p} %>edit/process/domreg.cgi?op=revoke&svcnum=<% $svcnum %>">Revoke</A>
-% }
-% }
-
- </TD>
- </TR>
-% }
-
-% if ( $communigate ) {
-
- <TR>
- <TD ALIGN="right">Administrator domain</TD>
- <TD BGCOLOR="#ffffff">
-% if ( $svc_domain->parent_svcnum ) {
-% #XXX agent-virt aware the link
- <A HREF="svc_domain.cgi?<% $svc_domain->parent_svcnum %>"><% $svc_domain->parent_svc_x->domain %></A>
-% } else {
- <I>(none)</I>
-% }
- </TD>
- </TR>
-
- <TR>
- <TD ALIGN="right">Aliases</TD>
- <TD BGCOLOR="#ffffff"><% $svc_domain->cgp_aliases %></TD>
- </TR>
-
-% }
-
-% if ( $communigate && $svc_domain->max_accounts ) {
- <TR>
- <TD ALIGN="right">Maximum number of Accounts</TD>
- <TD BGCOLOR="#ffffff"><% $svc_domain->max_accounts %></TD>
- </TR>
-% }
-
-<TR>
- <TD ALIGN="right">Catch all email</TD>
- <TD BGCOLOR="#ffffff"><% $email ? "<B>$email</B>" : '<I>(none)</I>' %>
-% if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain catchall') ) {
- <A HREF="<% ${p} %>misc/catchall.cgi?<% $svcnum %>">(change)</A>
-% }
- </TD>
-</TR>
-
-<TR>
- <TD ALIGN="right">Enabled services</TD>
- <TD BGCOLOR="#ffffff"><% $svc_domain->cgp_accessmodes %></TD>
-</TR>
-
-</TABLE></TD></TR></TABLE>
+<% include('svc_domain/basics.html', $svc_domain,
+ 'part_svc' => $part_svc,
+ 'custnum' => $custnum,
+ )
+%>
<BR>
-<SCRIPT>
- function areyousure(href, message) {
- if ( confirm(message) == true )
- window.location.href = href;
- }
- function slave_areyousure() {
- return confirm("Remove all records and slave from " + document.SlaveForm.recdata.value + "?");
- }
-</SCRIPT>
-
-DNS records
-% my @records; if ( @records = $svc_domain->domain_record ) {
-
- <% include('/elements/table-grid.html') %>
-
-% my $bgcolor1 = '#eeeeee';
-% my $bgcolor2 = '#ffffff';
-% my $bgcolor = $bgcolor2;
-
- <tr>
- <th CLASS="grid" BGCOLOR="#cccccc">Zone</th>
- <th CLASS="grid" BGCOLOR="#cccccc">Type</th>
- <th CLASS="grid" BGCOLOR="#cccccc">Data</th>
- </tr>
-
-% foreach my $domain_record ( @records ) {
-% my $type = $domain_record->rectype eq '_mstr'
-% ? "(slave)"
-% : $domain_record->recaf. ' '. $domain_record->rectype;
-
-
- <tr>
- <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->reczone %></td>
- <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $type %></td>
- <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->recdata %>
-
-% unless ( $domain_record->rectype eq 'SOA'
-% || ! $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice')
-% ) {
-% ( my $recdata = $domain_record->recdata ) =~ s/"/\\'\\'/g;
- (<A HREF="javascript:areyousure('<%$p%>misc/delete-domain_record.cgi?<%$domain_record->recnum%>', 'Delete \'<% $domain_record->reczone %> <% $type %> <% $recdata %>\' ?' )">delete</A>)
-% }
- </td>
- </tr>
-
-
-% if ( $bgcolor eq $bgcolor1 ) {
-% $bgcolor = $bgcolor2;
-% } else {
-% $bgcolor = $bgcolor1;
-% }
-
-% }
-
- </table>
-% }
-
-% if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') ) {
- <FORM METHOD="POST" ACTION="<%$p%>edit/process/domain_record.cgi">
- <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
- <INPUT TYPE="text" NAME="reczone">
- <INPUT TYPE="hidden" NAME="recaf" VALUE="IN"> IN
- <SELECT NAME="rectype">
-% foreach (qw( A NS CNAME MX PTR TXT) ) {
- <OPTION VALUE="<%$_%>"><%$_%></OPTION>
-% }
- </SELECT>
- <INPUT TYPE="text" NAME="recdata">
- <INPUT TYPE="submit" VALUE="Add record">
- </FORM>
-
- <FORM NAME="SlaveForm" METHOD="POST" ACTION="<%$p%>edit/process/domain_record.cgi">
- <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
-% if ( @records ) {
- Delete all records and
-% }
- Or slave from nameserver IP
- <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
- <INPUT TYPE="hidden" NAME="reczone" VALUE="@">
- <INPUT TYPE="hidden" NAME="recaf" VALUE="IN">
- <INPUT TYPE="hidden" NAME="rectype" VALUE="_mstr">
- <INPUT TYPE="text" NAME="recdata">
- <INPUT TYPE="submit" VALUE="Slave domain" onClick="return slave_areyousure()">
- </FORM>
+<% include('svc_domain/acct_defaults.html', $svc_domain,
+ 'part_svc' => $part_svc,
+ )
+%>
+<BR>
-% }
+<% include('svc_domain/dns.html', $svc_domain ) %>
<BR>
<% include('elements/svc_export_settings.html', $svc_domain) %>
@@ -238,43 +77,6 @@ if ($pkgnum) {
my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } );
die "Unknown svcpart" unless $part_svc;
-my $email = '';
-if ($svc_domain->catchall) {
- my $svc_acct = qsearchs('svc_acct',{'svcnum'=> $svc_domain->catchall } );
- die "Unknown svcpart" unless $svc_acct;
- $email = $svc_acct->email;
-}
-
my $domain = $svc_domain->domain;
-my $communigate = scalar($part_svc->part_export('communigate_pro'));
- # || scalar($part_svc->part_export('communigate_pro_singledomain'));
-
-# Find the first export that does domain registration
-my @exports = grep $_->can('registrar'), $part_svc->part_export;
-my $export = $exports[0];
-# If we have a domain registration export, get the registrar object
-my $registrar;
-my $status = 'Unknown';
-my %ops = ();
-if ($export) {
- $registrar = $export->registrar;
- my $domstat = $export->get_status( $svc_domain );
- if (defined($domstat->{'message'})) {
- $status = $domstat->{'message'};
- } elsif (defined($domstat->{'unregistered'})) {
- $status = 'Not registered';
- $ops{'register'} = "Register";
- } elsif (defined($domstat->{'status'})) {
- $status = $domstat->{'status'} . ' ' . $domstat->{'contact_email'} . ' ' . $domstat->{'last_update_time'};
- } elsif (defined($domstat->{'expdate'})) {
- $status = "Expires " . $domstat->{'expdate'};
- $ops{'renew'} = "Renew";
- $ops{'revoke'} = "Revoke";
- } else {
- $status = $domstat->{'reason'};
- $ops{'transfer'} = "Transfer";
- }
-}
-
</%init>
diff --git a/httemplate/view/svc_domain/acct_defaults.html b/httemplate/view/svc_domain/acct_defaults.html
new file mode 100644
index 000000000..0c072bff5
--- /dev/null
+++ b/httemplate/view/svc_domain/acct_defaults.html
@@ -0,0 +1,71 @@
+% if ( $communigate ) {
+
+ Account defaults
+ <% &ntable("#cccccc") %><TR><TD><% &ntable("#cccccc",2) %>
+
+ <% include('/view/elements/tr.html',
+ label=>'Password modification',
+ value=>$svc_domain->acct_def_password_selfchange ? 'YES' : 'NO',
+ )
+ %>
+ <% include('/view/elements/tr.html',
+ label=>'Password recovery',
+ value=>$svc_domain->acct_def_password_recover ? 'YES' : 'NO',
+ )
+ %>
+
+ <% include('/view/elements/tr.html',
+ label=>'Enabled services',
+ value=>$svc_domain->acct_def_cgp_accessmodes,
+ )
+ %>
+
+ <% include('/view/elements/tr.html',
+ label=>'Mail storage limit',
+ value=>$svc_domain->acct_def_quota,
+ )
+ %>
+
+ <% include('/view/elements/tr.html',
+ label=>'File storage limit',
+ value=>$svc_domain->acct_def_file_quota,
+ )
+ %>
+
+ <% include('/view/elements/tr.html',
+ label=>'Files limt',
+ value=>$svc_domain->acct_def_file_maxnum,
+ )
+ %>
+
+ <% include('/view/elements/tr.html',
+ label=>'File size limit',
+ value=>$svc_domain->acct_def_file_maxsize,
+ )
+ %>
+
+ <% include('/view/elements/tr.html',
+ label=>'Message delete method',
+ value=>$svc_domain->acct_def_cgp_deletemode,
+ )
+ %>
+
+ <% include('/view/elements/tr.html',
+ label=>'On logout remove trash',
+ value=>$svc_domain->acct_def_cgp_emptytrash,
+ )
+ %>
+
+ </TABLE></TD></TR></TABLE>
+
+% }
+<%init>
+
+my($svc_domain, %opt) = @_;
+
+my $part_svc = $opt{'part_svc'};
+
+my $communigate = scalar($part_svc->part_export('communigate_pro'));
+ # || scalar($part_svc->part_export('communigate_pro_singledomain'));
+
+</%init>
diff --git a/httemplate/view/svc_domain/basics.html b/httemplate/view/svc_domain/basics.html
new file mode 100644
index 000000000..db4fac150
--- /dev/null
+++ b/httemplate/view/svc_domain/basics.html
@@ -0,0 +1,134 @@
+Service #<B><% $svcnum %></B>
+% #if ( $conf->exists('svc_domain-edit_domain') ) {
+ | <A HREF="<%$p%>edit/svc_domain.cgi?<%$svcnum%>">Edit this domain</A>
+% #}
+
+<% &ntable("#cccccc") %><TR><TD><% &ntable("#cccccc",2) %>
+
+<TR>
+ <TD ALIGN="right">Service</TD>
+ <TD BGCOLOR="#ffffff"><% $part_svc->svc %></TD>
+</TR>
+
+<TR>
+ <TD ALIGN="right">Domain</TD>
+ <TD BGCOLOR="#ffffff">
+ <B><% $domain %></B>
+ <A HREF="<% ${p} %>misc/whois.cgi?custnum=<%$custnum%>;svcnum=<%$svcnum%>;domain=<%$domain%>">(view whois information)</A>
+ </TD>
+</TR>
+
+% if ($export) {
+ <TR>
+ <TD ALIGN="right">Registration status</TD>
+ <TD BGCOLOR="#ffffff"><B><% $status %></B>
+
+% if ( $FS::CurrentUser::CurrentUser->access_right('Manage domain registration') ) {
+% if ( defined($ops{'register'}) ) {
+ <A HREF="<% ${p} %>edit/process/domreg.cgi?op=register&svcnum=<% $svcnum %>">Register at <% $registrar->{'name'} %></A>&nbsp;
+% }
+% if ( defined($ops{'transfer'}) ) {
+ <A HREF="<% ${p} %>edit/process/domreg.cgi?op=transfer&svcnum=<% $svcnum %>">Transfer to <% $registrar->{'name'} %></A>&nbsp;
+% }
+% if ( defined($ops{'renew'}) ) {
+ <A HREF="<% ${p} %>edit/process/domreg.cgi?op=renew&svcnum=<% $svcnum %>&period=1">Renew at <% $registrar->{'name'} %></A>&nbsp;
+% }
+% if ( defined($ops{'revoke'}) ) {
+ <A HREF="<% ${p} %>edit/process/domreg.cgi?op=revoke&svcnum=<% $svcnum %>">Revoke</A>
+% }
+% }
+
+ </TD>
+ </TR>
+% }
+
+% if ( $communigate ) {
+
+ <TR>
+ <TD ALIGN="right">Administrator domain</TD>
+ <TD BGCOLOR="#ffffff">
+% if ( $svc_domain->parent_svcnum ) {
+% #XXX agent-virt aware the link
+ <A HREF="svc_domain.cgi?<% $svc_domain->parent_svcnum %>"><% $svc_domain->parent_svc_x->domain %></A>
+% } else {
+ <I>(none)</I>
+% }
+ </TD>
+ </TR>
+
+ <TR>
+ <TD ALIGN="right">Aliases</TD>
+ <TD BGCOLOR="#ffffff"><% $svc_domain->cgp_aliases %></TD>
+ </TR>
+
+% }
+
+% if ( $communigate && $svc_domain->max_accounts ) {
+ <TR>
+ <TD ALIGN="right">Maximum number of Accounts</TD>
+ <TD BGCOLOR="#ffffff"><% $svc_domain->max_accounts %></TD>
+ </TR>
+% }
+
+<TR>
+ <TD ALIGN="right">Catch all email</TD>
+ <TD BGCOLOR="#ffffff"><% $email ? "<B>$email</B>" : '<I>(none)</I>' %>
+% if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain catchall') ) {
+ <A HREF="<% ${p} %>misc/catchall.cgi?<% $svcnum %>">(change)</A>
+% }
+ </TD>
+</TR>
+
+<TR>
+ <TD ALIGN="right">Enabled services</TD>
+ <TD BGCOLOR="#ffffff"><% $svc_domain->cgp_accessmodes %></TD>
+</TR>
+
+</TABLE></TD></TR></TABLE>
+
+<%init>
+
+my($svc_domain, %opt) = @_;
+my $svcnum = $svc_domain->svcnum;
+my $domain = $svc_domain->domain;
+my $custnum = $opt{'custnum'};
+my $part_svc = $opt{'part_svc'};
+
+my $communigate = scalar($part_svc->part_export('communigate_pro'));
+ # || scalar($part_svc->part_export('communigate_pro_singledomain'));
+
+my $email = '';
+if ($svc_domain->catchall) {
+ my $svc_acct = qsearchs('svc_acct',{'svcnum'=> $svc_domain->catchall } );
+ die "Unknown svcpart" unless $svc_acct;
+ $email = $svc_acct->email;
+}
+
+# Find the first export that does domain registration
+my @exports = grep $_->can('registrar'), $part_svc->part_export;
+my $export = $exports[0];
+# If we have a domain registration export, get the registrar object
+my $registrar;
+my $status = 'Unknown';
+my %ops = ();
+if ($export) {
+ $registrar = $export->registrar;
+ my $domstat = $export->get_status( $svc_domain );
+ if (defined($domstat->{'message'})) {
+ $status = $domstat->{'message'};
+ } elsif (defined($domstat->{'unregistered'})) {
+ $status = 'Not registered';
+ $ops{'register'} = "Register";
+ } elsif (defined($domstat->{'status'})) {
+ $status = $domstat->{'status'} . ' ' . $domstat->{'contact_email'} . ' ' . $domstat->{'last_update_time'};
+ } elsif (defined($domstat->{'expdate'})) {
+ $status = "Expires " . $domstat->{'expdate'};
+ $ops{'renew'} = "Renew";
+ $ops{'revoke'} = "Revoke";
+ } else {
+ $status = $domstat->{'reason'};
+ $ops{'transfer'} = "Transfer";
+ }
+}
+
+</%init>
diff --git a/httemplate/view/svc_domain/dns.html b/httemplate/view/svc_domain/dns.html
new file mode 100644
index 000000000..f6f8c71c7
--- /dev/null
+++ b/httemplate/view/svc_domain/dns.html
@@ -0,0 +1,94 @@
+<SCRIPT>
+ function areyousure(href, message) {
+ if ( confirm(message) == true )
+ window.location.href = href;
+ }
+ function slave_areyousure() {
+ return confirm("Remove all records and slave from " + document.SlaveForm.recdata.value + "?");
+ }
+</SCRIPT>
+
+DNS records
+% my @records; if ( @records = $svc_domain->domain_record ) {
+
+ <% include('/elements/table-grid.html') %>
+
+% my $bgcolor1 = '#eeeeee';
+% my $bgcolor2 = '#ffffff';
+% my $bgcolor = $bgcolor2;
+
+ <tr>
+ <th CLASS="grid" BGCOLOR="#cccccc">Zone</th>
+ <th CLASS="grid" BGCOLOR="#cccccc">Type</th>
+ <th CLASS="grid" BGCOLOR="#cccccc">Data</th>
+ </tr>
+
+% foreach my $domain_record ( @records ) {
+% my $type = $domain_record->rectype eq '_mstr'
+% ? "(slave)"
+% : $domain_record->recaf. ' '. $domain_record->rectype;
+
+
+ <tr>
+ <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->reczone %></td>
+ <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $type %></td>
+ <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->recdata %>
+
+% unless ( $domain_record->rectype eq 'SOA'
+% || ! $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice')
+% ) {
+% ( my $recdata = $domain_record->recdata ) =~ s/"/\\'\\'/g;
+ (<A HREF="javascript:areyousure('<%$p%>misc/delete-domain_record.cgi?<%$domain_record->recnum%>', 'Delete \'<% $domain_record->reczone %> <% $type %> <% $recdata %>\' ?' )">delete</A>)
+% }
+ </td>
+ </tr>
+
+
+% if ( $bgcolor eq $bgcolor1 ) {
+% $bgcolor = $bgcolor2;
+% } else {
+% $bgcolor = $bgcolor1;
+% }
+
+% }
+
+ </table>
+% }
+
+% if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') ) {
+ <FORM METHOD="POST" ACTION="<%$p%>edit/process/domain_record.cgi">
+ <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
+ <INPUT TYPE="text" NAME="reczone">
+ <INPUT TYPE="hidden" NAME="recaf" VALUE="IN"> IN
+ <SELECT NAME="rectype">
+% foreach (qw( A NS CNAME MX PTR TXT) ) {
+ <OPTION VALUE="<%$_%>"><%$_%></OPTION>
+% }
+ </SELECT>
+ <INPUT TYPE="text" NAME="recdata">
+ <INPUT TYPE="submit" VALUE="Add record">
+ </FORM>
+
+ <FORM NAME="SlaveForm" METHOD="POST" ACTION="<%$p%>edit/process/domain_record.cgi">
+ <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
+% if ( @records ) {
+ Delete all records and
+% }
+ Or slave from nameserver IP
+ <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
+ <INPUT TYPE="hidden" NAME="reczone" VALUE="@">
+ <INPUT TYPE="hidden" NAME="recaf" VALUE="IN">
+ <INPUT TYPE="hidden" NAME="rectype" VALUE="_mstr">
+ <INPUT TYPE="text" NAME="recdata">
+ <INPUT TYPE="submit" VALUE="Slave domain" onClick="return slave_areyousure()">
+ </FORM>
+
+% }
+
+<%init>
+
+my($svc_domain, %opt) = @_;
+my $svcnum = $svc_domain->svcnum;
+
+</%init>
+