Index: trunk/dns.cgi
===================================================================
--- trunk/dns.cgi	(revision 11)
+++ trunk/dns.cgi	(revision 12)
@@ -114,17 +114,11 @@
     my ($count) = ($sth->fetchrow_array);
 
-  $page->param(ntot => $count);
-  $page->param(nfirst => 1);
-  $page->param(nlast => 10);
-
+# fill the page-count and first-previous-next-last-all details
+  fill_pgcount($count,"records",domainName($dbh,$webvar{id}));
   fill_fpnla($count);  # should put some params on this sub...
-
-##fixme
-  $page->param(domain => domainName($dbh,$webvar{id}));
-  $page->param(id => $webvar{id});
-##fixme
 
   $page->param(defrec => $webvar{defrec});
   if ($webvar{defrec} eq 'y') {
+##fixme: hardcoded group
     showdomain('y',1);
   } else {
@@ -278,5 +272,5 @@
   if ($code eq 'OK') {
 # redirect to dns.cgi?etc&page=reclist
-    print $q->redirect("");
+    changepage(page => "reclist", id => $msg);
     $page = HTML::Template->new(filename => "$templatedir/reclist.tmpl");
     showdomain(0,$msg);
@@ -454,4 +448,19 @@
 
 
+sub fill_pgcount {
+  my $pgcount = shift;
+  my $pgtype = shift;
+  my $parent = shift;
+
+  $page->param(ntot => $pgcount);
+  $page->param(nfirst => (($offset eq 'all' ? 0 : $offset)*$perpage+1));
+  $page->param(npglast => ($offset eq 'all' ? $pgcount :
+	( (($offset+1)*$perpage) > $pgcount ? $pgcount : (($offset+1)*$perpage) )
+	));
+  $page->param(pgtype => $pgtype);
+  $page->param(parent => $parent);
+} # end fill_pgcount()
+
+
 sub listdomains {
   my $sth = $dbh->prepare("select count(*) from domains");
@@ -459,11 +468,8 @@
   my ($count) = ($sth->fetchrow_array);
 
+# fill page count and first-previous-next-last-all bits
+##fixme - hardcoded group bit
+  fill_pgcount($count,"domains","default group");
   fill_fpnla($count);
-
-  $page->param(ndomains => $count);
-  $page->param(nstart => (($offset eq 'all' ? 0 : $offset)*$perpage+1));
-  $page->param(npglast => ($offset eq 'all' ? $count :
-	( (($offset+1)*$perpage) > $count ? $count : (($offset+1)*$perpage) )
-	));
 
 ##fixme - group
