Changeset 47 for trunk/dns.cgi


Ignore:
Timestamp:
12/10/09 13:29:16 (15 years ago)
Author:
Kris Deugau
Message:

/trunk

checkpoint
Cosmetic shuffle of "which page am I processing?" logic to group related pages
Add stub for WHOIS, stub-and-a-bit for log display
Remove several obsolete or unused templates (mostly copies of Vega's output)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r44 r47  
    154154  listdomains();
    155155
    156 } elsif ($webvar{page} eq 'reclist') {
    157 
    158   # Handle record list for both default records (per-group) and live domain records
    159 
    160   $page->param(defrec => $webvar{defrec});
    161   $page->param(id => $webvar{id});
    162   $page->param(curpage => $webvar{page});
    163 
    164 # select count(*) from (default_)?records where (group|domain)_id=?
    165     my $sth = $dbh->prepare("SELECT count(*) FROM ".
    166         ($webvar{defrec} eq 'y' ? 'default_' : '')."records ".
    167         "WHERE ".($webvar{defrec} eq 'y' ? 'group' : 'domain')."_id=? ".
    168         "AND NOT type=$reverse_typemap{SOA}");
    169     $sth->execute($webvar{id});
    170     my ($count) = ($sth->fetchrow_array);
    171 
    172 # fill the page-count and first-previous-next-last-all details
    173   fill_pgcount($count,"records",domainName($dbh,$webvar{id}));
    174   fill_fpnla($count);  # should put some params on this sub...
    175 
    176   $page->param(defrec => $webvar{defrec});
    177   if ($webvar{defrec} eq 'y') {
    178 ##fixme: hardcoded group
    179     showdomain('y',$curgroup);
    180   } else {
    181     showdomain('n',$webvar{id});
    182   }
    183 
    184156} elsif ($webvar{page} eq 'newdomain') {
    185157
     
    211183    # cancelled.  whee!
    212184    changepage(page => "domlist");
     185  }
     186
     187} elsif ($webvar{page} eq 'reclist') {
     188
     189  # Handle record list for both default records (per-group) and live domain records
     190
     191  $page->param(defrec => $webvar{defrec});
     192  $page->param(id => $webvar{id});
     193  $page->param(curpage => $webvar{page});
     194
     195# select count(*) from (default_)?records where (group|domain)_id=?
     196    my $sth = $dbh->prepare("SELECT count(*) FROM ".
     197        ($webvar{defrec} eq 'y' ? 'default_' : '')."records ".
     198        "WHERE ".($webvar{defrec} eq 'y' ? 'group' : 'domain')."_id=? ".
     199        "AND NOT type=$reverse_typemap{SOA}");
     200    $sth->execute($webvar{id});
     201    my ($count) = ($sth->fetchrow_array);
     202
     203# fill the page-count and first-previous-next-last-all details
     204  fill_pgcount($count,"records",domainName($dbh,$webvar{id}));
     205  fill_fpnla($count);  # should put some params on this sub...
     206
     207  $page->param(defrec => $webvar{defrec});
     208  if ($webvar{defrec} eq 'y') {
     209##fixme: hardcoded group
     210    showdomain('y',$curgroup);
     211  } else {
     212    showdomain('n',$webvar{id});
    213213  }
    214214
     
    639639  }
    640640
     641} elsif ($webvar{page} eq 'whois') {
     642
     643} elsif ($webvar{page} eq 'log') {
     644
     645##fixme put in some real log-munching stuff
     646##fixme need to add bits to *create* log entries...
     647  my $sth = $dbh->prepare("SELECT * FROM log");
     648  $sth->execute;
     649  my @logbits;
     650  while (my @data = $sth->fetchrow_array) {
     651    my %row;
     652# (1,1,1,'test@test','Test','frobbed the whatsit',now());
     653    $row{userfname} = $data[4];
     654    $row{userid} = $data[1];
     655    $row{useremail} = $data[3];
     656    $row{logentry} = $data[5];
     657    $row{logtime} = $data[6];
     658    push @logbits, \%row;
     659  }
     660  $page->param(logentries => \@logbits);
     661
    641662}
    642663
     
    927948  fill_colheads(\@cols, \%colheads);
    928949
    929   $page->param(sortorder => $sortorder);
     950#  $page->param(sortorder => $sortorder);
    930951  # hack! hack! pthbttt.  have to rethink the status column storage,
    931952  # or inactive comes "before" active.  *sigh*
Note: See TracChangeset for help on using the changeset viewer.