Changeset 12 for trunk


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

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/TODO

    r9 r12  
    1313   - throw garbage at it and see what sticks
    1414   - throw deliberately malformed data and see what sticks
     15 - rDNS matching
     16   - tag'n'warn records where forward and reverse are both supposed to be published
     17     "here" - mainly prevents unneccessary record duplication
  • 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
  • trunk/templates/domlist.tmpl

    r7 r12  
    66<table width="98%">
    77<tr><td colspan=3 align=center>Domain list</td></tr>
    8 <tr><td>Listing <TMPL_VAR NAME=nstart> - <TMPL_VAR NAME=npglast> of <TMPL_VAR NAME=ndomains> Domains</td>
     8<tr><td><TMPL_INCLUDE NAME="pgcount.tmpl"></td>
    99<td>
    1010<TMPL_IF navfirst><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=domlist&offset=0"><img src="images/frev.png" border=0>first</a><TMPL_ELSE><img src="images/frev.png" border=0>first</TMPL_IF>&nbsp;
  • trunk/templates/reclist.tmpl

    r3 r12  
    1212<tr class="darkrowheader">
    1313        <td colspan>
    14         Listing <TMPL_VAR NAME=nfirst> - <TMPL_VAR NAME=nlast> of <TMPL_VAR NAME=ntot> entries in <TMPL_VAR NAME=domain>
     14        <TMPL_INCLUDE NAME="pgcount.tmpl">
    1515        </td>
    1616        <td align=center>
Note: See TracChangeset for help on using the changeset viewer.