Changeset 480
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/DNSDB.pm ¶
r479 r480 2160 2160 } else { 2161 2161 my $logentry = "[new $zone] Added record '$host $typemap{$type} $val', TTL $ttl"; 2162 $logentry .= ", default location ". getLoc($dbh,$defloc)->{description} if $defloc;2162 $logentry .= ", default location ".$self->getLoc($defloc)->{description} if $defloc; 2163 2163 _log($dbh, (rdns_id => $rdns_id, domain_id => $domid, group_id => $group, entry => $logentry) ); 2164 2164 } … … 3073 3073 # Returns ('OK',<location>) on success, ('FAIL',<failmsg>) on failure 3074 3074 sub addLoc { 3075 my $dbh = shift; 3075 my $self = shift; 3076 my $dbh = $self->{dbh}; 3076 3077 my $grp = shift; 3077 3078 my $shdesc = shift; … … 3153 3154 # Returns a result code and message 3154 3155 sub updateLoc { 3155 my $dbh = shift; 3156 my $self = shift; 3157 my $dbh = $self->{dbh}; 3156 3158 my $loc = shift; 3157 3159 my $grp = shift; … … 3169 3171 local $dbh->{RaiseError} = 1; 3170 3172 3171 my $oldloc = getLoc($dbh,$loc);3173 my $oldloc = $self->getLoc($loc); 3172 3174 my $okmsg = "Updated location (".$oldloc->{description}.", '".$oldloc->{iplist}."') to ($shdesc, '$iplist')"; 3173 3175 … … 3195 3197 ## DNSDB::delLoc() 3196 3198 sub delLoc { 3197 my $dbh = shift; 3199 my $self = shift; 3200 my $dbh = $self->{dbh}; 3198 3201 my $loc = shift; 3199 3202 … … 3203 3206 local $dbh->{RaiseError} = 1; 3204 3207 3205 my $oldloc = getLoc($dbh,$loc);3208 my $oldloc = $self->getLoc($loc); 3206 3209 my $olddesc = ($oldloc->{description} ? $oldloc->{description} : $loc); 3207 3210 my $okmsg = "Deleted location ($olddesc, '".$oldloc->{iplist}."')"; … … 3235 3238 # Returns a reference to a hash containing the group ID, IP list, description, and comments/notes 3236 3239 sub getLoc { 3237 my $dbh = shift; 3240 my $self = shift; 3241 my $dbh = $self->{dbh}; 3238 3242 my $loc = shift; 3239 3243 … … 3251 3255 # - a "Starts with" string 3252 3256 sub getLocCount { 3253 my $dbh = shift; 3257 my $self = shift; 3258 my $dbh = $self->{dbh}; 3254 3259 3255 3260 my %args = @_; … … 3274 3279 ## DNSDB::getLocList() 3275 3280 sub getLocList { 3276 my $dbh = shift; 3281 my $self = shift; 3282 my $dbh = $self->{dbh}; 3277 3283 3278 3284 my %args = @_; … … 3313 3319 # Returns a reference to a list of hashrefs suitable to feeding to HTML::Template 3314 3320 sub getLocDropdown { 3315 my $dbh = shift; 3321 my $self = shift; 3322 my $dbh = $self->{dbh}; 3316 3323 my $grp = shift; 3317 3324 my $sel = shift || ''; … … 3655 3662 if $typemap{$$rectype} eq 'SRV'; 3656 3663 $logdata{entry} .= "', TTL $ttl"; 3657 $logdata{entry} .= ", location ". getLoc($dbh,$location)->{description} if $location;3664 $logdata{entry} .= ", location ".$self->getLoc($location)->{description} if $location; 3658 3665 3659 3666 # Allow transactions, and raise an exception on errors so we can catch it later. … … 3822 3829 if $typemap{$oldrec->{type}} eq 'SRV'; 3823 3830 $logdata{entry} .= "', TTL $oldrec->{ttl}"; 3824 $logdata{entry} .= ", location ". getLoc($dbh,$oldrec->{location})->{description} if $oldrec->{location};3831 $logdata{entry} .= ", location ".$self->getLoc($oldrec->{location})->{description} if $oldrec->{location}; 3825 3832 $logdata{entry} .= "\nto\n"; 3826 3833 # More NS special … … 3833 3840 $logdata{entry} .= " [priority $dist] [weight $weight] [port $port]" if $typemap{$$rectype} eq 'SRV'; 3834 3841 $logdata{entry} .= "', TTL $ttl"; 3835 $logdata{entry} .= ", location ". getLoc($dbh,$location)->{description} if $location;3842 $logdata{entry} .= ", location ".$self->getLoc($location)->{description} if $location; 3836 3843 3837 3844 local $dbh->{AutoCommit} = 0; … … 3949 3956 if $typemap{$oldrec->{type}} eq 'SRV'; 3950 3957 $logdata{entry} .= "', TTL $oldrec->{ttl}"; 3951 $logdata{entry} .= ", location ". getLoc($dbh,$oldrec->{location})->{description} if $oldrec->{location};3958 $logdata{entry} .= ", location ".$self->getLoc($oldrec->{location})->{description} if $oldrec->{location}; 3952 3959 3953 3960 eval { -
TabularUnified trunk/dns-rpc.cgi ¶
r479 r480 304 304 $args{defloc} = '' if !$args{defloc}; 305 305 306 my $ret = DNSDB::getLocDropdown($dbh,$args{group}, $args{defloc});306 my $ret = $dnsdb->getLocDropdown($args{group}, $args{defloc}); 307 307 return $ret; 308 308 } -
TabularUnified trunk/dns.cgi ¶
r479 r480 439 439 440 440 fill_grouplist("grouplist"); 441 my $loclist = getLocDropdown($dbh,$curgroup);441 my $loclist = $dnsdb->getLocDropdown($curgroup); 442 442 $page->param(loclist => $loclist); 443 443 … … 1363 1363 unless ($permissions{admin} || $permissions{location_create}); 1364 1364 1365 my ($code,$msg) = addLoc($dbh,$curgroup, $webvar{locname}, $webvar{comments}, $webvar{iplist});1365 my ($code,$msg) = $dnsdb->addLoc($curgroup, $webvar{locname}, $webvar{comments}, $webvar{iplist}); 1366 1366 1367 1367 if ($code eq 'OK' || $code eq 'WARN') { … … 1387 1387 unless ($permissions{admin} || $permissions{location_edit}); 1388 1388 1389 my $loc = getLoc($dbh,$webvar{loc});1389 my $loc = $dnsdb->getLoc($webvar{loc}); 1390 1390 $page->param(wastrying => "editing"); 1391 1391 $page->param(todo => "Edit location/view"); … … 1400 1400 unless ($permissions{admin} || $permissions{location_edit}); 1401 1401 1402 my ($code,$msg) = updateLoc($dbh,$webvar{id}, $curgroup, $webvar{locname}, $webvar{comments}, $webvar{iplist});1402 my ($code,$msg) = $dnsdb->updateLoc($webvar{id}, $curgroup, $webvar{locname}, $webvar{comments}, $webvar{iplist}); 1403 1403 1404 1404 if ($code eq 'OK') { … … 1438 1438 1439 1439 $page->param(locid => $webvar{locid}); 1440 my $locdata = getLoc($dbh,$webvar{locid});1440 my $locdata = $dnsdb->getLoc($webvar{locid}); 1441 1441 $locdata->{description} = $webvar{locid} if !$locdata->{description}; 1442 1442 # first pass = confirm y/n (sorta) … … 1445 1445 $page->param(location => $locdata->{description}); 1446 1446 } elsif ($webvar{del} eq 'ok') { 1447 my ($code,$msg) = delLoc($dbh,$webvar{locid});1447 my ($code,$msg) = $dnsdb->delLoc($webvar{locid}); 1448 1448 if ($code eq 'OK') { 1449 1449 # success. go back to the user list, do not pass "GO" … … 2174 2174 2175 2175 if ($permissions{admin} || $permissions{record_locchg}) { 2176 my $loclist = getLocDropdown($dbh,$cur, $defloc);2176 my $loclist = $dnsdb->getLocDropdown($cur, $defloc); 2177 2177 $page->param(record_locchg => 1); 2178 2178 $page->param(loclist => $loclist); 2179 2179 } else { 2180 my $loc = getLoc($dbh,$defloc);2180 my $loc = $dnsdb->getLoc($defloc); 2181 2181 $page->param(loc_name => $loc->{description}); 2182 2182 } … … 2237 2237 my $childlist = join(',',@childgroups); 2238 2238 2239 my $count = getLocCount($dbh,(childlist => $childlist, curgroup => $curgroup,2240 filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef) ) );2239 my $count = $dnsdb->getLocCount(childlist => $childlist, curgroup => $curgroup, 2240 filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef) ); 2241 2241 2242 2242 # fill page count and first-previous-next-last-all bits … … 2263 2263 $page->param(searchsubs => $searchsubs) if $searchsubs; 2264 2264 2265 my $loclist = getLocList($dbh,(childlist => $childlist, curgroup => $curgroup,2265 my $loclist = $dnsdb->getLocList(childlist => $childlist, curgroup => $curgroup, 2266 2266 filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef), 2267 offset => $webvar{offset}, sortby => $sortby, sortorder => $sortorder) );2267 offset => $webvar{offset}, sortby => $sortby, sortorder => $sortorder); 2268 2268 # Some UI things need to be done to the list 2269 2269 foreach my $l (@{$loclist}) {
Note:
See TracChangeset
for help on using the changeset viewer.