Changeset 682 for trunk/cgi-bin


Ignore:
Timestamp:
01/20/15 16:57:05 (10 years ago)
Author:
Kris Deugau
Message:

/trunk

Convert working hack for comparing container list layout into a
configuration switch, and pick a default.

Location:
trunk/cgi-bin
Files:
3 edited

Legend:

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

    r681 r682  
    104104# (eg, NetAddr::IP->bits - NetAddr::IP->masklen)
    105105our $maxrevlist = 5;  # /27
     106
     107# UI layout for subblocks/containers
     108our $sublistlayout = 1;
    106109
    107110##
  • trunk/cgi-bin/MyIPDB.pm

    r681 r682  
    7878#$IPDB::maxrevlist = 8;  # v4 /24
    7979
     80## UI layout for showing subblocks
     81# 1 lists all containers in a group, then all end-use allocations (including pools) in a group
     82# 2 lists all entries in a container in CIDR order, and puts a secondary summary line under a container entry
     83# Both show free blocks in a group at the bottom as previously
     84# $IPDB::sublistlayout = 1;
     85
    8086## connectDB_My()
    8187# Wrapper for IPDB::connectDB
  • trunk/cgi-bin/main.cgi

    r677 r682  
    8787  $webvar{action} = "index";    #shuts up the warnings.
    8888}
     89
     90# collect variations in layout by way of $IPDB::sublistlayout
     91$webvar{action} = 'showsubs' if $webvar{action} =~ /^showsubs/;
    8992
    9093my $page;
     
    244247# Display blocks immediately within a given parent
    245248sub showSubs {
     249  # Which layout?
     250  if ($IPDB::sublistlayout == 2) {
     251
     252    # 2-part layout;  mixed containers and end-use allocations and free blocks.
     253    # Containers have a second line for the subblock metadata.
     254    # We need to load an alternate template for this case.
     255    $page = HTML::Template->new(filename => "showsubs2.tmpl", loop_context_vars => 1, global_vars => 1);
     256
     257    $page->param(maydel => ($IPDBacl{$authuser} =~ /d/));
     258
     259    my $sublist = listSubs($ip_dbh, parent => $webvar{parent});
     260    $page->param(sublist => $sublist);
     261
     262  } else {
     263
     264    # Default 3-part layout;  containers, end-use allocations, and free blocks
     265
     266    my $contlist = listContainers($ip_dbh, parent => $webvar{parent});
     267    $page->param(contlist => $contlist);
     268
     269    my $alloclist = listAllocations($ip_dbh, parent => $webvar{parent});
     270    $page->param(alloclist => $alloclist);
     271
     272    # only show "delete" button if we have no container or usage allocations
     273    $page->param(maydel => ($IPDBacl{$authuser} =~ /d/) && !(@$contlist || @$alloclist));
     274
     275  }
     276
     277  # Common elements
    246278  my $pinfo = getBlockData($ip_dbh, $webvar{parent});
    247279
     
    249281  $page->param(block => $pinfo->{block});
    250282  $page->param(mayadd => ($IPDBacl{$authuser} =~ /a/));
    251   $page->param(maydel => ($IPDBacl{$authuser} =~ /d/));
    252 
    253   my $sublist = listSubs($ip_dbh, parent => $webvar{parent});
    254   $page->param(sublist => $sublist);
    255283
    256284  my $flist = listFree($ip_dbh, parent => $webvar{parent});
Note: See TracChangeset for help on using the changeset viewer.