Changeset 815 for trunk


Ignore:
Timestamp:
03/09/16 17:25:26 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Pass VRF in to add master page, and include it in the database checks. See #54.
Add missing breadcrumb links on add master entry and confirmation pages.

Location:
trunk
Files:
4 edited

Legend:

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

    r814 r815  
    703703  eval {
    704704    # First check - does the master exist?  Ignore VRFs until we can see a sane UI
    705     my ($mcontained) = $dbh->selectrow_array("SELECT cidr FROM allocations WHERE cidr >>= ? AND type = 'mm'",
    706         undef, ($cidr) );
     705    my ($mcontained) = $dbh->selectrow_array("SELECT cidr FROM allocations WHERE cidr >>= ? AND type = 'mm' AND vrf = ?",
     706        undef, ($cidr, $args{vrf}) );
    707707    die "Master block $mcontained already exists and entirely contains $cidr\n"
    708708        if $mcontained;
    709709
    710710    # Second check - does the new master contain an existing one or ones?
    711     my ($mexist) = $dbh->selectrow_array("SELECT cidr FROM allocations WHERE cidr <<= ? AND type = 'mm'",
    712         undef, ($cidr) );
     711    my ($mexist) = $dbh->selectrow_array("SELECT cidr FROM allocations WHERE cidr <<= ? AND type = 'mm' AND vrf = ?",
     712        undef, ($cidr, $args{vrf}) );
    713713
    714714    if (!$mexist) {
  • trunk/cgi-bin/main.cgi

    r813 r815  
    165165  }
    166166
     167  # we don't have a netblock;  pass 0 for the block ID
     168  # Tree navigation
     169  my $crumbs = getBreadCrumbs($ip_dbh, 0, $webvar{vrf});
     170  my @rcrumbs = reverse (@$crumbs);
     171  $utilbar->param(breadcrumb => \@rcrumbs);
     172
     173  $page->param(vrf => $webvar{vrf});
     174
    167175} elsif ($webvar{action} eq 'newmaster') {
    168176
     
    188196      syslog "info", "$authuser added master block $webvar{cidr}";
    189197    }
     198
     199    # we don't have a netblock;  pass 0 for the block ID
     200    # Tree navigation
     201    my $crumbs = getBreadCrumbs($ip_dbh, 0, $webvar{vrf});
     202    my @rcrumbs = reverse (@$crumbs);
     203    $utilbar->param(breadcrumb => \@rcrumbs);
    190204
    191205  } # ACL check
  • trunk/templates/addmaster.tmpl

    r687 r815  
    77<td>Master block to add: (CIDR)</td>
    88<td><input type="text" name="cidr"></td>
    9 </tr>
    10 <tr>
    11 <td>Default VRF:</td>
    12 <td><input type="text" name="vrf"></td>
    139</tr>
    1410<tr>
     
    3329</tr>
    3430</table>
     31<input type="hidden" name="vrf" value="<TMPL_VAR NAME=vrf>">
    3532<input type="hidden" name="action" value="newmaster">
    3633</fieldset>
  • trunk/templates/showvrf.tmpl

    r808 r815  
    2929<TMPL_IF addmaster>
    3030<br>
    31 <a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=addmaster">Add new master block</a>
     31<a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=addmaster&vrf=<TMPL_VAR NAME=vrf>">Add new master block</a>
    3232</TMPL_IF>
    3333</div>
Note: See TracChangeset for help on using the changeset viewer.