Index: branches/htmlform/cgi-bin/main.cgi
===================================================================
--- branches/htmlform/cgi-bin/main.cgi	(revision 468)
+++ branches/htmlform/cgi-bin/main.cgi	(revision 469)
@@ -982,17 +982,34 @@
 ##fixme
 # Needs thinking.  Have to allow changes to city to correct errors, no?
+# Also have areas where a routed block at a POP serves "many" cities/towns/named crossroads
   $html =~ s/\$\$BLOCK\$\$/$webvar{block}/g;
+
+# cidr,custid,type,city,circuitid,description,notes,modifystamp,privdata,swip
+
+$page->param(block => $webvar{block});
+
+$page->param(custid => $data[1]);
+$page->param(city => $data[3]);
+$page->param(circid => $data[4]);
+$page->param(desc => $data[5]);
+$page->param(notes => $data[6]);
 
   if ($IPDBacl{$authuser} =~ /c/) {
     $html =~ s/\$\$CUSTID\$\$/<input type=text name=custid value="$data[1]" maxlength=15 class="regular">/;
-
-# Screw it.  Changing allocation types gets very ugly VERY quickly- especially
-# with the much longer list of allocation types.
-# We'll just show what type of block it is.
-
-# this has now been Requested, so here goes.
-
 ##fixme The check here should be built from the database
+# Need to expand to support pool types too
     if ($data[2] =~ /^.[ne]$/) {
+$page->param(changetype => $IPDBacl{$authuser} =~ /c/);
+$page->param(alloctype => [
+		{ selme => ($data[2] eq 'me'), type => "me", disptype => "Dialup netblock" },
+		{ selme => ($data[2] eq 'de'), type => "de", disptype => "Dynamic DSL netblock" },
+		{ selme => ($data[2] eq 'ce'), type => "ce", disptype => "Dynamic cable netblock" },
+		{ selme => ($data[2] eq 'we'), type => "we", disptype => "Dynamic wireless netblock" },
+		{ selme => ($data[2] eq 'cn'), type => "cn", disptype => "Customer netblock" },
+		{ selme => ($data[2] eq 'en'), type => "en", disptype => "End-use netblock" },
+		{ selme => ($data[2] eq 'in'), type => "in", disptype => "Internal netblock" },
+		]
+	);
+
       # Block that can be changed
       my $blockoptions = "<select name=alloctype><option".
@@ -1010,14 +1027,25 @@
     }
 ## node hack
+##fixme:  this whole hack needs cleanup and generalization for all alloctypes
   $sth = $ip_dbh->prepare("SELECT node_id FROM noderef WHERE block='$webvar{block}'");
   $sth->execute;
   my ($nodeid) = $sth->fetchrow_array();
+$page->param(havenodeid => $nodeid);
+$page->param(typesupportsnodes => ($data[2] eq 'fr' || $data[2] eq 'bi'));
   if ($nodeid) {
     $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id");
     $sth->execute() or print "DEBUG: failed retrieval from nodes: ".$sth->errstr,"<br>\n";
     my $nodes = "<select name=node>\n";
+    my @nodelist;
     while (my ($nid,$nname) = $sth->fetchrow_array()) {
       $nodes .= "<option".($nodeid == $nid ? ' selected' : '')." value='$nid'>$nname</option>\n";
-    }
+      my %row = (
+	selme => ($nodeid == $nid),
+	nodeid => $nid,
+	nodename => $nname,
+	);
+      push (@nodelist, \%row);
+    }
+$page->param(nodelist => \@nodelist);
     $nodes .= "</select>\n";
     $html =~ s/\$\$NODE\$\$/$nodes/;
@@ -1061,5 +1089,5 @@
   }
   my ($lastmod,undef) = split /\s+/, $data[7];
-  $html =~ s/\$\$LASTMOD\$\$/$lastmod/g;
+  $page->param(lastmod => $lastmod);
 
 ## Hack time!  SWIP isn't going to stay, so I'm not going to integrate it with ACLs.
@@ -1077,4 +1105,7 @@
   # Check to see if we can display sensitive data
   my $privdata = '';
+$page->param(nocling => $IPDBacl{$authuser} =~ /s/);
+$page->param(privdata => $data[8]);
+
   if ($IPDBacl{$authuser} =~ /s/) {
     $privdata = qq(<tr class="color).($i%2).qq("><td class=heading>Restricted data:</td>).
@@ -1089,4 +1120,5 @@
   # can't leave the submit buttons there.
   my $updok = '';
+$page->param(maychange => $IPDBacl{$authuser} =~ /c/);
   if ($IPDBacl{$authuser} =~ /c/) {
     $updok = qq(<tr class="color).($i%2).qq("><td colspan=2><div class="center">).
@@ -1098,4 +1130,5 @@
 
   my $delok = '';
+$page->param(maydel => $IPDBacl{$authuser} =~ /d/);
   if ($IPDBacl{$authuser} =~ /d/) {
     $delok = qq(<form method="POST" action="main.cgi">
@@ -1109,5 +1142,5 @@
   $html =~ s/\$\$DELOK\$\$/$delok/;
 
-  print $html;
+#  print $html;
 
 } # edit()
Index: branches/htmlform/ipdb.css
===================================================================
--- branches/htmlform/ipdb.css	(revision 468)
+++ branches/htmlform/ipdb.css	(revision 469)
@@ -96,10 +96,12 @@
 	font-family: Verdana, Arial, Helvetica, sans-serif;
 }
-tr.row0 {
+/* for reasons of Please The Validation Gods, these may be applied to
+   things that are not technically table rows */
+.row0 {
 	background-color: #D0E0E0;
 	font-family: Verdana, Arial, Helvetica, sans-serif;
 	font-size: 90%;
 }
-tr.row1 {
+.row1 {
 	background-color: #A8C4D0;
 	font-family: Verdana, Arial, Helvetica, sans-serif;
Index: branches/htmlform/templates/edit.tmpl
===================================================================
--- branches/htmlform/templates/edit.tmpl	(revision 469)
+++ branches/htmlform/templates/edit.tmpl	(revision 469)
@@ -0,0 +1,161 @@
+<div class="indent">
+<div class="heading">Edit the information below</div>
+
+<!-- table class="indent" size="33%" cellspacing=1 bgcolor="black" -->
+
+<table>
+<tr>
+<td>
+
+<TMPL_IF maychange>
+<form method="POST" action="main.cgi">
+<fieldset><legend></legend>
+<input type="hidden" name="action" value="update">
+<input type="hidden" name="block" value="<TMPL_VAR NAME=block>">
+</TMPL_IF>
+
+<table cellspacing=1>
+
+<tr class="row0">
+<td class=heading>IP block:</td>
+<td class="regular"><TMPL_VAR NAME=block></td>
+</tr>
+
+<tr class="row1">
+<td class=heading>City:</td>
+<td class="regular">
+<TMPL_IF maychange>
+<input type=text name=city value="<TMPL_VAR NAME=city>">
+<TMPL_ELSE>
+<TMPL_VAR NAME=city>
+</TMPL_IF>
+</td>
+</tr>
+
+<tr class="row0">
+<td class=heading>Type:</td>
+<td class=regular>
+<TMPL_IF changetype>
+<select name=alloctype>
+<TMPL_LOOP name=alloctype>	<option <TMPL_IF selme>selected="selected"</TMPL_IF> value="<TMPL_VAR NAME=type>"><TMPL_VAR NAME=disptype></option>
+</TMPL_LOOP>
+</select>
+<TMPL_ELSE>
+<TMPL_VAR NAME=disptype>
+</TMPL_IF>
+</td>
+</tr>
+
+<tr class="row1">
+<td class=heading>Demarc/tower:</td>
+<td class=regular>
+<TMPL_IF typesupportsnodes>
+<TMPL_IF maychange>
+<select name=demarc><TMPL_UNLESS havenodeid>
+	<option selected="selected">--</option></TMPL_UNLESS>
+<TMPL_LOOP NAME=nodelist>
+	<option <TMPL_IF selme>selected="selected"</TMPL_IF> value="<TMPL_VAR NAME=nodeid>"><TMPL_VAR NAME=nodename></option></TMPL_LOOP>
+</select>
+<TMPL_ELSE>
+<TMPL_VAR NAME=nodename>
+</TMPL_IF>
+<TMPL_ELSE>
+N/A
+</TMPL_IF>
+</td>
+</tr>
+
+<tr class="row0">
+<td class=heading>CustID:</td>
+<td class="regular">
+<TMPL_IF maychange>
+<input type=text name=custid value="<TMPL_VAR NAME=custid>" maxlength=15 class="regular">
+<TMPL_ELSE>
+<TMPL_VAR NAME=custid>
+</TMPL_IF>
+</td>
+</tr>
+
+<tr class="row1">
+<td class=heading>SWIPed?:</td>
+<td class=regular>
+<TMPL_IF maychange>
+<input type=checkbox name=swip <TMPL_IF swip>checked=yes</TMPL_IF>>
+<TMPL_ELSE>
+<TMPL_IF swip>Yes<TMPL_ELSE>No</TMPL_IF>
+</TMPL_IF>
+</td>
+</tr>
+
+<tr class="row0">
+<td class=heading>Last modified:</td>
+<td class=regular><TMPL_VAR NAME=lastmod></td>
+</tr>
+
+<tr class="row1">
+<td class="heading">Circuit ID:</td>
+<td class="regular">
+<TMPL_IF maychange>
+<input type="text" name="circid" value="<TMPL_VAR NAME=circid>" maxlength=64 size=64 class="regular">
+<TMPL_ELSE>
+<TMPL_VAR NAME=circid>
+</TMPL_IF>
+</td>
+</tr>
+
+<tr class="row0">
+<td class="heading">Description/Name:</td>
+<td class="regular">
+<TMPL_IF maychange>
+<input type="text" name="desc" value="<TMPL_VAR NAME=desc>" maxlength=64 size=64 class="regular">
+<TMPL_ELSE>
+<TMPL_VAR NAME=desc>
+</TMPL_IF>
+</td>
+</tr>
+
+<tr class="row1">
+<td class="heading" valign="top">Notes:</td>
+<td class="regular">
+<TMPL_IF maychange><textarea rows="8" cols="64" name="notes" class="regular"><TMPL_VAR NAME=notes></textarea>
+<TMPL_ELSE>
+<TMPL_VAR NAME=notes>
+</TMPL_IF>
+</td>
+</tr>
+
+<TMPL_IF nocling>
+<tr class="row0">
+<td class=heading>Restricted data:</td>
+<td class=regular>
+<TMPL_IF maychange>
+<textarea rows="3" cols="64" name="privdata" class="regular"><TMPL_VAR NAME=privdata></textarea>
+<TMPL_ELSE>
+<TMPL_VAR NAME=privdata>
+</TMPL_IF>
+</td>
+</tr>
+</TMPL_IF>
+</table>
+
+<TMPL_IF maychange>
+<div class="row0"><input type="submit" value=" Update this block " class="regular"></div>
+</fieldset>
+</form>
+</TMPL_IF>
+
+<TMPL_IF maydel>
+<form method="POST" action="main.cgi">
+<div class="row1">
+<input type="hidden" name="action" value="delete">
+<input type="hidden" name="block" value="1.2.14.24/29">
+<input type="hidden" name="alloctype" value="me">
+<input type=submit value=" Delete this block ">
+</div>
+</form>
+</TMPL_IF>
+</td>
+</tr>
+</table>
+
+</div>
