Changeset 62 for trunk/dns.cgi
- Timestamp:
- 01/19/10 16:50:05 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r61 r62 69 69 # per-page startwith, filter, searchsubs 70 70 $session->param($webvar{page}.'startwith', $webvar{startwith}) if $webvar{startwith}; 71 $session->param($webvar{page}.'filter', $webvar{filter}) if $webvar{filter};71 $session->param($webvar{page}.'filter', $webvar{filter}) if defined($webvar{filter}); 72 72 $webvar{searchsubs} =~ s/^n ?// if $webvar{searchsubs}; 73 73 $session->param($webvar{page}.'searchsubs', $webvar{searchsubs}) if defined($webvar{searchsubs}); … … 166 166 # this currently only handles "domain on", "domain off" 167 167 if (defined($webvar{action})) { 168 domStatus($dbh,$webvar{id},$webvar{action}); 168 my $stat = domStatus($dbh,$webvar{id},$webvar{action}); 169 logaction($webvar{id}, $session->param("username"), parentID($webvar{id}, 'dom', 'group'), 170 "Changed ".domainName($dbh, $webvar{id})." state to ".($stat ? 'active' : 'inactive')); 169 171 } 170 172 171 173 $page->param(curpage => $webvar{page}); 174 if ($webvar{del_failed}) { 175 $page->param(del_failed => 1); 176 $page->param(errmsg => $webvar{errmsg}); 177 } 172 178 173 179 listdomains(); … … 177 183 # hmm. nothing to do here? 178 184 # - group list is filled by the same bit that fills the group list in the menu 185 if ($webvar{add_failed}) { 186 $page->param(add_failed => 1); 187 $page->param(errmsg => $webvar{errmsg}); 188 $page->param(domain => $webvar{domain}); 189 } 179 190 180 191 } elsif ($webvar{page} eq 'adddomain') { … … 186 197 changepage(page => "reclist", id => $msg); 187 198 } else { 199 logaction(0, $session->param("username"), $webvar{group}, "Failed adding domain $webvar{domain} ($msg)"); 188 200 changepage(page => "newdomain", add_failed => 1, domain => $webvar{domain}, errmsg => $msg); 189 201 } … … 207 219 if ($code ne 'OK') { 208 220 # need to find failure mode 209 $page->param(del_failed => 1); 210 $page->param(errmsg => $msg); 211 logaction($webvar{id}, $session->param("username"), $pargroup, "Failed to delete domain $dom"); 212 listdomains($curgroup); 213 ##work 221 logaction($webvar{id}, $session->param("username"), $pargroup, "Failed to delete domain $dom ($msg)"); 222 changepage(page => "domlist", del_failed => 1, errmsg => $msg); 214 223 } else { 215 224 logaction($webvar{id}, $session->param("username"), $pargroup, "Deleted domain $dom"); … … 295 304 if ($webvar{defrec} eq 'y') { 296 305 logaction(0, $session->param("username"), $webvar{parentid}, 297 "Failed adding default record '$ typemap{$webvar{type}} $webvar{name} $webvar{address}', TTL $webvar{ttl}");306 "Failed adding default record '$webvar{name} $typemap{$webvar{type}} $webvar{address}', TTL $webvar{ttl}"); 298 307 } else { 299 308 logaction($webvar{parentid}, $session->param("username"), parentID($webvar{parentid}, 'dom', 'group'), 300 "Failed adding record '$ typemap{$webvar{type}} $webvar{name} $webvar{address}', TTL $webvar{ttl}");309 "Failed adding record '$webvar{name} $typemap{$webvar{type}} $webvar{address}', TTL $webvar{ttl}"); 301 310 } 302 311 } … … 384 393 $page->param(recval => $rec{val}); 385 394 } elsif ($webvar{del} eq 'ok') { 386 # get groupid of deleted recordbefore we try to delete it387 my $pargrp = parentID($webvar{id}, 'rec', 'group', $webvar{defrec});395 # get rec data before we try to delete it 396 my %rec = getRecLine($dbh,$webvar{defrec},$webvar{id}); 388 397 my ($code,$msg) = delRec($dbh,$webvar{defrec},$webvar{id}); 389 398 if ($code ne 'OK') { 390 399 ## need to find failure mode 391 #logaction( 400 if ($webvar{defrec} eq 'y') { 401 logaction(0, $session->param("username"), $rec{parid}, 402 "Failed deleting default record '$rec{host} $typemap{$rec{type}} $rec{val}', TTL $rec{ttl}"); 403 } else { 404 logaction($rec{parid}, $session->param("username"), parentID($rec{parid}, 'dom', 'group'), 405 "Failed deleting record '$rec{host} $typemap{$rec{type}} $rec{val}', TTL $rec{ttl}"); 406 } 392 407 $page->param(del_failed => 1); 393 408 $page->param(errmsg => $msg); 394 409 showdomain($webvar{defrec}, $webvar{parentid}); 395 410 } else { 396 ##log 411 if ($webvar{defrec} eq 'y') { 412 logaction(0, $session->param("username"), $rec{parid}, 413 "Deleted default record '$rec{host} $typemap{$rec{type}} $rec{val}', TTL $rec{ttl}"); 414 } else { 415 logaction($rec{parid}, $session->param("username"), parentID($rec{parid}, 'dom', 'group'), 416 "Deleted record '$rec{host} $typemap{$rec{type}} $rec{val}', TTL $rec{ttl}"); 417 } 397 418 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}); 398 419 } … … 907 928 $rec->{type} = $typemap{$rec->{type}}; 908 929 $rec->{row} = $row % 2; 909 $rec->{defrec} = $ webvar{defrec};930 $rec->{defrec} = $def; 910 931 $rec->{sid} = $webvar{sid}; 911 932 $rec->{id} = $id; … … 1008 1029 1009 1030 sub listdomains { 1031 1032 $startwith = $session->param($webvar{page}.'startwith'); 1033 $filter = $session->param($webvar{page}.'filter'); 1034 $searchsubs = $session->param($webvar{page}.'searchsubs'); 1010 1035 1011 1036 ##fixme: $logingroup or $curgroup?
Note:
See TracChangeset
for help on using the changeset viewer.