Changeset 12 for trunk/dns.cgi


Ignore:
Timestamp:
09/10/09 17:41:30 (15 years ago)
Author:
Kris Deugau
Message:

/trunk

Moved "Listing n of m <blahs> in <foo>" to its own template, and
shuffled code to match
Misc changes, checkpoint

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r11 r12  
    114114    my ($count) = ($sth->fetchrow_array);
    115115
    116   $page->param(ntot => $count);
    117   $page->param(nfirst => 1);
    118   $page->param(nlast => 10);
    119 
     116# fill the page-count and first-previous-next-last-all details
     117  fill_pgcount($count,"records",domainName($dbh,$webvar{id}));
    120118  fill_fpnla($count);  # should put some params on this sub...
    121 
    122 ##fixme
    123   $page->param(domain => domainName($dbh,$webvar{id}));
    124   $page->param(id => $webvar{id});
    125 ##fixme
    126119
    127120  $page->param(defrec => $webvar{defrec});
    128121  if ($webvar{defrec} eq 'y') {
     122##fixme: hardcoded group
    129123    showdomain('y',1);
    130124  } else {
     
    278272  if ($code eq 'OK') {
    279273# redirect to dns.cgi?etc&page=reclist
    280     print $q->redirect("");
     274    changepage(page => "reclist", id => $msg);
    281275    $page = HTML::Template->new(filename => "$templatedir/reclist.tmpl");
    282276    showdomain(0,$msg);
     
    454448
    455449
     450sub fill_pgcount {
     451  my $pgcount = shift;
     452  my $pgtype = shift;
     453  my $parent = shift;
     454
     455  $page->param(ntot => $pgcount);
     456  $page->param(nfirst => (($offset eq 'all' ? 0 : $offset)*$perpage+1));
     457  $page->param(npglast => ($offset eq 'all' ? $pgcount :
     458        ( (($offset+1)*$perpage) > $pgcount ? $pgcount : (($offset+1)*$perpage) )
     459        ));
     460  $page->param(pgtype => $pgtype);
     461  $page->param(parent => $parent);
     462} # end fill_pgcount()
     463
     464
    456465sub listdomains {
    457466  my $sth = $dbh->prepare("select count(*) from domains");
     
    459468  my ($count) = ($sth->fetchrow_array);
    460469
     470# fill page count and first-previous-next-last-all bits
     471##fixme - hardcoded group bit
     472  fill_pgcount($count,"domains","default group");
    461473  fill_fpnla($count);
    462 
    463   $page->param(ndomains => $count);
    464   $page->param(nstart => (($offset eq 'all' ? 0 : $offset)*$perpage+1));
    465   $page->param(npglast => ($offset eq 'all' ? $count :
    466         ( (($offset+1)*$perpage) > $count ? $count : (($offset+1)*$perpage) )
    467         ));
    468474
    469475##fixme - group
Note: See TracChangeset for help on using the changeset viewer.