- Timestamp:
- 01/14/10 17:54:44 (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/INSTALL
r58 r59 6 6 Net::Whois::Raw 7 7 Text::Wrap (core) - for WHOIS response linewrapping 8 8 Net::DNS -
trunk/dns.cgi
r57 r59 251 251 } elsif ($webvar{page} eq 'record') { 252 252 253 $debugenv = 1; 254 253 255 if ($webvar{recact} eq 'new') { 254 256 255 257 $page->param(todo => "Add record to"); 256 258 $page->param(recact => "add"); 257 fill_rectypes(); 259 $page->param(parentid => $webvar{parentid}); 260 $page->param(defrec => $webvar{defrec}); 261 262 fill_recdata(); 258 263 259 264 } elsif ($webvar{recact} eq 'add') { … … 267 272 } 268 273 } 274 269 275 my ($code,$msg) = addRec(@recargs); 270 276 271 277 if ($code eq 'OK') { 272 ##fixme: need more magic to get proper group - if domain was fiddled273 # from search-subgroups listing, may not be "current" group274 275 # SELECT group_id FROM domains WHERE domain_id=?;276 # sth->execute($webvar{parentid});277 ##log278 278 if ($webvar{defrec} eq 'y') { 279 279 logaction(0, $session->param("username"), $webvar{parentid}, … … 285 285 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}); 286 286 } else { 287 288 287 $page->param(failed => 1); 289 288 $page->param(errmsg => $msg); … … 295 294 $page->param(id => $webvar{id}); 296 295 fill_recdata(); # populate the form... er, mostly. 296 if ($webvar{defrec} eq 'y') { 297 logaction(0, $session->param("username"), $webvar{parentid}, 298 "Failed adding default record '$typemap{$webvar{type}} $webvar{name} $webvar{address}', TTL $webvar{ttl}"); 299 } else { 300 logaction($webvar{parentid}, $session->param("username"), parentID($webvar{parentid}, 'dom', 'group'), 301 "Failed adding record '$typemap{$webvar{type}} $webvar{name} $webvar{address}', TTL $webvar{ttl}"); 302 } 297 303 } 298 304 … … 348 354 $page->param(id => $webvar{id}); 349 355 fill_recdata(); 356 if ($webvar{defrec} eq 'y') { 357 logaction(0, $session->param("username"), $webvar{parentid}, 358 "Failed updating default record '$typemap{$webvar{type}} $webvar{name} $webvar{address}', TTL $webvar{ttl}"); 359 } else { 360 logaction($webvar{parentid}, $session->param("username"), parentID($webvar{parentid}, 'dom', 'group'), 361 "Failed updating record '$typemap{$webvar{type}} $webvar{name} $webvar{address}', TTL $webvar{ttl}"); 362 } 350 363 } 351 364 } … … 695 708 ##fixme put in some real log-munching stuff 696 709 ##fixme need to add bits to *create* log entries... 697 my $sth = $dbh->prepare("SELECT * FROM log"); 698 $sth->execute; 710 my $sql = "SELECT user_id, email, name, entry, date_trunc('second',stamp) FROM log WHERE "; 711 my $id = $curgroup; 712 if ($webvar{ltype} && $webvar{ltype} eq 'dom') { 713 $sql .= "domain_id=?"; 714 $id = $webvar{id}; 715 } else { 716 # Default to listing curgroup log 717 $sql .= "group_id=?"; 718 } 719 my $sth = $dbh->prepare($sql); 720 $sth->execute($id); 699 721 my @logbits; 700 while (my @data= $sth->fetchrow_array) {722 while (my ($uid, $email, $name, $entry, $stamp) = $sth->fetchrow_array) { 701 723 my %row; 702 724 # (1,1,1,'test@test','Test','frobbed the whatsit',now()); 703 $row{userfname} = $ data[4];704 $row{userid} = $ data[1];705 $row{useremail} = $ data[3];706 $row{logentry} = $ data[5];707 $row{logtime} = $data[6];725 $row{userfname} = $name; 726 $row{userid} = $uid; 727 $row{useremail} = $email; 728 $row{logentry} = $entry; 729 ($row{logtime}) = ($stamp =~ /^(.+)-\d\d$/); 708 730 push @logbits, \%row; 709 731 } … … 1263 1285 1264 1286 sub logaction { 1265 my ($domid,$username,$groupid,$entry) = shift; 1266 1267 my $sth = dbh->prepare("SELECT user_id, firstname || ' ' || lastname FROM users WHERE username=?"); 1287 my $domid = shift; 1288 my $username = shift; 1289 my $groupid = shift; 1290 my $entry = shift; 1291 1292 ##fixme: ooohhh, nasty. what if we get a failure *here*? PTHBTT! 1293 my $sth = $dbh->prepare("SELECT user_id, firstname || ' ' || lastname FROM users WHERE username=?"); 1268 1294 $sth->execute($username); 1269 1295 my ($user_id, $fullname) = $sth->fetchrow_array; … … 1272 1298 "VALUES (?,?,?,?,?,?)"); 1273 1299 $sth->execute($domid,$user_id,$groupid,$username,$fullname,$entry); 1274 1275 1300 } # end logaction() 1276 1301 1277 # sub parentID($dbh, $id, $idtype, $partype[, $defrec])1302 ##fixme: generalize to return appropriate id on all cases (ie, use $partype) 1278 1303 sub parentID { 1279 1304 my $id = shift; … … 1285 1310 1286 1311 if ($idtype eq 'dom') { 1287 return $id if $defrec eq 'y'; 1312 return $id if $defrec eq 'y'; # "domain" + default records, we're really looking at a group. 1288 1313 $sql = "SELECT group_id FROM domains WHERE domain_id=?"; 1289 1314 } elsif ($idtype eq 'rec') { 1290 if ($defrec && $defrec eq 'y') { 1315 if ($defrec eq 'y') { 1316 $sql = "SELECT group_id FROM default_records WHERE record_id=?"; 1291 1317 } else { 1292 1318 return … … 1302 1328 return "FOO", "BAR"; # can't get here.... we think. 1303 1329 } 1304 } 1330 my $sth = $dbh->prepare($sql); 1331 $sth->execute($id); 1332 my ($retid) = $sth->fetchrow_array; 1333 return $retid if $retid; 1334 # ahh! fall of the edge of the world if things went sideways 1335 ##fixme: really need to do a little more error handling, I think 1336 } # end parentID() -
trunk/templates/dns.css
r48 r59 80 80 border-bottom: 1px solid #666666; 81 81 width: 1%; 82 white-space: nowrap; 83 } 84 td.data_nowrap { 82 85 white-space: nowrap; 83 86 } -
trunk/templates/log.tmpl
r47 r59 8 8 9 9 <table border="0" width="70%"> 10 <tr><th colspan="5" align="center">Log entries for domain</th></tr>10 <tr><th colspan="5" align="center">Log entries for <TMPL_VAR NAME=logfor></th></tr> 11 11 <tr class="darkrowheader"> 12 12 <td>Name</td> -
trunk/templates/useradmin.tmpl
r51 r59 32 32 <tr class="row<TMPL_VAR name=bg>"> 33 33 <td align="left"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=useradmin&action=chuser&user=<TMPL_VAR NAME=userid>"><TMPL_VAR NAME=username></a></td> 34 <td ><TMPL_VAR name=userfull></td>34 <td class="data_nowrap"><TMPL_VAR name=userfull></td> 35 35 <td><TMPL_VAR name=usertype></td> 36 36 <td><TMPL_VAR name=usergroup></td>
Note:
See TracChangeset
for help on using the changeset viewer.