Index: branches/htmlform/cgi-bin/admin.cgi
===================================================================
--- branches/htmlform/cgi-bin/admin.cgi	(revision 484)
+++ branches/htmlform/cgi-bin/admin.cgi	(revision 487)
@@ -84,6 +84,10 @@
 }
 
-#print "Content-type: text/html\n\n".$header->output;
-my $page = HTML::Template->new(filename => "admin/$webvar{action}.tmpl");
+my $page;
+if (-e "$ENV{HTML_TEMPLATE_ROOT}/admin/$webvar{action}.tmpl") {
+  $page = HTML::Template->new(filename => "admin/$webvar{action}.tmpl");
+} else {
+  $page = HTML::Template->new(filename => "admin/dunno.tmpl");
+}
 
 if ($webvar{action} eq 'main') {
@@ -180,51 +184,26 @@
   $sth->finish;
 
-  my $cities = '';
+  my @cities;
   foreach my $city (@citylist) {
-    $cities .= "<option>$city</option>\n";
-  }
-
-  print qq(<table class=regular>
-<form method=POST action=admin.cgi>
-<tr class=color1>
-<td>Allocating:</td>
-<td>$cidr<input type=hidden name=cidr value="$cidr"></td>
-</tr><tr class=color2>
-<td>Type:</td><td>$disp_alloctypes{$webvar{alloctype}}
-<input type=hidden name=alloctype value="$webvar{alloctype}"></td>
-</tr><tr class=color1>
-<td>Allocated from:</td>
-<td>$alloc_from<input type=hidden name=alloc_from value="$alloc_from"></td>
-</tr><tr class="color2">
-<td>Customer ID:</td><td>$custid<input type=hidden name=custid value="$custid"></td>
-</tr><tr class=color1>
-<td>Customer location:</td><td>
-<select name="city"><option selected>-</option>
-$cities
-</select>
-&nbsp;<a href="javascript:popNotes('/ip/cgi-bin/newcity.cgi')">Add new location</a>
-</td>
-</tr>
-<tr class="color2">
-<td>Circuit ID:</td><td><input name=circid size=40></td>
-</tr><tr class="color1">
-<td>Description/Name:</td><td><input name="desc" size=40></td>
-</tr><tr class="color2">
-<td>Notes:</td><td><textarea name="notes" rows="3" cols="40"></textarea></td>
-</tr><tr class="warning">
-<td colspan=2><center>WARNING:  This will IMMEDIATELY assign this block!!</center></td>
-</tr><tr class="color2">
-<td class="center" colspan="2"><input type="submit" value="  Assign  "></td>
-<input type="hidden" name="action" value="confirm">
-</form>
-</tr>
-</table>
-);
-
+     my %row = (city => $city);
+     push @cities, \%row;
+  }
+  $page->param(
+	cidr => $cidr,
+	disptype => $disp_alloctypes{$webvar{alloctype}},
+	type => $webvar{alloctype},
+	alloc_from => $alloc_from,
+	custid => $custid,
+	citylist => \@cities
+	);
 
 } elsif ($webvar{action} eq 'confirm') {
 
-  print "Assigning $webvar{cidr} to $webvar{custid} (\"$webvar{desc}\") as ".
-	"$disp_alloctypes{$webvar{alloctype}}...<br>\n";
+  $page->param(
+	cidr => $webvar{cidr},
+	custid => $webvar{custid},
+	desc => $webvar{desc},
+	disptype => $disp_alloctypes{$webvar{alloctype}}
+	);
   # Only need to check city here.
   if ($webvar{city} eq '-') {
@@ -237,9 +216,8 @@
       $sth->execute;
       if ($sth->err) {
-	print "Allocation failed!  DBI said:\n".$sth->errstr."\n";
+	$page->param(errmsg => $sth->errstr);
         syslog "err", "($authuser) Allocation of '$webvar{cidr}' to '$webvar{custid}' as ".
 		"'$webvar{alloctype}' failed: '".$sth->errstr."'";
       } else {
-	print "Allocation OK!\n";
 	syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ".
 		"'$webvar{alloctype}'";
@@ -253,9 +231,8 @@
 	$webvar{circid});
       if ($retcode eq 'OK') {
-	print "Allocation OK!\n";
 	syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ".
 		"'$webvar{alloctype}'";
       } else {
-	print "Allocation failed!  IPDB::allocateBlock said:\n$msg\n";
+	$page->param(errmsg => $msg);
         syslog "err", "($authuser) Allocation of '$webvar{cidr}' to '$webvar{custid}' as ".
 		"'$webvar{alloctype}' failed: '$msg'";
@@ -379,5 +356,7 @@
 
 } elsif ($webvar{action} eq 'tweakpool') {
+
   showPool($webvar{pool});
+
 } elsif ($webvar{action} eq 'updatepool') {
 
@@ -388,14 +367,15 @@
 	"where ip='$webvar{ip}'");
   $sth->execute($webvar{city},$webvar{notes},$webvar{desc});
+  $page->param(ip => $webvar{ip});
   if ($sth->err) {
-    print "Error updating pool IP $webvar{ip}: $@<hr>\n";
-    syslog "err", "$authuser could not update pool IP $webvar{ip}: $@";
-  } else {  
-    $sth = $ip_dbh->prepare("select pool from poolips where ip='$webvar{ip}'");
-    $sth->execute;
-    my @data = $sth->fetchrow_array;
-    print "$webvar{ip} in $data[0] updated\n<hr>\n";
+    $page->param(errmsg => $sth->errstr);
+    syslog "err", "$authuser could not update pool IP $webvar{ip}: ".$sth->errstr;
+  } else {
     syslog "notice", "$authuser updated pool IP $webvar{ip}";
   }
+  $sth = $ip_dbh->prepare("select pool from poolips where ip='$webvar{ip}'");
+  $sth->execute;
+  my @data = $sth->fetchrow_array;
+  $page->param(pool => $data[0]);
 
 } elsif ($webvar{action} eq 'showusers') {
@@ -455,53 +435,19 @@
 
 } elsif ($webvar{action} eq 'emailnotice') {
-  print "<h4>Email notice management:</h4>\nClick the email addresses to edit that list.";
+
   $sth = $ip_dbh->prepare("SELECT action,reciplist FROM notify");
   $sth->execute;
-
-  print "<table border=1>\n";
+  my @spamlist;
   while (my ($notice_code,$reciplist) = $sth->fetchrow_array() ) {
 ##fixme: hairy mess, only a few things call mailNotify() anyway, so many possible notices won't work.
     my $action_out = dispNoticeCode($notice_code);
-    print "<tr><td>$action_out</td>".
-	qq(<td><a href="admin.cgi?action=ednotice&code=$notice_code">$reciplist</a></td>).
-	qq(<td><a href="admin.cgi?action=delnotice&code=$notice_code">Delete</a></tr>\n);
-  }
-  print qq(<tr><td colspan=2>Known "special" codes:<br>
-<ul style="margin-top: 0px; margin-bottom: 0px;">
-	<li>swi: Notify if block being updated has SWIP flag set</li>
-</ul></td></tr>
-</table>
-);
-
-# add new entries from this tangle:
-  print "<h4>Add new notification:</h4>\n".
-	"Note:  Failure notices on most conditions are not yet supported.\n";
-
-  print qq(<table border=1><form action=admin.cgi method="POST">
-<input type=hidden name=action value=addnotice>
-<tr>
-<td>Recipients</td><td colspan=3><textarea name=reciplist cols=50 rows=5></textarea></td></tr>
-<tr><td>Action</td><td>
-	<table><tr>
-		<td><input type=radio name=msgaction value=a>Add &nbsp;
-		<input type=radio name=msgaction value=u>Update &nbsp;
-		<input type=radio name=msgaction value=d>Delete &nbsp;
-		<input type=radio name=msgaction value=n>New listitem</td>
-	</tr><tr>
-		<td>
-		<input type=radio name=msgaction value=s:>Special: <input name=special>(requires code changes)
-	</td></tr></table>
-</td>
-<td>Failure?</td><td><input type=checkbox name=onfail></td></tr>
-<tr><td>Event/Allocation type:</td><td colspan=3>
-	<table>
-	<tr>
-		<td><input type=radio name=alloctype value=a>All allocations</td>
-		<td><input type=radio name=alloctype value=.i>All static IPs</td>
-		<td><input type=radio name=alloctype value=ci>New city</td>
-		<td><input type=radio name=alloctype value=no>New node</td>
-	</tr>
-	<tr>
-);
+    my %row = (
+	action => $action_out,
+	code => $notice_code,
+	recips => $reciplist
+	);
+    push @spamlist, \%row;
+  }
+  $page->param(spamlist => \@spamlist);
 
   $sth = $ip_dbh->prepare("SELECT type,dispname FROM alloctypes WHERE listorder < 500 ".
@@ -509,74 +455,58 @@
   $sth->execute;
   my $i=0;
+  my @typelist;
   while (my ($type,$disp) = $sth->fetchrow_array) {
-    print "		<td><input type=radio name=alloctype value=$type>$disp</td>";
-    $i++;
-    print "	</tr>\n\t<tr>"
-	if ($i % 4 == 0);
-  }
-
-  print qq(	</tr>
-	</table>
-</tr>
-<tr><td colspan=4 align=center><input type=submit value="Add notice"></td></tr>
-</table>
-</form>
-);
-  ## done spitting out add-new-spam-me-now table
+    my %row = (
+	type => $type,
+	disptype => $disp,
+# ahh, off-by-one counts, how we do love thee...  NOT!
+	newrow => ($i+2 > $sth->rows ? 1 : (++$i % 4)),
+	);
+    push @typelist, \%row;
+  }
+  $page->param(typelist => \@typelist);
 
 } elsif ($webvar{action} eq 'addnotice') {
+
   $webvar{alloctype} = $webvar{special} if $webvar{msgaction} eq 's:';
   if ($webvar{msgaction} && $webvar{alloctype} && $webvar{reciplist}) {
+    $page->param(cantry => 1);
     $webvar{reciplist} =~ s/[\r\n]+/,/g;
     $webvar{msgaction} = "f:$webvar{msgaction}" if $webvar{onfail};
-    print "Adding notice to $webvar{reciplist} for ".dispNoticeCode($webvar{msgaction}.$webvar{alloctype}).":\n";
+    $page->param(reciplist => $webvar{reciplist});
+    $page->param(dispnotice => dispNoticeCode($webvar{msgaction}.$webvar{alloctype}));
     $sth = $ip_dbh->prepare("INSERT INTO notify (action, reciplist) VALUES (?,?)");
 ##fixme:  automagically merge reciplists iff action already exists
     $sth->execute($webvar{msgaction}.$webvar{alloctype}, $webvar{reciplist});
-    if ($sth->err) {
-      print "Failed:  DB error: ".$sth->errstr."\n";
-    } else {
-      print "OK!<br>\n"
-    }
-  } else {
-    print "Need to specify at least one recipient, an action, and an allocation type. ".
-	qq{("Special" content is considered an allocation type).  Hit the Back button and try again.<br>\n};
-  }
-  print qq(<a href="admin.cgi?action=emailnotice">Back to email notice list</a>\n);
+    $page->param(addfailed => $sth->errstr) if $sth->err;
+  }
 
 } elsif ($webvar{action} eq 'delnotice') {
-  print "Deleting notices on ".dispNoticeCode($webvar{code}.$webvar{alloctype}).":\n";
+
+  $page->param(dispnotice => dispNoticeCode($webvar{code}.$webvar{alloctype}));
   $sth = $ip_dbh->prepare("DELETE FROM notify WHERE action=?");
   $sth->execute($webvar{code});
-  if ($sth->err) {
-    print "Failed:  DB error: ".$sth->errstr."\n";
-  } else {
-    print "OK!<br>\n"
-  }
-  print qq(<a href="admin.cgi?action=emailnotice">Back to email notice list</a>\n);
+  $page->param(delfailed => $sth->errstr) if $sth->err;
 
 } elsif ($webvar{action} eq 'ednotice') {
-  print "<h4>Editing recipient list for '".dispNoticeCode($webvar{code})."':</h4>\n";
+
+  $page->param(dispnotice => dispNoticeCode($webvar{code}));
+  $page->param(code => $webvar{code});
   $sth = $ip_dbh->prepare("SELECT reciplist FROM notify WHERE action=?");
   $sth->execute($webvar{code});
   my ($reciplist) = $sth->fetchrow_array;
   $reciplist =~ s/,/\n/g;
-  print qq(<form action=admin.cgi method=POST><input type=hidden name=code value="$webvar{code}">\n).
-	qq(<input type=hidden name=action value="updnotice"><table border=1><tr><td>).
-	qq(<textarea cols="40" rows="5" name=reciplist>$reciplist</textarea></td><td><input type=submit value="Update">\n).
-	"</td></tr></table></form>\n";
+  $page->param(reciplist => $reciplist);
+
 } elsif ($webvar{action} eq 'updnotice') {
-  print "<h4>Updating recipient list for '".dispNoticeCode($webvar{code})."':</h4>\n";
+
+  $page->param(dispnotice => dispNoticeCode($webvar{code}));
   $sth = $ip_dbh->prepare("UPDATE notify SET reciplist=? WHERE action=?");
   $webvar{reciplist} =~ s/[\r\n]+/,/g;
   $sth->execute($webvar{reciplist}, $webvar{code});
-  if ($sth->err) {
-    print "Failed:  DB error: ".$sth->errstr."\n";
-  } else {
-    print "OK!<br>\n"
-  }
-  print qq(<a href="admin.cgi?action=emailnotice">Back to email notice list</a>\n);
+  $page->param(updfailed => $sth->errstr) if $sth->err;
+
 } elsif ($webvar{action} ne '<NULL>') {
-  print "webvar{action} check failed: Don't know how to $webvar{action}";
+  $page->param(dunno => $webvar{action});
 }
 
@@ -645,56 +575,54 @@
 
 # Show allocations to allow editing.
-sub showAllocs($) {
-  my $cidr = new NetAddr::IP $_[0];
-  print "Edit custID, allocation type, city for allocations in ".
-	"$cidr:\n<table border=1>";
-  $sth = $ip_dbh->prepare("select * from allocations where cidr <<= '$cidr' order by cidr");
-  $sth->execute;
-  while (my @data = $sth->fetchrow_array) {
-    print "<tr><form action=admin.cgi method=POST><input type=hidden name=action value=update>\n".
-	qq(<td>$data[0]<input type=hidden value="$data[0]" name=block></td>\n).
-	qq(<td><input name=custid value="$data[1]"></td>\n).
-	"<td><select name=alloctype>";
-
+sub showAllocs {
+
+  my $within = new NetAddr::IP $_[0];
+  $page->param(within => $within);
+
+  $sth = $ip_dbh->prepare("select cidr,custid,type,city,description from allocations where cidr <<= '$within' order by cidr");
+  $sth->execute;
+  my @blocklist;
+  while (my ($cidr,$custid,$type,$city,$desc) = $sth->fetchrow_array) {
+    my %row = (
+	cidr => $cidr,
+	custid => $custid,
+	city => $city,
+	desc => $desc,
+	);
+
+##fixme:  don't wanna retrieve the whole type list *every time around the outer loop*
     my $sth2 = $ip_dbh->prepare("select type,listname from alloctypes".
 	" where listorder < 500 and not (type like '_i') order by listorder");
     $sth2->execute;
-    while (my @types = $sth2->fetchrow_array) {
-      print "<option". (($data[2] eq $types[0]) ? ' selected' : '') .
-	" value='$types[0]'>$types[1]</option>\n";
+    my @typelist;
+    while (my ($listtype,$dispname) = $sth2->fetchrow_array) {
+      my %subrow = (
+	type => $listtype,
+	dispname => $dispname,
+	selected => ($listtype eq $type)
+	);
+      push @typelist, \%subrow;
     }
-
-    print qq(<td><input name=city value="$data[3]"></td>\n).
-	"<td>$data[4]</td><td>$data[5]</td>".
-	qq(<td><input type=submit value="Update"></td></form></tr>\n);
-  }
-  print "</table>\n";
-
-  # notes
-  print "<hr><b>Notes:</b>\n".
-	"<ul>\n<li>Use the main interface to update description and notes fields\n".
-	"<li>Changing the allocation type here will NOT affect IP pool data.\n".
-	"</ul>\n";
-}
+    $row{typelist} = \@typelist;
+    push @blocklist, \%row;
+  }
+  $page->param(blocklist => \@blocklist);
+} # end showAllocs()
 
 
 # Stuff updates into DB
 sub update {
-  eval {
-    # Relatively simple SQL transaction here.  Note that we're deliberately NOT
-    # updating notes/desc here as it's available through the main interface.
-    $sth = $ip_dbh->prepare("update allocations set custid='$webvar{custid}',".
-	"city='$webvar{city}',type='$webvar{alloctype}' where cidr='$webvar{block}'");
-    $sth->execute;
-    $ip_dbh->commit;
-  };
-  if ($@) {
-    carp "Transaction aborted because $@";
-    eval { $ip_dbh->rollback; };
-    syslog "err", "$authuser could not update block '$webvar{block}': '$@'";
+  # Relatively simple SQL transaction here.  Note that we're deliberately NOT
+  # updating notes/desc here as it's available through the main interface.
+  $sth = $ip_dbh->prepare("update allocations set custid='$webvar{custid}',".
+	"city=?,type='$webvar{alloctype}' where cidr='$webvar{block}'");
+  $sth->execute($webvar{city});
+
+  $page->param(block => $webvar{block});
+  if ($sth->err) {
+    $page->param(updfailed => $sth->errstr);
+    syslog "err", "$authuser could not update block '$webvar{block}': '".$sth->errstr."'";
   } else {
-    # If we get here, the operation succeeded.
     syslog "notice", "$authuser updated $webvar{block}";
-    print "Allocation $webvar{block} updated<hr>\n";
   }
   # need to get /24 that block is part of
@@ -702,5 +630,5 @@
   $bits[3] = "0/24";
   showAllocs((join ".", @bits));
-}
+} # end update()
 
 
@@ -710,33 +638,34 @@
 sub showPool($) {
   my $pool = new NetAddr::IP $_[0];
-  print qq(Listing pool $pool:\n<table border=1>
-<form action=admin.cgi method=POST>
-<input type=hidden name=action value=updatepool>
-<tr><td align=right>Customer ID:</td><td><input name=custid></td></tr>
-<tr><td align=right>Customer location:</td><td><input name=city></td></tr>
-<tr><td align=right>Type:</td><td><select name=type><option selected>-</option>\n);
 
   $sth = $ip_dbh->prepare("select type,listname from alloctypes where type like '_i' order by listorder");
   $sth->execute;
-  while (my @data = $sth->fetchrow_array) {
-    print "<option value='$data[0]'>$data[1]</option>\n";
-  }
-
-  print qq(</select></td></tr>
-<tr><td align=right>Available?</td><td><input type=checkbox value=y></td></tr>
-<tr><td align=right>Description/name:</td><td><input name=desc size=40></td></tr>
-<tr><td align=right>Notes:</td><td><textarea name=notes rows=3 cols=40></textarea></td></tr>
-<tr><td colspan=2 align=center><input type=submit value="Update"></td></tr>
-).
-	"</table>Update the following record:<table border=1>\n";
-  $sth = $ip_dbh->prepare("select pool,ip,custid,city,type,available,description,notes from poolips where pool='$pool' order by ip");
-  $sth->execute;
-  while (my @data = $sth->fetchrow_array) {
-    print qq(<tr><td><input type=radio name=ip value="$data[1]">$data[1]</td>).
-	"<td>$data[2]</td><td>$data[3]</td><td>$data[4]</td>".
-	"<td>$data[5]</td><td>$data[6]</td><td>$data[7]</td></tr>\n";
-  }
-  print "</form></table>\n";
-}
+  my @typelist;
+  while (my ($type,$dispname) = $sth->fetchrow_array) {
+    my %row = (
+	type => $type,
+	dispname => $dispname
+	);
+    push @typelist, \%row;
+  }
+  $page->param(typelist => \@typelist);
+
+  $sth = $ip_dbh->prepare("select ip,custid,city,type,available,description,notes from poolips where pool='$pool' order by ip");
+  $sth->execute;
+  my @iplist;
+  while (my ($ip,$custid,$city,$type,$avail,$desc,$notes) = $sth->fetchrow_array) {
+    my %row = (
+	ip => $ip,
+	custid => $custid,
+	city => $city,
+	type => $type,
+	avail => $avail,
+	desc => $desc,
+	notes => $notes
+	);
+    push @iplist, \%row;
+  }
+  $page->param(iplist => \@iplist);
+} # end showPool()
 
 
Index: branches/htmlform/templates/admin/addnotice.tmpl
===================================================================
--- branches/htmlform/templates/admin/addnotice.tmpl	(revision 487)
+++ branches/htmlform/templates/admin/addnotice.tmpl	(revision 487)
@@ -0,0 +1,12 @@
+<TMPL_IF cantry>
+Adding notice to <TMPL_VAR NAME=reciplist> for <TMPL_VAR NAME=dispnotice>:
+<TMPL_IF addfailed>
+Failed: DB error: <TMPL_VAR NAME=addfailed>
+<TMPL_ELSE>
+OK!<br>
+</TMPL_IF>
+<TMPL_ELSE>
+Need to specify at least one recipient, an action, and an allocation type.
+("Special" content is considered an allocation type).  Hit the Back button and try again.<br>
+</TMPL_IF>
+<a href="admin.cgi?action=emailnotice">Back to email notice list</a>
Index: branches/htmlform/templates/admin/alloc.tmpl
===================================================================
--- branches/htmlform/templates/admin/alloc.tmpl	(revision 487)
+++ branches/htmlform/templates/admin/alloc.tmpl	(revision 487)
@@ -0,0 +1,47 @@
+<form method="POST" action="admin.cgi">
+<fieldset><legend></legend>
+<table class="regular">
+<tr class="row0">
+<td>Allocating:</td>
+<td><TMPL_VAR NAME=cidr><input type="hidden" name="cidr" value="<TMPL_VAR NAME=cidr>"></td>
+</tr>
+<tr class="row1">
+<td>Type:</td>
+<td><TMPL_VAR NAME=disptype><input type="hidden" name="alloctype" value="<TMPL_VAR NAME=type>"></td>
+</tr>
+<tr class="row0">
+<td>Allocated from:</td>
+<td><TMPL_VAR NAME=alloc_from><input type="hidden" name="alloc_from" value="<TMPL_VAR NAME=alloc_from>"></td>
+</tr>
+<tr class="row1">
+<td>Customer ID:</td>
+<td><TMPL_VAR NAME=custid><input type="hidden" name="custid" value="<TMPL_VAR NAME=custid>"></td>
+</tr>
+<tr class="row0">
+<td>Customer location:</td>
+<td>
+<select name="city"><option selected>-</option>
+<TMPL_LOOP NAME=citylist><option><TMPL_VAR NAME=city></option>
+</TMPL_LOOP></select>
+&nbsp;<a href="javascript:popNotes('/ip/cgi-bin/newcity.cgi')">Add new location</a>
+</td>
+</tr>
+<tr class="row1">
+<td>Circuit ID:</td><td><input name="circid" size="40"></td>
+</tr>
+<tr class="row0">
+<td>Description/Name:</td><td><input name="desc" size="40"></td>
+</tr>
+<tr class="row1">
+<td>Notes:</td><td><textarea name="notes" rows="3" cols="40"></textarea></td>
+</tr>
+<tr class="warning">
+<td class="center" colspan="2">WARNING:  This will IMMEDIATELY assign this block!!</td>
+</tr>
+<tr class="row1">
+<td class="center" colspan="2"><input type="submit" value="  Assign  "></td>
+</tr>
+</table>
+<input type="hidden" name="action" value="confirm">
+</fieldset></form>
+
Index: branches/htmlform/templates/admin/alloctweak.tmpl
===================================================================
--- branches/htmlform/templates/admin/alloctweak.tmpl	(revision 487)
+++ branches/htmlform/templates/admin/alloctweak.tmpl	(revision 487)
@@ -0,0 +1,1 @@
+<TMPL_INCLUDE showallocs.tmpl>
Index: branches/htmlform/templates/admin/confirm.tmpl
===================================================================
--- branches/htmlform/templates/admin/confirm.tmpl	(revision 487)
+++ branches/htmlform/templates/admin/confirm.tmpl	(revision 487)
@@ -0,0 +1,7 @@
+Assigning <TMPL_VAR NAME=cidr> to <TMPL_VAR NAME=custid> ("<TMPL_VAR NAME=desc>") as
+<TMPL_VAR NAME=disptype>...<br>
+<TMPL_IF errmsg>
+Allocation failed: <TMPL_VAR NAME=errmsg>
+<TMPL_ELSE>
+Allocation OK!
+</TMPL_IF>
Index: branches/htmlform/templates/admin/delnotice.tmpl
===================================================================
--- branches/htmlform/templates/admin/delnotice.tmpl	(revision 487)
+++ branches/htmlform/templates/admin/delnotice.tmpl	(revision 487)
@@ -0,0 +1,7 @@
+Deleting notices on <TMPL_VAR NAME=dispnotice>:
+<TMPL_IF delfailed>
+Failed: DB error: <TMPL_VAR NAME=delfailed>
+<TMPL_ELSE>
+OK!<br>
+</TMPL_IF>
+<a href="admin.cgi?action=emailnotice">Back to email notice list</a>
Index: branches/htmlform/templates/admin/dunno.tmpl
===================================================================
--- branches/htmlform/templates/admin/dunno.tmpl	(revision 487)
+++ branches/htmlform/templates/admin/dunno.tmpl	(revision 487)
@@ -0,0 +1,1 @@
+webvar{action} check failed: Don't know how to <TMPL_VAR NAME=dunno>
Index: branches/htmlform/templates/admin/ednotice.tmpl
===================================================================
--- branches/htmlform/templates/admin/ednotice.tmpl	(revision 487)
+++ branches/htmlform/templates/admin/ednotice.tmpl	(revision 487)
@@ -0,0 +1,15 @@
+<h4>Editing recipient list for '<TMPL_VAR NAME=dispnotice>':</h4>
+<form action="admin.cgi" method="POST">
+<fieldset><legend></legend>
+<input type="hidden" name="code" value="<TMPL_VAR NAME=code>">
+<input type="hidden" name="action" value="updnotice">
+<table border="1">
+<tr>
+<td><textarea cols="40" rows="5" name=reciplist><TMPL_VAR NAME=reciplist></textarea></td>
+<td><input type="submit" value="Update"></td>
+</tr>
+</table>
+</fieldset>
+</form>
+<hr>
+<a href="admin.cgi?action=emailnotice">Back to email notice list</a>
Index: branches/htmlform/templates/admin/emailnotice.tmpl
===================================================================
--- branches/htmlform/templates/admin/emailnotice.tmpl	(revision 487)
+++ branches/htmlform/templates/admin/emailnotice.tmpl	(revision 487)
@@ -0,0 +1,57 @@
+<h4>Email notice management:</h4>
+Click the email addresses to edit that list.
+<table border=1>
+<TMPL_LOOP name=spamlist>
+<tr>
+<td><TMPL_VAR NAME=action></td>
+<td><a href="admin.cgi?action=ednotice&amp;code=<TMPL_VAR NAME=code>"><TMPL_VAR NAME=recips></a></td>
+<td><a href="admin.cgi?action=delnotice&amp;code=<TMPL_VAR NAME=code>">Delete</a></td>
+</tr>
+</TMPL_LOOP>
+<tr><td colspan=2>Known "special" codes:<br>
+<ul style="margin-top: 0px; margin-bottom: 0px;">
+        <li>swi: Notify if block being updated has SWIP flag set</li>
+</ul></td></tr>
+</table>
+
+<h4>Add new notification:</h4>
+Note:  Failure notices on most conditions are not yet supported.
+
+<form action=admin.cgi method="POST">
+<fieldset><legend></legend>
+<input type="hidden" name="action" value="addnotice">
+<table border="1">
+<tr>
+<td>Recipients</td><td colspan="3"><textarea name="reciplist" cols="50" rows="5"></textarea></td></tr>
+<tr><td>Action</td><td>
+	<table><tr>
+		<td><input type="radio" name="msgaction" value="a">Add &nbsp;
+		<input type="radio" name="msgaction" value="u">Update &nbsp;
+		<input type="radio" name="msgaction" value="d">Delete &nbsp;
+		<input type="radio" name="msgaction" value="n">New listitem</td>
+	</tr><tr>
+		<td>
+		<input type="radio" name="msgaction" value="s:">Special: <input name="special">(requires code changes)
+	</td></tr></table>
+</td>
+<td>Failure?</td><td><input type="checkbox" name="onfail"></td></tr>
+<tr><td>Event/Allocation type:</td><td colspan="3">
+	<table>
+	<tr>
+		<td><input type="radio" name="alloctype" value="a">All allocations</td>
+		<td><input type="radio" name="alloctype" value=".i">All static IPs</td>
+		<td><input type="radio" name="alloctype" value="ci">New city</td>
+		<td><input type="radio" name="alloctype" value="no">New node</td>
+	</tr>
+	<tr>
+<TMPL_LOOP name=typelist>		<td><input type="radio" name="alloctype" value="<TMPL_VAR NAME=type>"><TMPL_VAR NAME=disptype></td>
+<TMPL_UNLESS newrow>	</tr>
+	<tr>
+</TMPL_UNLESS></TMPL_LOOP>
+	</tr>
+	</table>
+</tr>
+<tr><td colspan="4" align="center"><input type="submit" value="Add notice"></td></tr>
+</table>
+</fieldset>
+</form>
Index: branches/htmlform/templates/admin/header.tmpl
===================================================================
--- branches/htmlform/templates/admin/header.tmpl	(revision 484)
+++ branches/htmlform/templates/admin/header.tmpl	(revision 487)
@@ -5,4 +5,5 @@
 	<link rel="stylesheet" type="text/css" href="/ip/ipdb.css">
 	<link rel="stylesheet" type="text/css" href="/ip/local.css">
+	<script src="/ip/templates/widgets.js" type="text/javascript"></script>
 </head>
 <body>
Index: branches/htmlform/templates/admin/showallocs.tmpl
===================================================================
--- branches/htmlform/templates/admin/showallocs.tmpl	(revision 487)
+++ branches/htmlform/templates/admin/showallocs.tmpl	(revision 487)
@@ -0,0 +1,27 @@
+Edit custID, allocation type, city for allocations in <TMPL_VAR NAME=within>:
+<table border="1">
+<TMPL_LOOP name=blocklist>
+<tr>
+<form action="admin.cgi" method="POST">
+<fieldset><legend></legend>
+<input type="hidden" name="action" value="update">
+<td><TMPL_VAR NAME=cidr><input type="hidden" value="<TMPL_VAR NAME=cidr>" name=block></td>
+<td><input name="custid" value="<TMPL_VAR NAME=custid>"></td>
+<td>
+	<select name="alloctype">
+<TMPL_LOOP name=typelist>	<option value="<TMPL_VAR NAME=type>"<TMPL_IF selected> selected</TMPL_IF>><TMPL_VAR NAME=dispname></option>
+</TMPL_LOOP>	</select>
+</td>
+<td><input name="city" value="<TMPL_VAR NAME=city>"></td>
+<td><TMPL_VAR NAME=desc></td>
+<td><input type="submit" value="Update"></td>
+</fieldset></form>
+</tr>
+</TMPL_LOOP>
+</table>
+<hr>
+<b>Notes:</b>
+<ul>
+	<li>Use the main interface to update description and notes fields.
+	<li>Changing the allocation type here will NOT affect IP pool data.
+</ul>
Index: branches/htmlform/templates/admin/tweakpool.tmpl
===================================================================
--- branches/htmlform/templates/admin/tweakpool.tmpl	(revision 484)
+++ branches/htmlform/templates/admin/tweakpool.tmpl	(revision 487)
@@ -0,0 +1,25 @@
+Listing pool <TMPL_VAR NAME=pool>:
+<form action="admin.cgi" method="POST">
+<fieldset><legend></legend>
+<input type="hidden" name="action" value="updatepool">
+<table border="1">
+<tr><td align="right">Customer ID:</td><td><input name="custid"></td></tr>
+<tr><td align="right">Customer location:</td><td><input name="city"></td></tr>
+<tr><td align="right">Type:</td><td><select name="type"><option selected>-</option>
+<TMPL_LOOP name=typelist><option value="<TMPL_VAR NAME=type>"><TMPL_VAR NAME=dispname></option>
+</TMPL_LOOP>
+</select></td></tr>
+<tr><td align="right">Available?</td><td><input type="checkbox" value="y"></td></tr>
+<tr><td align="right">Description/name:</td><td><input name="desc" size="40"></td></tr>
+<tr><td align="right">Notes:</td><td><textarea name="notes" rows="3" cols="40"></textarea></td></tr>
+<tr><td colspan=2 align=center><input type=submit value="Update"></td></tr>
+</table>
+Update the following record:
+<table border=1>
+<TMPL_LOOP NAME=iplist>
+<tr><td><input type="radio" name="ip" value="<TMPL_VAR NAME=ip>"><TMPL_VAR NAME=ip></td>
+<td><TMPL_VAR NAME=custid></td><td><TMPL_VAR NAME=city></td><td><TMPL_VAR NAME=type></td>
+<td><TMPL_VAR NAME=avail></td><td><TMPL_VAR NAME=desc></td><td><TMPL_VAR NAME=notes></td></tr>
+</TMPL_LOOP>
+</table>
+</fieldset></form>
Index: branches/htmlform/templates/admin/update.tmpl
===================================================================
--- branches/htmlform/templates/admin/update.tmpl	(revision 487)
+++ branches/htmlform/templates/admin/update.tmpl	(revision 487)
@@ -0,0 +1,7 @@
+<TMPL_IF updfailed>
+Update of <TMPL_VAR NAME=block> failed: <TMPL_VAR NAME=updfailed>
+<TMPL_ELSE>
+Allocation <TMPL_VAR NAME=block> updated
+</TMPL_IF>
+<hr>
+<TMPL_INCLUDE showallocs.tmpl>
Index: branches/htmlform/templates/admin/updatepool.tmpl
===================================================================
--- branches/htmlform/templates/admin/updatepool.tmpl	(revision 487)
+++ branches/htmlform/templates/admin/updatepool.tmpl	(revision 487)
@@ -0,0 +1,9 @@
+<TMPL_IF errmsg>
+Error updating pool IP <TMPL_VAR NAME=ip>: <TMPL_VAR NAME=errmsg>
+<TMPL_ELSE>
+<TMPL_VAR NAME=ip> in <TMPL_VAR NAME=pool> updated.
+</TMPL_IF>
+<hr>
+<a href="admin.cgi?action=tweakpool&amp;pool=<TMPL_VAR NAME=pool>">Back</a> to list of IPs in <TMPL_VAR NAME=pool>
+<hr>
+<a href="admin.cgi?action=showpools">Back</a> to list of pools
Index: branches/htmlform/templates/admin/updnotice.tmpl
===================================================================
--- branches/htmlform/templates/admin/updnotice.tmpl	(revision 487)
+++ branches/htmlform/templates/admin/updnotice.tmpl	(revision 487)
@@ -0,0 +1,7 @@
+<h4>Updating recipient list for '<TMPL_VAR NAME=dispnotice>':</h4>
+<TMPL_IF updfailed>
+Failed: DB error: <TMPL_VAR NAME=updfailed>
+<TMPL_ELSE>
+OK!<br>
+</TMPL_IF>
+<a href="admin.cgi?action=emailnotice">Back to email notice list</a>
