Changeset 370 for trunk/dns.cgi


Ignore:
Timestamp:
07/29/12 22:02:48 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Checkpoint; adding location/view support. See #10.

  • add location to menu
  • add table and link fields to initial tabledef and upgrade SQL
  • add listing subs and list page
  • update permissions list and subpage template with new permissions
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r338 r370  
    13421342  }
    13431343
     1344} elsif ($webvar{page} eq 'loclist') {
     1345
     1346#  changepage(page => "domlist", errmsg => "You are not allowed access to this function")
     1347#       unless $permissions{admin} || $permissions{ foo? };
     1348
     1349  # security check - does the user have permission to access this entity?
     1350#  if (!check_scope(id => $webvar{id}, type => 'loc')) {
     1351#    changepage(page => "loclist", errmsg => "You are not permitted to <foo> the requested location/view");
     1352#  }
     1353  list_locations();
     1354
     1355# Permissions!
     1356  $page->param(addloc => $permissions{admin} || $permissions{loc_create});
     1357  $page->param(delloc => $permissions{admin} || $permissions{loc_delete});
     1358
     1359} elsif ($webvar{page} eq 'location') {
     1360
     1361
    13441362} elsif ($webvar{page} eq 'dnsq') {
    13451363
     
    15861604##fixme
    15871605  $page->param(mayrdns => 1);
     1606  $page->param(mayloc => 1);
    15881607
    15891608  $page->param(maydefrec => $permissions{admin});
     
    20792098
    20802099
     2100sub list_locations {
     2101
     2102  my @childgroups;
     2103  getChildren($dbh, $curgroup, \@childgroups, 'all') if $searchsubs;
     2104  my $childlist = join(',',@childgroups);
     2105
     2106  my $count = getLocCount($dbh, (childlist => $childlist, curgroup => $curgroup,
     2107        filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef) ) );
     2108
     2109# fill page count and first-previous-next-last-all bits
     2110  fill_pgcount($count,"locations/views",'');
     2111  fill_fpnla($count);
     2112
     2113  $sortby = 'user';
     2114# sort/order
     2115  $session->param($webvar{page}.'sortby', $webvar{sortby}) if $webvar{sortby};
     2116  $session->param($webvar{page}.'order', $webvar{order}) if $webvar{order};
     2117
     2118  $sortby = $session->param($webvar{page}.'sortby') if $session->param($webvar{page}.'sortby');
     2119  $sortorder = $session->param($webvar{page}.'order') if $session->param($webvar{page}.'order');
     2120
     2121# set up the headers
     2122  my @cols = ('description', 'iplist', 'group');
     2123  my %colnames = (description => 'Location/View Name', iplist => 'Permitted IPs/Ranges', group => 'Group');
     2124  fill_colheads($sortby, $sortorder, \@cols, \%colnames);
     2125
     2126# waffle, waffle - keep state on these as well as sortby, sortorder?
     2127  $page->param("start$startwith" => 1) if $startwith && $startwith =~ /^(?:[a-z]|0-9)$/;
     2128
     2129  $page->param(filter => $filter) if $filter;
     2130  $page->param(searchsubs => $searchsubs) if $searchsubs;
     2131
     2132  my $loclist = getLocList($dbh, (childlist => $childlist, curgroup => $curgroup,
     2133        filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef),
     2134        offset => $webvar{offset}, sortby => $sortby, sortorder => $sortorder) );
     2135  # Some UI things need to be done to the list
     2136  foreach my $l (@{$loclist}) {
     2137    $l->{edloc} = ($permissions{admin} || $permissions{loc_edit});
     2138    $l->{delloc} = ($permissions{admin} || $permissions{loc_delete});
     2139  }
     2140  $page->param(loctable => $loclist);
     2141} # end list_locations()
     2142
     2143
    20812144# Generate all of the glop necessary to add or not the appropriate marker/flag for
    20822145# the sort order and column in domain, user, group, and record lists
Note: See TracChangeset for help on using the changeset viewer.