From 5fa9ce1b7c8b934e96a6a2f850a4e788eb76f495 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 22 Feb 2010 09:18:10 +0000 Subject: communigate: domain account defaults, RT#7083 --- httemplate/view/elements/tr.html | 9 ++ httemplate/view/svc_acct/basics.html | 52 +++--- httemplate/view/svc_domain.cgi | 220 ++------------------------ httemplate/view/svc_domain/acct_defaults.html | 71 +++++++++ httemplate/view/svc_domain/basics.html | 134 ++++++++++++++++ httemplate/view/svc_domain/dns.html | 94 +++++++++++ 6 files changed, 345 insertions(+), 235 deletions(-) create mode 100644 httemplate/view/elements/tr.html create mode 100644 httemplate/view/svc_domain/acct_defaults.html create mode 100644 httemplate/view/svc_domain/basics.html create mode 100644 httemplate/view/svc_domain/dns.html (limited to 'httemplate/view') 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 @@ + + <% $opt{'label'} %> + <% $opt{'value'} %> + +<%init> + +my %opt = @_; + + 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") %><% &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 .= '(hidden)'; % } % $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' ) ? "(Dynamic)" @@ -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('
', $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 #<% $svcnum %> -% #if ( $conf->exists('svc_domain-edit_domain') ) { - | Edit this domain -% #} - -<% &ntable("#cccccc") %><% &ntable("#cccccc",2) %> - - - Service - <% $part_svc->svc %> - - - - Domain - - <% $domain %> - (view whois information) - - - -% if ($export) { - - Registration status - <% $status %> - -% if ( $FS::CurrentUser::CurrentUser->access_right('Manage domain registration') ) { -% if ( defined($ops{'register'}) ) { - Register at <% $registrar->{'name'} %>  -% } -% if ( defined($ops{'transfer'}) ) { - Transfer to <% $registrar->{'name'} %>  -% } -% if ( defined($ops{'renew'}) ) { - Renew at <% $registrar->{'name'} %>  -% } -% if ( defined($ops{'revoke'}) ) { - Revoke -% } -% } - - - -% } - -% if ( $communigate ) { - - - Administrator domain - -% if ( $svc_domain->parent_svcnum ) { -% #XXX agent-virt aware the link - <% $svc_domain->parent_svc_x->domain %> -% } else { - (none) -% } - - - - - Aliases - <% $svc_domain->cgp_aliases %> - - -% } - -% if ( $communigate && $svc_domain->max_accounts ) { - - Maximum number of Accounts - <% $svc_domain->max_accounts %> - -% } - - - Catch all email - <% $email ? "$email" : '(none)' %> -% if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain catchall') ) { - (change) -% } - - - - - Enabled services - <% $svc_domain->cgp_accessmodes %> - - - +<% include('svc_domain/basics.html', $svc_domain, + 'part_svc' => $part_svc, + 'custnum' => $custnum, + ) +%>
- - -DNS records -% my @records; if ( @records = $svc_domain->domain_record ) { - - <% include('/elements/table-grid.html') %> - -% my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor = $bgcolor2; - - - Zone - Type - Data - - -% foreach my $domain_record ( @records ) { -% my $type = $domain_record->rectype eq '_mstr' -% ? "(slave)" -% : $domain_record->recaf. ' '. $domain_record->rectype; - - - - <% $domain_record->reczone %> - <% $type %> - <% $domain_record->recdata %> - -% unless ( $domain_record->rectype eq 'SOA' -% || ! $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') -% ) { -% ( my $recdata = $domain_record->recdata ) =~ s/"/\\'\\'/g; - (delete) -% } - - - - -% if ( $bgcolor eq $bgcolor1 ) { -% $bgcolor = $bgcolor2; -% } else { -% $bgcolor = $bgcolor1; -% } - -% } - - -% } - -% if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') ) { -
- - - IN - - - -
- -
- -% if ( @records ) { - Delete all records and -% } - Or slave from nameserver IP - - - - - - -
+<% include('svc_domain/acct_defaults.html', $svc_domain, + 'part_svc' => $part_svc, + ) +%> +
-% } +<% include('svc_domain/dns.html', $svc_domain ) %>
<% 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"; - } -} - 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") %><% &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, + ) + %> + + + +% } +<%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')); + + 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 #<% $svcnum %> +% #if ( $conf->exists('svc_domain-edit_domain') ) { + | Edit this domain +% #} + +<% &ntable("#cccccc") %><% &ntable("#cccccc",2) %> + + + Service + <% $part_svc->svc %> + + + + Domain + + <% $domain %> + (view whois information) + + + +% if ($export) { + + Registration status + <% $status %> + +% if ( $FS::CurrentUser::CurrentUser->access_right('Manage domain registration') ) { +% if ( defined($ops{'register'}) ) { + Register at <% $registrar->{'name'} %>  +% } +% if ( defined($ops{'transfer'}) ) { + Transfer to <% $registrar->{'name'} %>  +% } +% if ( defined($ops{'renew'}) ) { + Renew at <% $registrar->{'name'} %>  +% } +% if ( defined($ops{'revoke'}) ) { + Revoke +% } +% } + + + +% } + +% if ( $communigate ) { + + + Administrator domain + +% if ( $svc_domain->parent_svcnum ) { +% #XXX agent-virt aware the link + <% $svc_domain->parent_svc_x->domain %> +% } else { + (none) +% } + + + + + Aliases + <% $svc_domain->cgp_aliases %> + + +% } + +% if ( $communigate && $svc_domain->max_accounts ) { + + Maximum number of Accounts + <% $svc_domain->max_accounts %> + +% } + + + Catch all email + <% $email ? "$email" : '(none)' %> +% if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain catchall') ) { + (change) +% } + + + + + Enabled services + <% $svc_domain->cgp_accessmodes %> + + + + +<%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"; + } +} + + 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 @@ + + +DNS records +% my @records; if ( @records = $svc_domain->domain_record ) { + + <% include('/elements/table-grid.html') %> + +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = $bgcolor2; + + + Zone + Type + Data + + +% foreach my $domain_record ( @records ) { +% my $type = $domain_record->rectype eq '_mstr' +% ? "(slave)" +% : $domain_record->recaf. ' '. $domain_record->rectype; + + + + <% $domain_record->reczone %> + <% $type %> + <% $domain_record->recdata %> + +% unless ( $domain_record->rectype eq 'SOA' +% || ! $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') +% ) { +% ( my $recdata = $domain_record->recdata ) =~ s/"/\\'\\'/g; + (delete) +% } + + + + +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } + +% } + + +% } + +% if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') ) { +
+ + + IN + + + +
+ +
+ +% if ( @records ) { + Delete all records and +% } + Or slave from nameserver IP + + + + + + +
+ +% } + +<%init> + +my($svc_domain, %opt) = @_; +my $svcnum = $svc_domain->svcnum; + + + -- cgit v1.2.1