Changeset 383 for trunk/dns.cgi


Ignore:
Timestamp:
08/13/12 17:26:35 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Checkpoint adding location support to UI. See #10.

  • Add location entries to new domain, record list, and record add/edit templates
  • Add UI sub to fill location dropdown on new domain and record add/edit templates
  • Fix thinko in initial setting of location_view permission
  • Handle display properly if user does not have location_view permission
  • Add DB-interfacing subs in DNSDB.pm to get the default location set on a zone, and to return a list of locations suitable for a UI dropdown
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r381 r383  
    346346  $webvar{group} = $curgroup if !$webvar{group};
    347347  fill_grouplist("grouplist", $webvar{group});
     348  fill_loclist();
    348349
    349350  if ($session->param('add_failed')) {
     
    630631
    631632    fill_recdata();
     633
     634    if ($webvar{defrec} eq 'n') {
     635      my $defloc = getZoneLocation($dbh, $webvar{revrec}, $webvar{parentid});
     636      fill_loclist($curgroup, $defloc);
     637    }
    632638
    633639  } elsif ($webvar{recact} eq 'add') {
     
    663669      $page->param(id           => $webvar{id});
    664670      fill_recdata();   # populate the form... er, mostly.
     671      if ($webvar{defrec} eq 'n') {
     672        fill_loclist($curgroup, $webvar{location});
     673      }
    665674    }
    666675
     
    682691    $page->param(ttl            => $recdata->{ttl});
    683692    $page->param(typelist       => getTypelist($dbh, $webvar{revrec}, $recdata->{type}));
     693
     694    if ($webvar{defrec} eq 'n') {
     695      fill_loclist($curgroup, $recdata->{location});
     696    }
    684697
    685698  } elsif ($webvar{recact} eq 'update') {
     
    16381651  $page->param(mayrdns => 1);
    16391652
    1640   $page->param(mayloc => ($permissions{admin} || $permissions{loc_view}));
     1653  $page->param(mayloc => ($permissions{admin} || $permissions{location_view}));
    16411654
    16421655  $page->param(maydefrec => $permissions{admin});
     
    18481861    $rec->{record_edit} = ($permissions{admin} || $permissions{record_edit});
    18491862    $rec->{record_delete} = ($permissions{admin} || $permissions{record_delete});
     1863    $rec->{locname} = '' unless ($permissions{admin} || $permissions{location_view});
    18501864  }
    18511865  $page->param(reclist => $foo2);
     
    21012115
    21022116
     2117sub fill_loclist {
     2118  my $cur = shift || $curgroup;
     2119  my $defloc = shift || '';
     2120
     2121  return unless ($permissions{admin} || $permissions{location_view});
     2122
     2123  my $loclist = getLocDropdown($dbh, $cur, $defloc);
     2124
     2125  $page->param(location_view => ($permissions{admin} || $permissions{location_view}));
     2126  $page->param(loclist => $loclist);
     2127} # end fill_loclist()
     2128
     2129
    21032130sub list_users {
    21042131
Note: See TracChangeset for help on using the changeset viewer.