Index: trunk/cgi-bin/main.cgi
===================================================================
--- trunk/cgi-bin/main.cgi	(revision 631)
+++ trunk/cgi-bin/main.cgi	(revision 633)
@@ -300,4 +300,5 @@
 
   # hack pthbttt eww
+  $webvar{parent} = 0 if !$webvar{parent};
   $webvar{block} = '' if !$webvar{block};
 
@@ -307,22 +308,24 @@
   $page->param(allocfrom => $webvar{block});	# fb-assign flag, if block is set, we're in fb-assign
 
-  if ($webvar{block} ne '') {
+  if ($webvar{fbid} || $webvar{fbtype}) {
 
     # Common case, according to reported usage.  Block to assign is specified.
     my $block = new NetAddr::IP $webvar{block};
-    $page->param(rdepth => $webvar{rdepth});
-
-    my $rdns = getBlockRDNS($ip_dbh, $webvar{block}, $webvar{rdepth}, vrf => $webvar{vrf}, user => $authuser);
+
+    my $rdns = getBlockRDNS($ip_dbh, id => $webvar{parent}, type => $webvar{fbtype}, user => $authuser);
     $page->param(rdns => $rdns) if $rdns;
+    $page->param(parent => $webvar{parent});
+    $page->param(fbid => $webvar{fbid});
 
     $webvar{fbtype} = '' if !$webvar{fbtype};
     if ($webvar{fbtype} eq 'i') {
-      my $ipinfo = getBlockData($ip_dbh, $block);
+      my $ipinfo = getBlockData($ip_dbh, $webvar{block}, 'i');
+      my $pinfo = getBlockData($ip_dbh, $webvar{parent});
       $page->param(
 	fbip => 1,
-	block => $block,
+	block => $ipinfo->{block},
 	fbdisptype => $list_alloctypes{$ipinfo->{type}},
 	type => $ipinfo->{type},
-	allocfrom => $ipinfo->{pool},
+	allocfrom => $pinfo->{block},
 	);
     } else {
@@ -340,5 +343,5 @@
 
     my @pops;
-    foreach my $pop (@poplist) {
+    foreach my $pop (@citylist) {
       my %row = (pop => $pop);
       push (@pops, \%row);
@@ -378,4 +381,6 @@
   my $cidr;
   my $alloc_from;
+  my $fbid = $webvar{fbid};
+  my $p_id = $webvar{parent};
 
   # Going to manually validate some items.
@@ -428,6 +433,6 @@
 
 ## fixme:  add rdepth?
-      ($cidr,$webvar{rdepth}) = findAllocateFrom($ip_dbh, $webvar{maskbits}, $webvar{alloctype}, $webvar{city},
-	$webvar{pop}, (master => $webvar{allocfrom}, allowpriv => $webvar{allowpriv}) );
+      ($fbid,$cidr,$p_id) = findAllocateFrom($ip_dbh, $webvar{maskbits}, $webvar{alloctype},
+	$webvar{city}, $webvar{pop}, (master => $webvar{allocfrom}, allowpriv => $webvar{allowpriv}) );
       if (!$cidr) {
 	$page->param(err => $failmsg);
@@ -464,5 +469,6 @@
   $page->param(typefull => $q->escapeHTML($disp_alloctypes{$webvar{alloctype}}));
   $page->param(alloc_from => $alloc_from);
-  $page->param(rdepth => $webvar{rdepth});
+  $page->param(parent => $p_id);
+  $page->param(fbid => $fbid);
   $page->param(cidr => $cidr);
   $page->param(rdns => $webvar{rdns});
@@ -514,6 +520,6 @@
   # IP, or the error message if an error occurred.
 
-  my ($code,$msg) = allocateBlock($ip_dbh, cidr => $webvar{fullcidr}, alloc_from => $webvar{alloc_from},
-	rdepth => $webvar{rdepth}, custid => $webvar{custid}, type => $webvar{alloctype}, city => $webvar{city}, 
+  my ($code,$msg) = allocateBlock($ip_dbh, cidr => $webvar{fullcidr}, fbid => $webvar{fbid},
+	parent => $webvar{parent}, custid => $webvar{custid}, type => $webvar{alloctype}, city => $webvar{city}, 
 	desc => $webvar{desc}, notes => $webvar{notes}, circid => $webvar{circid},
 	privdata => $webvar{privdata}, nodeid => $webvar{node}, rdns => $webvar{rdns}, user => $authuser);
@@ -524,5 +530,5 @@
       $page->param(staticip => $msg);
       $page->param(custid => $webvar{custid});
-      $page->param(parent => $webvar{alloc_from}, rdepth => $webvar{rdepth}-1);
+      $page->param(parent => $webvar{parent}, pool => $webvar{alloc_from});
       $page->param(billinguser => $webvar{billinguser});
       mailNotify($ip_dbh, "a$webvar{alloctype}", "ADDED: $disp_alloctypes{$webvar{alloctype}} allocation",
@@ -535,6 +541,7 @@
       $page->param(custid => $webvar{custid});
       # breadcrumbs lite!  provide at least a link to the parent of the block we just allocated.
-      my $binfo = getBlockData($ip_dbh, $webvar{fullcidr}, $webvar{rdepth});
-      $page->param(parent => $binfo->{parent}, rdepth => $binfo->{rdepth});
+      my $binfo = getBlockData($ip_dbh, $webvar{parent});
+      $page->param(parentid => $webvar{parent});
+      $page->param(parentblock => $binfo->{block});
       if ($webvar{alloctype} eq 'pr' && $webvar{billinguser}) {
 	$page->param(billinguser => $webvar{billinguser});
