Changeset 586 for trunk


Ignore:
Timestamp:
01/17/13 15:47:14 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Add rDNS to edit allocation part 1 - retrieve information for
the edit page. See #1.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r585 r586  
    14621462  } elsif ($btype =~ /^.i$/) {
    14631463    my $binfo = $dbh->selectrow_hashref("SELECT ip AS block, custid, type, city, circuitid, description,".
    1464         " notes, modifystamp AS lastmod, privdata, vrf, pool, rdepth".
     1464        " notes, modifystamp AS lastmod, privdata, vrf, pool, rdepth, rdns".
    14651465        " FROM poolips WHERE ip = ?", undef, ($block) );
    14661466#       " FROM poolips WHERE ip = ? AND vrf = ?", undef, ($block, $vrf) );
     
    14681468  } else {
    14691469    my $binfo = $dbh->selectrow_hashref("SELECT cidr AS block, parent, custid, type, city, circuitid, ".
    1470         "description, notes, modifystamp AS lastmod, privdata, vrf, swip, rdepth".
     1470        "description, notes, modifystamp AS lastmod, privdata, vrf, swip, rdepth, rdns".
    14711471        " FROM allocations WHERE cidr = ? AND rdepth = ?", undef, ($block, $rdepth) );
    14721472#       " FROM allocations WHERE cidr = ? AND rdepth = ? AND vrf = ?", undef, ($block, $rdepth, $vrf) );
     
    15021502    # or sub-/19 /24 to retrieve - it's the least-wrong way to do things.
    15031503
    1504     my ($rpcblock) = $cidr->split( ($cidr->masklen <= 16 ? 16 : 24) );
     1504    my ($rpcblock) = ($cidr->masklen <= 24 ? $cidr->split( ($cidr->masklen <= 16 ? 16 : 24) ) : $cidr);
     1505
    15051506    my %rpcargs = (
    15061507        rpcuser => $args{user},
    1507         rpcsystem => 'ipdb',
    15081508        group => $revgroup,     # not sure how this could sanely be exposed, tbh...
    15091509        cidr => "$rpcblock",
    15101510        );
    15111511
    1512     eval {
    1513       $result = $server->call('dnsdb.getRevPattern', %rpcargs);
    1514     };
    1515     if ($@) {
    1516       my $msg = $@;
    1517       $msg =~ s/Fault returned from XML RPC Server, fault code 4: error executing RPC `dnsdb.addRDNS'\.\s//;
    1518     }
     1512    $rdns = _rpc('getRevPattern', %rpcargs);
    15191513  }
    15201514
  • trunk/cgi-bin/main.cgi

    r585 r586  
    654654  $blockinfo->{type} =~ s/\s//;
    655655
     656  # Get rDNS info;  duplicates a bit of getBlockData but also does the RPC call if possible
     657  $blockinfo->{rdns} = getBlockRDNS($ip_dbh, $webvar{block}, $webvar{rdepth}, user => $authuser);
     658
    656659  $page->param(block => $webvar{block});
     660  $page->param(rdns     => $blockinfo->{rdns});
    657661  $page->param(rdepth   => $blockinfo->{rdepth});
    658662
  • trunk/templates/edit.tmpl

    r576 r586  
    2323
    2424<tr class="row1">
     25<td class="heading">Reverse DNS pattern:</td>
     26<td class="regular">
     27<TMPL_IF maychange>
     28<input type="text" name="rdns" size="40" value="<TMPL_VAR NAME=rdns>">
     29<TMPL_ELSE>
     30<TMPL_VAR NAME=rdns>
     31</TMPL_IF>
     32<input type="button" value=" ? " onclick="helpRDNS()" class="regular">
     33</td>
     34</tr>
     35
     36<tr class="row0">
    2537<td class=heading>City:</td>
    2638<td class="regular">
     
    3345</tr>
    3446
    35 <tr class="row0">
     47<tr class="row1">
    3648<td class=heading>Type:</td>
    3749<td class=regular>
     
    4860</tr>
    4961
    50 <tr class="row1">
     62<tr class="row0">
    5163<td class=heading>Demarc/tower:</td>
    5264<td class=regular>
     
    6779</tr>
    6880
    69 <tr class="row0">
     81<tr class="row1">
    7082<td class=heading>CustID:</td>
    7183<td class="regular">
     
    7890</tr>
    7991
    80 <tr class="row1">
     92<tr class="row0">
    8193<td class=heading>SWIPed?:</td>
    8294<td class=regular>
     
    93105</tr>
    94106
    95 <tr class="row0">
     107<tr class="row1">
    96108<td class=heading>Last modified:</td>
    97109<td class=regular><TMPL_VAR NAME=lastmod></td>
    98110</tr>
    99111
    100 <tr class="row1">
     112<tr class="row0">
    101113<td class="heading">Circuit ID:</td>
    102114<td class="regular">
     
    109121</tr>
    110122
    111 <tr class="row0">
     123<tr class="row1">
    112124<td class="heading">Description/Name:</td>
    113125<td class="regular">
     
    120132</tr>
    121133
    122 <tr class="row1">
     134<tr class="row0">
    123135<td class="heading" valign="top">Notes:</td>
    124136<td class="regular">
     
    131143
    132144<TMPL_IF nocling>
    133 <tr class="row0">
     145<tr class="row1">
    134146<td class="heading" valign="top">Restricted data:</td>
    135147<td class="regular">
     
    144156
    145157<TMPL_IF maychange>
    146 <tr class="row<TMPL_IF nocling>1<TMPL_ELSE>0</TMPL_IF>">
     158<tr class="row<TMPL_IF nocling>0<TMPL_ELSE>1</TMPL_IF>">
    147159<td colspan="2" class="center">
    148160<input type="submit" value=" Update this block " class="regular">
     
    161173<form method="POST" action="main.cgi">
    162174<fieldset><legend class="noshow">&nbsp;</legend>
    163 <div class="row<TMPL_IF nocling><TMPL_IF maychange>0<TMPL_ELSE>1</TMPL_IF><TMPL_ELSE><TMPL_IF maychange>1<TMPL_ELSE>0</TMPL_IF></TMPL_IF>">
     175<div class="row<TMPL_IF nocling><TMPL_IF maychange>1<TMPL_ELSE>0</TMPL_IF><TMPL_ELSE><TMPL_IF maychange>0<TMPL_ELSE>1</TMPL_IF></TMPL_IF>">
    164176<input type="hidden" name="action" value="delete">
    165177<input type="hidden" name="block" value="<TMPL_VAR NAME=block>">
Note: See TracChangeset for help on using the changeset viewer.