Changeset 674


Ignore:
Timestamp:
01/14/15 12:58:58 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Start extending rDNS support to allow entering per-IP reverse names. See #1.

  • configuration for maximum IP list length
  • CSS to support hideable space so longer lists don't distort and confuse the page too much
  • Hideable space on the assignment confirmation page for per-IP fields
  • Generate IP list for assignment confirmation - note we can't do it on the previous page without heavy AJAX (or heavier Javascript) because we don't know what block we're even assigning at that stage.
Location:
trunk
Files:
5 edited

Legend:

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

    r671 r674  
    9999our $revgroup = 1;      # should probably be configurable somewhere
    100100our $rpccount = 0;
     101
     102# Largest inverse CIDR mask length to show per-IP rDNS list
     103# (eg, NetAddr::IP->bits - NetAddr::IP->masklen)
     104our $maxrevlist = 5;  # /27
    101105
    102106##
  • trunk/cgi-bin/MyIPDB.pm

    r667 r674  
    7272#$IPDB::rpc_url = 'http://dnsadmin.example.com/dns-rpc.cgi';
    7373
     74# Largest inverse CIDR mask length to show per-IP rDNS list
     75# (eg, NetAddr::IP->bits - NetAddr::IP->masklen)
     76# allowing longer than a /27 is probably going to slow things down;  longer than /29 will scroll.
     77#$IPDB::maxrevlist = 8;  # v4 /24
     78
    7479## connectDB_My()
    7580# Wrapper for IPDB::connectDB
  • trunk/cgi-bin/main.cgi

    r665 r674  
    462462    } # check for freeblocks assignment or IPDB-controlled assignment
    463463
     464    # Generate the IP list for the new allocation in case someone wants to set per-IP rDNS right away.
     465    # We don't do this on the previous page because we don't know how big a block or even what IP range
     466    # it's for (if following the "normal" allocation process)
     467    if ($IPDBacl{$authuser} =~ /c/
     468        && $cidr->masklen != $cidr->bits
     469        && ($cidr->bits - $cidr->masklen) <= $IPDB::maxrevlist
     470        && $webvar{alloctype} !~ /^.[dpi]/
     471        # do we want to allow v6 at all?
     472        #&& ! $cidr->{isv6}
     473        ) {
     474      my @list;
     475      foreach my $ip (@{$cidr->splitref()}) {
     476        my %row;
     477        $row{r_ip} = $ip->addr;
     478        $row{iphost} = '';
     479        push @list, \%row;
     480      }
     481      $page->param(r_iplist => \@list);
     482      # We don't use this here, because these IPs should already be bare.
     483      # ... or should we be paranoid?  Make it a config option?
     484      #getRDNSbyIP($ip_dbh, type => $webvar{alloctype}, range => "$cidr", user => $authuser) );
     485    }
    464486  } # if ($webvar{alloctype} =~ /^.i$/)
    465487
  • trunk/ipdb.css

    r580 r674  
    122122}
    123123
     124/* Reverse DNS odds and ends */
     125div.rdns {
     126        max-height: 20em;
     127//      overflow-y: scroll;
     128        overflow-x: hidden;
     129//      display:inline-block;
     130        width: 600px;
     131//      width: 16em;
     132        border: solid 1px #000000;
     133}
     134
     135/* Abuse collapsible list tree for hideable page segment */
     136
     137/* hide the content <li> */
     138.collapsible li > input + * {
     139        display: none;
     140}
     141/* when the input is checked, show the content <li> */
     142.collapsible li > input:checked + * {
     143        display: block;
     144}
     145/* hide the checkbox */
     146.collapsible li > input {
     147        display: none;
     148        margin: 0em;
     149        padding: 0px;
     150}
     151/* mostly just making the input label clickable */
     152.collapsible label {
     153        cursor: pointer;
     154        display: inline;
     155        margin: 0em;
     156        padding: 0px;
     157        padding-left: 10px;
     158}
     159/* be nice if we could make this work without the HTML list structure... */
     160.notalist {
     161        list-style: none;
     162        margin: 0;
     163        padding: 3px;
     164}
     165
     166/* done hideable page segment */
     167
     168/* Per-IP rDNS listings on edit allocation page */
     169.revdata {
     170        background-color: #C8D3DE;
     171}
     172.host {
     173        width: 450px;
     174//      width: 35em;
     175}
     176
    124177/* legacy defs */
    125178tr.hack {
  • trunk/templates/confirm.tmpl

    r633 r674  
    3232
    3333<tr class="row0">
    34 <td>Reverse DNS pattern:</td>
    35 <td><TMPL_IF rdns><TMPL_VAR NAME=rdns><TMPL_ELSE>[ Keep default ]</TMPL_IF>
     34<td>Reverse DNS:</td>
     35<td>
     36<TMPL_IF rdns><TMPL_VAR NAME=rdns><TMPL_ELSE>[ Keep default ]</TMPL_IF>
    3637<input type="button" value=" ? " onclick="helpRDNS()" class="regular">
     38<TMPL_IF r_iplist>
     39<div class="rdns revdata">
     40<ul class="collapsible notalist">
     41<li><label for="per-iplist">Per-IP reverse entries (click to show) <img src="<TMPL_VAR NAME=webpath>/images/tree_open.png"></label>
     42<input type="checkbox" id="per-iplist" />
     43<ul class="notalist">
     44<li>
     45<table>
     46<TMPL_LOOP name="r_iplist">
     47<tr>
     48<td><TMPL_VAR NAME=r_ip></td>
     49<td><input class="host" name="host_<TMPL_VAR NAME=r_ip>" value="<TMPL_VAR NAME=iphost>"></td>
     50</tr>
     51</TMPL_LOOP>
     52</table>
     53</li>
     54</ul>
     55</li>
     56</ul>
     57</div>
     58</TMPL_IF>
     59
    3760</td>
    3861</tr>
Note: See TracChangeset for help on using the changeset viewer.