Index: /trunk/DNSDB.pm
===================================================================
--- /trunk/DNSDB.pm	(revision 6)
+++ /trunk/DNSDB.pm	(revision 7)
@@ -216,4 +216,7 @@
   local $dbh->{RaiseError} = 1;
 
+##fixme
+return ('OK',"don't wanna!");
+
   # Wrap all the SQL in a transaction
   eval {
Index: /trunk/dns.cgi
===================================================================
--- /trunk/dns.cgi	(revision 6)
+++ /trunk/dns.cgi	(revision 7)
@@ -31,9 +31,6 @@
 $q->parse_query_string;
 
-my %webvar;
 # This is probably excessive fiddling, but it puts the parameters somewhere my fingers know about...
-foreach ($q->param()) {
-  $webvar{$_} = $q->param($_);
-}
+my %webvar = $q->Vars;
 
 my $sid = ($webvar{sid} ? $webvar{sid} : undef);
@@ -60,10 +57,7 @@
 my $footer = HTML::Template->new(filename => "$templatedir/footer.tmpl");
 
-## hmm.  may want to move this so we can redirect after adding/deleting/etc
-print "Content-type: text/html\n\n", $header->output;
-
 # default
 #my $perpage = 15;
-my $perpage = 3;
+my $perpage = 4;
 my $offset = ($webvar{offset} ? $webvar{offset} : 0);
 
@@ -107,28 +101,5 @@
   my ($count) = ($sth->fetchrow_array);
 
-##fixme
-  if ($offset eq 'all') {
-    print "foo!  wanna see'em all\n";
-  } else {
-    # all these bits only have sensible behaviour if offset is numeric. err, probably.
-    if ($count > $perpage) {
-      # if there are more results than the default, always show the "all" link
-      $page->param(navall => 1);
-
-      if ($offset > 0) {
-        $page->param(navfirst => 1);
-        $page->param(navprev => 1);
-        $page->param(prevoffs => $offset-1);
-      }
-
-      # show "next" and "last" links if we're not on the last page of results
-      if ( (($offset+1) * $perpage - $count) < 0 ) {
-        $page->param(navnext => 1);
-        $page->param(nextoffs => $offset+1);
-        $page->param(navlast => 1);
-        $page->param(lastoffs => int $count/$perpage);
-      }
-    }
-  }
+  fill_fpnla($count);
 
   $page->param(ndomains => $count);
@@ -137,5 +108,5 @@
 	( (($offset+1)*$perpage) > $count ? $count : (($offset+1)*$perpage) )
 	));
-##fixme
+##fixme - group
   $page->param(id => 1);
   my @domlist;
@@ -181,28 +152,5 @@
   $page->param(nlast => 10);
 
-##fixme
-  if ($offset eq 'all') {
-    print "foo!  wanna see'em all\n";
-  } else {
-    # all these bits only have sensible behaviour if offset is numeric. err, probably.
-    if ($count > $perpage) {
-      # if there are more results than the default, always show the "all" link
-      $page->param(navall => 1);
-
-      if ($offset > 0) {
-        $page->param(navfirst => 1);
-        $page->param(navprev => 1);
-        $page->param(prevoffs => $offset-1);
-      }
-
-      # show "next" and "last" links if we're not on the last page of results
-      if ( (($offset+1) * $perpage - $count) < 0 ) {
-        $page->param(navnext => 1);
-        $page->param(nextoffs => $offset+1);
-        $page->param(navlast => 1);
-        $page->param(lastoffs => int $count/$perpage);
-      }
-    }
-  }
+  fill_fpnla($count);  # should put some params on this sub...
 
 ##fixme
@@ -308,4 +256,8 @@
     $page->param(domain => domainName($dbh,$webvar{id}));
 # print some neato things?
+
+#  } else {
+#    #whether actually deleting or cancelling we redirect to the domain list, default format
+
   } elsif ($webvar{del} eq 'ok') {
     my ($code,$msg) = delDomain($dbh, $webvar{id});
@@ -372,4 +324,7 @@
 
 
+## hmm.  may want to move this so we can redirect after adding/deleting/etc
+print "Content-type: text/html\n\n", $header->output;
+
 # spit it out
 print $page->output;
@@ -447,26 +402,6 @@
   $page->param(ttl	=> $soa{ttl});
 
-##fixme!
-my $roffset = 0;
-
 #  my @foo2 = getDomRecs($dbh,'def',1);
   my $foo2 = getDomRecs($dbh,$def,$id,$perpage,$webvar{offset});
-
-#  $sth = $dbh->prepare("select domain_id,domain,status,groups.name from domains".
-#	" inner join groups on domains.group_id=groups.group_id".
-#	" order by domain".($offset eq 'all' ? '' : " limit $perpage offset ".$offset*$perpage));
-#  $sth->execute;
-#  my $rownum = 0;
-#  while (my @data = $sth->fetchrow_array) {
-#    my %row;
-#    $row{domainid} = $data[0];
-#    $row{domain} = $data[1];
-#    $row{status} = ($data[2] ? 'Active' : 'Inactive');
-#    $row{group} = $data[3];
-#    $row{bg} = ($rownum++)%2;
-##    $row{mkactive} = ($data[2] eq 'inactive' ? 1 : 0);
-#    $row{mkactive} = !$data[2];
-#    $row{sid} = $sid;
-#    $row{offset} = $offset;
 
   my $row = 0;
@@ -505,2 +440,30 @@
   }
 }
+
+sub fill_fpnla {
+  my $count = shift;
+##fixme
+  if ($offset eq 'all') {
+    #print "foo!  wanna see'em all\n";
+  } else {
+    # all these bits only have sensible behaviour if offset is numeric. err, probably.
+    if ($count > $perpage) {
+      # if there are more results than the default, always show the "all" link
+      $page->param(navall => 1);
+
+      if ($offset > 0) {
+        $page->param(navfirst => 1);
+        $page->param(navprev => 1);
+        $page->param(prevoffs => $offset-1);
+      }
+
+      # show "next" and "last" links if we're not on the last page of results
+      if ( (($offset+1) * $perpage - $count) < 0 ) {
+        $page->param(navnext => 1);
+        $page->param(nextoffs => $offset+1);
+        $page->param(navlast => 1);
+        $page->param(lastoffs => int $count/$perpage -1);
+      }
+    }
+  }
+}
Index: /trunk/templates/deldom.tmpl
===================================================================
--- /trunk/templates/deldom.tmpl	(revision 6)
+++ /trunk/templates/deldom.tmpl	(revision 7)
@@ -5,14 +5,11 @@
 <td align="center">
 <h3>Are you really sure you want to delete domain <TMPL_VAR NAME=domain>?</h3>
-<a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=deldom&del=cancel&id=<TMPL_VAR NAME=id>&">cancel</a> &nbsp; | &nbsp; <a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=deldom&del=ok&id=<TMPL_VAR NAME=id>&">confirm</a>
+<a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=deldom&del=cancel&id=<TMPL_VAR NAME=id>">cancel</a> &nbsp; | &nbsp; <a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=deldom&del=ok&id=<TMPL_VAR NAME=id>">confirm</a>
 </td></tr></table>
 
 <TMPL_ELSE>
-<TMPL_IF del_failed>
-<!-- Need to find failure mode to cause/test this -->
-<h1>FOO!</h1>
-<TMPL_VAR NAME=errmsg>
-<TMPL_ELSE>
-<TMPL_INCLUDE NAME="domlist.tmpl">
+ <TMPL_IF del_failed>
+  <div class='errmsg'>Error deleting domain <TMPL_VAR NAME=domain>: <TMPL_VAR NAME=errmsg></div>
+ </TMPL_IF>
+ <TMPL_INCLUDE NAME="domlist.tmpl">
 </TMPL_IF>
-</TMPL_IF>
Index: /trunk/templates/domlist.tmpl
===================================================================
--- /trunk/templates/domlist.tmpl	(revision 6)
+++ /trunk/templates/domlist.tmpl	(revision 7)
@@ -42,5 +42,5 @@
 	<td width="1%" nowrap><TMPL_VAR name=group></td>
 	<td width="1%" nowrap align=center><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=domlist<TMPL_IF NAME=offset>&offset=<TMPL_VAR NAME=offset></TMPL_IF>&id=<TMPL_VAR NAME=domainid>&action=<TMPL_IF NAME=mkactive>domon<TMPL_ELSE>domoff</TMPL_IF>"><TMPL_IF NAME=mkactive>activate<TMPL_ELSE>deactivate</TMPL_IF></a></td>
-	<td width="1%" nowrap align=center><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=deldom&id=<TMPL_VAR NAME=domainid>&defrec=w"><img src="images/trash2.png" border=0></a></td>
+	<td width="1%" nowrap align=center><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=deldom&id=<TMPL_VAR NAME=domainid>"><img src="images/trash2.png" border=0></a></td>
 </tr>
 </TMPL_LOOP>
