Changeset 697
- Timestamp:
- 02/18/15 17:16:21 (10 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r696 r697 31 31 &listSummary &listSubs &listContainers &listAllocations &listFree &listPool 32 32 &getMasterList &getTypeList &getPoolSelect &findAllocateFrom 33 &ipParent &subParent &blockParent &get RoutedCity33 &ipParent &subParent &blockParent &getBreadCrumbs &getRoutedCity 34 34 &allocateBlock &updateBlock &deleteBlock &getBlockData &getBlockRDNS &getRDNSbyIP 35 35 &getNodeList &getNodeName &getNodeInfo … … 46 46 &listSummary &listSubs &listContainers &listAllocations &listFree &listPool 47 47 &getMasterList &getTypeList &getPoolSelect &findAllocateFrom 48 &ipParent &subParent &blockParent &get RoutedCity48 &ipParent &subParent &blockParent &getBreadCrumbs &getRoutedCity 49 49 &allocateBlock &updateBlock &deleteBlock &getBlockData &getBlockRDNS &getRDNSbyIP 50 50 &getNodeList &getNodeName &getNodeInfo … … 950 950 951 951 952 ## IPDB::getBreadCrumbs() 953 # Retrieve the ID and CIDR of a block's parent(s) up to the master block 954 # Returns an arrayref to a list of hashrefs with CIDR and block ID 955 sub getBreadCrumbs { 956 my $dbh = shift; 957 my $parent = shift; 958 my @result; 959 960 my $sth = $dbh-> prepare("SELECT cidr,type,id,parent_id FROM allocations WHERE id=?"); 961 962 while ($parent != 0) { 963 $sth->execute($parent); 964 my ($cidr,$type,$id,$pid) = $sth->fetchrow_array; 965 push @result, {cidr => $cidr, link => $id, ispool => ($type =~ /^.[dp]$/ ? 1 : 0)}; 966 $parent = $pid; 967 } 968 969 return \@result; 970 } # end getBread() 971 972 952 973 ## IPDB::getRoutedCity() 953 974 # Get the city for a routed block. -
trunk/cgi-bin/main.cgi
r695 r697 74 74 my $header = HTML::Template->new(filename => "header.tmpl"); 75 75 my $footer = HTML::Template->new(filename => "footer.tmpl"); 76 my $utilbar = HTML::Template->new(filename => "utilbar.tmpl", loop_context_vars => 1, global_vars => 1); 77 78 print "Content-type: text/html\n\n"; 76 79 77 80 $header->param(version => $IPDB::VERSION); 78 81 $header->param(addperm => $IPDBacl{$authuser} =~ /a/); 79 82 $header->param(webpath => $IPDB::webpath); 80 print "Content-type: text/html\n\n", $header->output; 83 84 $utilbar->param(webpath => $IPDB::webpath); 85 86 print $header->output; 81 87 82 88 … … 221 227 #print "Content-type: text/html\n\n", $header->output; 222 228 $page->param(webpath => $IPDB::webpath); 229 print $utilbar->output; 223 230 print $page->output; 224 231 … … 278 285 #$page->param(editme => 1) unless $pinfo->{type} ne 'mm'; 279 286 287 my $crumbs = getBreadCrumbs($ip_dbh, $pinfo->{parent_id}); 288 my @rcrumbs = reverse (@$crumbs); 289 $utilbar->param(breadcrumb => \@rcrumbs); 290 280 291 $page->param(self_id => $webvar{parent}); 281 292 $page->param(block => $pinfo->{block}); … … 292 303 my $poolinfo = getBlockData($ip_dbh, $webvar{pool}); 293 304 my $cidr = new NetAddr::IP $poolinfo->{block}; 305 306 # Tree navigation 307 my $crumbs = getBreadCrumbs($ip_dbh, $poolinfo->{parent_id}); 308 my @rcrumbs = reverse (@$crumbs); 309 $utilbar->param(breadcrumb => \@rcrumbs); 294 310 295 311 $page->param(block => $cidr); … … 348 364 # seems reasonable that a new allocation would share a VRF with its parent 349 365 $page->param(pvrf => $pinfo->{vrf}); 366 367 # Tree navigation 368 my $crumbs = getBreadCrumbs($ip_dbh, $webvar{parent}); 369 my @rcrumbs = reverse (@$crumbs); 370 $utilbar->param(breadcrumb => \@rcrumbs); 350 371 351 372 $webvar{fbtype} = '' if !$webvar{fbtype}; … … 441 462 442 463 if ($webvar{fbassign} && $webvar{fbassign} eq 'y') { 464 465 # Tree navigation 466 my $crumbs = getBreadCrumbs($ip_dbh, $webvar{parent}); 467 my @rcrumbs = reverse (@$crumbs); 468 $utilbar->param(breadcrumb => \@rcrumbs); 469 443 470 $cidr = new NetAddr::IP $webvar{block}; 444 471 $alloc_from = new NetAddr::IP $webvar{allocfrom}; … … 685 712 $page->param(alloctype => $disp_alloctypes{$webvar{alloctype}}); 686 713 $page->param(custid => $webvar{custid}); 714 687 715 # breadcrumbs lite! provide at least a link to the parent of the block we just allocated. 688 716 my $binfo = getBlockData($ip_dbh, $webvar{parent}); 689 717 $page->param(parentid => $webvar{parent}); 690 718 $page->param(parentblock => $binfo->{block}); 719 720 # Full breadcrumbs 721 my $crumbs = getBreadCrumbs($ip_dbh, $webvar{parent}); 722 my @rcrumbs = reverse (@$crumbs); 723 $utilbar->param(breadcrumb => \@rcrumbs); 724 691 725 if ($webvar{alloctype} eq 'pr' && $webvar{billinguser}) { 692 726 $page->param(billinguser => $webvar{billinguser}); … … 829 863 $page->param(id => $webvar{id}); 830 864 $page->param(basetype => $webvar{basetype}); 865 866 # Tree navigation 867 my $crumbs = getBreadCrumbs($ip_dbh, $blockinfo->{parent_id}); 868 my @rcrumbs = reverse (@$crumbs); 869 $utilbar->param(breadcrumb => \@rcrumbs); 831 870 832 871 # Clean up extra whitespace on alloc type. Mainly a legacy-data cleanup. -
trunk/ipdb.css
r691 r697 56 56 top: 2px; 57 57 text-align: right; 58 } 59 #breadcrumb { 60 font-size: 13px; 61 font-weight: bold; 62 position: absolute; 63 top: 2px; 58 64 } 59 65 #adminlink { -
trunk/templates/header.tmpl
r517 r697 44 44 45 45 <div id="main"> 46 <div id="utils">47 <a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=nodesearch">Find by connection point</a>48 </div>
Note:
See TracChangeset
for help on using the changeset viewer.