diff options
author | ivan <ivan> | 2002-03-18 09:10:12 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-03-18 09:10:12 +0000 |
commit | daac302e231e2e09b84e771c0413b0f2119c52e8 (patch) | |
tree | bbe52639e866c9016ebe2d342308ee92de2532ab | |
parent | 697dfd9ac2dfa36aa244e6d2d9f2e8f8a364a120 (diff) |
new config value `defaultrecords', documentation, javascript config file editor
-rw-r--r-- | FS/FS/Conf.pm | 22 | ||||
-rw-r--r-- | FS/FS/svc_domain.pm | 85 | ||||
-rw-r--r-- | README.1.4.0pre12 | 2 | ||||
-rw-r--r-- | httemplate/config/config-process.cgi | 6 | ||||
-rw-r--r-- | httemplate/config/config-view.cgi | 4 | ||||
-rw-r--r-- | httemplate/config/config.cgi | 51 | ||||
-rw-r--r-- | httemplate/docs/upgrade8.html | 3 |
7 files changed, 81 insertions, 92 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 5dba387fe..18725ced2 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -437,28 +437,40 @@ httemplate/docs/config.html { 'key' => 'mxmachines', - 'section' => 'BIND', + 'section' => 'deprecated', 'description' => 'MX entries for new domains, weight and machine, one per line, with trailing `.\'', 'type' => 'textarea', }, { 'key' => 'nsmachines', - 'section' => 'BIND', + 'section' => 'deprecated', 'description' => 'NS nameservers for new domains, one per line, with trailing `.\'', 'type' => 'textarea', }, { - 'key' => 'arecords', + 'key' => 'defaultrecords', 'section' => 'BIND', - 'description' => 'A list of tab seperated A records to add automatically when creating a domain', + 'description' => 'DNS entries add automatically when creating a domain', + 'type' => 'editlist', + 'editlist_parts' => [ { type=>'text' }, + { type=>'immutable', value=>'IN' }, + { type=>'select', + select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS)} }, + { type=> 'text' }, ], + }, + + { + 'key' => 'arecords', + 'section' => 'deprecated', + 'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain', 'type' => 'textarea', }, { 'key' => 'cnamerecords', - 'section' => 'BIND', + 'section' => 'deprecated', 'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain', 'type' => 'textarea', }, diff --git a/FS/FS/svc_domain.pm b/FS/FS/svc_domain.pm index 1e16ba87f..d01a403d1 100644 --- a/FS/FS/svc_domain.pm +++ b/FS/FS/svc_domain.pm @@ -2,8 +2,8 @@ package FS::svc_domain; use strict; use vars qw( @ISA $whois_hack $conf $smtpmachine - @mxmachines @nsmachines $soadefaultttl $soaemail $soaexpire $soamachine - $soarefresh $soaretry $qshellmachine $nossh_hack %arecords %cnamerecords + @defaultrecords $soadefaultttl $soaemail $soaexpire $soamachine + $soarefresh $soaretry $qshellmachine $nossh_hack ); use Carp; use Mail::Internet; @@ -29,10 +29,7 @@ $FS::UID::callback{'FS::domain'} = sub { $smtpmachine = $conf->config('smtpmachine'); - %arecords = map { split /\t/ } $conf->config('arecords'); - %cnamerecords = map { split /\t/ } $conf->config('cnamerecords'); - @mxmachines = $conf->config('mxmachines'); - @nsmachines = $conf->config('nsmachines'); + @defaultrecords = $conf->config('defaultrecords'); $soadefaultttl = $conf->config('soadefaultttl'); $soaemail = $conf->config('soaemail'); $soaexpire = $conf->config('soaexpire'); @@ -119,15 +116,9 @@ in the same package, it is automatically used. Otherwise an error is returned. If any I<soamachine> configuration file exists, an SOA record is added to the domain_record table (see <FS::domain_record>). -If any machines are defined in the I<nsmachines> configuration file, NS -records are added to the domain_record table (see L<FS::domain_record>). - -If any machines are defined in the I<mxmachines> configuration file, MX -records are added to the domain_record table (see L<FS::domain_record>). - -If the I<arecords> configuration file exits, A records are added to the -domain_record table. The I<cnamerecords> file does the same thing for -CNAME records. +If any records are defined in the I<defaultrecords> configuration file, +appropriate records are added to the domain_record table (see +L<FS::domain_record>). If a machine is defined in the I<shellmachine> configuration value, the I<qmailmachines> configuration file exists, and the I<catchall> field points @@ -200,63 +191,19 @@ sub insert { return "couldn't insert SOA record for new domain: $error"; } - foreach my $nsmachine ( @nsmachines ) { - my $ns = new FS::domain_record { - 'svcnum' => $self->svcnum, - 'reczone' => '@', - 'recaf' => 'IN', - 'rectype' => 'NS', - 'recdata' => $nsmachine, - }; - my $error = $ns->insert; - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return "couldn't insert NS record for new domain: $error"; - } - } - - foreach my $mxmachine ( @mxmachines ) { - my $mx = new FS::domain_record { - 'svcnum' => $self->svcnum, - 'reczone' => '@', - 'recaf' => 'IN', - 'rectype' => 'MX', - 'recdata' => $mxmachine, - }; - my $error = $mx->insert; - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return "couldn't insert MX record for new domain: $error"; - } - } - - foreach my $arecord ( keys %arecords ) { - my $arec = new FS::domain_record { - 'svcnum' => $self->svcnum, - 'reczone' => $arecord, - 'recaf' => 'IN', - 'rectype' => 'A', - 'recdata' => $arecords{$arecord}, - }; - my $error = $arec->insert; - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return "WARNING: couldn't insert A record for new domain: $error"; - } - } - - foreach my $cnamerecord ( keys %cnamerecords ) { - my $cnamerec = new FS::domain_record { + foreach my $record ( @defaultrecords ) { + my($zone,$af,$type,$data) = split(/\s+/,$record,4); + my $record = new FS::domain_record { 'svcnum' => $self->svcnum, - 'reczone' => $cnamerecord, - 'recaf' => 'IN', - 'rectype' => 'CNAME', - 'recdata' => $cnamerecords{$cnamerecord}, + 'reczone' => $zone, + 'recaf' => $af, + 'rectype' => $type, + 'recdata' => $data, }; - my $error = $cnamerec->insert; + my $error = $record->insert; if ( $error ) { $dbh->rollback if $oldAutoCommit; - return "WARNING: couldn't insert CNAME record for new domain: $error"; + return "couldn't insert record for new domain: $error"; } } @@ -460,7 +407,7 @@ sub submit_internic { =head1 VERSION -$Id: svc_domain.pm,v 1.25 2002-03-09 10:19:38 khoff Exp $ +$Id: svc_domain.pm,v 1.26 2002-03-18 09:10:12 ivan Exp $ =head1 BUGS diff --git a/README.1.4.0pre12 b/README.1.4.0pre12 index 824b7fd86..c801a2604 100644 --- a/README.1.4.0pre12 +++ b/README.1.4.0pre12 @@ -25,3 +25,5 @@ Arrange for freeside-expiration-alerter to be run daily, if desired. Restart Apache and freeside-queued +the mxmachines, nsmachines, arecords and cnamerecords configuration values have been deprecated. Use the defaultrecords configuration value instead. + diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index a296abfe4..38d9af0db 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -32,6 +32,12 @@ } else { $conf->delete($i->key); } + } elsif ( $type eq 'editlist' || $type eq 'selectmultiple' ) { + if ( scalar(@{[ $cgi->param($i->key. $n) ]}) ) { + $conf->set($i->key, join("\n", $cgi->param($i->key. $n) )); + } else { + $conf->delete($i->key); + } } else { } $n++; diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 917cc7316..d40c4dc10 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -8,6 +8,7 @@ shell mail radius apache BIND ), '', 'deprecated') { %> + <A NAME="<%= $section || 'unclassified' %>"></A> <FONT SIZE="-2"> <% foreach my $nav_section ( qw(required billing username password UI session shell mail radius apache BIND @@ -16,11 +17,10 @@ <% if ( $section eq $nav_section ) { %> [<A NAME="not<%= $nav_section || 'unclassified' %>" style="background-color: #cccccc"><%= ucfirst($nav_section || 'unclassified') %></A>] <% } else { %> - [<A HREF="#<%= $nav_section %>"><%= ucfirst($nav_section || 'unclassified') %></A>] + [<A HREF="#<%= $nav_section || 'unclassified' %>"><%= ucfirst($nav_section || 'unclassified') %></A>] <% } %> <% } %> </FONT><BR> - <A NAME="<%= $section || 'unclassified' %>"></A> <%= table("#cccccc", 2) %> <tr> <th colspan="2" bgcolor="#dcdcdc"> diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi index 155dcfdbc..5013de0dc 100644 --- a/httemplate/config/config.cgi +++ b/httemplate/config/config.cgi @@ -2,25 +2,33 @@ <%= header('Edit Configuration', menubar( 'Main Menu' => $p ) ) %> <SCRIPT> var gSafeOnload = new Array(); +var gSafeOnsubmit = new Array(); window.onload = SafeOnload; function SafeAddOnLoad(f) { gSafeOnload[gSafeOnload.length] = f; } -function SafeOnload() -{ +function SafeOnload() { for (var i=0;i<gSafeOnload.length;i++) gSafeOnload[i](); } +function SafeAddOnSubmit(f) { + gSafeOnsubmit[gSafeOnsubmit.length] = f; +} +function SafeOnsubmit() { + for (var i=0;i<gSafeOnsubmit.length;i++) + gSafeOnsubmit[i](); +} </SCRIPT> <% my $conf = new FS::Conf; my @config_items = $conf->config_items; %> -<form name="OneTrueForm" action="config-process.cgi" METHOD="POST"> +<form name="OneTrueForm" action="config-process.cgi" METHOD="POST" onSubmit="SafeOnsubmit()"> <% foreach my $section ( qw(required billing username password UI session shell mail radius apache BIND ), '', 'deprecated') { %> + <A NAME="<%= $section || 'unclassified' %>"></A> <FONT SIZE="-2"> <% foreach my $nav_section ( qw(required billing username password UI session shell mail radius apache BIND @@ -29,11 +37,10 @@ function SafeOnload() <% if ( $section eq $nav_section ) { %> [<A NAME="not<%= $nav_section || 'unclassified' %>" style="background-color: #cccccc"><%= ucfirst($nav_section || 'unclassified') %></A>] <% } else { %> - [<A HREF="#<%= $nav_section %>"><%= ucfirst($nav_section || 'unclassified') %></A>] + [<A HREF="#<%= $nav_section || 'unclassified' %>"><%= ucfirst($nav_section || 'unclassified') %></A>] <% } %> <% } %> </FONT><BR> - <A NAME="<%= $section || 'unclassified' %>"></A> <%= table("#cccccc", 2) %> <tr> <th colspan="2" bgcolor="#dcdcdc"> @@ -65,6 +72,7 @@ function SafeOnload() <% if ( $conf->exists($i->key) && $conf->config($i->key) && ! grep { $conf->config($i->key) eq $_ } @{$i->select_enum}) { %> <option value=<%= $conf->config($i->key) %> SELECTED><%= conf->config($i->key) %> <% } %> + </select> <% } elsif ( $type eq 'editlist' ) { %> <script> function doremove<%= $i->key. $n %>() { @@ -77,6 +85,12 @@ function SafeOnload() function deleteOption<%= $i->key. $n %>(object,index) { object.options[index] = null; } + function selectall<%= $i->key. $n %>() { + fromObject = document.OneTrueForm.<%= $i->key. $n %>; + for (var i=fromObject.options.length-1;i>-1;i--) { + fromObject.options[i].selected = true; + } + } function doadd<%= $i->key. $n %>(object) { var myvalue = ""; <% if ( defined($i->editlist_parts) ) { %> @@ -105,16 +119,19 @@ function SafeOnload() } </script> <select multiple size=5 name="<%= $i->key. $n %>"> - <option selected>--------------------------------</option> + <option selected>----------------------------------------------------------------</option> <% foreach my $line ( $conf->config($i->key) ) { %> - <option value="$line">$line</option> + <option value="<%= $line %>"><%= $line %></option> <% } %> </select><br> <input type="button" value="remove selected" onClick="doremove<%= $i->key. $n %>()"> - <script>SafeAddOnLoad(doremove<%= $i->key. $n %>)</script> + <script>SafeAddOnLoad(doremove<%= $i->key. $n %>); + SafeAddOnSubmit(selectall<%= $i->key. $n %>);</script> <br> + <%= itable() %><tr> <% if ( defined $i->editlist_parts ) { %> <% my $pnum=0; foreach my $part ( @{$i->editlist_parts} ) { %> + <td> <% if ( $part->{type} eq 'text' ) { %> <input type="text" name="add<%= $i->key. $n."_$pnum" %>"> <% } elsif ( $part->{type} eq 'immutable' ) { %> @@ -128,11 +145,13 @@ function SafeOnload() <% } else { %> <font color="#ff0000">unknown type <%= $part->type %></font> <% } %> + </td> <% $pnum++; } %> <% } else { %> - <input type="text" name="add<%= $i->key. $n %>_0"> + <td><input type="text" name="add<%= $i->key. $n %>_0"></td> <% } %> - <input type="button" value="add" onClick="doadd<%= $i->key. $n %>(this.form)"> + <td><input type="button" value="add" onClick="doadd<%= $i->key. $n %>(this.form)"></td> + </tr></table> <% } else { %> <font color="#ff0000">unknown type <%= $type %></font> <% } %> @@ -143,13 +162,15 @@ function SafeOnload() </a></td> </tr> <% } %> - </table><br><br> -<% } %> + </table><br> -You may need to restart Apache and/or freeside-queued for configuration -changes to take effect.<BR> + You may need to restart Apache and/or freeside-queued for configuration + changes to take effect.<br> + + <input type="submit" value="Apply changes"><br><br> + +<% } %> -<input type="submit" value="Apply changes"> </form> </body></html> diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 2640be419..25e766b1e 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -308,8 +308,9 @@ ALTER TABLE cust_refund DROP COLUMN crednum; <li><b>IMPORTANT</b>: run bin/create-history-tables <li><b>IMPORTANT: After running bin/create-history-tables</b>, run bin/dbdef-create again. <li>set the <a href="../config/config.cgi#username_policy">user_policy configuration value</a> as appropriate for your site. + <li>the mxmachines, nsmachines, arecords and cnamerecords configuration values have been deprecated. Set the <a href="../config/config.cgi#defaultrecords">defaultrecords configuration value</a> instead. <li>Create the `/usr/local/etc/freeside/cache.<i>datasrc</i>' directory - (ownded by the freeside user). + (owned by the freeside user). <li>freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup. <li>Set appropriate <a href="../browse/part_bill_event.cgi">invoice events</a> for your site. At the very least, you'll want to set some invoice events "<i>After 0 days</i>": a <i>BILL</i> invoice event to print invoices, a <i>CARD</i> invoice event to batch or run cards real-time, and a <i>COMP</i> invoice event to "pay" complimentary customers. If you were using the <i>-i</i> option to <a href="man/bin/freeside-bill.html">freeside-bill</a> it should be removed. <li>Use <a href="man/bin/freeside-daily.html">freeside-daily</a> instead of <a href="man/bin/freeside-bill.html">freeside-bill</a>. |