Changeset 39 for trunk/dns.cgi
- Timestamp:
- 12/01/09 17:21:41 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r38 r39 344 344 $page->param(id => $webvar{id}); 345 345 $page->param(defrec => $webvar{defrec}); 346 $page->param(parentid => $webvar{parentid}); 346 347 # first pass = confirm y/n (sorta) 347 348 if (!defined($webvar{del})) { … … 351 352 $page->param(ftype => $typemap{$rec{type}}); 352 353 $page->param(recval => $rec{val}); 353 } els e{354 } elsif ($webvar{del} eq 'ok') { 354 355 my ($code,$msg) = delRec($dbh,$webvar{defrec},$webvar{id}); 355 356 if ($code ne 'OK') { … … 357 358 $page->param(del_failed => 1); 358 359 $page->param(errmsg => $msg); 359 } 360 ##fixme: group/parent instead of hardcoded 1 361 showdomain('y',1); 360 showdomain($webvar{defrec}, $webvar{parentid}); 361 } else { 362 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}); 363 } 364 } else { 365 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}); 362 366 } 363 367 364 368 } elsif ($webvar{page} eq 'editsoa') { 365 369 366 fillsoa($webvar{defrec},$webvar{ recid});370 fillsoa($webvar{defrec},$webvar{id}); 367 371 368 372 } elsif ($webvar{page} eq 'updatesoa') { 369 print "ooooo!\n";370 373 371 374 my $sth; … … 373 376 # no domain ID, so we're editing the default SOA for a group (we don't care which one here) 374 377 # plus a bit of magic to update the appropriate table 375 $sql = "update ".($webvar{d omainid} eq '' ? "default_records" : "records").378 $sql = "update ".($webvar{defrec} eq 'y' ? "default_records" : "records"). 376 379 " set host='$webvar{prins}:$webvar{contact}',". 377 380 " val='$webvar{refresh}:$webvar{retry}:$webvar{expire}:$webvar{minttl}',". … … 383 386 $page->param(update_failed => 1); 384 387 $page->param(msg => $DBI::errstr); 385 fillsoa($webvar{defrec},1); 386 } else { 388 fillsoa($webvar{defrec},$webvar{id}); 389 } else { 390 changepage(page => "reclist", id => $webvar{id}, defrec => $webvar{defrec}); 387 391 $page->param(update_failed => 0); 388 392 ##fixme! need to set group ID properly here 389 showdomain('y',1);393 # showdomain('y',1); 390 394 } 391 395 … … 657 661 my $tmp_ruri = $ENV{REQUEST_URI}; 658 662 $tmp_ruri =~ s/\&([a-z])/\&\;$1/g; 663 # le sigh. and we need to strip any previous action 664 $tmp_ruri =~ s/\&action=[^&]+//g; 659 665 # $page->param(whereami => $ENV{REQUEST_URI}); 660 666 $page->param(whereami => $tmp_ruri); … … 733 739 my $def = shift; 734 740 my $id = shift; 735 my $domname; 736 737 if ($webvar{domain} == 0) { 738 $domname = "DOMAIN"; 739 } else { 740 my $sth = $dbh->prepare("SELECT domain FROM domains WHERE domain_id=?"); 741 $sth->execute($webvar{domain}); 742 ($domname) = $sth->fetchrow_array(); 743 } 744 745 $page->param(domain => $domname); 746 $page->param(defrec => !$webvar{domain}); 747 $page->param(group => $DNSDB::group); 741 my $domname = ($def eq 'y' ? '' : "DOMAIN"); 742 743 $page->param(defrec => $def); 744 745 # i had a good reason to do this when I wrote it... 746 # $page->param(domain => $domname); 747 # $page->param(group => $DNSDB::group); 748 $page->param(isgrp => 1) if $def eq 'y'; 749 $page->param(parent => ($def eq 'y' ? groupName($dbh, $DNSDB::group) : domainName($dbh, $id)) ); 748 750 749 751 # defaults … … 759 761 my %soa = getSOA($dbh,$def,$id); 760 762 761 $page->param( domainid => $webvar{domain});763 $page->param(id => $id); 762 764 $page->param(recid => $soa{recid}); 763 765 $page->param(prins => ($soa{prins} ? $soa{prins} : $DNSDB::def{prins}));
Note:
See TracChangeset
for help on using the changeset viewer.