- Timestamp:
- 01/02/15 17:26:32 (10 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/ipdb-2.7-3.0.sql
r658 r670 32 32 -- probably need some more indexes 33 33 34 -- Need some additional fields to support search output. Might arguably 35 -- move pool IPs into the allocations table; we'll see. 36 DROP VIEW searchme; 37 CREATE VIEW "searchme" AS 38 SELECT allocations.cidr, allocations.custid, allocations."type", allocations.city, 39 allocations.description, allocations.notes, allocations.circuitid, allocations.id, 40 allocations.parent_id, 'n' AS available 41 FROM allocations 42 UNION 43 SELECT poolips.ip, poolips.custid, poolips.type, poolips.city, 44 poolips.description, poolips.notes, poolips.circuitid, poolips.id, 45 poolips.parent_id, poolips.available 46 FROM poolips; 47 34 48 -- Relabel a few types to match the new structure 35 49 UPDATE alloctypes SET listname='Routing aggregation', dispname='Routing aggregation' WHERE type='rm'; -
trunk/cgi-bin/search.cgi
r526 r670 78 78 $page = HTML::Template->new(filename => "search/compsearch.tmpl"); 79 79 } else { 80 $page = HTML::Template->new(filename => "search/sresults.tmpl"); 80 $page = HTML::Template->new(filename => "search/sresults.tmpl", global_vars => 1); 81 $page->param(webpath => $IPDB::webpath); 81 82 } 82 83 … … 84 85 $header->param(version => $IPDB::VERSION); 85 86 $header->param(addperm => $IPDBacl{$authuser} =~ /a/); 87 $header->param(webpath => $IPDB::webpath); 86 88 print "Content-type: text/html\n\n", $header->output; 89 90 # Columns actually returned. Slightly better than hardcoding it 91 # in each (sub)select 92 my $cols = "cidr,custid,type,city,description,id,parent_id,available"; 87 93 88 94 # Handle the DB error first … … 141 147 # Iff something has NOT been entered, we still include it but in 142 148 # such a way that it does not actually filter anything out. 143 144 # Columns actually returned. Slightly better than hardcoding it145 # in each (sub)select146 my $cols = "cidr,custid,type,city,description";147 149 148 150 # hack fix for undefined variables … … 248 250 # Node search. 249 251 250 my $sql = "SELECT cidr,custid,type,city,descriptionFROM searchme".252 my $sql = "SELECT $cols FROM searchme". 251 253 " WHERE cidr IN (SELECT block FROM noderef WHERE node_id=$webvar{node})"; 252 254 … … 345 347 # 5) Invalid data which might be interpretable as an IP or something, but 346 348 # which probably shouldn't be for reasons of sanity. 347 348 my $cols = "cidr,custid,type,city,description";349 349 350 350 if ($category eq 'all') { … … 469 469 my $count = 0; 470 470 my @sresults; 471 while (my ($block, $custid, $type, $city, $desc ) = $sth->fetchrow_array) {471 while (my ($block, $custid, $type, $city, $desc, $id, $parent, $avail) = $sth->fetchrow_array) { 472 472 my %row = ( 473 473 rowclass => $count++ % 2, 474 474 issub => ($type =~ /^.r$/ ? 1 : 0), 475 ispool => ($type =~ /^.[pd]$/ ? 1 : 0), 476 basetype => ($type =~ /^.i/ ? 'i' : 'b'), 477 freeip => ($avail eq 'y'), 478 parent => $parent, 475 479 block => $block, 476 ispool => ($type =~ /^.[pd]$/ ? 1 : 0),477 480 custid => $custid, 478 481 disptype => $disp_alloctypes{$type}, 479 482 city => $city, 480 desc => $desc 483 desc => $desc, 484 id => $id, 481 485 ); 482 486 push @sresults, \%row; -
trunk/templates/search/sresults.tmpl
r517 r670 17 17 <TMPL_LOOP NAME=sresults> 18 18 <tr class="row<TMPL_VAR NAME=rowclass>"> 19 <td><TMPL_IF issub>Sub </TMPL_IF><a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=edit&block=<TMPL_VAR NAME=block>"><TMPL_VAR NAME=block></a><TMPL_IF ispool> <a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=listpool&pool=<TMPL_VAR NAME=block>">List IPs</a></TMPL_IF></td> 19 <td><TMPL_IF issub>Sub </TMPL_IF> 20 <TMPL_IF freeip> 21 <a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=assign&block=<TMPL_VAR NAME=id>&parent=<TMPL_VAR NAME=parent>&fbtype=i"><TMPL_VAR NAME=block></a> 22 <TMPL_ELSE> 23 <a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=edit&id=<TMPL_VAR NAME=id>&basetype=<TMPL_VAR NAME=basetype>"><TMPL_VAR NAME=block></a><TMPL_IF ispool> <a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=listpool&pool=<TMPL_VAR NAME=id>">List IPs</a></TMPL_IF> 24 </TMPL_IF> 25 </td> 20 26 <td><TMPL_VAR NAME=custid></td> 21 27 <td><TMPL_VAR NAME=disptype></td>
Note:
See TracChangeset
for help on using the changeset viewer.