Changeset 446
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r445 r446 1979 1979 my $dbh = shift; 1980 1980 my $zone = NetAddr::IP->new(shift); 1981 1981 1982 return ('FAIL',"Zone name must be a valid CIDR netblock") unless ($zone && $zone->addr !~ /^0/); 1982 1983 my $revpatt = shift; # construct a custom (A/AAAA+)? PTR template record 1983 1984 my $group = shift; 1984 1985 my $state = shift; 1986 my $defloc = shift || ''; 1985 1987 1986 1988 $state = 1 if $state =~ /^active$/; … … 2007 2009 # Wrap all the SQL in a transaction 2008 2010 eval { 2009 # insert the domain... 2010 $dbh->do("INSERT INTO revzones (revnet,group_id,status) VALUES (?,?,?)", undef, ($zone, $group, $state)); 2011 # insert the zone... 2012 $dbh->do("INSERT INTO revzones (revnet,group_id,status,default_location) VALUES (?,?,?,?)", undef, 2013 ($zone, $group, $state, $defloc) ); 2011 2014 2012 2015 # get the ID... … … 2018 2021 # ... and now we construct the standard records from the default set. NB: group should be variable. 2019 2022 my $sth = $dbh->prepare("SELECT host,type,val,ttl FROM default_rev_records WHERE group_id=?"); 2020 my $sth_in = $dbh->prepare("INSERT INTO records (rdns_id,domain_id,host,type,val,ttl )".2021 " VALUES ($rdns_id,?,?,?,?,? )");2023 my $sth_in = $dbh->prepare("INSERT INTO records (rdns_id,domain_id,host,type,val,ttl,location)". 2024 " VALUES ($rdns_id,?,?,?,?,?,?)"); 2022 2025 $sth->execute($group); 2023 2026 while (my ($host,$type,$val,$ttl) = $sth->fetchrow_array()) { … … 2073 2076 } 2074 2077 2075 $sth_in->execute($domid,$host,$type,$val,$ttl );2078 $sth_in->execute($domid,$host,$type,$val,$ttl,$defloc); 2076 2079 2077 2080 if ($typemap{$type} eq 'SOA') { … … 2083 2086 $defttl = $tmp2[3]; 2084 2087 } else { 2085 my $logentry = "[new $zone] Added record '$host $typemap{$type} ";2086 _log($dbh, (rdns_id => $rdns_id, domain_id => $domid, group_id => $group,2087 entry => $logentry." $val', TTL $ttl"));2088 my $logentry = "[new $zone] Added record '$host $typemap{$type} $val', TTL $ttl"; 2089 $logentry .= ", default location ".getLoc($dbh, $defloc)->{description} if $defloc; 2090 _log($dbh, (rdns_id => $rdns_id, domain_id => $domid, group_id => $group, entry => $logentry) ); 2088 2091 } 2089 2092 } … … 2105 2108 } 2106 2109 2107 $sth_in->execute($domid,$host,$type,$val,$defttl );2110 $sth_in->execute($domid,$host,$type,$val,$defttl,$defloc); 2108 2111 my $logentry = "[new $zone] Added record '$host $typemap{$type}"; 2109 2112 _log($dbh, (rdns_id => $rdns_id, domain_id => $domid, group_id => $group, … … 3041 3044 ($loc) = ($loc =~ /^(..)/); 3042 3045 my $origloc = $loc; 3046 $loc = 'aa' if !$loc; 3043 3047 # Make a change... 3044 3048 $loc++; … … 3252 3256 3253 3257 my @loclist; 3254 push @loclist, { locname => "( None/public)", loc => '', selected => ($sel ? 0 : ($sel eq '' ? 1 : 0)) };3258 push @loclist, { locname => "(Default/All)", loc => '', selected => ($sel ? 0 : ($sel eq '' ? 1 : 0)) }; 3255 3259 while (my ($locname, $loc) = $sth->fetchrow_array) { 3256 3260 my %row = ( -
trunk/dns.cgi
r436 r446 449 449 450 450 fill_grouplist("grouplist"); 451 my $loclist = getLocDropdown($dbh, $curgroup); 452 $page->param(loclist => $loclist); 451 453 452 454 # prepopulate revpatt with the matching default record … … 473 475 474 476 my ($code,$msg) = addRDNS($dbh, $webvar{revzone}, $webvar{revpatt}, $webvar{group}, 475 ($webvar{makeactive} eq 'on' ? 1 : 0) );477 ($webvar{makeactive} eq 'on' ? 1 : 0), $webvar{location}); 476 478 477 479 if ($code eq 'OK') { -
trunk/templates/newrevzone.tmpl
r270 r446 28 28 </tr> 29 29 <tr class="datalinelight"> 30 <td>Default location/view:</td> 31 <td align="left"> 32 <select name="location"> 33 <TMPL_LOOP loclist> 34 <option value="<TMPL_VAR NAME=loc>"<TMPL_IF selected> selected</TMPL_IF>><TMPL_VAR NAME=locname></option> 35 </TMPL_LOOP> 36 </select> 37 </td> 38 </tr> 39 <tr class="datalinelight"> 30 40 <td>Add reverse zone to group:</td> 31 41 <td><select name="group">
Note:
See TracChangeset
for help on using the changeset viewer.